author | unc0rr |
Sat, 17 Nov 2012 00:41:30 +0400 | |
branch | physfslayer |
changeset 8043 | da083f8d95e6 |
parent 7996 | 66e8ac9c2274 |
child 8057 | 93e16240f178 |
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 |
||
8043 | 55 |
HedgewarsScriptLoad("/Scripts/Locale.lua") |
56 |
HedgewarsScriptLoad("/Scripts/Tracker.lua") |
|
7889 | 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() |
|
7996 | 212 |
setAIHints() |
7889 | 213 |
kill_reward= numhhs*10 |
214 |
||
215 |
if CurrentHedgehog == mutant then |
|
216 |
mt_hurt=true |
|
217 |
disease= mutant_base_disease - numhhs |
|
218 |
else |
|
219 |
mt_hurt=false |
|
220 |
end |
|
221 |
||
222 |
setGearValue(CurrentHedgehog, "Alive", true) |
|
223 |
||
224 |
end |
|
225 |
||
226 |
function countBodies() |
|
227 |
if killsCounter == 2 then |
|
228 |
AddCaption(loc("DOUBLE KILL")) |
|
229 |
elseif killsCounter == 3 then |
|
230 |
AddCaption(loc("MEGA KILL")) |
|
231 |
PlaySound(sndRegret) |
|
232 |
elseif killsCounter == 4 then |
|
233 |
AddCaption(loc("ULTRA KILL")) |
|
234 |
elseif killsCounter == 5 then |
|
235 |
AddCaption(loc("MONSTER KILL")) |
|
236 |
PlaySound(sndIllGetYou) |
|
237 |
elseif killsCounter == 6 then |
|
238 |
AddCaption(loc("LUDICROUS KILL")) |
|
239 |
PlaySound(sndNutter) |
|
240 |
elseif killsCounter == 7 then |
|
241 |
AddCaption(loc("HOLY SHIT!")) |
|
242 |
PlaySound(sndLaugh) |
|
243 |
elseif killsCounter > 8 then |
|
7938 | 244 |
AddCaption(loc("INSANITY")) |
7889 | 245 |
end |
246 |
||
247 |
end |
|
248 |
||
249 |
function onGameTick() |
|
250 |
||
251 |
if circleFrame > -1 then |
|
252 |
for i = 0, #hhs do |
|
253 |
if circles[hhs[i]] ~= nil and hhs[i]~= nil then |
|
254 |
hhx, hhy = GetGearPosition(hhs[i]) |
|
255 |
X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint = GetVisualGearValues(circles[hhs[i]]) |
|
256 |
SetVisualGearValues(circles[hhs[i]], hhx + 1, hhy - 3, 0, 0, 0, 0, 0, 40 - (circleFrame % 25), Timer, Tint) |
|
257 |
end |
|
258 |
end |
|
259 |
||
260 |
circleFrame = circleFrame + 0.06 |
|
261 |
||
262 |
if circleFrame >= 25 then |
|
263 |
for i = 0, #hhs do |
|
264 |
if circles[hhs[i]] ~= nil then |
|
265 |
DeleteVisualGear(circles[hhs[i]]) |
|
266 |
circles[hhs[i]] = nil |
|
267 |
end |
|
268 |
end |
|
269 |
end |
|
270 |
end |
|
271 |
||
272 |
if TurnTimeLeft==0 and mt_hurt then |
|
273 |
mt_hurt = false |
|
274 |
end |
|
275 |
||
276 |
if mt_hurt and mutant~=nil then |
|
277 |
timer = timer + 1 |
|
278 |
if timer > disease_timer then |
|
279 |
timer = 0 |
|
280 |
SetHealth(mutant, GetHealth(mutant)-disease ) |
|
281 |
AddVisualGear(GetX(mutant), GetY(mutant)-5, vgtHealthTag, disease, true) |
|
282 |
if GetHealth(mutant)<=0 then |
|
283 |
SetHealth(mutant,0) |
|
284 |
mt_hurt= false |
|
285 |
setGearValue(mutant,"SelfDestruct",true) |
|
286 |
TurnTimeLeft = 0 |
|
287 |
end |
|
288 |
end |
|
289 |
end |
|
290 |
end |
|
291 |
||
292 |
function saveStuff(gear) |
|
293 |
setGearValue(gear,"Name",GetHogName(gear)) |
|
294 |
setGearValue(gear,"Hat",GetHogHat(gear)) |
|
295 |
end |
|
296 |
||
297 |
function armageddon(gear) |
|
298 |
SetState(gear, gstLoser) |
|
299 |
SetEffect(gear, heResurrectable, false) |
|
300 |
SetHealth(gear, 0) |
|
301 |
end |
|
302 |
||
303 |
function updateScore() |
|
304 |
local showScore = "" |
|
305 |
||
306 |
for i=0, TeamsCount-1 do |
|
307 |
if teams[i]~= nil then |
|
308 |
||
309 |
local curr_score = getTeamValue(teams[i], "Score") |
|
310 |
showScore = showScore .. teams[i] .. ": " .. curr_score .. " (deaths: " .. getTeamValue(teams[i], "DeadHogs") .. ") " .. "|" |
|
311 |
||
312 |
end |
|
313 |
end |
|
314 |
||
315 |
ShowMission(loc("Score"), |
|
316 |
"-------", |
|
317 |
showScore, 0, 200) |
|
318 |
||
319 |
HideMission() |
|
320 |
||
321 |
end |
|
322 |
||
323 |
function checkScore() |
|
324 |
local showScore = "" |
|
325 |
local lowest_score_team = nil |
|
326 |
local min_score=nil |
|
327 |
local winTeam = nil |
|
328 |
||
329 |
local only_low_score = true |
|
330 |
||
331 |
for i=0, TeamsCount-1 do |
|
332 |
if teams[i]~=nil then |
|
333 |
local curr_score = getTeamValue(teams[i], "Score") |
|
334 |
||
335 |
runOnHogsInTeam(removeFeeder, teams[i]) |
|
336 |
||
337 |
showScore = showScore .. teams[i] ..": " .. curr_score .. " (deaths: " .. getTeamValue(teams[i], "DeadHogs") .. ") " .. "|" |
|
338 |
||
339 |
if curr_score >= winScore then |
|
340 |
gameOver = true |
|
341 |
winTeam = teams[i] |
|
342 |
end |
|
343 |
||
344 |
if min_score==nil then |
|
345 |
min_score= curr_score |
|
346 |
lowest_score_team = teams[i] |
|
347 |
else |
|
348 |
if curr_score <= min_score then |
|
349 |
if curr_score == min_score then |
|
350 |
if getTeamValue(teams[i], "DeadHogs") == getTeamValue(lowest_score_team, "DeadHogs") then |
|
351 |
only_low_score = false |
|
352 |
else |
|
353 |
if getTeamValue(teams[i], "DeadHogs") > getTeamValue(lowest_score_team, "DeadHogs") then |
|
354 |
lowest_score_team = teams[i] |
|
355 |
end |
|
356 |
only_low_score = true |
|
357 |
end |
|
358 |
||
359 |
else |
|
360 |
min_score= curr_score |
|
361 |
lowest_score_team = teams[i] |
|
362 |
only_low_score = true |
|
363 |
end |
|
364 |
end |
|
365 |
end |
|
366 |
end |
|
367 |
end |
|
368 |
||
369 |
if gameOver then |
|
370 |
TurnTimeLeft = 0 |
|
371 |
for i=0, #teams do |
|
372 |
if teams[i]~=winTeam then |
|
373 |
runOnHogsInTeam(armageddon, teams[i]) |
|
374 |
end |
|
375 |
end |
|
376 |
||
377 |
ShowMission( loc("WINNER IS ") .. winTeam, |
|
378 |
"~~~~~~~~~~~~~~~~~~~~~~~~~", |
|
379 |
showScore, 0, 200) |
|
380 |
else |
|
381 |
||
382 |
if only_low_score then |
|
383 |
runOnHogsInTeam(setFeeder, lowest_score_team) |
|
384 |
end |
|
385 |
||
386 |
ShowMission( loc("Score"), |
|
387 |
loc("-------"), |
|
388 |
showScore, 0, 200) |
|
389 |
||
390 |
end |
|
391 |
end |
|
392 |
||
393 |
function backToNormal(gear) |
|
394 |
||
395 |
SetHogName(gear, getGearValue(gear,"Name")) |
|
396 |
SetHogHat(gear, 'NoHat') |
|
397 |
SetHogHat(gear, getGearValue(gear,"Hat")) |
|
398 |
setGearValue(mutant,"SelfDestruct",false) |
|
399 |
mt_hurt=false |
|
400 |
mutant=nil |
|
401 |
end |
|
402 |
||
7996 | 403 |
function setAIHints() |
404 |
for i = 0, #hhs do |
|
405 |
if mutant == nil or hhs[i] == mutant or CurrentHedgehog == mutant then |
|
406 |
SetGearAIHints(hhs[i], aihUsual) |
|
407 |
else |
|
408 |
SetGearAIHints(hhs[i], aihDoesntMatter) |
|
409 |
end |
|
410 |
end |
|
411 |
end |
|
412 |
||
7889 | 413 |
function removeFeeder(gear) |
414 |
||
415 |
if gear~=nil then |
|
416 |
setGearValue(gear,"Feeder",false) |
|
417 |
if gear~= mutant then |
|
418 |
SetHogName(gear, getGearValue(gear,"Name") ) |
|
419 |
SetHogHat(gear, 'NoHat') |
|
420 |
SetHogHat(gear, getGearValue(gear,"Hat")) |
|
421 |
end |
|
422 |
end |
|
423 |
end |
|
424 |
||
425 |
function setFeeder(gear) |
|
426 |
||
427 |
if gear~= mutant and gear~= nil then |
|
428 |
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
|
429 |
SetHogHat(gear, 'poke_slowpoke') |
7889 | 430 |
setGearValue(gear,"Feeder", true) |
431 |
end |
|
432 |
end |
|
433 |
||
434 |
function setMutantStuff(gear) |
|
435 |
mutant = gear |
|
436 |
||
437 |
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
|
438 |
SetHogHat(gear,'WhySoSerious') |
7889 | 439 |
SetHealth(gear, ( mutant_base_health + numhhs*25) ) |
440 |
SetEffect(gear, hePoisoned, 1) |
|
441 |
setGearValue(mutant,"SelfDestruct",false) |
|
442 |
setGearValue(gear, "Feeder", false) |
|
443 |
||
7936 | 444 |
AddCaption(getGearValue(gear, "Name") .. loc(" HAS MUTATED")) |
7889 | 445 |
|
446 |
TurnTimeLeft=0 |
|
447 |
||
448 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
449 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
450 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
451 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
452 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
453 |
PlaySound(sndSuddenDeath) |
|
454 |
end |
|
455 |
||
456 |
function teamScan() |
|
457 |
||
458 |
for i=0, TeamsCount-1 do --nil filling |
|
459 |
teams[i]=nil |
|
460 |
end |
|
461 |
||
462 |
for i=0, #hhs do |
|
463 |
for j=0, TeamsCount-1 do |
|
464 |
if teams[j] ==nil and hhs[i]~=nil then |
|
465 |
teams[j] = GetHogTeamName(hhs[i]) |
|
466 |
setTeamValue(teams[j],"Score",0) |
|
467 |
setTeamValue(teams[j], "DeadHogs",0) |
|
468 |
break |
|
469 |
end |
|
470 |
||
471 |
if teams[j] == GetHogTeamName(hhs[i]) then |
|
472 |
break |
|
473 |
end |
|
474 |
end |
|
475 |
end |
|
476 |
||
477 |
---***--- |
|
478 |
end |
|
479 |
||
480 |
||
481 |
function onGearDamage(gear, dmg) |
|
482 |
||
483 |
end |
|
484 |
||
485 |
function set_Mutant_and_Score(gear) |
|
486 |
||
487 |
local curr_team = GetHogTeamName(CurrentHedgehog) |
|
488 |
||
489 |
if gear == CurrentHedgehog then |
|
490 |
if CurrentHedgehog == mutant then |
|
491 |
PlaySound(sndHomerun) |
|
492 |
if getGearValue(gear, "SelfDestruct")==false then |
|
493 |
decreaseTeamValue(curr_team,"Score") |
|
494 |
end |
|
495 |
backToNormal(gear) |
|
496 |
else |
|
497 |
decreaseTeamValue(curr_team,"Score") |
|
498 |
end |
|
499 |
||
500 |
else |
|
501 |
if gear == mutant then |
|
502 |
backToNormal(mutant) |
|
503 |
if curr_team ~=GetHogTeamName(gear) then |
|
504 |
if getGearValue(CurrentHedgehog, "Alive") then |
|
505 |
setMutantStuff(CurrentHedgehog) |
|
506 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") + mutant_kill_reward)) |
|
507 |
end |
|
508 |
else |
|
509 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment)) |
|
510 |
end |
|
511 |
else |
|
512 |
if mutant==nil then |
|
513 |
if curr_team ~=GetHogTeamName(gear) then |
|
514 |
if getGearValue(CurrentHedgehog, "Alive") then |
|
515 |
setMutantStuff(CurrentHedgehog) |
|
516 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") + mutant_kill_reward)) |
|
517 |
else |
|
518 |
increaseTeamValue(curr_team,"Score") |
|
519 |
end |
|
520 |
else |
|
521 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment)) |
|
522 |
end |
|
523 |
else |
|
524 |
if curr_team ~=GetHogTeamName(gear) then |
|
525 |
if CurrentHedgehog==mutant and getGearValue(mutant,"SelfDestruct")==false then |
|
526 |
SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+kill_reward) |
|
527 |
AddCaption("+" .. kill_reward .. loc(" HP") ) |
|
528 |
increaseTeamValue(curr_team,"Score") |
|
529 |
end |
|
530 |
if getGearValue(CurrentHedgehog,"Feeder") then |
|
531 |
increaseTeamValue(curr_team,"Score") |
|
532 |
end |
|
533 |
else |
|
534 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment)) |
|
535 |
end |
|
536 |
end |
|
537 |
end |
|
538 |
end |
|
539 |
end |
|
540 |
||
541 |
function onGearResurrect(gear) |
|
542 |
if not gameOver then |
|
543 |
if GetGearType(gear) == gtHedgehog then |
|
544 |
||
545 |
increaseTeamValue(GetHogTeamName(gear), "DeadHogs") |
|
546 |
||
547 |
if gear==CurrentHedgehog then |
|
548 |
setGearValue(CurrentHedgehog, "Alive", false) |
|
549 |
end |
|
550 |
set_Mutant_and_Score(gear) |
|
551 |
if gear~=CurrentHedgehog then |
|
552 |
killsCounter = killsCounter + 1 |
|
553 |
countBodies() |
|
554 |
end |
|
555 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
556 |
PlaySound(sndWhack) |
|
557 |
updateScore() |
|
558 |
end |
|
559 |
end |
|
560 |
end |
|
561 |
||
562 |
function onGearAdd(gear) |
|
563 |
||
564 |
-- Catch hedgehogs for the tracker |
|
565 |
if GetGearType(gear) == gtHedgehog then |
|
566 |
trackGear(gear) |
|
567 |
hhs[numhhs] = gear |
|
568 |
numhhs = numhhs + 1 |
|
569 |
SetEffect(gear, heResurrectable, 1) |
|
570 |
end |
|
571 |
end |
|
572 |
||
573 |
function checkEmptyTeam (teamName) |
|
574 |
for i=0 , #hhs do |
|
575 |
if hhs[i]~=nil then |
|
576 |
if teamName == GetHogTeamName(hhs[i]) then |
|
577 |
return false |
|
578 |
end |
|
579 |
end |
|
580 |
end |
|
581 |
return true |
|
582 |
end |
|
583 |
||
584 |
function onGearDelete(gear) |
|
585 |
-- Remove hogs that are gone |
|
586 |
if GetGearType(gear) == gtHedgehog then |
|
587 |
numhhs = numhhs - 1 |
|
588 |
||
589 |
local found |
|
590 |
for i=0, #hhs do |
|
591 |
if hhs[i] == gear then |
|
592 |
found = i |
|
593 |
break |
|
594 |
end |
|
595 |
end |
|
596 |
for i = found, #hhs - 1 do |
|
597 |
hhs[i] = hhs[i + 1] |
|
598 |
end |
|
599 |
hhs[#hhs] = nil |
|
600 |
||
601 |
local t_name = GetHogTeamName(gear) |
|
602 |
if checkEmptyTeam(t_name) then |
|
603 |
for i = 0, TeamsCount - 1 do |
|
604 |
if teams[i] == t_name then |
|
605 |
found = i |
|
606 |
break |
|
607 |
end |
|
608 |
end |
|
609 |
for i = found, TeamsCount - 2 do |
|
610 |
teams[i] = teams[i + 1] |
|
611 |
end |
|
612 |
teams[TeamsCount - 1] = nil |
|
613 |
TeamsCount = TeamsCount - 1 |
|
614 |
end |
|
615 |
AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
|
616 |
trackDeletion(gear) |
|
617 |
end |
|
618 |
end |
|
619 |
||
620 |
--[[ |
|
621 |
S T A R R I N G |
|
622 |
||
623 |
prof - Coding, implementing and evangelism |
|
624 |
vos - Initial idea and script improvements |
|
625 |
--]] |