author | Wuzzy <Wuzzy2@mail.ru> |
Mon, 12 Feb 2018 20:47:45 +0100 | |
changeset 12992 | ba99ecc53cf0 |
parent 12945 | 39b7b3ed619e |
child 12993 | a15413d896c3 |
permissions | -rw-r--r-- |
11015 | 1 |
--[[ ___ ___ |
2 |
( ) ( ) |
|
3 |
___ .-. .-. ___ ___ | |_ .---. ___ .-. | |_ |
|
4 |
( ) ' ( )( ( __) / .-, ( ) ( __) |
|
5 |
| .-. .-. | | | | | | (__) ; || .-. .| | |
|
6 |
| | | | | | | | | | | ___ .'` || | | || | ___ |
|
7 |
| | | | | | | | | | |( / .'| || | | || |( ) |
|
8 |
| | | | | | | | | | | | | / | || | | || | | | |
|
9 |
| | | | | | | ; ' | ' | ; | ; || | | || ' | | |
|
10 |
| | | | | ' `-' / ' `-' ' `-' || | | |' `-' ; |
|
11 |
(___)(___)(___'.__.' `.__.`.__.'_(___)(___)`.__. |
|
12 |
||
13 |
||
14 |
---- Recommended settings: |
|
15 |
---- * one hedgehog per team |
|
16 |
---- * 'Small' one-island map |
|
17 |
||
18 |
--]] |
|
19 |
||
20 |
HedgewarsScriptLoad("/Scripts/Locale.lua") |
|
21 |
HedgewarsScriptLoad("/Scripts/Tracker.lua") |
|
22 |
HedgewarsScriptLoad("/Scripts/Params.lua") |
|
23 |
||
24 |
--[[ |
|
25 |
MUTANT SCRIPT |
|
26 |
||
27 |
To Do: -Clean-up this fucking piece of code |
|
28 |
-Debug |
|
29 |
-Find a girlfriend |
|
30 |
-Fix Sheepluva's hat +[p] |
|
31 |
-Cookies |
|
32 |
-----------------------]] |
|
33 |
||
34 |
local hhs = {} |
|
35 |
local numhhs = 0 |
|
36 |
local meh = false |
|
37 |
||
38 |
local gameOver=false |
|
39 |
||
40 |
local mutant = nil |
|
41 |
local mutant_base_health = 200 |
|
42 |
local mutant_base_disease = 25 |
|
43 |
local disease_timer = 2000 |
|
44 |
||
45 |
local kill_reward = nil |
|
46 |
local mt_hurt=false |
|
47 |
||
48 |
local killsCounter = 0 |
|
49 |
||
50 |
local team_fire_punishment = 3 |
|
51 |
local mutant_kill_reward = 2 |
|
52 |
||
53 |
local hh_weapons = { amBazooka, amGrenade, amShotgun, amMine} |
|
54 |
||
55 |
local mt_weapons = {amWatermelon, amHellishBomb, amBallgun, amRCPlane, amTeleport} |
|
56 |
||
57 |
local disease=0 |
|
58 |
local timer=0 |
|
59 |
||
60 |
local winScore = 15 |
|
61 |
local hogsLimit = 1 |
|
62 |
||
63 |
local teams = {} |
|
64 |
||
65 |
local circles = {} |
|
66 |
local circleFrame = -1 |
|
67 |
||
11914 | 68 |
-- Variables for custom achievements |
69 |
||
70 |
-- Most kills in 1 turn |
|
71 |
local recordKills = 0 |
|
72 |
local recordKillsHogName = nil |
|
73 |
local recordKillsTeamName = nil |
|
74 |
||
75 |
-- Most suicides |
|
76 |
local recordSuicides = 0 |
|
77 |
local recordSuicidesHogName = nil |
|
78 |
local recordSuicidesTeamName = nil |
|
79 |
||
80 |
-- Most skips |
|
81 |
local recordSkips = 0 |
|
82 |
local recordSkipsHogName = nil |
|
83 |
local recordSkipsTeamName = nil |
|
11015 | 84 |
|
11914 | 85 |
-- Most crates collected |
86 |
local recordCrates = 0 |
|
87 |
local recordCratesHogName = nil |
|
88 |
local recordCratesTeamName = nil |
|
89 |
||
90 |
-- Most deaths |
|
91 |
local recordDeaths = 0 |
|
92 |
local recordDeathsHogName = nil |
|
93 |
local recordDeathsTeamName = nil |
|
94 |
||
95 |
-- Total killed hedgehogs |
|
96 |
local totalKills = 0 |
|
97 |
||
98 |
-- Total damage |
|
99 |
local totalDamage = 0 |
|
100 |
||
101 |
function rules() |
|
102 |
||
103 |
local ruleSet = loc("Rules: ") .. "|" .. |
|
104 |
loc("Hedgehogs will be revived after their death.") .. "|" .. |
|
105 |
string.format(loc("Mines explode after %d s."), div(MinesTime, 1000)) .. "|" .. |
|
106 |
" |".. |
|
107 |
loc("The first hedgehog to kill someone becomes the Mutant.") .. "|" .. |
|
11015 | 108 |
loc("The Mutant has super-weapons and a lot of health.") .. "|" .. |
109 |
loc("The Mutant loses health quickly if he doesn't keep scoring kills.") .. "|" .. |
|
110 |
" |" .. |
|
11914 | 111 |
loc("Score points by killing other hedgehogs (see below).") .. "|" .. |
112 |
loc("The hedgehog with least points (or most deaths) becomes the Bottom Feeder.") .. "|" .. |
|
113 |
string.format(loc("The first hedgehog which scores %d or more wins the game."), winScore) .. "|" .. |
|
114 |
" |" .. |
|
115 |
loc("Scoring: ") .. "|" .. |
|
116 |
loc("+2 for becoming the Mutant") .. "|" .. |
|
117 |
loc("+1 to the Mutant for killing anyone") .. "|" .. |
|
118 |
loc("+1 to the Bottom Feeder for killing anyone") .. "|" .. |
|
11015 | 119 |
loc("-1 to anyone for a suicide") .. "|" .. |
120 |
loc("Other kills don't give you points.") |
|
121 |
||
11914 | 122 |
return ruleSet |
123 |
||
124 |
end |
|
125 |
||
126 |
function showStartingInfo() |
|
127 |
||
128 |
ShowMission(loc("Mutant"), loc("A Hedgewars tag game"), rules(), 1, 5000) |
|
11015 | 129 |
|
130 |
end |
|
131 |
||
132 |
function onGameInit() |
|
133 |
TurnTime = 20000 |
|
134 |
WaterRise = 0 |
|
11914 | 135 |
HealthDecrease = 0 |
11015 | 136 |
EnableGameFlags(gfResetWeps, gfPerHogAmmo) |
137 |
HealthCaseProb=0 |
|
138 |
HealthCaseAmount=0 |
|
139 |
MinesTime=1000 |
|
140 |
CaseFreq = 2 |
|
141 |
end |
|
142 |
||
143 |
||
144 |
function limitHogs(gear) |
|
145 |
cnthhs = cnthhs + 1 |
|
146 |
if cnthhs > 1 then |
|
147 |
hogLimitHit = true |
|
148 |
SetEffect(gear, heResurrectable, false) |
|
149 |
SetGearPosition(gear, -100,LAND_HEIGHT) |
|
150 |
end |
|
151 |
end |
|
152 |
||
153 |
function onGameStart() |
|
11914 | 154 |
SendHealthStatsOff() |
12340
8f693d25be2f
Show traditional winning animation in Mutant again
Wuzzy <almikes@aol.com>
parents:
12293
diff
changeset
|
155 |
SendRankingStatsOff() |
8f693d25be2f
Show traditional winning animation in Mutant again
Wuzzy <almikes@aol.com>
parents:
12293
diff
changeset
|
156 |
SendAchievementsStatsOff() |
11015 | 157 |
trackTeams() |
158 |
teamScan() |
|
159 |
runOnHogs(saveStuff) |
|
160 |
||
161 |
hogLimitHit = false |
|
162 |
for i=0 , TeamsCount - 1 do |
|
163 |
cnthhs = 0 |
|
164 |
runOnHogsInTeam(limitHogs, teams[i]) |
|
165 |
end |
|
166 |
if hogLimitHit then |
|
11914 | 167 |
AddCaption(loc("Only one hog per team allowed! Excess hogs will be removed"), 0xFFFFFFFF, capgrpGameState) |
11015 | 168 |
end |
169 |
showStartingInfo() |
|
170 |
end |
|
171 |
||
172 |
||
173 |
||
174 |
function giveWeapons(gear) |
|
175 |
if gear == mutant then |
|
176 |
AddAmmo(gear, amRope) |
|
177 |
for i=1, #mt_weapons do |
|
178 |
AddAmmo(gear, mt_weapons[i]) |
|
179 |
end |
|
180 |
||
181 |
else |
|
182 |
for i=1, #hh_weapons do |
|
183 |
AddAmmo(gear,hh_weapons[i]) |
|
184 |
end |
|
185 |
end |
|
186 |
end |
|
187 |
||
188 |
function onAmmoStoreInit() |
|
189 |
||
190 |
SetAmmo(amSkip, 9, 0, 0, 0) |
|
191 |
SetAmmo(amRope,0,1,0,5) |
|
192 |
SetAmmo(amSnowball,0,1,0,1) |
|
193 |
||
194 |
for i=1, #hh_weapons do |
|
195 |
SetAmmo(hh_weapons[i], 0, 0, 0, 1) |
|
196 |
end |
|
197 |
||
198 |
for i=1, #mt_weapons do |
|
199 |
SetAmmo(mt_weapons[i], 0, 3, 0, 1) |
|
200 |
end |
|
201 |
||
202 |
end |
|
203 |
||
204 |
function drawCircles() |
|
205 |
for i = 0, #hhs do |
|
206 |
if circles[hhs[i]] ~= nil then |
|
207 |
DeleteVisualGear(circles[hhs[i]]) |
|
208 |
circles[hhs[i]] = nil |
|
209 |
end |
|
210 |
||
211 |
if hhs[i] ~= CurrentHedgehog then |
|
212 |
if mutant == nil then |
|
213 |
circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false) |
|
214 |
SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 5, 0xff000080) |
|
215 |
elseif CurrentHedgehog == mutant then |
|
216 |
circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false) |
|
217 |
SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 3, 0xaa000070) |
|
218 |
elseif getGearValue(CurrentHedgehog, "Feeder") and hhs[i] ~= mutant then |
|
219 |
circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false) |
|
220 |
SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 3, 0xaa000070) |
|
221 |
elseif hhs[i] == mutant then |
|
222 |
circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false) |
|
223 |
SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 5, 0xff000080) |
|
224 |
end |
|
225 |
end |
|
226 |
end |
|
227 |
circleFrame = 0 |
|
228 |
end |
|
229 |
||
230 |
function onNewTurn() |
|
231 |
||
232 |
trackTeams() |
|
233 |
killsCounter = 0 |
|
234 |
||
235 |
if mutant == nil then |
|
11914 | 236 |
AddCaption( loc("First killer will mutate"), 0xFFFFFFFF, capgrpGameState ) |
11015 | 237 |
end |
238 |
||
239 |
checkScore() |
|
11914 | 240 |
|
241 |
for i=0, TeamsCount-1 do |
|
242 |
SendStat(siClanHealth, getTeamValue(teams[i], "Score"), teams[i]) |
|
243 |
end |
|
244 |
||
11015 | 245 |
giveWeapons(CurrentHedgehog) |
246 |
drawCircles() |
|
247 |
setAIHints() |
|
248 |
kill_reward= numhhs*10 |
|
249 |
||
250 |
if CurrentHedgehog == mutant then |
|
251 |
mt_hurt=true |
|
252 |
disease= mutant_base_disease - numhhs |
|
253 |
else |
|
254 |
mt_hurt=false |
|
255 |
end |
|
256 |
||
257 |
setGearValue(CurrentHedgehog, "Alive", true) |
|
258 |
||
259 |
end |
|
260 |
||
261 |
function countBodies() |
|
262 |
if killsCounter == 2 then |
|
11914 | 263 |
AddCaption(loc("Double kill!"), 0xFFFFFFFF, capgrpGameState ) |
11015 | 264 |
elseif killsCounter == 3 then |
11914 | 265 |
AddCaption(loc("Mega kill!"), 0xFFFFFFFF, capgrpGameState ) |
11015 | 266 |
PlaySound(sndRegret) |
267 |
elseif killsCounter == 4 then |
|
11914 | 268 |
AddCaption(loc("Ultra kill!"), 0xFFFFFFFF, capgrpGameState ) |
11015 | 269 |
elseif killsCounter == 5 then |
11914 | 270 |
AddCaption(loc("Monster kill!"), 0xFFFFFFFF, capgrpGameState ) |
11015 | 271 |
PlaySound(sndIllGetYou) |
272 |
elseif killsCounter == 6 then |
|
11914 | 273 |
AddCaption(loc("Ludicrous kill!"), 0xFFFFFFFF, capgrpGameState ) |
11015 | 274 |
PlaySound(sndNutter) |
275 |
elseif killsCounter == 7 then |
|
11914 | 276 |
AddCaption(loc("Holy shit!"), 0xFFFFFFFF, capgrpGameState ) |
11015 | 277 |
PlaySound(sndLaugh) |
278 |
elseif killsCounter > 8 then |
|
11914 | 279 |
AddCaption(loc("Insanity!"), 0xFFFFFFFF, capgrpGameState ) |
280 |
end |
|
281 |
||
282 |
if killsCounter > recordKills then |
|
283 |
recordKills = killsCounter |
|
284 |
recordKillsHogName = getGearValue(CurrentHedgehog, "Name") |
|
285 |
recordKillsTeamName = GetHogTeamName(CurrentHedgehog) |
|
11015 | 286 |
end |
287 |
end |
|
288 |
||
289 |
function onGameTick() |
|
290 |
||
291 |
if circleFrame > -1 then |
|
292 |
for i = 0, #hhs do |
|
293 |
if circles[hhs[i]] ~= nil and hhs[i]~= nil then |
|
294 |
hhx, hhy = GetGearPosition(hhs[i]) |
|
295 |
X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint = GetVisualGearValues(circles[hhs[i]]) |
|
296 |
SetVisualGearValues(circles[hhs[i]], hhx + 1, hhy - 3, 0, 0, 0, 0, 0, 40 - (circleFrame % 25), Timer, Tint) |
|
297 |
end |
|
298 |
end |
|
299 |
||
300 |
circleFrame = circleFrame + 0.06 |
|
301 |
||
302 |
if circleFrame >= 25 then |
|
303 |
for i = 0, #hhs do |
|
304 |
if circles[hhs[i]] ~= nil then |
|
305 |
DeleteVisualGear(circles[hhs[i]]) |
|
306 |
circles[hhs[i]] = nil |
|
307 |
end |
|
308 |
end |
|
309 |
end |
|
310 |
end |
|
311 |
||
312 |
if TurnTimeLeft==0 and mt_hurt then |
|
313 |
mt_hurt = false |
|
314 |
end |
|
315 |
||
316 |
if mt_hurt and mutant~=nil then |
|
317 |
timer = timer + 1 |
|
318 |
if timer > disease_timer then |
|
319 |
timer = 0 |
|
320 |
SetHealth(mutant, GetHealth(mutant)-disease ) |
|
321 |
AddVisualGear(GetX(mutant), GetY(mutant)-5, vgtHealthTag, disease, true) |
|
322 |
if GetHealth(mutant)<=0 then |
|
323 |
SetHealth(mutant,0) |
|
324 |
mt_hurt= false |
|
325 |
setGearValue(mutant,"SelfDestruct",true) |
|
12346
c73521104fac
Mutant: Fix “Boring” taunt being played when becoming the mutant
Wuzzy <almikes@aol.com>
parents:
12340
diff
changeset
|
326 |
EndTurn() |
11015 | 327 |
end |
328 |
end |
|
329 |
end |
|
330 |
||
331 |
end |
|
332 |
||
333 |
function saveStuff(gear) |
|
334 |
setGearValue(gear,"Name",GetHogName(gear)) |
|
335 |
setGearValue(gear,"Hat",GetHogHat(gear)) |
|
336 |
end |
|
337 |
||
338 |
function armageddon(gear) |
|
339 |
SetState(gear, gstLoser) |
|
340 |
SetEffect(gear, heResurrectable, false) |
|
341 |
SetHealth(gear, 0) |
|
342 |
end |
|
343 |
||
344 |
function updateScore() |
|
345 |
||
346 |
local showScore = "" |
|
347 |
||
348 |
for i=0, TeamsCount-1 do |
|
349 |
if teams[i]~= nil then |
|
350 |
||
351 |
local curr_score = getTeamValue(teams[i], "Score") |
|
11914 | 352 |
showScore = showScore .. string.format(loc("%s: %d (deaths: %d)"), teams[i], curr_score, getTeamValue(teams[i], "DeadHogs")) .. "|" |
11015 | 353 |
|
354 |
end |
|
355 |
end |
|
356 |
||
11914 | 357 |
ShowMission(loc("Mutant"), |
358 |
loc("Scores"), |
|
359 |
showScore, 4, 1) |
|
11015 | 360 |
|
361 |
HideMission() |
|
362 |
||
363 |
end |
|
364 |
||
365 |
function checkScore() |
|
366 |
local showScore = "" |
|
367 |
local lowest_score_team = nil |
|
368 |
local min_score=nil |
|
369 |
local winTeam = nil |
|
370 |
||
371 |
local only_low_score = true |
|
372 |
||
373 |
for i=0, TeamsCount-1 do |
|
374 |
if teams[i]~=nil then |
|
375 |
local curr_score = getTeamValue(teams[i], "Score") |
|
376 |
||
377 |
runOnHogsInTeam(removeFeeder, teams[i]) |
|
378 |
||
11914 | 379 |
showScore = showScore .. string.format(loc("%s: %d (deaths: %d)"), teams[i], curr_score, getTeamValue(teams[i], "DeadHogs")) .. "|" |
11015 | 380 |
|
381 |
if curr_score >= winScore then |
|
382 |
gameOver = true |
|
383 |
winTeam = teams[i] |
|
384 |
end |
|
385 |
||
386 |
if min_score==nil then |
|
387 |
min_score= curr_score |
|
388 |
lowest_score_team = teams[i] |
|
389 |
else |
|
390 |
if curr_score <= min_score then |
|
391 |
if curr_score == min_score then |
|
392 |
if getTeamValue(teams[i], "DeadHogs") == getTeamValue(lowest_score_team, "DeadHogs") then |
|
393 |
only_low_score = false |
|
394 |
else |
|
395 |
if getTeamValue(teams[i], "DeadHogs") > getTeamValue(lowest_score_team, "DeadHogs") then |
|
396 |
lowest_score_team = teams[i] |
|
397 |
end |
|
398 |
only_low_score = true |
|
399 |
end |
|
400 |
||
401 |
else |
|
402 |
min_score= curr_score |
|
403 |
lowest_score_team = teams[i] |
|
404 |
only_low_score = true |
|
405 |
end |
|
406 |
end |
|
407 |
end |
|
408 |
end |
|
409 |
end |
|
410 |
||
411 |
if gameOver then |
|
11914 | 412 |
SendStat(siGraphTitle, loc("Score graph")) |
413 |
||
12346
c73521104fac
Mutant: Fix “Boring” taunt being played when becoming the mutant
Wuzzy <almikes@aol.com>
parents:
12340
diff
changeset
|
414 |
EndTurn(true) |
11914 | 415 |
|
416 |
teamsSorted = {} |
|
417 |
||
418 |
for i=0, TeamsCount-1 do |
|
11015 | 419 |
if teams[i]~=winTeam then |
420 |
runOnHogsInTeam(armageddon, teams[i]) |
|
421 |
end |
|
11914 | 422 |
teamsSorted[i+1] = teams[i] |
11015 | 423 |
end |
424 |
||
11914 | 425 |
-- Achievements stuff |
426 |
local achievements = 0 |
|
427 |
--- Most kills per turn |
|
428 |
if recordKills >= 3 then |
|
429 |
SendStat(siMaxStepKills, string.format("%d %s (%s)", recordKills, recordKillsHogName, recordKillsTeamName)) |
|
430 |
achievements = achievements + 1 |
|
431 |
end |
|
432 |
--- Most crates collected |
|
433 |
if recordCrates >= 5 then |
|
434 |
SendStat(siCustomAchievement, string.format(loc("%s (%s) was the greediest hedgehog and collected %d crates."), recordCratesHogName, recordCratesTeamName, recordCrates)) |
|
435 |
achievements = achievements + 1 |
|
436 |
end |
|
437 |
--- Most suicides |
|
438 |
if recordSuicides >= 5 then |
|
439 |
SendStat(siCustomAchievement, string.format(loc("%s (%s) hate life and suicided %d times."), recordSuicidesHogName, recordSuicidesTeamName, recordSuicides)) |
|
440 |
achievements = achievements + 1 |
|
441 |
end |
|
442 |
--- Most deaths |
|
443 |
if recordDeaths >= 5 then |
|
444 |
SendStat(siCustomAchievement, string.format(loc("Poor %s (%s) died %d times."), recordDeathsHogName, recordDeathsTeamName, recordDeaths)) |
|
445 |
achievements = achievements + 1 |
|
446 |
end |
|
447 |
--- Most skips |
|
448 |
if recordSkips >= 3 then |
|
449 |
SendStat(siMaxTurnSkips, string.format("%d %s (%s)", recordSkips, recordSkipsHogName, recordSkipsTeamName)) |
|
450 |
achievements = achievements + 1 |
|
451 |
end |
|
452 |
--- Total damage |
|
453 |
if totalDamage >= 900 then |
|
454 |
SendStat(siCustomAchievement, string.format(loc("%d damage was dealt in this game."), totalDamage)) |
|
455 |
achievements = achievements + 1 |
|
456 |
end |
|
457 |
--- Total kills |
|
458 |
if totalKills >= 20 or achievements <= 0 then |
|
459 |
SendStat(siKilledHHs, tostring(totalKills)) |
|
460 |
achievements = achievements + 1 |
|
461 |
end |
|
462 |
||
463 |
-- Score and stats stuff |
|
464 |
table.sort(teamsSorted, function(team1, team2) return getTeamValue(team1, "Score") < getTeamValue(team2, "Score") end) |
|
465 |
for i=TeamsCount, 1, -1 do |
|
466 |
SendStat(siPointType, loc("point(s)")) |
|
467 |
SendStat(siPlayerKills, getTeamValue(teamsSorted[i], "Score"), teamsSorted[i]) |
|
468 |
end |
|
469 |
||
470 |
ShowMission( loc("Mutant"), |
|
471 |
loc("Final result"), |
|
472 |
string.format(loc("Winner: %s"), winTeam) .. "| |" .. loc("Scores:") .. " |" .. |
|
473 |
showScore, 0, 15000) |
|
11015 | 474 |
else |
475 |
||
476 |
if only_low_score then |
|
477 |
runOnHogsInTeam(setFeeder, lowest_score_team) |
|
478 |
end |
|
479 |
||
480 |
if meh == false then |
|
481 |
meh = true |
|
482 |
else |
|
11914 | 483 |
ShowMission( loc("Mutant"), |
484 |
loc("Scores"), |
|
485 |
showScore, 4, 1) |
|
486 |
HideMission() |
|
11015 | 487 |
end |
488 |
||
489 |
end |
|
490 |
end |
|
491 |
||
492 |
function backToNormal(gear) |
|
493 |
SetHogName(gear, getGearValue(gear,"Name")) |
|
494 |
SetHogHat(gear, 'NoHat') |
|
495 |
SetHogHat(gear, getGearValue(gear,"Hat")) |
|
496 |
setGearValue(mutant,"SelfDestruct",false) |
|
497 |
mt_hurt=false |
|
498 |
mutant=nil |
|
499 |
end |
|
500 |
||
501 |
function setAIHints() |
|
502 |
for i = 0, #hhs do |
|
503 |
if mutant == nil or hhs[i] == mutant or CurrentHedgehog == mutant or getGearValue(CurrentHedgehog, "Feeder") then |
|
504 |
SetGearAIHints(hhs[i], aihUsual) |
|
505 |
else |
|
506 |
SetGearAIHints(hhs[i], aihDoesntMatter) |
|
507 |
end |
|
508 |
end |
|
509 |
end |
|
510 |
||
511 |
function removeFeeder(gear) |
|
512 |
if gear~=nil then |
|
513 |
setGearValue(gear,"Feeder",false) |
|
514 |
if gear~= mutant then |
|
515 |
SetHogName(gear, getGearValue(gear,"Name") ) |
|
516 |
SetHogHat(gear, 'NoHat') |
|
517 |
SetHogHat(gear, getGearValue(gear,"Hat")) |
|
518 |
end |
|
519 |
end |
|
520 |
end |
|
521 |
||
522 |
function setFeeder(gear) |
|
523 |
if gear~= mutant and gear~= nil then |
|
11914 | 524 |
SetHogName(gear, loc("Bottom Feeder")) |
11015 | 525 |
SetHogHat(gear, 'poke_slowpoke') |
526 |
setGearValue(gear,"Feeder", true) |
|
527 |
end |
|
528 |
end |
|
529 |
||
530 |
function setMutantStuff(gear) |
|
531 |
mutant = gear |
|
532 |
||
11914 | 533 |
SetHogName(gear, loc("Mutant")) |
11015 | 534 |
SetHogHat(gear,'WhySoSerious') |
535 |
SetHealth(gear, ( mutant_base_health + numhhs*25) ) |
|
536 |
SetEffect(gear, hePoisoned, 1) |
|
537 |
setGearValue(mutant,"SelfDestruct",false) |
|
538 |
setGearValue(gear, "Feeder", false) |
|
539 |
||
11914 | 540 |
AddCaption(string.format(loc("%s has mutated! +2 points"), getGearValue(gear, "Name")), GetClanColor(GetHogClan(gear)), capgrpMessage) |
11015 | 541 |
|
12435
c461a224ec09
Mutant: Fix turn skip of next hog after mutating when TurnTimeLeft = 0
Wuzzy <almikes@aol.com>
parents:
12346
diff
changeset
|
542 |
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
|
543 |
EndTurn(true) |
c461a224ec09
Mutant: Fix turn skip of next hog after mutating when TurnTimeLeft = 0
Wuzzy <almikes@aol.com>
parents:
12346
diff
changeset
|
544 |
end |
11015 | 545 |
|
546 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
547 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
548 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
549 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
550 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
551 |
PlaySound(sndSuddenDeath) |
|
552 |
end |
|
553 |
||
554 |
function teamScan() |
|
555 |
||
556 |
for i=0, TeamsCount-1 do --nil filling |
|
557 |
teams[i]=nil |
|
558 |
end |
|
559 |
||
560 |
for i=0, #hhs do |
|
561 |
for j=0, TeamsCount-1 do |
|
562 |
if teams[j] ==nil and hhs[i]~=nil then |
|
563 |
teams[j] = GetHogTeamName(hhs[i]) |
|
11914 | 564 |
setTeamValue(teams[j], "Score",0) |
565 |
setTeamValue(teams[j], "Suicides",0) |
|
566 |
setTeamValue(teams[j], "Skips",0) |
|
567 |
setTeamValue(teams[j], "Crates",0) |
|
11015 | 568 |
setTeamValue(teams[j], "DeadHogs",0) |
569 |
break |
|
570 |
end |
|
571 |
||
572 |
if teams[j] == GetHogTeamName(hhs[i]) then |
|
573 |
break |
|
574 |
end |
|
575 |
end |
|
576 |
end |
|
577 |
||
578 |
---***--- |
|
579 |
end |
|
580 |
||
581 |
function set_Mutant_and_Score(gear) |
|
582 |
||
583 |
local curr_team = GetHogTeamName(CurrentHedgehog) |
|
584 |
||
585 |
if gear == CurrentHedgehog then |
|
586 |
if CurrentHedgehog == mutant then |
|
587 |
PlaySound(sndHomerun) |
|
588 |
if getGearValue(gear, "SelfDestruct")==false then |
|
589 |
decreaseTeamValue(curr_team,"Score") |
|
590 |
end |
|
591 |
backToNormal(gear) |
|
592 |
else |
|
593 |
decreaseTeamValue(curr_team,"Score") |
|
594 |
end |
|
595 |
||
596 |
else |
|
597 |
if gear == mutant then |
|
598 |
backToNormal(mutant) |
|
599 |
if curr_team ~=GetHogTeamName(gear) then |
|
600 |
if getGearValue(CurrentHedgehog, "Alive") then |
|
601 |
setMutantStuff(CurrentHedgehog) |
|
602 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") + mutant_kill_reward)) |
|
603 |
end |
|
604 |
else |
|
605 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment)) |
|
11914 | 606 |
increaseTeamValue(curr_team,"Suicides") |
607 |
if(getTeamValue(curr_team, "Suicides") > recordSuicides) then |
|
608 |
recordSuicides = getTeamValue(curr_team, "Suicides") |
|
609 |
recordSuicidesHogName = getGearValue(CurrentHedgehog, "Name") |
|
610 |
recordSuicidesTeamName = curr_team |
|
611 |
end |
|
612 |
AddCaption(loc("-1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage) |
|
11015 | 613 |
end |
614 |
else |
|
615 |
if mutant==nil then |
|
616 |
if curr_team ~=GetHogTeamName(gear) then |
|
617 |
if getGearValue(CurrentHedgehog, "Alive") then |
|
618 |
setMutantStuff(CurrentHedgehog) |
|
619 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") + mutant_kill_reward)) |
|
620 |
else |
|
621 |
increaseTeamValue(curr_team,"Score") |
|
622 |
end |
|
623 |
else |
|
624 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment)) |
|
11914 | 625 |
increaseTeamValue(curr_team,"Suicides") |
626 |
if(getTeamValue(curr_team, "Suicides") > recordSuicides) then |
|
627 |
recordSuicides = getTeamValue(curr_team, "Suicides") |
|
628 |
recordSuicidesHogName = getGearValue(CurrentHedgehog, "Name") |
|
629 |
recordSuicidesTeamName = curr_team |
|
630 |
end |
|
631 |
AddCaption(loc("-1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage) |
|
11015 | 632 |
end |
633 |
else |
|
634 |
if curr_team ~=GetHogTeamName(gear) then |
|
635 |
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
|
636 |
HealHog(CurrentHedgehog, kill_reward) |
12293
a5a7d0c6d3f3
Fix incorrect Mutant score message color
Wuzzy <almikes@aol.com>
parents:
11914
diff
changeset
|
637 |
AddCaption(loc("+1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage) |
11015 | 638 |
increaseTeamValue(curr_team,"Score") |
639 |
end |
|
640 |
if getGearValue(CurrentHedgehog,"Feeder") then |
|
641 |
increaseTeamValue(curr_team,"Score") |
|
11914 | 642 |
AddCaption(loc("+1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage) |
11015 | 643 |
end |
644 |
else |
|
645 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment)) |
|
11914 | 646 |
AddCaption(loc("+1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage) |
11015 | 647 |
end |
648 |
end |
|
649 |
end |
|
650 |
end |
|
651 |
end |
|
652 |
||
653 |
function onGearResurrect(gear) |
|
654 |
if not gameOver then |
|
655 |
if GetGearType(gear) == gtHedgehog then |
|
656 |
||
657 |
increaseTeamValue(GetHogTeamName(gear), "DeadHogs") |
|
11914 | 658 |
totalKills = totalKills + 1 |
659 |
if(getTeamValue(GetHogTeamName(gear), "DeadHogs") > recordDeaths) then |
|
660 |
recordDeaths = getTeamValue(GetHogTeamName(gear), "DeadHogs") |
|
661 |
recordDeathsHogName = getGearValue(gear, "Name") |
|
662 |
recordDeathsTeamName = GetHogTeamName(gear) |
|
663 |
end |
|
11015 | 664 |
|
665 |
if gear==CurrentHedgehog then |
|
666 |
setGearValue(CurrentHedgehog, "Alive", false) |
|
667 |
end |
|
668 |
set_Mutant_and_Score(gear) |
|
669 |
if gear~=CurrentHedgehog then |
|
670 |
killsCounter = killsCounter + 1 |
|
671 |
countBodies() |
|
672 |
end |
|
673 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
674 |
PlaySound(sndWhack) |
|
675 |
updateScore() |
|
676 |
end |
|
677 |
end |
|
678 |
end |
|
679 |
||
11914 | 680 |
function onGearDamage(gear, damage) |
681 |
if not gameOver and GetGearType(gear) == gtHedgehog then |
|
682 |
totalDamage = totalDamage + damage |
|
683 |
end |
|
684 |
end |
|
685 |
||
686 |
function onHogAttack(ammoType) |
|
687 |
-- Record skips for achievement |
|
688 |
if ammoType == amSkip then |
|
689 |
local team = GetHogTeamName(CurrentHedgehog) |
|
690 |
increaseTeamValue(team, "Skips") |
|
691 |
if(getTeamValue(team, "Skips") > recordSkips) then |
|
692 |
recordSkips = getTeamValue(team, "Skips") |
|
693 |
recordSkipsHogName = getGearValue(CurrentHedgehog, "Name") |
|
694 |
recordSkipsTeamName = team |
|
695 |
end |
|
696 |
end |
|
697 |
end |
|
698 |
||
11015 | 699 |
function onGearAdd(gear) |
700 |
||
701 |
-- Catch hedgehogs for the tracker |
|
702 |
if GetGearType(gear) == gtHedgehog then |
|
703 |
trackGear(gear) |
|
704 |
hhs[numhhs] = gear |
|
705 |
numhhs = numhhs + 1 |
|
706 |
SetEffect(gear, heResurrectable, 1) |
|
707 |
end |
|
708 |
end |
|
709 |
||
710 |
function checkEmptyTeam (teamName) |
|
711 |
for i=0 , #hhs do |
|
712 |
if hhs[i]~=nil then |
|
713 |
if teamName == GetHogTeamName(hhs[i]) then |
|
714 |
return false |
|
715 |
end |
|
716 |
end |
|
717 |
end |
|
718 |
return true |
|
719 |
end |
|
720 |
||
721 |
function onGearDelete(gear) |
|
722 |
-- Remove hogs that are gone |
|
723 |
if GetGearType(gear) == gtHedgehog then |
|
724 |
numhhs = numhhs - 1 |
|
725 |
||
726 |
local found |
|
727 |
for i=0, #hhs do |
|
728 |
if hhs[i] == gear then |
|
729 |
found = i |
|
730 |
break |
|
731 |
end |
|
732 |
end |
|
733 |
for i = found, #hhs - 1 do |
|
734 |
hhs[i] = hhs[i + 1] |
|
735 |
end |
|
736 |
hhs[#hhs] = nil |
|
737 |
||
738 |
local t_name = GetHogTeamName(gear) |
|
739 |
if checkEmptyTeam(t_name) then |
|
740 |
for i = 0, TeamsCount - 1 do |
|
741 |
if teams[i] == t_name then |
|
742 |
found = i |
|
743 |
break |
|
744 |
end |
|
745 |
end |
|
746 |
for i = found, TeamsCount - 2 do |
|
747 |
teams[i] = teams[i + 1] |
|
748 |
end |
|
749 |
teams[TeamsCount - 1] = nil |
|
750 |
TeamsCount = TeamsCount - 1 |
|
751 |
end |
|
752 |
AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
|
753 |
trackDeletion(gear) |
|
11914 | 754 |
elseif GetGearType(gear) == gtCase then |
755 |
-- Check if a crate has been collected |
|
756 |
if band(GetGearMessage(gear), gmDestroy) ~= 0 and CurrentHedgehog ~= nil then |
|
757 |
-- Update crate collection achievement |
|
758 |
increaseTeamValue(GetHogTeamName(CurrentHedgehog), "Crates") |
|
759 |
if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Crates") > recordCrates) then |
|
760 |
recordCrates = getTeamValue(GetHogTeamName(CurrentHedgehog), "Crates") |
|
761 |
recordCratesHogName = getGearValue(CurrentHedgehog, "Name") |
|
762 |
recordCratesTeamName = GetHogTeamName(CurrentHedgehog) |
|
763 |
end |
|
764 |
end |
|
11015 | 765 |
end |
766 |
end |
|
767 |
||
768 |
function onParameters() |
|
769 |
parseParams() |
|
770 |
winScore = tonumber(params["winscore"]) or winScore |
|
771 |
end |
|
772 |
||
773 |
--[[ |
|
774 |
S T A R R I N G |
|
775 |
prof - Coding, implementing and evangelism |
|
776 |
vos - Initial idea and script improvements |
|
777 |
mikade - Moving the `how to play` into the game so that people know `how to play`, and whitespace :D |
|
778 |
--]] |