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