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