author | nemo |
Sat, 03 Nov 2012 22:45:24 -0400 | |
branch | 0.9.18 |
changeset 7938 | 80e2e50471d9 |
parent 7936 | 9f44e39d856c |
child 7996 | 66e8ac9c2274 |
permissions | -rw-r--r-- |
7889 | 1 |
local MUTANT_VERSION = "v0.9.4" |
2 |
||
3 |
--[[ ___ ___ |
|
4 |
( ) ( ) |
|
5 |
___ .-. .-. ___ ___ | |_ .---. ___ .-. | |_ |
|
6 |
( ) ' ( )( ( __) / .-, ( ) ( __) |
|
7 |
| .-. .-. | | | | | | (__) ; || .-. .| | |
|
8 |
| | | | | | | | | | | ___ .'` || | | || | ___ |
|
9 |
| | | | | | | | | | |( / .'| || | | || |( ) |
|
10 |
| | | | | | | | | | | | | / | || | | || | | | |
|
11 |
| | | | | | | ; ' | ' | ; | ; || | | || ' | | |
|
12 |
| | | | | ' `-' / ' `-' ' `-' || | | |' `-' ; |
|
13 |
(___)(___)(___'.__.' `.__.`.__.'_(___)(___)`.__. |
|
14 |
||
15 |
||
16 |
---- IMPORTANT! |
|
17 |
---- |
|
18 |
---- You should save (press Ctrl+S) this script to: |
|
19 |
---- Program Files\Hedgewars\share\hedgewars\Data\Scripts\Multiplayer\Mutant.lua |
|
20 |
---- or (on Linux): |
|
21 |
---- ~/.hedgewars/Data/Scripts/Multiplayer/Mutant.lua |
|
22 |
---- |
|
23 |
---- (or wherever scripts like Highlander.lua, Racer.lua are on your system) |
|
24 |
---- |
|
25 |
---- Also, if you didn't have Mutant script yet, you need to restart Hedgewars for it to find the script file. |
|
26 |
---- |
|
27 |
||
28 |
||
29 |
---- GAME RULES |
|
30 |
---- |
|
31 |
---- Recommended settings: |
|
32 |
---- * one hedgehog per team |
|
33 |
---- * 'Small' one-island map |
|
34 |
---- |
|
35 |
---- First one to kill anyone becomes Mutant. Mutant has super-weapons |
|
36 |
---- and a lot of health, which however depletes if he doesn't frag fast. |
|
37 |
---- Goal of Mutant is to use his weapons to hold his status for as long |
|
38 |
---- as he can. |
|
39 |
---- Goal of others is to hunt the Mutant down. The one who kills Mutant, |
|
40 |
---- becomes Mutant himself. |
|
41 |
---- The player with least points (or most deaths) is Bottom Feeder. He |
|
42 |
---- can gain points by killing anyone. Other normal players only get points |
|
43 |
---- for killing Mutant. |
|
44 |
---- |
|
45 |
---- Points: |
|
46 |
---- +2 for becoming a Mutant |
|
47 |
---- +1 to a Mutant for killing anyone |
|
48 |
---- +1 to a Bottom Feeder for killing anyone |
|
49 |
---- -1 to anyone for a suicide |
|
50 |
---- other kills don't give you points. |
|
51 |
---- |
|
52 |
||
53 |
--]] |
|
54 |
||
55 |
loadfile(GetDataPath() .. "Scripts/Locale.lua")() |
|
56 |
loadfile(GetDataPath() .. "Scripts/Tracker.lua")() |
|
57 |
||
58 |
--[[ |
|
59 |
MUTANT SCRIPT |
|
60 |
||
61 |
To Do: -Clean-up this fucking piece of code |
|
62 |
-Debug |
|
63 |
-Find a girlfriend |
|
64 |
-Fix Sheepluva's hat +[p] |
|
65 |
-Cookies |
|
66 |
||
67 |
-----------------------]] |
|
68 |
||
69 |
local hhs = {} |
|
70 |
local numhhs = 0 |
|
71 |
||
72 |
local gameOver=false |
|
73 |
||
74 |
local mutant = nil |
|
75 |
local mutant_base_health = 200 |
|
76 |
local mutant_base_disease = 25 |
|
77 |
local disease_timer = 2000 |
|
78 |
||
79 |
local kill_reward = nil |
|
80 |
local mt_hurt=false |
|
81 |
||
82 |
local killsCounter = 0 |
|
83 |
||
84 |
local team_fire_punishment = 3 |
|
85 |
local mutant_kill_reward = 2 |
|
86 |
||
87 |
local hh_weapons = { amBazooka, amGrenade, amShotgun, amMine} |
|
88 |
||
89 |
local mt_weapons = {amWatermelon, amHellishBomb, amBallgun, amRCPlane, amTeleport} |
|
90 |
||
91 |
local disease=0 |
|
92 |
local timer=0 |
|
93 |
||
94 |
local winScore = 15 |
|
95 |
local hogsLimit = 1 |
|
96 |
||
97 |
local teams = {} |
|
98 |
||
99 |
local circles = {} |
|
100 |
local circleFrame = -1 |
|
101 |
||
102 |
function onGameInit() |
|
103 |
TurnTime = 20000 |
|
104 |
WaterRise = 0 |
|
105 |
GameFlags = GameFlags + gfResetWeps + gfPerHogAmmo |
|
106 |
HealthCaseProb=0 |
|
107 |
HealthCaseAmount=0 |
|
108 |
MinesTime=1000 |
|
109 |
CaseFreq = 2 |
|
110 |
||
111 |
end |
|
112 |
||
113 |
||
114 |
function limitHogs(gear) |
|
115 |
cnthhs = cnthhs + 1 |
|
116 |
if cnthhs > 1 then |
|
117 |
hogLimitHit = true |
|
118 |
SetEffect(gear, heResurrectable, false) |
|
7894
1e8e9400e9de
fix hat names. more efficient killing off of limited hogs (takes too long to wait otherwise)
nemo
parents:
7889
diff
changeset
|
119 |
--SetHealth(gear, 0) |
1e8e9400e9de
fix hat names. more efficient killing off of limited hogs (takes too long to wait otherwise)
nemo
parents:
7889
diff
changeset
|
120 |
SetGearPosition(gear, -100,LAND_HEIGHT) |
7889 | 121 |
end |
122 |
end |
|
123 |
||
124 |
function onGameStart() |
|
125 |
trackTeams() |
|
126 |
teamScan() |
|
127 |
runOnHogs(saveStuff) |
|
128 |
--local str = "/say " .. MUTANT_VERSION |
|
129 |
--ParseCommand(str) |
|
130 |
||
131 |
hogLimitHit = false |
|
132 |
for i=0 , TeamsCount - 1 do |
|
133 |
cnthhs = 0 |
|
134 |
runOnHogsInTeam(limitHogs, teams[i]) |
|
135 |
end |
|
136 |
if hogLimitHit then |
|
137 |
AddCaption(loc("ONE HOG PER TEAM! KILLING EXCESS HEDGES")) |
|
138 |
end |
|
139 |
end |
|
140 |
||
141 |
||
142 |
||
143 |
function giveWeapons(gear) |
|
144 |
||
145 |
if gear == mutant then |
|
146 |
AddAmmo(gear, amRope) |
|
147 |
for i=1, #mt_weapons do |
|
148 |
AddAmmo(gear, mt_weapons[i]) |
|
149 |
end |
|
150 |
||
151 |
else |
|
152 |
for i=1, #hh_weapons do |
|
153 |
AddAmmo(gear,hh_weapons[i]) |
|
154 |
end |
|
155 |
end |
|
156 |
end |
|
157 |
||
158 |
function onAmmoStoreInit() |
|
159 |
||
160 |
SetAmmo(amSkip, 9, 0, 0, 0) |
|
161 |
SetAmmo(amRope,0,1,0,5) |
|
162 |
SetAmmo(amSnowball,0,1,0,1) |
|
163 |
||
164 |
for i=1, #hh_weapons do |
|
165 |
SetAmmo(hh_weapons[i], 0, 0, 0, 1) |
|
166 |
end |
|
167 |
||
168 |
for i=1, #mt_weapons do |
|
169 |
SetAmmo(mt_weapons[i], 0, 3, 0, 1) |
|
170 |
end |
|
171 |
||
172 |
end |
|
173 |
||
174 |
function drawCircles() |
|
175 |
for i = 0, #hhs do |
|
176 |
if circles[hhs[i]] ~= nil then |
|
177 |
DeleteVisualGear(circles[hhs[i]]) |
|
178 |
circles[hhs[i]] = nil |
|
179 |
end |
|
180 |
||
181 |
if hhs[i] ~= CurrentHedgehog then |
|
182 |
if mutant == nil then |
|
183 |
circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false) |
|
184 |
SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 5, 0xff000080) |
|
185 |
elseif CurrentHedgehog == mutant then |
|
186 |
circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false) |
|
187 |
SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 3, 0xaa000070) |
|
188 |
elseif getGearValue(CurrentHedgehog, "Feeder") and hhs[i] ~= mutant then |
|
189 |
circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false) |
|
190 |
SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 3, 0xaa000070) |
|
191 |
elseif hhs[i] == mutant then |
|
192 |
circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false) |
|
193 |
SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 5, 0xff000080) |
|
194 |
end |
|
195 |
end |
|
196 |
end |
|
197 |
circleFrame = 0 |
|
198 |
end |
|
199 |
||
200 |
function onNewTurn() |
|
201 |
||
202 |
trackTeams() |
|
203 |
killsCounter = 0 |
|
204 |
||
205 |
if mutant == nil then |
|
206 |
AddCaption( loc("FIRST BLOOD MUTATES") ) |
|
207 |
end |
|
208 |
||
209 |
checkScore() |
|
210 |
giveWeapons(CurrentHedgehog) |
|
211 |
drawCircles() |
|
212 |
kill_reward= numhhs*10 |
|
213 |
||
214 |
if CurrentHedgehog == mutant then |
|
215 |
mt_hurt=true |
|
216 |
disease= mutant_base_disease - numhhs |
|
217 |
else |
|
218 |
mt_hurt=false |
|
219 |
end |
|
220 |
||
221 |
setGearValue(CurrentHedgehog, "Alive", true) |
|
222 |
||
223 |
end |
|
224 |
||
225 |
function countBodies() |
|
226 |
if killsCounter == 2 then |
|
227 |
AddCaption(loc("DOUBLE KILL")) |
|
228 |
elseif killsCounter == 3 then |
|
229 |
AddCaption(loc("MEGA KILL")) |
|
230 |
PlaySound(sndRegret) |
|
231 |
elseif killsCounter == 4 then |
|
232 |
AddCaption(loc("ULTRA KILL")) |
|
233 |
elseif killsCounter == 5 then |
|
234 |
AddCaption(loc("MONSTER KILL")) |
|
235 |
PlaySound(sndIllGetYou) |
|
236 |
elseif killsCounter == 6 then |
|
237 |
AddCaption(loc("LUDICROUS KILL")) |
|
238 |
PlaySound(sndNutter) |
|
239 |
elseif killsCounter == 7 then |
|
240 |
AddCaption(loc("HOLY SHIT!")) |
|
241 |
PlaySound(sndLaugh) |
|
242 |
elseif killsCounter > 8 then |
|
7938 | 243 |
AddCaption(loc("INSANITY")) |
7889 | 244 |
end |
245 |
||
246 |
end |
|
247 |
||
248 |
function onGameTick() |
|
249 |
||
250 |
if circleFrame > -1 then |
|
251 |
for i = 0, #hhs do |
|
252 |
if circles[hhs[i]] ~= nil and hhs[i]~= nil then |
|
253 |
hhx, hhy = GetGearPosition(hhs[i]) |
|
254 |
X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint = GetVisualGearValues(circles[hhs[i]]) |
|
255 |
SetVisualGearValues(circles[hhs[i]], hhx + 1, hhy - 3, 0, 0, 0, 0, 0, 40 - (circleFrame % 25), Timer, Tint) |
|
256 |
end |
|
257 |
end |
|
258 |
||
259 |
circleFrame = circleFrame + 0.06 |
|
260 |
||
261 |
if circleFrame >= 25 then |
|
262 |
for i = 0, #hhs do |
|
263 |
if circles[hhs[i]] ~= nil then |
|
264 |
DeleteVisualGear(circles[hhs[i]]) |
|
265 |
circles[hhs[i]] = nil |
|
266 |
end |
|
267 |
end |
|
268 |
end |
|
269 |
end |
|
270 |
||
271 |
if TurnTimeLeft==0 and mt_hurt then |
|
272 |
mt_hurt = false |
|
273 |
end |
|
274 |
||
275 |
if mt_hurt and mutant~=nil then |
|
276 |
timer = timer + 1 |
|
277 |
if timer > disease_timer then |
|
278 |
timer = 0 |
|
279 |
SetHealth(mutant, GetHealth(mutant)-disease ) |
|
280 |
AddVisualGear(GetX(mutant), GetY(mutant)-5, vgtHealthTag, disease, true) |
|
281 |
if GetHealth(mutant)<=0 then |
|
282 |
SetHealth(mutant,0) |
|
283 |
mt_hurt= false |
|
284 |
setGearValue(mutant,"SelfDestruct",true) |
|
285 |
TurnTimeLeft = 0 |
|
286 |
end |
|
287 |
end |
|
288 |
end |
|
289 |
end |
|
290 |
||
291 |
function saveStuff(gear) |
|
292 |
setGearValue(gear,"Name",GetHogName(gear)) |
|
293 |
setGearValue(gear,"Hat",GetHogHat(gear)) |
|
294 |
end |
|
295 |
||
296 |
function armageddon(gear) |
|
297 |
SetState(gear, gstLoser) |
|
298 |
SetEffect(gear, heResurrectable, false) |
|
299 |
SetHealth(gear, 0) |
|
300 |
end |
|
301 |
||
302 |
function updateScore() |
|
303 |
local showScore = "" |
|
304 |
||
305 |
for i=0, TeamsCount-1 do |
|
306 |
if teams[i]~= nil then |
|
307 |
||
308 |
local curr_score = getTeamValue(teams[i], "Score") |
|
309 |
showScore = showScore .. teams[i] .. ": " .. curr_score .. " (deaths: " .. getTeamValue(teams[i], "DeadHogs") .. ") " .. "|" |
|
310 |
||
311 |
end |
|
312 |
end |
|
313 |
||
314 |
ShowMission(loc("Score"), |
|
315 |
"-------", |
|
316 |
showScore, 0, 200) |
|
317 |
||
318 |
HideMission() |
|
319 |
||
320 |
end |
|
321 |
||
322 |
function checkScore() |
|
323 |
local showScore = "" |
|
324 |
local lowest_score_team = nil |
|
325 |
local min_score=nil |
|
326 |
local winTeam = nil |
|
327 |
||
328 |
local only_low_score = true |
|
329 |
||
330 |
for i=0, TeamsCount-1 do |
|
331 |
if teams[i]~=nil then |
|
332 |
local curr_score = getTeamValue(teams[i], "Score") |
|
333 |
||
334 |
runOnHogsInTeam(removeFeeder, teams[i]) |
|
335 |
||
336 |
showScore = showScore .. teams[i] ..": " .. curr_score .. " (deaths: " .. getTeamValue(teams[i], "DeadHogs") .. ") " .. "|" |
|
337 |
||
338 |
if curr_score >= winScore then |
|
339 |
gameOver = true |
|
340 |
winTeam = teams[i] |
|
341 |
end |
|
342 |
||
343 |
if min_score==nil then |
|
344 |
min_score= curr_score |
|
345 |
lowest_score_team = teams[i] |
|
346 |
else |
|
347 |
if curr_score <= min_score then |
|
348 |
if curr_score == min_score then |
|
349 |
if getTeamValue(teams[i], "DeadHogs") == getTeamValue(lowest_score_team, "DeadHogs") then |
|
350 |
only_low_score = false |
|
351 |
else |
|
352 |
if getTeamValue(teams[i], "DeadHogs") > getTeamValue(lowest_score_team, "DeadHogs") then |
|
353 |
lowest_score_team = teams[i] |
|
354 |
end |
|
355 |
only_low_score = true |
|
356 |
end |
|
357 |
||
358 |
else |
|
359 |
min_score= curr_score |
|
360 |
lowest_score_team = teams[i] |
|
361 |
only_low_score = true |
|
362 |
end |
|
363 |
end |
|
364 |
end |
|
365 |
end |
|
366 |
end |
|
367 |
||
368 |
if gameOver then |
|
369 |
TurnTimeLeft = 0 |
|
370 |
for i=0, #teams do |
|
371 |
if teams[i]~=winTeam then |
|
372 |
runOnHogsInTeam(armageddon, teams[i]) |
|
373 |
end |
|
374 |
end |
|
375 |
||
376 |
ShowMission( loc("WINNER IS ") .. winTeam, |
|
377 |
"~~~~~~~~~~~~~~~~~~~~~~~~~", |
|
378 |
showScore, 0, 200) |
|
379 |
else |
|
380 |
||
381 |
if only_low_score then |
|
382 |
runOnHogsInTeam(setFeeder, lowest_score_team) |
|
383 |
end |
|
384 |
||
385 |
ShowMission( loc("Score"), |
|
386 |
loc("-------"), |
|
387 |
showScore, 0, 200) |
|
388 |
||
389 |
end |
|
390 |
end |
|
391 |
||
392 |
function backToNormal(gear) |
|
393 |
||
394 |
SetHogName(gear, getGearValue(gear,"Name")) |
|
395 |
SetHogHat(gear, 'NoHat') |
|
396 |
SetHogHat(gear, getGearValue(gear,"Hat")) |
|
397 |
setGearValue(mutant,"SelfDestruct",false) |
|
398 |
mt_hurt=false |
|
399 |
mutant=nil |
|
400 |
end |
|
401 |
||
402 |
function removeFeeder(gear) |
|
403 |
||
404 |
if gear~=nil then |
|
405 |
setGearValue(gear,"Feeder",false) |
|
406 |
if gear~= mutant then |
|
407 |
SetHogName(gear, getGearValue(gear,"Name") ) |
|
408 |
SetHogHat(gear, 'NoHat') |
|
409 |
SetHogHat(gear, getGearValue(gear,"Hat")) |
|
410 |
end |
|
411 |
end |
|
412 |
end |
|
413 |
||
414 |
function setFeeder(gear) |
|
415 |
||
416 |
if gear~= mutant and gear~= nil then |
|
417 |
SetHogName(gear,"BOTTOM FEEDER") |
|
7894
1e8e9400e9de
fix hat names. more efficient killing off of limited hogs (takes too long to wait otherwise)
nemo
parents:
7889
diff
changeset
|
418 |
SetHogHat(gear, 'poke_slowpoke') |
7889 | 419 |
setGearValue(gear,"Feeder", true) |
420 |
end |
|
421 |
end |
|
422 |
||
423 |
function setMutantStuff(gear) |
|
424 |
mutant = gear |
|
425 |
||
426 |
SetHogName(gear,"MUTANT") |
|
7894
1e8e9400e9de
fix hat names. more efficient killing off of limited hogs (takes too long to wait otherwise)
nemo
parents:
7889
diff
changeset
|
427 |
SetHogHat(gear,'WhySoSerious') |
7889 | 428 |
SetHealth(gear, ( mutant_base_health + numhhs*25) ) |
429 |
SetEffect(gear, hePoisoned, 1) |
|
430 |
setGearValue(mutant,"SelfDestruct",false) |
|
431 |
setGearValue(gear, "Feeder", false) |
|
432 |
||
7936 | 433 |
AddCaption(getGearValue(gear, "Name") .. loc(" HAS MUTATED")) |
7889 | 434 |
|
435 |
TurnTimeLeft=0 |
|
436 |
||
437 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
438 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
439 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
440 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
441 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
442 |
PlaySound(sndSuddenDeath) |
|
443 |
end |
|
444 |
||
445 |
function teamScan() |
|
446 |
||
447 |
for i=0, TeamsCount-1 do --nil filling |
|
448 |
teams[i]=nil |
|
449 |
end |
|
450 |
||
451 |
for i=0, #hhs do |
|
452 |
for j=0, TeamsCount-1 do |
|
453 |
if teams[j] ==nil and hhs[i]~=nil then |
|
454 |
teams[j] = GetHogTeamName(hhs[i]) |
|
455 |
setTeamValue(teams[j],"Score",0) |
|
456 |
setTeamValue(teams[j], "DeadHogs",0) |
|
457 |
break |
|
458 |
end |
|
459 |
||
460 |
if teams[j] == GetHogTeamName(hhs[i]) then |
|
461 |
break |
|
462 |
end |
|
463 |
end |
|
464 |
end |
|
465 |
||
466 |
---***--- |
|
467 |
end |
|
468 |
||
469 |
||
470 |
function onGearDamage(gear, dmg) |
|
471 |
||
472 |
end |
|
473 |
||
474 |
function set_Mutant_and_Score(gear) |
|
475 |
||
476 |
local curr_team = GetHogTeamName(CurrentHedgehog) |
|
477 |
||
478 |
if gear == CurrentHedgehog then |
|
479 |
if CurrentHedgehog == mutant then |
|
480 |
PlaySound(sndHomerun) |
|
481 |
if getGearValue(gear, "SelfDestruct")==false then |
|
482 |
decreaseTeamValue(curr_team,"Score") |
|
483 |
end |
|
484 |
backToNormal(gear) |
|
485 |
else |
|
486 |
decreaseTeamValue(curr_team,"Score") |
|
487 |
end |
|
488 |
||
489 |
else |
|
490 |
if gear == mutant then |
|
491 |
backToNormal(mutant) |
|
492 |
if curr_team ~=GetHogTeamName(gear) then |
|
493 |
if getGearValue(CurrentHedgehog, "Alive") then |
|
494 |
setMutantStuff(CurrentHedgehog) |
|
495 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") + mutant_kill_reward)) |
|
496 |
end |
|
497 |
else |
|
498 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment)) |
|
499 |
end |
|
500 |
else |
|
501 |
if mutant==nil then |
|
502 |
if curr_team ~=GetHogTeamName(gear) then |
|
503 |
if getGearValue(CurrentHedgehog, "Alive") then |
|
504 |
setMutantStuff(CurrentHedgehog) |
|
505 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") + mutant_kill_reward)) |
|
506 |
else |
|
507 |
increaseTeamValue(curr_team,"Score") |
|
508 |
end |
|
509 |
else |
|
510 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment)) |
|
511 |
end |
|
512 |
else |
|
513 |
if curr_team ~=GetHogTeamName(gear) then |
|
514 |
if CurrentHedgehog==mutant and getGearValue(mutant,"SelfDestruct")==false then |
|
515 |
SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+kill_reward) |
|
516 |
AddCaption("+" .. kill_reward .. loc(" HP") ) |
|
517 |
increaseTeamValue(curr_team,"Score") |
|
518 |
end |
|
519 |
if getGearValue(CurrentHedgehog,"Feeder") then |
|
520 |
increaseTeamValue(curr_team,"Score") |
|
521 |
end |
|
522 |
else |
|
523 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment)) |
|
524 |
end |
|
525 |
end |
|
526 |
end |
|
527 |
end |
|
528 |
end |
|
529 |
||
530 |
function onGearResurrect(gear) |
|
531 |
if not gameOver then |
|
532 |
if GetGearType(gear) == gtHedgehog then |
|
533 |
||
534 |
increaseTeamValue(GetHogTeamName(gear), "DeadHogs") |
|
535 |
||
536 |
if gear==CurrentHedgehog then |
|
537 |
setGearValue(CurrentHedgehog, "Alive", false) |
|
538 |
end |
|
539 |
set_Mutant_and_Score(gear) |
|
540 |
if gear~=CurrentHedgehog then |
|
541 |
killsCounter = killsCounter + 1 |
|
542 |
countBodies() |
|
543 |
end |
|
544 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
545 |
PlaySound(sndWhack) |
|
546 |
updateScore() |
|
547 |
end |
|
548 |
end |
|
549 |
end |
|
550 |
||
551 |
function onGearAdd(gear) |
|
552 |
||
553 |
-- Catch hedgehogs for the tracker |
|
554 |
if GetGearType(gear) == gtHedgehog then |
|
555 |
trackGear(gear) |
|
556 |
hhs[numhhs] = gear |
|
557 |
numhhs = numhhs + 1 |
|
558 |
SetEffect(gear, heResurrectable, 1) |
|
559 |
end |
|
560 |
end |
|
561 |
||
562 |
function checkEmptyTeam (teamName) |
|
563 |
for i=0 , #hhs do |
|
564 |
if hhs[i]~=nil then |
|
565 |
if teamName == GetHogTeamName(hhs[i]) then |
|
566 |
return false |
|
567 |
end |
|
568 |
end |
|
569 |
end |
|
570 |
return true |
|
571 |
end |
|
572 |
||
573 |
function onGearDelete(gear) |
|
574 |
-- Remove hogs that are gone |
|
575 |
if GetGearType(gear) == gtHedgehog then |
|
576 |
numhhs = numhhs - 1 |
|
577 |
||
578 |
local found |
|
579 |
for i=0, #hhs do |
|
580 |
if hhs[i] == gear then |
|
581 |
found = i |
|
582 |
break |
|
583 |
end |
|
584 |
end |
|
585 |
for i = found, #hhs - 1 do |
|
586 |
hhs[i] = hhs[i + 1] |
|
587 |
end |
|
588 |
hhs[#hhs] = nil |
|
589 |
||
590 |
local t_name = GetHogTeamName(gear) |
|
591 |
if checkEmptyTeam(t_name) then |
|
592 |
for i = 0, TeamsCount - 1 do |
|
593 |
if teams[i] == t_name then |
|
594 |
found = i |
|
595 |
break |
|
596 |
end |
|
597 |
end |
|
598 |
for i = found, TeamsCount - 2 do |
|
599 |
teams[i] = teams[i + 1] |
|
600 |
end |
|
601 |
teams[TeamsCount - 1] = nil |
|
602 |
TeamsCount = TeamsCount - 1 |
|
603 |
end |
|
604 |
AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
|
605 |
trackDeletion(gear) |
|
606 |
end |
|
607 |
end |
|
608 |
||
609 |
--[[ |
|
610 |
S T A R R I N G |
|
611 |
||
612 |
prof - Coding, implementing and evangelism |
|
613 |
vos - Initial idea and script improvements |
|
614 |
--]] |