author | Wuzzy <Wuzzy2@mail.ru> |
Sat, 15 Jun 2019 14:49:18 +0200 | |
changeset 15157 | 35f6213ba1fa |
parent 15074 | e16f906224fd |
child 15274 | 96fbf9bb960a |
permissions | -rw-r--r-- |
11015 | 1 |
--[[ ___ ___ |
2 |
( ) ( ) |
|
3 |
___ .-. .-. ___ ___ | |_ .---. ___ .-. | |_ |
|
4 |
( ) ' ( )( ( __) / .-, ( ) ( __) |
|
5 |
| .-. .-. | | | | | | (__) ; || .-. .| | |
|
6 |
| | | | | | | | | | | ___ .'` || | | || | ___ |
|
7 |
| | | | | | | | | | |( / .'| || | | || |( ) |
|
8 |
| | | | | | | | | | | | | / | || | | || | | | |
|
9 |
| | | | | | | ; ' | ' | ; | ; || | | || ' | | |
|
10 |
| | | | | ' `-' / ' `-' ' `-' || | | |' `-' ; |
|
11 |
(___)(___)(___'.__.' `.__.`.__.'_(___)(___)`.__. |
|
12 |
||
13 |
||
14 |
---- Recommended settings: |
|
14274
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14271
diff
changeset
|
15 |
---- * one hedgehog per team (forced by game) |
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14271
diff
changeset
|
16 |
---- * one team per clan |
11015 | 17 |
---- * 'Small' one-island map |
18 |
||
19 |
--]] |
|
20 |
||
21 |
HedgewarsScriptLoad("/Scripts/Locale.lua") |
|
22 |
HedgewarsScriptLoad("/Scripts/Tracker.lua") |
|
23 |
HedgewarsScriptLoad("/Scripts/Params.lua") |
|
24 |
||
25 |
--[[ |
|
26 |
MUTANT SCRIPT |
|
14274
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14271
diff
changeset
|
27 |
]] |
11015 | 28 |
|
29 |
local hhs = {} |
|
14269 | 30 |
local crates = {} |
11015 | 31 |
local numhhs = 0 |
32 |
local meh = false |
|
33 |
||
34 |
local gameOver=false |
|
35 |
||
36 |
local mutant = nil |
|
37 |
local mutant_base_health = 200 |
|
38 |
local mutant_base_disease = 25 |
|
39 |
local disease_timer = 2000 |
|
40 |
||
41 |
local kill_reward = nil |
|
42 |
local mt_hurt=false |
|
43 |
||
44 |
local killsCounter = 0 |
|
45 |
||
46 |
local team_fire_punishment = 3 |
|
47 |
local mutant_kill_reward = 2 |
|
48 |
||
49 |
local hh_weapons = { amBazooka, amGrenade, amShotgun, amMine} |
|
50 |
||
51 |
local mt_weapons = {amWatermelon, amHellishBomb, amBallgun, amRCPlane, amTeleport} |
|
52 |
||
53 |
local disease=0 |
|
54 |
local timer=0 |
|
55 |
||
56 |
local winScore = 15 |
|
57 |
local hogsLimit = 1 |
|
58 |
||
13225
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
59 |
local teamsDead = {} |
11015 | 60 |
|
61 |
local circles = {} |
|
62 |
local circleFrame = -1 |
|
63 |
||
11914 | 64 |
-- Variables for custom achievements |
65 |
||
66 |
-- Most kills in 1 turn |
|
67 |
local recordKills = 0 |
|
68 |
local recordKillsHogName = nil |
|
69 |
local recordKillsTeamName = nil |
|
70 |
||
71 |
-- Most suicides |
|
72 |
local recordSuicides = 0 |
|
73 |
local recordSuicidesHogName = nil |
|
74 |
local recordSuicidesTeamName = nil |
|
75 |
||
76 |
-- Most skips |
|
77 |
local recordSkips = 0 |
|
78 |
local recordSkipsHogName = nil |
|
79 |
local recordSkipsTeamName = nil |
|
11015 | 80 |
|
13225
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
81 |
-- Most crates collected |
11914 | 82 |
local recordCrates = 0 |
83 |
local recordCratesHogName = nil |
|
84 |
local recordCratesTeamName = nil |
|
85 |
||
86 |
-- Most deaths |
|
87 |
local recordDeaths = 0 |
|
88 |
local recordDeathsHogName = nil |
|
89 |
local recordDeathsTeamName = nil |
|
90 |
||
91 |
-- Total killed hedgehogs |
|
92 |
local totalKills = 0 |
|
93 |
||
94 |
-- Total damage |
|
95 |
local totalDamage = 0 |
|
96 |
||
12993
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
97 |
local mutantHat = "WhySoSerious" |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
98 |
local feederHat = "poke_slowpoke" |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
99 |
|
11914 | 100 |
function rules() |
101 |
||
14274
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14271
diff
changeset
|
102 |
local mineStr |
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14271
diff
changeset
|
103 |
if MinesTime < 0 then |
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14271
diff
changeset
|
104 |
mineStr = loc("Mines time: 0s-5s") |
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14271
diff
changeset
|
105 |
else |
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14271
diff
changeset
|
106 |
mineStr = string.format(loc("Mines explode after %d s."), div(MinesTime, 1000)) |
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14271
diff
changeset
|
107 |
end |
14269 | 108 |
local ruleSet = loc("Hedgehogs will be revived after their death.") .. "|" .. |
14274
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14271
diff
changeset
|
109 |
mineStr .. "|" .. |
14269 | 110 |
loc("The first hedgehog to kill someone becomes the Mutant.") .. "|" .. |
111 |
loc("The Mutant has super weapons and a lot of health.") .. "|" .. |
|
112 |
loc("The Mutant loses health quickly, but gains health by killing.") .. "|" .. |
|
113 |
" |" .. |
|
114 |
loc("Score points by killing other hedgehogs.") .. "|" .. |
|
115 |
loc("The hedgehog with least points (or most deaths) becomes the Bottom Feeder.") .. "|" .. |
|
116 |
loc("The score and deaths are shown next to the team bar.") .. "|" .. |
|
117 |
string.format(loc("Goal: Score %d points or more to win!"), winScore) .. "|" .. |
|
11914 | 118 |
" |" .. |
14269 | 119 |
loc("Scoring: ") .. "|" .. |
120 |
loc("+2 for becoming the Mutant") .. "|" .. |
|
121 |
loc("+1 to the Mutant for killing anyone") .. "|" .. |
|
122 |
loc("+1 to the Bottom Feeder for killing anyone") .. "|" .. |
|
123 |
loc("-1 to anyone for a suicide") |
|
11015 | 124 |
|
14269 | 125 |
return ruleSet |
11914 | 126 |
|
127 |
end |
|
128 |
||
129 |
function showStartingInfo() |
|
130 |
||
15074
e16f906224fd
Change mission panel icons for a couple of game styles
Wuzzy <Wuzzy2@mail.ru>
parents:
14994
diff
changeset
|
131 |
ShowMission(loc("Mutant"), loc("A Hedgewars tag game"), rules(), -amWatermelon, 5000) |
11015 | 132 |
|
133 |
end |
|
134 |
||
135 |
function onGameInit() |
|
14274
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14271
diff
changeset
|
136 |
-- Sudden Death would be weird |
11015 | 137 |
WaterRise = 0 |
11914 | 138 |
HealthDecrease = 0 |
14274
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14271
diff
changeset
|
139 |
-- Weapons must be reset for the Mutant mechanic to work |
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14271
diff
changeset
|
140 |
EnableGameFlags(gfResetWeps) |
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14271
diff
changeset
|
141 |
-- King Mode messes with game too much |
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14271
diff
changeset
|
142 |
DisableGameFlags(gfKing) |
11015 | 143 |
end |
144 |
||
145 |
||
146 |
function limitHogs(gear) |
|
147 |
cnthhs = cnthhs + 1 |
|
13113 | 148 |
if cnthhs > 1 then |
149 |
hogLimitHit = true |
|
150 |
SetEffect(gear, heResurrectable, 0) |
|
151 |
setGearValue(gear, "excess", true) |
|
152 |
DeleteGear(gear) |
|
153 |
end |
|
11015 | 154 |
end |
155 |
||
156 |
function onGameStart() |
|
13774
e874bfe563c7
Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents:
13690
diff
changeset
|
157 |
if ClansCount >= 2 then |
e874bfe563c7
Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents:
13690
diff
changeset
|
158 |
SendHealthStatsOff() |
e874bfe563c7
Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents:
13690
diff
changeset
|
159 |
SendAchievementsStatsOff() |
e874bfe563c7
Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents:
13690
diff
changeset
|
160 |
end |
12340
8f693d25be2f
Show traditional winning animation in Mutant again
Wuzzy <almikes@aol.com>
parents:
12293
diff
changeset
|
161 |
SendRankingStatsOff() |
11015 | 162 |
trackTeams() |
163 |
teamScan() |
|
164 |
runOnHogs(saveStuff) |
|
165 |
||
166 |
hogLimitHit = false |
|
167 |
for i=0 , TeamsCount - 1 do |
|
168 |
cnthhs = 0 |
|
13225
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
169 |
runOnHogsInTeam(limitHogs, GetTeamName(i)) |
11015 | 170 |
end |
171 |
if hogLimitHit then |
|
13113 | 172 |
WriteLnToChat(loc("Only one hog per team allowed! Excess hogs will be removed.")) |
11015 | 173 |
end |
174 |
showStartingInfo() |
|
175 |
end |
|
176 |
||
177 |
||
178 |
||
179 |
function giveWeapons(gear) |
|
180 |
if gear == mutant then |
|
181 |
AddAmmo(gear, amRope) |
|
182 |
for i=1, #mt_weapons do |
|
183 |
AddAmmo(gear, mt_weapons[i]) |
|
184 |
end |
|
185 |
||
186 |
else |
|
187 |
for i=1, #hh_weapons do |
|
188 |
AddAmmo(gear,hh_weapons[i]) |
|
189 |
end |
|
190 |
end |
|
191 |
end |
|
192 |
||
193 |
function onAmmoStoreInit() |
|
194 |
||
195 |
SetAmmo(amSkip, 9, 0, 0, 0) |
|
196 |
SetAmmo(amRope,0,1,0,5) |
|
197 |
SetAmmo(amSnowball,0,1,0,1) |
|
198 |
||
199 |
for i=1, #hh_weapons do |
|
200 |
SetAmmo(hh_weapons[i], 0, 0, 0, 1) |
|
201 |
end |
|
202 |
||
203 |
for i=1, #mt_weapons do |
|
204 |
SetAmmo(mt_weapons[i], 0, 3, 0, 1) |
|
205 |
end |
|
206 |
||
207 |
end |
|
208 |
||
209 |
function drawCircles() |
|
210 |
for i = 0, #hhs do |
|
211 |
if circles[hhs[i]] ~= nil then |
|
212 |
DeleteVisualGear(circles[hhs[i]]) |
|
213 |
circles[hhs[i]] = nil |
|
214 |
end |
|
215 |
||
216 |
if hhs[i] ~= CurrentHedgehog then |
|
217 |
if mutant == nil then |
|
218 |
circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false) |
|
219 |
SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 5, 0xff000080) |
|
220 |
elseif CurrentHedgehog == mutant then |
|
221 |
circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false) |
|
222 |
SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 3, 0xaa000070) |
|
223 |
elseif getGearValue(CurrentHedgehog, "Feeder") and hhs[i] ~= mutant then |
|
224 |
circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false) |
|
225 |
SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 3, 0xaa000070) |
|
226 |
elseif hhs[i] == mutant then |
|
227 |
circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false) |
|
228 |
SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 5, 0xff000080) |
|
229 |
end |
|
230 |
end |
|
231 |
end |
|
232 |
circleFrame = 0 |
|
233 |
end |
|
234 |
||
235 |
function onNewTurn() |
|
236 |
||
237 |
trackTeams() |
|
238 |
killsCounter = 0 |
|
239 |
||
14274
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14271
diff
changeset
|
240 |
if mutant == nil and TotalRounds >= 0 then |
13648 | 241 |
AddCaption( loc("First killer will mutate"), capcolDefault, capgrpGameState ) |
11015 | 242 |
end |
243 |
||
244 |
checkScore() |
|
11914 | 245 |
|
246 |
for i=0, TeamsCount-1 do |
|
13225
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
247 |
SendStat(siClanHealth, getTeamValue(GetTeamName(i), "Score"), GetTeamName(i)) |
11914 | 248 |
end |
249 |
||
11015 | 250 |
giveWeapons(CurrentHedgehog) |
251 |
drawCircles() |
|
252 |
setAIHints() |
|
253 |
kill_reward= numhhs*10 |
|
254 |
||
255 |
if CurrentHedgehog == mutant then |
|
256 |
mt_hurt=true |
|
257 |
disease= mutant_base_disease - numhhs |
|
258 |
else |
|
259 |
mt_hurt=false |
|
260 |
end |
|
261 |
||
262 |
setGearValue(CurrentHedgehog, "Alive", true) |
|
263 |
||
264 |
end |
|
265 |
||
266 |
function countBodies() |
|
267 |
if killsCounter == 2 then |
|
13648 | 268 |
AddCaption(loc("Double kill!"), capcolDefault, capgrpGameState ) |
11015 | 269 |
elseif killsCounter == 3 then |
13648 | 270 |
AddCaption(loc("Mega kill!"), capcolDefault, capgrpGameState ) |
11015 | 271 |
PlaySound(sndRegret) |
272 |
elseif killsCounter == 4 then |
|
13648 | 273 |
AddCaption(loc("Ultra kill!"), capcolDefault, capgrpGameState ) |
11015 | 274 |
elseif killsCounter == 5 then |
13648 | 275 |
AddCaption(loc("Monster kill!"), capcolDefault, capgrpGameState ) |
11015 | 276 |
PlaySound(sndIllGetYou) |
277 |
elseif killsCounter == 6 then |
|
13648 | 278 |
AddCaption(loc("Ludicrous kill!"), capcolDefault, capgrpGameState ) |
11015 | 279 |
PlaySound(sndNutter) |
280 |
elseif killsCounter == 7 then |
|
13648 | 281 |
AddCaption(loc("Holy shit!"), capcolDefault, capgrpGameState ) |
11015 | 282 |
PlaySound(sndLaugh) |
283 |
elseif killsCounter > 8 then |
|
13648 | 284 |
AddCaption(loc("Insanity!"), capcolDefault, capgrpGameState ) |
11914 | 285 |
end |
286 |
||
287 |
if killsCounter > recordKills then |
|
288 |
recordKills = killsCounter |
|
289 |
recordKillsHogName = getGearValue(CurrentHedgehog, "Name") |
|
290 |
recordKillsTeamName = GetHogTeamName(CurrentHedgehog) |
|
11015 | 291 |
end |
292 |
end |
|
293 |
||
294 |
function onGameTick() |
|
295 |
||
296 |
if circleFrame > -1 then |
|
297 |
for i = 0, #hhs do |
|
298 |
if circles[hhs[i]] ~= nil and hhs[i]~= nil then |
|
299 |
hhx, hhy = GetGearPosition(hhs[i]) |
|
13690
09ea1faf97ca
Remove calls to GetVisualGearValues where it's not needed
Wuzzy <Wuzzy2@mail.ru>
parents:
13648
diff
changeset
|
300 |
SetVisualGearValues(circles[hhs[i]], hhx + 1, hhy - 3, 0, 0, 0, 0, 0, 40 - (circleFrame % 25)) |
11015 | 301 |
end |
302 |
end |
|
303 |
||
304 |
circleFrame = circleFrame + 0.06 |
|
305 |
||
306 |
if circleFrame >= 25 then |
|
307 |
for i = 0, #hhs do |
|
308 |
if circles[hhs[i]] ~= nil then |
|
309 |
DeleteVisualGear(circles[hhs[i]]) |
|
310 |
circles[hhs[i]] = nil |
|
311 |
end |
|
312 |
end |
|
313 |
end |
|
314 |
end |
|
315 |
||
14330
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14274
diff
changeset
|
316 |
if (TurnTimeLeft==0 or band(GetState(mutant), gstHHDriven) == 0) and mt_hurt then |
11015 | 317 |
mt_hurt = false |
318 |
end |
|
319 |
||
14330
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14274
diff
changeset
|
320 |
-- Mutant's disease |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14274
diff
changeset
|
321 |
-- Hurt Mutant during its turn time |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14274
diff
changeset
|
322 |
-- Mutant's health is safe in ready phase |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14274
diff
changeset
|
323 |
if mt_hurt and mutant~=nil and ReadyTimeLeft == 0 then |
11015 | 324 |
timer = timer + 1 |
14330
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14274
diff
changeset
|
325 |
if timer > disease_timer then |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14274
diff
changeset
|
326 |
timer = 0 |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14274
diff
changeset
|
327 |
local h = GetHealth(mutant)-disease |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14274
diff
changeset
|
328 |
SetHealth(mutant, h) |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14274
diff
changeset
|
329 |
-- Low health warning |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14274
diff
changeset
|
330 |
if h <= 75 then |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14274
diff
changeset
|
331 |
PlaySound(sndPoisonMoan, mutant) |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14274
diff
changeset
|
332 |
elseif h <= 150 then |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14274
diff
changeset
|
333 |
PlaySound(sndPoisonCough, mutant) |
11015 | 334 |
end |
14330
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14274
diff
changeset
|
335 |
local tag = AddVisualGear(GetX(mutant), GetY(mutant)-5, vgtHealthTag, disease, true) |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14274
diff
changeset
|
336 |
SetVisualGearValues(tag, nil, nil, nil, nil, nil, nil, nil, nil, nil, GetClanColor(GetHogClan(mutant))) |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14274
diff
changeset
|
337 |
if GetHealth(mutant)<=0 then |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14274
diff
changeset
|
338 |
SetHealth(mutant,0) |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14274
diff
changeset
|
339 |
mt_hurt= false |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14274
diff
changeset
|
340 |
setGearValue(mutant,"SelfDestruct",true) |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14274
diff
changeset
|
341 |
EndTurn() |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14274
diff
changeset
|
342 |
end |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14274
diff
changeset
|
343 |
end |
11015 | 344 |
end |
345 |
||
346 |
end |
|
347 |
||
12993
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
348 |
--[[ |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
349 |
Forces the special mutant/feeder names and hats only to be |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
350 |
taken by those who deserved it. |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
351 |
Names and hats will be changed (and ridiculed) if neccesary. |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
352 |
]] |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
353 |
function exposeIdentityTheft(gear) |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
354 |
local lon = string.lower(GetHogName(gear)) -- lowercase origina name |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
355 |
local name, hat |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
356 |
-- Change name if hog uses a reserved one |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
357 |
if lon == "mutant" or lon == string.lower(loc("Mutant")) then |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
358 |
SetHogName(gear, loc("Identity Thief")) |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
359 |
SetHogHat(gear, "Disguise") |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
360 |
elseif lon == "bottom feeder" or lon == string.lower(loc("Bottom Feeder")) then |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
361 |
-- Word play on "Bottom Feeder". Someone who is low on cotton. :D |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
362 |
-- Either translate literally or make up your ow word play |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
363 |
SetHogName(gear, loc("Cotton Needer")) |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
364 |
SetHogHat(gear, "StrawHat") |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
365 |
end |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
366 |
-- Strip hog off its special hat |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
367 |
if GetHogHat(gear) == mutantHat or GetHogHat(gear) == feederHat then |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
368 |
SetHogHat(gear, "NoHat") |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
369 |
end |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
370 |
end |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
371 |
|
11015 | 372 |
function saveStuff(gear) |
12993
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
373 |
exposeIdentityTheft(gear) |
11015 | 374 |
setGearValue(gear,"Name",GetHogName(gear)) |
375 |
setGearValue(gear,"Hat",GetHogHat(gear)) |
|
376 |
end |
|
377 |
||
378 |
function armageddon(gear) |
|
379 |
SetState(gear, gstLoser) |
|
13113 | 380 |
SetEffect(gear, heResurrectable, 0) |
11015 | 381 |
SetHealth(gear, 0) |
382 |
end |
|
383 |
||
13024
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12993
diff
changeset
|
384 |
function renderScores() |
11015 | 385 |
for i=0, TeamsCount-1 do |
13225
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
386 |
local name = GetTeamName(i) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
387 |
SetTeamLabel(name, string.format(loc("%d | %d"), getTeamValue(name, "Score"), getTeamValue(name, "DeadHogs"))) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
388 |
end |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
389 |
end |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
390 |
|
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
391 |
function createEndGameStats() |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
392 |
SendStat(siGraphTitle, loc("Score graph")) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
393 |
|
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
394 |
local teamsSorted = {} |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
395 |
for i=0, TeamsCount-1, 1 do |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
396 |
teamsSorted[i+1] = GetTeamName(i) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
397 |
end |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
398 |
|
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
399 |
-- Achievements stuff |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
400 |
local achievements = 0 |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
401 |
--- Most kills per turn |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
402 |
if recordKills >= 3 then |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
403 |
SendStat(siMaxStepKills, string.format("%d %s (%s)", recordKills, recordKillsHogName, recordKillsTeamName)) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
404 |
achievements = achievements + 1 |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
405 |
end |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
406 |
--- Most crates collected |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
407 |
if recordCrates >= 5 then |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
408 |
SendStat(siCustomAchievement, string.format(loc("%s (%s) was the greediest hedgehog and collected %d crates."), recordCratesHogName, recordCratesTeamName, recordCrates)) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
409 |
achievements = achievements + 1 |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
410 |
end |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
411 |
--- Most suicides |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
412 |
if recordSuicides >= 5 then |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
413 |
SendStat(siCustomAchievement, string.format(loc("%s (%s) hate life and suicided %d times."), recordSuicidesHogName, recordSuicidesTeamName, recordSuicides)) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
414 |
achievements = achievements + 1 |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
415 |
end |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
416 |
--- Most deaths |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
417 |
if recordDeaths >= 5 then |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
418 |
SendStat(siCustomAchievement, string.format(loc("Poor %s (%s) died %d times."), recordDeathsHogName, recordDeathsTeamName, recordDeaths)) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
419 |
achievements = achievements + 1 |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
420 |
end |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
421 |
--- Most skips |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
422 |
if recordSkips >= 3 then |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
423 |
SendStat(siMaxTurnSkips, string.format("%d %s (%s)", recordSkips, recordSkipsHogName, recordSkipsTeamName)) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
424 |
achievements = achievements + 1 |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
425 |
end |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
426 |
--- Total damage |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
427 |
if totalDamage >= 900 then |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
428 |
SendStat(siCustomAchievement, string.format(loc("%d damage was dealt in this game."), totalDamage)) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
429 |
achievements = achievements + 1 |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
430 |
end |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
431 |
--- Total kills |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
432 |
if totalKills >= 20 or (achievements <= 0 and totalKills >= 1) then |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
433 |
SendStat(siKilledHHs, tostring(totalKills)) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
434 |
achievements = achievements + 1 |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
435 |
end |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
436 |
|
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
437 |
-- Score and stats stuff |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
438 |
local showScore = "" |
14994
5188ecbf726f
Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
14583
diff
changeset
|
439 |
local rank = 0 |
5188ecbf726f
Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
14583
diff
changeset
|
440 |
local rankPlus = 1 |
5188ecbf726f
Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
14583
diff
changeset
|
441 |
local prevScore |
13225
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
442 |
table.sort(teamsSorted, function(team1, team2) return getTeamValue(team1, "Score") > getTeamValue(team2, "Score") end) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
443 |
for i=1, TeamsCount do |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
444 |
local score = getTeamValue(teamsSorted[i], "Score") |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
445 |
local deaths = getTeamValue(teamsSorted[i], "DeadHogs") |
14994
5188ecbf726f
Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
14583
diff
changeset
|
446 |
if i == 1 or score < prevScore then |
5188ecbf726f
Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
14583
diff
changeset
|
447 |
rank = rank + rankPlus |
5188ecbf726f
Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
14583
diff
changeset
|
448 |
rankPlus = 1 |
5188ecbf726f
Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
14583
diff
changeset
|
449 |
prevScore = score |
5188ecbf726f
Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
14583
diff
changeset
|
450 |
else |
5188ecbf726f
Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
14583
diff
changeset
|
451 |
rankPlus = rankPlus + 1 |
5188ecbf726f
Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
14583
diff
changeset
|
452 |
end |
5188ecbf726f
Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
14583
diff
changeset
|
453 |
SendStat(siPointType, "!POINTS") |
5188ecbf726f
Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
14583
diff
changeset
|
454 |
SendStat(siTeamRank, rank) |
13225
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
455 |
SendStat(siPlayerKills, score, teamsSorted[i]) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
456 |
|
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
457 |
showScore = showScore .. string.format(loc("%s: %d (deaths: %d)"), teamsSorted[i], score, deaths) .. "|" |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
458 |
end |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
459 |
|
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
460 |
if getTeamValue(teamsSorted[1], "Score") == getTeamValue(teamsSorted[2], "Score") then |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
461 |
-- The first two teams have the same score! Round is drawn. |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
462 |
return nil |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
463 |
else |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
464 |
|
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
465 |
ShowMission(loc("Mutant"), |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
466 |
loc("Final result"), |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
467 |
string.format(loc("Winner: %s"), teamsSorted[1]) .. "| |" .. loc("Scores:") .. " |" .. |
15074
e16f906224fd
Change mission panel icons for a couple of game styles
Wuzzy <Wuzzy2@mail.ru>
parents:
14994
diff
changeset
|
468 |
showScore, 4, 15000) |
13225
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
469 |
|
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
470 |
-- return winning team |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
471 |
return teamsSorted[1] |
11015 | 472 |
end |
473 |
end |
|
474 |
||
475 |
function checkScore() |
|
476 |
local lowest_score_team = nil |
|
477 |
local min_score=nil |
|
478 |
local winTeam = nil |
|
479 |
||
480 |
local only_low_score = true |
|
481 |
||
482 |
for i=0, TeamsCount-1 do |
|
13225
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
483 |
local teamName = GetTeamName(i) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
484 |
if not teamsDead[teamName] then |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
485 |
local curr_score = getTeamValue(teamName, "Score") |
11015 | 486 |
|
13225
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
487 |
runOnHogsInTeam(removeFeeder, teamName) |
11015 | 488 |
|
489 |
if curr_score >= winScore then |
|
490 |
gameOver = true |
|
13225
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
491 |
winTeam = teamName |
11015 | 492 |
end |
493 |
||
494 |
if min_score==nil then |
|
495 |
min_score= curr_score |
|
13225
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
496 |
lowest_score_team = teamName |
11015 | 497 |
else |
498 |
if curr_score <= min_score then |
|
499 |
if curr_score == min_score then |
|
13225
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
500 |
if getTeamValue(teamName, "DeadHogs") == getTeamValue(lowest_score_team, "DeadHogs") then |
11015 | 501 |
only_low_score = false |
502 |
else |
|
13225
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
503 |
if getTeamValue(teamName, "DeadHogs") > getTeamValue(lowest_score_team, "DeadHogs") then |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
504 |
lowest_score_team = teamName |
11015 | 505 |
end |
506 |
only_low_score = true |
|
507 |
end |
|
508 |
||
509 |
else |
|
510 |
min_score= curr_score |
|
13225
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
511 |
lowest_score_team = teamName |
11015 | 512 |
only_low_score = true |
513 |
end |
|
514 |
end |
|
515 |
end |
|
516 |
end |
|
517 |
end |
|
518 |
||
519 |
if gameOver then |
|
12346
c73521104fac
Mutant: Fix “Boring” taunt being played when becoming the mutant
Wuzzy <almikes@aol.com>
parents:
12340
diff
changeset
|
520 |
EndTurn(true) |
11914 | 521 |
|
522 |
for i=0, TeamsCount-1 do |
|
13225
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
523 |
local teamName = GetTeamName(i) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
524 |
if teamName~=winTeam then |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
525 |
runOnHogsInTeam(armageddon, teamName) |
11015 | 526 |
end |
527 |
end |
|
528 |
||
13225
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
529 |
createEndGameStats() |
11015 | 530 |
else |
531 |
||
532 |
if only_low_score then |
|
533 |
runOnHogsInTeam(setFeeder, lowest_score_team) |
|
534 |
end |
|
535 |
||
536 |
if meh == false then |
|
14269 | 537 |
meh = true |
538 |
end |
|
11015 | 539 |
|
540 |
end |
|
541 |
end |
|
542 |
||
543 |
function backToNormal(gear) |
|
544 |
SetHogName(gear, getGearValue(gear,"Name")) |
|
545 |
SetHogHat(gear, 'NoHat') |
|
546 |
SetHogHat(gear, getGearValue(gear,"Hat")) |
|
547 |
setGearValue(mutant,"SelfDestruct",false) |
|
548 |
mt_hurt=false |
|
549 |
mutant=nil |
|
550 |
end |
|
551 |
||
552 |
function setAIHints() |
|
553 |
for i = 0, #hhs do |
|
554 |
if mutant == nil or hhs[i] == mutant or CurrentHedgehog == mutant or getGearValue(CurrentHedgehog, "Feeder") then |
|
13041
434bcdd9562c
Fix inconsistent name of SetGearAIHints
Wuzzy <Wuzzy2@mail.ru>
parents:
13024
diff
changeset
|
555 |
SetGearAIHints(hhs[i], aihUsualProcessing) |
11015 | 556 |
else |
557 |
SetGearAIHints(hhs[i], aihDoesntMatter) |
|
558 |
end |
|
559 |
end |
|
14271
9b5a8147386f
I think this is correct way to use iterate over it as a hashmap. don't have much lua practice
nemo
parents:
14270
diff
changeset
|
560 |
for k,v in pairs(crates) do |
9b5a8147386f
I think this is correct way to use iterate over it as a hashmap. don't have much lua practice
nemo
parents:
14270
diff
changeset
|
561 |
if CurrentHedgehog == mutant and v ~= nil then |
9b5a8147386f
I think this is correct way to use iterate over it as a hashmap. don't have much lua practice
nemo
parents:
14270
diff
changeset
|
562 |
SetGearAIHints(v, aihDoesntMatter) |
14269 | 563 |
else |
14271
9b5a8147386f
I think this is correct way to use iterate over it as a hashmap. don't have much lua practice
nemo
parents:
14270
diff
changeset
|
564 |
SetGearAIHints(v, aihUsualProcessing) |
14269 | 565 |
end |
566 |
end |
|
11015 | 567 |
end |
568 |
||
569 |
function removeFeeder(gear) |
|
570 |
if gear~=nil then |
|
571 |
setGearValue(gear,"Feeder",false) |
|
572 |
if gear~= mutant then |
|
573 |
SetHogName(gear, getGearValue(gear,"Name") ) |
|
574 |
SetHogHat(gear, 'NoHat') |
|
575 |
SetHogHat(gear, getGearValue(gear,"Hat")) |
|
576 |
end |
|
577 |
end |
|
578 |
end |
|
579 |
||
580 |
function setFeeder(gear) |
|
581 |
if gear~= mutant and gear~= nil then |
|
11914 | 582 |
SetHogName(gear, loc("Bottom Feeder")) |
12993
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
583 |
SetHogHat(gear, feederHat) |
11015 | 584 |
setGearValue(gear,"Feeder", true) |
585 |
end |
|
586 |
end |
|
587 |
||
588 |
function setMutantStuff(gear) |
|
589 |
mutant = gear |
|
590 |
||
11914 | 591 |
SetHogName(gear, loc("Mutant")) |
12993
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12945
diff
changeset
|
592 |
SetHogHat(gear, mutantHat) |
11015 | 593 |
SetHealth(gear, ( mutant_base_health + numhhs*25) ) |
594 |
SetEffect(gear, hePoisoned, 1) |
|
595 |
setGearValue(mutant,"SelfDestruct",false) |
|
596 |
setGearValue(gear, "Feeder", false) |
|
597 |
||
11914 | 598 |
AddCaption(string.format(loc("%s has mutated! +2 points"), getGearValue(gear, "Name")), GetClanColor(GetHogClan(gear)), capgrpMessage) |
11015 | 599 |
|
12435
c461a224ec09
Mutant: Fix turn skip of next hog after mutating when TurnTimeLeft = 0
Wuzzy <almikes@aol.com>
parents:
12346
diff
changeset
|
600 |
if TurnTimeLeft > 0 then |
c461a224ec09
Mutant: Fix turn skip of next hog after mutating when TurnTimeLeft = 0
Wuzzy <almikes@aol.com>
parents:
12346
diff
changeset
|
601 |
EndTurn(true) |
c461a224ec09
Mutant: Fix turn skip of next hog after mutating when TurnTimeLeft = 0
Wuzzy <almikes@aol.com>
parents:
12346
diff
changeset
|
602 |
end |
11015 | 603 |
|
604 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
605 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
606 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
607 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
608 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
609 |
PlaySound(sndSuddenDeath) |
|
610 |
end |
|
611 |
||
612 |
function teamScan() |
|
613 |
||
13225
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
614 |
for j=0, TeamsCount-1 do |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
615 |
teamName = GetTeamName(j) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
616 |
teamsDead[teamName] = false |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
617 |
setTeamValue(teamName, "Score",0) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
618 |
setTeamValue(teamName, "Suicides",0) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
619 |
setTeamValue(teamName, "Skips",0) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
620 |
setTeamValue(teamName, "Crates",0) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
621 |
setTeamValue(teamName, "DeadHogs",0) |
11015 | 622 |
end |
623 |
||
13024
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12993
diff
changeset
|
624 |
renderScores() |
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12993
diff
changeset
|
625 |
|
11015 | 626 |
---***--- |
627 |
end |
|
628 |
||
629 |
function set_Mutant_and_Score(gear) |
|
630 |
||
631 |
local curr_team = GetHogTeamName(CurrentHedgehog) |
|
632 |
||
633 |
if gear == CurrentHedgehog then |
|
634 |
if CurrentHedgehog == mutant then |
|
635 |
PlaySound(sndHomerun) |
|
636 |
if getGearValue(gear, "SelfDestruct")==false then |
|
637 |
decreaseTeamValue(curr_team,"Score") |
|
638 |
end |
|
639 |
backToNormal(gear) |
|
640 |
else |
|
641 |
decreaseTeamValue(curr_team,"Score") |
|
642 |
end |
|
643 |
||
644 |
else |
|
645 |
if gear == mutant then |
|
646 |
backToNormal(mutant) |
|
647 |
if curr_team ~=GetHogTeamName(gear) then |
|
648 |
if getGearValue(CurrentHedgehog, "Alive") then |
|
649 |
setMutantStuff(CurrentHedgehog) |
|
650 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") + mutant_kill_reward)) |
|
651 |
end |
|
652 |
else |
|
653 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment)) |
|
11914 | 654 |
increaseTeamValue(curr_team,"Suicides") |
655 |
if(getTeamValue(curr_team, "Suicides") > recordSuicides) then |
|
656 |
recordSuicides = getTeamValue(curr_team, "Suicides") |
|
657 |
recordSuicidesHogName = getGearValue(CurrentHedgehog, "Name") |
|
658 |
recordSuicidesTeamName = curr_team |
|
659 |
end |
|
660 |
AddCaption(loc("-1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage) |
|
11015 | 661 |
end |
662 |
else |
|
663 |
if mutant==nil then |
|
664 |
if curr_team ~=GetHogTeamName(gear) then |
|
665 |
if getGearValue(CurrentHedgehog, "Alive") then |
|
666 |
setMutantStuff(CurrentHedgehog) |
|
667 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") + mutant_kill_reward)) |
|
668 |
else |
|
669 |
increaseTeamValue(curr_team,"Score") |
|
670 |
end |
|
671 |
else |
|
672 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment)) |
|
11914 | 673 |
increaseTeamValue(curr_team,"Suicides") |
674 |
if(getTeamValue(curr_team, "Suicides") > recordSuicides) then |
|
675 |
recordSuicides = getTeamValue(curr_team, "Suicides") |
|
676 |
recordSuicidesHogName = getGearValue(CurrentHedgehog, "Name") |
|
677 |
recordSuicidesTeamName = curr_team |
|
678 |
end |
|
679 |
AddCaption(loc("-1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage) |
|
11015 | 680 |
end |
681 |
else |
|
682 |
if curr_team ~=GetHogTeamName(gear) then |
|
683 |
if CurrentHedgehog==mutant and getGearValue(mutant,"SelfDestruct")==false then |
|
12945
39b7b3ed619e
Add healing visual effect + heal msg in scripts
Wuzzy <Wuzzy2@mail.ru>
parents:
12435
diff
changeset
|
684 |
HealHog(CurrentHedgehog, kill_reward) |
12293
a5a7d0c6d3f3
Fix incorrect Mutant score message color
Wuzzy <almikes@aol.com>
parents:
11914
diff
changeset
|
685 |
AddCaption(loc("+1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage) |
11015 | 686 |
increaseTeamValue(curr_team,"Score") |
687 |
end |
|
688 |
if getGearValue(CurrentHedgehog,"Feeder") then |
|
689 |
increaseTeamValue(curr_team,"Score") |
|
11914 | 690 |
AddCaption(loc("+1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage) |
11015 | 691 |
end |
692 |
else |
|
693 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment)) |
|
11914 | 694 |
AddCaption(loc("+1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage) |
11015 | 695 |
end |
696 |
end |
|
697 |
end |
|
698 |
end |
|
699 |
end |
|
700 |
||
701 |
function onGearResurrect(gear) |
|
702 |
if not gameOver then |
|
703 |
if GetGearType(gear) == gtHedgehog then |
|
704 |
||
705 |
increaseTeamValue(GetHogTeamName(gear), "DeadHogs") |
|
11914 | 706 |
totalKills = totalKills + 1 |
707 |
if(getTeamValue(GetHogTeamName(gear), "DeadHogs") > recordDeaths) then |
|
708 |
recordDeaths = getTeamValue(GetHogTeamName(gear), "DeadHogs") |
|
709 |
recordDeathsHogName = getGearValue(gear, "Name") |
|
710 |
recordDeathsTeamName = GetHogTeamName(gear) |
|
711 |
end |
|
11015 | 712 |
|
713 |
if gear==CurrentHedgehog then |
|
714 |
setGearValue(CurrentHedgehog, "Alive", false) |
|
715 |
end |
|
716 |
set_Mutant_and_Score(gear) |
|
717 |
if gear~=CurrentHedgehog then |
|
718 |
killsCounter = killsCounter + 1 |
|
719 |
countBodies() |
|
720 |
end |
|
721 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
722 |
PlaySound(sndWhack) |
|
13024
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12993
diff
changeset
|
723 |
renderScores() |
11015 | 724 |
end |
725 |
end |
|
726 |
end |
|
727 |
||
11914 | 728 |
function onGearDamage(gear, damage) |
14269 | 729 |
if not gameOver and GetGearType(gear) == gtHedgehog then |
730 |
totalDamage = totalDamage + damage |
|
731 |
end |
|
11914 | 732 |
end |
733 |
||
13177
159004144897
Use onSkipTurn in scripts to detect turn skips
Wuzzy <Wuzzy2@mail.ru>
parents:
13113
diff
changeset
|
734 |
function onSkipTurn() |
14269 | 735 |
-- Record skips for achievement |
736 |
local team = GetHogTeamName(CurrentHedgehog) |
|
737 |
increaseTeamValue(team, "Skips") |
|
738 |
if(getTeamValue(team, "Skips") > recordSkips) then |
|
739 |
recordSkips = getTeamValue(team, "Skips") |
|
740 |
recordSkipsHogName = getGearValue(CurrentHedgehog, "Name") |
|
741 |
recordSkipsTeamName = team |
|
742 |
end |
|
11914 | 743 |
end |
744 |
||
11015 | 745 |
function onGearAdd(gear) |
746 |
||
747 |
-- Catch hedgehogs for the tracker |
|
748 |
if GetGearType(gear) == gtHedgehog then |
|
749 |
trackGear(gear) |
|
750 |
hhs[numhhs] = gear |
|
751 |
numhhs = numhhs + 1 |
|
752 |
SetEffect(gear, heResurrectable, 1) |
|
14269 | 753 |
elseif GetGearType(gear) == gtCase then |
14271
9b5a8147386f
I think this is correct way to use iterate over it as a hashmap. don't have much lua practice
nemo
parents:
14270
diff
changeset
|
754 |
crates[gear] = gear |
13224
b229b3259a76
Mutant: Fix graph title on game draw
Wuzzy <Wuzzy2@mail.ru>
parents:
13177
diff
changeset
|
755 |
elseif GetGearType(gear) == gtATFinishGame then |
13225
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
756 |
if not gameOver then |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
757 |
local winner = createEndGameStats() |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
758 |
if winner then |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
759 |
SendStat(siGameResult, string.format(loc("%s wins!"), winner)) |
13648 | 760 |
AddCaption(string.format(loc("%s wins!"), winner), capcolDefault, capgrpGameState) |
13225
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
761 |
end |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
762 |
gameOver = true |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
763 |
end |
11015 | 764 |
end |
765 |
end |
|
766 |
||
767 |
function checkEmptyTeam (teamName) |
|
768 |
for i=0 , #hhs do |
|
769 |
if hhs[i]~=nil then |
|
770 |
if teamName == GetHogTeamName(hhs[i]) then |
|
771 |
return false |
|
772 |
end |
|
773 |
end |
|
774 |
end |
|
775 |
return true |
|
776 |
end |
|
777 |
||
778 |
function onGearDelete(gear) |
|
779 |
-- Remove hogs that are gone |
|
780 |
if GetGearType(gear) == gtHedgehog then |
|
781 |
numhhs = numhhs - 1 |
|
782 |
||
783 |
local found |
|
784 |
for i=0, #hhs do |
|
785 |
if hhs[i] == gear then |
|
786 |
found = i |
|
787 |
break |
|
788 |
end |
|
789 |
end |
|
790 |
for i = found, #hhs - 1 do |
|
791 |
hhs[i] = hhs[i + 1] |
|
792 |
end |
|
793 |
hhs[#hhs] = nil |
|
794 |
||
795 |
local t_name = GetHogTeamName(gear) |
|
796 |
if checkEmptyTeam(t_name) then |
|
797 |
for i = 0, TeamsCount - 1 do |
|
13225
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
798 |
if GetTeamName(i) == t_name then |
11015 | 799 |
found = i |
13225
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
800 |
teamsDead[t_name] = true |
11015 | 801 |
break |
802 |
end |
|
803 |
end |
|
804 |
end |
|
13225
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13224
diff
changeset
|
805 |
if getGearValue(gear, "excess") ~= true and band(GetState(gear), gstDrowning) == 0 then |
13113 | 806 |
AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
807 |
end |
|
11015 | 808 |
trackDeletion(gear) |
11914 | 809 |
elseif GetGearType(gear) == gtCase then |
14269 | 810 |
crates[gear] = nil |
11914 | 811 |
-- Check if a crate has been collected |
812 |
if band(GetGearMessage(gear), gmDestroy) ~= 0 and CurrentHedgehog ~= nil then |
|
813 |
-- Update crate collection achievement |
|
814 |
increaseTeamValue(GetHogTeamName(CurrentHedgehog), "Crates") |
|
815 |
if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Crates") > recordCrates) then |
|
816 |
recordCrates = getTeamValue(GetHogTeamName(CurrentHedgehog), "Crates") |
|
817 |
recordCratesHogName = getGearValue(CurrentHedgehog, "Name") |
|
818 |
recordCratesTeamName = GetHogTeamName(CurrentHedgehog) |
|
819 |
end |
|
820 |
end |
|
11015 | 821 |
end |
822 |
end |
|
823 |
||
824 |
function onParameters() |
|
825 |
parseParams() |
|
826 |
winScore = tonumber(params["winscore"]) or winScore |
|
827 |
end |
|
828 |
||
829 |
--[[ |
|
830 |
S T A R R I N G |
|
831 |
prof - Coding, implementing and evangelism |
|
832 |
vos - Initial idea and script improvements |
|
833 |
mikade - Moving the `how to play` into the game so that people know `how to play`, and whitespace :D |
|
834 |
--]] |