author | Wuzzy <Wuzzy2@mail.ru> |
Fri, 02 Nov 2018 10:31:08 +0100 | |
changeset 14091 | a5be3ef4bbbe |
parent 13798 | e874bfe563c7 |
child 14285 | 6f3f59266c4c |
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 |
||
13220
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
63 |
local teamsDead = {} |
11015 | 64 |
|
65 |
local circles = {} |
|
66 |
local circleFrame = -1 |
|
67 |
||
11909 | 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 |
|
13220
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
85 |
-- Most crates collected |
11909 | 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 |
||
12988
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
101 |
local mutantHat = "WhySoSerious" |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
102 |
local feederHat = "poke_slowpoke" |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
103 |
|
11909 | 104 |
function rules() |
105 |
||
13105
b14cac8ac56c
Slightly simplify Mutant mission panel
Wuzzy <Wuzzy2@mail.ru>
parents:
13036
diff
changeset
|
106 |
local ruleSet = loc("Hedgehogs will be revived after their death.") .. "|" .. |
11909 | 107 |
string.format(loc("Mines explode after %d s."), div(MinesTime, 1000)) .. "|" .. |
108 |
loc("The first hedgehog to kill someone becomes the Mutant.") .. "|" .. |
|
13105
b14cac8ac56c
Slightly simplify Mutant mission panel
Wuzzy <Wuzzy2@mail.ru>
parents:
13036
diff
changeset
|
109 |
loc("The Mutant has super weapons and a lot of health.") .. "|" .. |
b14cac8ac56c
Slightly simplify Mutant mission panel
Wuzzy <Wuzzy2@mail.ru>
parents:
13036
diff
changeset
|
110 |
loc("The Mutant loses health quickly, but gains health by killing.") .. "|" .. |
11015 | 111 |
" |" .. |
13105
b14cac8ac56c
Slightly simplify Mutant mission panel
Wuzzy <Wuzzy2@mail.ru>
parents:
13036
diff
changeset
|
112 |
loc("Score points by killing other hedgehogs.") .. "|" .. |
11909 | 113 |
loc("The hedgehog with least points (or most deaths) becomes the Bottom Feeder.") .. "|" .. |
13105
b14cac8ac56c
Slightly simplify Mutant mission panel
Wuzzy <Wuzzy2@mail.ru>
parents:
13036
diff
changeset
|
114 |
loc("The score and deaths are shown next to the team bar.") .. "|" .. |
b14cac8ac56c
Slightly simplify Mutant mission panel
Wuzzy <Wuzzy2@mail.ru>
parents:
13036
diff
changeset
|
115 |
string.format(loc("Goal: Score %d points or more to win!"), winScore) .. "|" .. |
11909 | 116 |
" |" .. |
117 |
loc("Scoring: ") .. "|" .. |
|
118 |
loc("+2 for becoming the Mutant") .. "|" .. |
|
119 |
loc("+1 to the Mutant for killing anyone") .. "|" .. |
|
120 |
loc("+1 to the Bottom Feeder for killing anyone") .. "|" .. |
|
13019
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12988
diff
changeset
|
121 |
loc("-1 to anyone for a suicide") |
11015 | 122 |
|
11909 | 123 |
return ruleSet |
124 |
||
125 |
end |
|
126 |
||
127 |
function showStartingInfo() |
|
128 |
||
129 |
ShowMission(loc("Mutant"), loc("A Hedgewars tag game"), rules(), 1, 5000) |
|
11015 | 130 |
|
131 |
end |
|
132 |
||
133 |
function onGameInit() |
|
134 |
TurnTime = 20000 |
|
135 |
WaterRise = 0 |
|
11909 | 136 |
HealthDecrease = 0 |
11015 | 137 |
EnableGameFlags(gfResetWeps, gfPerHogAmmo) |
138 |
HealthCaseProb=0 |
|
139 |
HealthCaseAmount=0 |
|
140 |
MinesTime=1000 |
|
141 |
CaseFreq = 2 |
|
142 |
end |
|
143 |
||
144 |
||
145 |
function limitHogs(gear) |
|
146 |
cnthhs = cnthhs + 1 |
|
13108 | 147 |
if cnthhs > 1 then |
148 |
hogLimitHit = true |
|
149 |
SetEffect(gear, heResurrectable, 0) |
|
150 |
setGearValue(gear, "excess", true) |
|
151 |
DeleteGear(gear) |
|
152 |
end |
|
11015 | 153 |
end |
154 |
||
155 |
function onGameStart() |
|
13798
e874bfe563c7
Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents:
13685
diff
changeset
|
156 |
if ClansCount >= 2 then |
e874bfe563c7
Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents:
13685
diff
changeset
|
157 |
SendHealthStatsOff() |
e874bfe563c7
Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents:
13685
diff
changeset
|
158 |
SendAchievementsStatsOff() |
e874bfe563c7
Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents:
13685
diff
changeset
|
159 |
end |
12335
8f693d25be2f
Show traditional winning animation in Mutant again
Wuzzy <almikes@aol.com>
parents:
12288
diff
changeset
|
160 |
SendRankingStatsOff() |
11015 | 161 |
trackTeams() |
162 |
teamScan() |
|
163 |
runOnHogs(saveStuff) |
|
164 |
||
165 |
hogLimitHit = false |
|
166 |
for i=0 , TeamsCount - 1 do |
|
167 |
cnthhs = 0 |
|
13220
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
168 |
runOnHogsInTeam(limitHogs, GetTeamName(i)) |
11015 | 169 |
end |
170 |
if hogLimitHit then |
|
13108 | 171 |
WriteLnToChat(loc("Only one hog per team allowed! Excess hogs will be removed.")) |
11015 | 172 |
end |
173 |
showStartingInfo() |
|
174 |
end |
|
175 |
||
176 |
||
177 |
||
178 |
function giveWeapons(gear) |
|
179 |
if gear == mutant then |
|
180 |
AddAmmo(gear, amRope) |
|
181 |
for i=1, #mt_weapons do |
|
182 |
AddAmmo(gear, mt_weapons[i]) |
|
183 |
end |
|
184 |
||
185 |
else |
|
186 |
for i=1, #hh_weapons do |
|
187 |
AddAmmo(gear,hh_weapons[i]) |
|
188 |
end |
|
189 |
end |
|
190 |
end |
|
191 |
||
192 |
function onAmmoStoreInit() |
|
193 |
||
194 |
SetAmmo(amSkip, 9, 0, 0, 0) |
|
195 |
SetAmmo(amRope,0,1,0,5) |
|
196 |
SetAmmo(amSnowball,0,1,0,1) |
|
197 |
||
198 |
for i=1, #hh_weapons do |
|
199 |
SetAmmo(hh_weapons[i], 0, 0, 0, 1) |
|
200 |
end |
|
201 |
||
202 |
for i=1, #mt_weapons do |
|
203 |
SetAmmo(mt_weapons[i], 0, 3, 0, 1) |
|
204 |
end |
|
205 |
||
206 |
end |
|
207 |
||
208 |
function drawCircles() |
|
209 |
for i = 0, #hhs do |
|
210 |
if circles[hhs[i]] ~= nil then |
|
211 |
DeleteVisualGear(circles[hhs[i]]) |
|
212 |
circles[hhs[i]] = nil |
|
213 |
end |
|
214 |
||
215 |
if hhs[i] ~= CurrentHedgehog then |
|
216 |
if mutant == nil then |
|
217 |
circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false) |
|
218 |
SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 5, 0xff000080) |
|
219 |
elseif CurrentHedgehog == mutant then |
|
220 |
circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false) |
|
221 |
SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 3, 0xaa000070) |
|
222 |
elseif getGearValue(CurrentHedgehog, "Feeder") and hhs[i] ~= mutant then |
|
223 |
circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false) |
|
224 |
SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 3, 0xaa000070) |
|
225 |
elseif hhs[i] == mutant then |
|
226 |
circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false) |
|
227 |
SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 5, 0xff000080) |
|
228 |
end |
|
229 |
end |
|
230 |
end |
|
231 |
circleFrame = 0 |
|
232 |
end |
|
233 |
||
234 |
function onNewTurn() |
|
235 |
||
236 |
trackTeams() |
|
237 |
killsCounter = 0 |
|
238 |
||
239 |
if mutant == nil then |
|
13643 | 240 |
AddCaption( loc("First killer will mutate"), capcolDefault, capgrpGameState ) |
11015 | 241 |
end |
242 |
||
243 |
checkScore() |
|
11909 | 244 |
|
245 |
for i=0, TeamsCount-1 do |
|
13220
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
246 |
SendStat(siClanHealth, getTeamValue(GetTeamName(i), "Score"), GetTeamName(i)) |
11909 | 247 |
end |
248 |
||
11015 | 249 |
giveWeapons(CurrentHedgehog) |
250 |
drawCircles() |
|
251 |
setAIHints() |
|
252 |
kill_reward= numhhs*10 |
|
253 |
||
254 |
if CurrentHedgehog == mutant then |
|
255 |
mt_hurt=true |
|
256 |
disease= mutant_base_disease - numhhs |
|
257 |
else |
|
258 |
mt_hurt=false |
|
259 |
end |
|
260 |
||
261 |
setGearValue(CurrentHedgehog, "Alive", true) |
|
262 |
||
263 |
end |
|
264 |
||
265 |
function countBodies() |
|
266 |
if killsCounter == 2 then |
|
13643 | 267 |
AddCaption(loc("Double kill!"), capcolDefault, capgrpGameState ) |
11015 | 268 |
elseif killsCounter == 3 then |
13643 | 269 |
AddCaption(loc("Mega kill!"), capcolDefault, capgrpGameState ) |
11015 | 270 |
PlaySound(sndRegret) |
271 |
elseif killsCounter == 4 then |
|
13643 | 272 |
AddCaption(loc("Ultra kill!"), capcolDefault, capgrpGameState ) |
11015 | 273 |
elseif killsCounter == 5 then |
13643 | 274 |
AddCaption(loc("Monster kill!"), capcolDefault, capgrpGameState ) |
11015 | 275 |
PlaySound(sndIllGetYou) |
276 |
elseif killsCounter == 6 then |
|
13643 | 277 |
AddCaption(loc("Ludicrous kill!"), capcolDefault, capgrpGameState ) |
11015 | 278 |
PlaySound(sndNutter) |
279 |
elseif killsCounter == 7 then |
|
13643 | 280 |
AddCaption(loc("Holy shit!"), capcolDefault, capgrpGameState ) |
11015 | 281 |
PlaySound(sndLaugh) |
282 |
elseif killsCounter > 8 then |
|
13643 | 283 |
AddCaption(loc("Insanity!"), capcolDefault, capgrpGameState ) |
11909 | 284 |
end |
285 |
||
286 |
if killsCounter > recordKills then |
|
287 |
recordKills = killsCounter |
|
288 |
recordKillsHogName = getGearValue(CurrentHedgehog, "Name") |
|
289 |
recordKillsTeamName = GetHogTeamName(CurrentHedgehog) |
|
11015 | 290 |
end |
291 |
end |
|
292 |
||
293 |
function onGameTick() |
|
294 |
||
295 |
if circleFrame > -1 then |
|
296 |
for i = 0, #hhs do |
|
297 |
if circles[hhs[i]] ~= nil and hhs[i]~= nil then |
|
298 |
hhx, hhy = GetGearPosition(hhs[i]) |
|
13685
09ea1faf97ca
Remove calls to GetVisualGearValues where it's not needed
Wuzzy <Wuzzy2@mail.ru>
parents:
13643
diff
changeset
|
299 |
SetVisualGearValues(circles[hhs[i]], hhx + 1, hhy - 3, 0, 0, 0, 0, 0, 40 - (circleFrame % 25)) |
11015 | 300 |
end |
301 |
end |
|
302 |
||
303 |
circleFrame = circleFrame + 0.06 |
|
304 |
||
305 |
if circleFrame >= 25 then |
|
306 |
for i = 0, #hhs do |
|
307 |
if circles[hhs[i]] ~= nil then |
|
308 |
DeleteVisualGear(circles[hhs[i]]) |
|
309 |
circles[hhs[i]] = nil |
|
310 |
end |
|
311 |
end |
|
312 |
end |
|
313 |
end |
|
314 |
||
315 |
if TurnTimeLeft==0 and mt_hurt then |
|
316 |
mt_hurt = false |
|
317 |
end |
|
318 |
||
319 |
if mt_hurt and mutant~=nil then |
|
320 |
timer = timer + 1 |
|
321 |
if timer > disease_timer then |
|
322 |
timer = 0 |
|
323 |
SetHealth(mutant, GetHealth(mutant)-disease ) |
|
324 |
AddVisualGear(GetX(mutant), GetY(mutant)-5, vgtHealthTag, disease, true) |
|
325 |
if GetHealth(mutant)<=0 then |
|
326 |
SetHealth(mutant,0) |
|
327 |
mt_hurt= false |
|
328 |
setGearValue(mutant,"SelfDestruct",true) |
|
12341
c73521104fac
Mutant: Fix “Boring” taunt being played when becoming the mutant
Wuzzy <almikes@aol.com>
parents:
12335
diff
changeset
|
329 |
EndTurn() |
11015 | 330 |
end |
331 |
end |
|
332 |
end |
|
333 |
||
334 |
end |
|
335 |
||
12988
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
336 |
--[[ |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
337 |
Forces the special mutant/feeder names and hats only to be |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
338 |
taken by those who deserved it. |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
339 |
Names and hats will be changed (and ridiculed) if neccesary. |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
340 |
]] |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
341 |
function exposeIdentityTheft(gear) |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
342 |
local lon = string.lower(GetHogName(gear)) -- lowercase origina name |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
343 |
local name, hat |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
344 |
-- Change name if hog uses a reserved one |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
345 |
if lon == "mutant" or lon == string.lower(loc("Mutant")) then |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
346 |
SetHogName(gear, loc("Identity Thief")) |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
347 |
SetHogHat(gear, "Disguise") |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
348 |
elseif lon == "bottom feeder" or lon == string.lower(loc("Bottom Feeder")) then |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
349 |
-- Word play on "Bottom Feeder". Someone who is low on cotton. :D |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
350 |
-- Either translate literally or make up your ow word play |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
351 |
SetHogName(gear, loc("Cotton Needer")) |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
352 |
SetHogHat(gear, "StrawHat") |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
353 |
end |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
354 |
-- Strip hog off its special hat |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
355 |
if GetHogHat(gear) == mutantHat or GetHogHat(gear) == feederHat then |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
356 |
SetHogHat(gear, "NoHat") |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
357 |
end |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
358 |
end |
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
359 |
|
11015 | 360 |
function saveStuff(gear) |
12988
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
361 |
exposeIdentityTheft(gear) |
11015 | 362 |
setGearValue(gear,"Name",GetHogName(gear)) |
363 |
setGearValue(gear,"Hat",GetHogHat(gear)) |
|
364 |
end |
|
365 |
||
366 |
function armageddon(gear) |
|
367 |
SetState(gear, gstLoser) |
|
13108 | 368 |
SetEffect(gear, heResurrectable, 0) |
11015 | 369 |
SetHealth(gear, 0) |
370 |
end |
|
371 |
||
13019
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12988
diff
changeset
|
372 |
function renderScores() |
11015 | 373 |
for i=0, TeamsCount-1 do |
13220
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
374 |
local name = GetTeamName(i) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
375 |
SetTeamLabel(name, string.format(loc("%d | %d"), getTeamValue(name, "Score"), getTeamValue(name, "DeadHogs"))) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
376 |
end |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
377 |
end |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
378 |
|
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
379 |
function createEndGameStats() |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
380 |
SendStat(siGraphTitle, loc("Score graph")) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
381 |
|
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
382 |
local teamsSorted = {} |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
383 |
for i=0, TeamsCount-1, 1 do |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
384 |
teamsSorted[i+1] = GetTeamName(i) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
385 |
end |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
386 |
|
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
387 |
-- Achievements stuff |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
388 |
local achievements = 0 |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
389 |
--- Most kills per turn |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
390 |
if recordKills >= 3 then |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
391 |
SendStat(siMaxStepKills, string.format("%d %s (%s)", recordKills, recordKillsHogName, recordKillsTeamName)) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
392 |
achievements = achievements + 1 |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
393 |
end |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
394 |
--- Most crates collected |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
395 |
if recordCrates >= 5 then |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
396 |
SendStat(siCustomAchievement, string.format(loc("%s (%s) was the greediest hedgehog and collected %d crates."), recordCratesHogName, recordCratesTeamName, recordCrates)) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
397 |
achievements = achievements + 1 |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
398 |
end |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
399 |
--- Most suicides |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
400 |
if recordSuicides >= 5 then |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
401 |
SendStat(siCustomAchievement, string.format(loc("%s (%s) hate life and suicided %d times."), recordSuicidesHogName, recordSuicidesTeamName, recordSuicides)) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
402 |
achievements = achievements + 1 |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
403 |
end |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
404 |
--- Most deaths |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
405 |
if recordDeaths >= 5 then |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
406 |
SendStat(siCustomAchievement, string.format(loc("Poor %s (%s) died %d times."), recordDeathsHogName, recordDeathsTeamName, recordDeaths)) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
407 |
achievements = achievements + 1 |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
408 |
end |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
409 |
--- Most skips |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
410 |
if recordSkips >= 3 then |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
411 |
SendStat(siMaxTurnSkips, string.format("%d %s (%s)", recordSkips, recordSkipsHogName, recordSkipsTeamName)) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
412 |
achievements = achievements + 1 |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
413 |
end |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
414 |
--- Total damage |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
415 |
if totalDamage >= 900 then |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
416 |
SendStat(siCustomAchievement, string.format(loc("%d damage was dealt in this game."), totalDamage)) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
417 |
achievements = achievements + 1 |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
418 |
end |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
419 |
--- Total kills |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
420 |
if totalKills >= 20 or (achievements <= 0 and totalKills >= 1) then |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
421 |
SendStat(siKilledHHs, tostring(totalKills)) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
422 |
achievements = achievements + 1 |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
423 |
end |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
424 |
|
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
425 |
-- Score and stats stuff |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
426 |
local showScore = "" |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
427 |
table.sort(teamsSorted, function(team1, team2) return getTeamValue(team1, "Score") > getTeamValue(team2, "Score") end) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
428 |
for i=1, TeamsCount do |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
429 |
SendStat(siPointType, loc("point(s)")) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
430 |
local score = getTeamValue(teamsSorted[i], "Score") |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
431 |
local deaths = getTeamValue(teamsSorted[i], "DeadHogs") |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
432 |
SendStat(siPlayerKills, score, teamsSorted[i]) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
433 |
|
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
434 |
showScore = showScore .. string.format(loc("%s: %d (deaths: %d)"), teamsSorted[i], score, deaths) .. "|" |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
435 |
end |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
436 |
|
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
437 |
if getTeamValue(teamsSorted[1], "Score") == getTeamValue(teamsSorted[2], "Score") then |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
438 |
-- The first two teams have the same score! Round is drawn. |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
439 |
return nil |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
440 |
else |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
441 |
|
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
442 |
ShowMission(loc("Mutant"), |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
443 |
loc("Final result"), |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
444 |
string.format(loc("Winner: %s"), teamsSorted[1]) .. "| |" .. loc("Scores:") .. " |" .. |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
445 |
showScore, 0, 15000) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
446 |
|
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
447 |
-- return winning team |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
448 |
return teamsSorted[1] |
11015 | 449 |
end |
450 |
end |
|
451 |
||
452 |
function checkScore() |
|
453 |
local lowest_score_team = nil |
|
454 |
local min_score=nil |
|
455 |
local winTeam = nil |
|
456 |
||
457 |
local only_low_score = true |
|
458 |
||
459 |
for i=0, TeamsCount-1 do |
|
13220
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
460 |
local teamName = GetTeamName(i) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
461 |
if not teamsDead[teamName] then |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
462 |
local curr_score = getTeamValue(teamName, "Score") |
11015 | 463 |
|
13220
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
464 |
runOnHogsInTeam(removeFeeder, teamName) |
11015 | 465 |
|
466 |
if curr_score >= winScore then |
|
467 |
gameOver = true |
|
13220
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
468 |
winTeam = teamName |
11015 | 469 |
end |
470 |
||
471 |
if min_score==nil then |
|
472 |
min_score= curr_score |
|
13220
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
473 |
lowest_score_team = teamName |
11015 | 474 |
else |
475 |
if curr_score <= min_score then |
|
476 |
if curr_score == min_score then |
|
13220
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
477 |
if getTeamValue(teamName, "DeadHogs") == getTeamValue(lowest_score_team, "DeadHogs") then |
11015 | 478 |
only_low_score = false |
479 |
else |
|
13220
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
480 |
if getTeamValue(teamName, "DeadHogs") > getTeamValue(lowest_score_team, "DeadHogs") then |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
481 |
lowest_score_team = teamName |
11015 | 482 |
end |
483 |
only_low_score = true |
|
484 |
end |
|
485 |
||
486 |
else |
|
487 |
min_score= curr_score |
|
13220
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
488 |
lowest_score_team = teamName |
11015 | 489 |
only_low_score = true |
490 |
end |
|
491 |
end |
|
492 |
end |
|
493 |
end |
|
494 |
end |
|
495 |
||
496 |
if gameOver then |
|
12341
c73521104fac
Mutant: Fix “Boring” taunt being played when becoming the mutant
Wuzzy <almikes@aol.com>
parents:
12335
diff
changeset
|
497 |
EndTurn(true) |
11909 | 498 |
|
499 |
for i=0, TeamsCount-1 do |
|
13220
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
500 |
local teamName = GetTeamName(i) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
501 |
if teamName~=winTeam then |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
502 |
runOnHogsInTeam(armageddon, teamName) |
11015 | 503 |
end |
504 |
end |
|
505 |
||
13220
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
506 |
createEndGameStats() |
11015 | 507 |
else |
508 |
||
509 |
if only_low_score then |
|
510 |
runOnHogsInTeam(setFeeder, lowest_score_team) |
|
511 |
end |
|
512 |
||
513 |
if meh == false then |
|
514 |
meh = true |
|
515 |
end |
|
516 |
||
517 |
end |
|
518 |
end |
|
519 |
||
520 |
function backToNormal(gear) |
|
521 |
SetHogName(gear, getGearValue(gear,"Name")) |
|
522 |
SetHogHat(gear, 'NoHat') |
|
523 |
SetHogHat(gear, getGearValue(gear,"Hat")) |
|
524 |
setGearValue(mutant,"SelfDestruct",false) |
|
525 |
mt_hurt=false |
|
526 |
mutant=nil |
|
527 |
end |
|
528 |
||
529 |
function setAIHints() |
|
530 |
for i = 0, #hhs do |
|
531 |
if mutant == nil or hhs[i] == mutant or CurrentHedgehog == mutant or getGearValue(CurrentHedgehog, "Feeder") then |
|
13036
434bcdd9562c
Fix inconsistent name of SetGearAIHints
Wuzzy <Wuzzy2@mail.ru>
parents:
13019
diff
changeset
|
532 |
SetGearAIHints(hhs[i], aihUsualProcessing) |
11015 | 533 |
else |
534 |
SetGearAIHints(hhs[i], aihDoesntMatter) |
|
535 |
end |
|
536 |
end |
|
537 |
end |
|
538 |
||
539 |
function removeFeeder(gear) |
|
540 |
if gear~=nil then |
|
541 |
setGearValue(gear,"Feeder",false) |
|
542 |
if gear~= mutant then |
|
543 |
SetHogName(gear, getGearValue(gear,"Name") ) |
|
544 |
SetHogHat(gear, 'NoHat') |
|
545 |
SetHogHat(gear, getGearValue(gear,"Hat")) |
|
546 |
end |
|
547 |
end |
|
548 |
end |
|
549 |
||
550 |
function setFeeder(gear) |
|
551 |
if gear~= mutant and gear~= nil then |
|
11909 | 552 |
SetHogName(gear, loc("Bottom Feeder")) |
12988
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
553 |
SetHogHat(gear, feederHat) |
11015 | 554 |
setGearValue(gear,"Feeder", true) |
555 |
end |
|
556 |
end |
|
557 |
||
558 |
function setMutantStuff(gear) |
|
559 |
mutant = gear |
|
560 |
||
11909 | 561 |
SetHogName(gear, loc("Mutant")) |
12988
a15413d896c3
Mutant: Force special mutant/feeder hat+name to be only hold by those who deserved it
Wuzzy <Wuzzy2@mail.ru>
parents:
12940
diff
changeset
|
562 |
SetHogHat(gear, mutantHat) |
11015 | 563 |
SetHealth(gear, ( mutant_base_health + numhhs*25) ) |
564 |
SetEffect(gear, hePoisoned, 1) |
|
565 |
setGearValue(mutant,"SelfDestruct",false) |
|
566 |
setGearValue(gear, "Feeder", false) |
|
567 |
||
11909 | 568 |
AddCaption(string.format(loc("%s has mutated! +2 points"), getGearValue(gear, "Name")), GetClanColor(GetHogClan(gear)), capgrpMessage) |
11015 | 569 |
|
12430
c461a224ec09
Mutant: Fix turn skip of next hog after mutating when TurnTimeLeft = 0
Wuzzy <almikes@aol.com>
parents:
12341
diff
changeset
|
570 |
if TurnTimeLeft > 0 then |
c461a224ec09
Mutant: Fix turn skip of next hog after mutating when TurnTimeLeft = 0
Wuzzy <almikes@aol.com>
parents:
12341
diff
changeset
|
571 |
EndTurn(true) |
c461a224ec09
Mutant: Fix turn skip of next hog after mutating when TurnTimeLeft = 0
Wuzzy <almikes@aol.com>
parents:
12341
diff
changeset
|
572 |
end |
11015 | 573 |
|
574 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
575 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
576 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
577 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
578 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
579 |
PlaySound(sndSuddenDeath) |
|
580 |
end |
|
581 |
||
582 |
function teamScan() |
|
583 |
||
13220
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
584 |
for j=0, TeamsCount-1 do |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
585 |
teamName = GetTeamName(j) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
586 |
teamsDead[teamName] = false |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
587 |
setTeamValue(teamName, "Score",0) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
588 |
setTeamValue(teamName, "Suicides",0) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
589 |
setTeamValue(teamName, "Skips",0) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
590 |
setTeamValue(teamName, "Crates",0) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
591 |
setTeamValue(teamName, "DeadHogs",0) |
11015 | 592 |
end |
593 |
||
13019
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12988
diff
changeset
|
594 |
renderScores() |
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12988
diff
changeset
|
595 |
|
11015 | 596 |
---***--- |
597 |
end |
|
598 |
||
599 |
function set_Mutant_and_Score(gear) |
|
600 |
||
601 |
local curr_team = GetHogTeamName(CurrentHedgehog) |
|
602 |
||
603 |
if gear == CurrentHedgehog then |
|
604 |
if CurrentHedgehog == mutant then |
|
605 |
PlaySound(sndHomerun) |
|
606 |
if getGearValue(gear, "SelfDestruct")==false then |
|
607 |
decreaseTeamValue(curr_team,"Score") |
|
608 |
end |
|
609 |
backToNormal(gear) |
|
610 |
else |
|
611 |
decreaseTeamValue(curr_team,"Score") |
|
612 |
end |
|
613 |
||
614 |
else |
|
615 |
if gear == mutant then |
|
616 |
backToNormal(mutant) |
|
617 |
if curr_team ~=GetHogTeamName(gear) then |
|
618 |
if getGearValue(CurrentHedgehog, "Alive") then |
|
619 |
setMutantStuff(CurrentHedgehog) |
|
620 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") + mutant_kill_reward)) |
|
621 |
end |
|
622 |
else |
|
623 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment)) |
|
11909 | 624 |
increaseTeamValue(curr_team,"Suicides") |
625 |
if(getTeamValue(curr_team, "Suicides") > recordSuicides) then |
|
626 |
recordSuicides = getTeamValue(curr_team, "Suicides") |
|
627 |
recordSuicidesHogName = getGearValue(CurrentHedgehog, "Name") |
|
628 |
recordSuicidesTeamName = curr_team |
|
629 |
end |
|
630 |
AddCaption(loc("-1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage) |
|
11015 | 631 |
end |
632 |
else |
|
633 |
if mutant==nil then |
|
634 |
if curr_team ~=GetHogTeamName(gear) then |
|
635 |
if getGearValue(CurrentHedgehog, "Alive") then |
|
636 |
setMutantStuff(CurrentHedgehog) |
|
637 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") + mutant_kill_reward)) |
|
638 |
else |
|
639 |
increaseTeamValue(curr_team,"Score") |
|
640 |
end |
|
641 |
else |
|
642 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment)) |
|
11909 | 643 |
increaseTeamValue(curr_team,"Suicides") |
644 |
if(getTeamValue(curr_team, "Suicides") > recordSuicides) then |
|
645 |
recordSuicides = getTeamValue(curr_team, "Suicides") |
|
646 |
recordSuicidesHogName = getGearValue(CurrentHedgehog, "Name") |
|
647 |
recordSuicidesTeamName = curr_team |
|
648 |
end |
|
649 |
AddCaption(loc("-1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage) |
|
11015 | 650 |
end |
651 |
else |
|
652 |
if curr_team ~=GetHogTeamName(gear) then |
|
653 |
if CurrentHedgehog==mutant and getGearValue(mutant,"SelfDestruct")==false then |
|
12940
39b7b3ed619e
Add healing visual effect + heal msg in scripts
Wuzzy <Wuzzy2@mail.ru>
parents:
12430
diff
changeset
|
654 |
HealHog(CurrentHedgehog, kill_reward) |
12288
a5a7d0c6d3f3
Fix incorrect Mutant score message color
Wuzzy <almikes@aol.com>
parents:
11909
diff
changeset
|
655 |
AddCaption(loc("+1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage) |
11015 | 656 |
increaseTeamValue(curr_team,"Score") |
657 |
end |
|
658 |
if getGearValue(CurrentHedgehog,"Feeder") then |
|
659 |
increaseTeamValue(curr_team,"Score") |
|
11909 | 660 |
AddCaption(loc("+1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage) |
11015 | 661 |
end |
662 |
else |
|
663 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment)) |
|
11909 | 664 |
AddCaption(loc("+1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage) |
11015 | 665 |
end |
666 |
end |
|
667 |
end |
|
668 |
end |
|
669 |
end |
|
670 |
||
671 |
function onGearResurrect(gear) |
|
672 |
if not gameOver then |
|
673 |
if GetGearType(gear) == gtHedgehog then |
|
674 |
||
675 |
increaseTeamValue(GetHogTeamName(gear), "DeadHogs") |
|
11909 | 676 |
totalKills = totalKills + 1 |
677 |
if(getTeamValue(GetHogTeamName(gear), "DeadHogs") > recordDeaths) then |
|
678 |
recordDeaths = getTeamValue(GetHogTeamName(gear), "DeadHogs") |
|
679 |
recordDeathsHogName = getGearValue(gear, "Name") |
|
680 |
recordDeathsTeamName = GetHogTeamName(gear) |
|
681 |
end |
|
11015 | 682 |
|
683 |
if gear==CurrentHedgehog then |
|
684 |
setGearValue(CurrentHedgehog, "Alive", false) |
|
685 |
end |
|
686 |
set_Mutant_and_Score(gear) |
|
687 |
if gear~=CurrentHedgehog then |
|
688 |
killsCounter = killsCounter + 1 |
|
689 |
countBodies() |
|
690 |
end |
|
691 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
692 |
PlaySound(sndWhack) |
|
13019
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12988
diff
changeset
|
693 |
renderScores() |
11015 | 694 |
end |
695 |
end |
|
696 |
end |
|
697 |
||
11909 | 698 |
function onGearDamage(gear, damage) |
699 |
if not gameOver and GetGearType(gear) == gtHedgehog then |
|
700 |
totalDamage = totalDamage + damage |
|
701 |
end |
|
702 |
end |
|
703 |
||
13172
159004144897
Use onSkipTurn in scripts to detect turn skips
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
704 |
function onSkipTurn() |
11909 | 705 |
-- Record skips for achievement |
13172
159004144897
Use onSkipTurn in scripts to detect turn skips
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
706 |
local team = GetHogTeamName(CurrentHedgehog) |
159004144897
Use onSkipTurn in scripts to detect turn skips
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
707 |
increaseTeamValue(team, "Skips") |
159004144897
Use onSkipTurn in scripts to detect turn skips
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
708 |
if(getTeamValue(team, "Skips") > recordSkips) then |
159004144897
Use onSkipTurn in scripts to detect turn skips
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
709 |
recordSkips = getTeamValue(team, "Skips") |
159004144897
Use onSkipTurn in scripts to detect turn skips
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
710 |
recordSkipsHogName = getGearValue(CurrentHedgehog, "Name") |
159004144897
Use onSkipTurn in scripts to detect turn skips
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
711 |
recordSkipsTeamName = team |
11909 | 712 |
end |
713 |
end |
|
714 |
||
11015 | 715 |
function onGearAdd(gear) |
716 |
||
717 |
-- Catch hedgehogs for the tracker |
|
718 |
if GetGearType(gear) == gtHedgehog then |
|
719 |
trackGear(gear) |
|
720 |
hhs[numhhs] = gear |
|
721 |
numhhs = numhhs + 1 |
|
722 |
SetEffect(gear, heResurrectable, 1) |
|
13219
b229b3259a76
Mutant: Fix graph title on game draw
Wuzzy <Wuzzy2@mail.ru>
parents:
13172
diff
changeset
|
723 |
elseif GetGearType(gear) == gtATFinishGame then |
13220
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
724 |
if not gameOver then |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
725 |
local winner = createEndGameStats() |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
726 |
if winner then |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
727 |
SendStat(siGameResult, string.format(loc("%s wins!"), winner)) |
13643 | 728 |
AddCaption(string.format(loc("%s wins!"), winner), capcolDefault, capgrpGameState) |
13220
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
729 |
end |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
730 |
gameOver = true |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
731 |
end |
11015 | 732 |
end |
733 |
end |
|
734 |
||
735 |
function checkEmptyTeam (teamName) |
|
736 |
for i=0 , #hhs do |
|
737 |
if hhs[i]~=nil then |
|
738 |
if teamName == GetHogTeamName(hhs[i]) then |
|
739 |
return false |
|
740 |
end |
|
741 |
end |
|
742 |
end |
|
743 |
return true |
|
744 |
end |
|
745 |
||
746 |
function onGearDelete(gear) |
|
747 |
-- Remove hogs that are gone |
|
748 |
if GetGearType(gear) == gtHedgehog then |
|
749 |
numhhs = numhhs - 1 |
|
750 |
||
751 |
local found |
|
752 |
for i=0, #hhs do |
|
753 |
if hhs[i] == gear then |
|
754 |
found = i |
|
755 |
break |
|
756 |
end |
|
757 |
end |
|
758 |
for i = found, #hhs - 1 do |
|
759 |
hhs[i] = hhs[i + 1] |
|
760 |
end |
|
761 |
hhs[#hhs] = nil |
|
762 |
||
763 |
local t_name = GetHogTeamName(gear) |
|
764 |
if checkEmptyTeam(t_name) then |
|
765 |
for i = 0, TeamsCount - 1 do |
|
13220
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
766 |
if GetTeamName(i) == t_name then |
11015 | 767 |
found = i |
13220
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
768 |
teamsDead[t_name] = true |
11015 | 769 |
break |
770 |
end |
|
771 |
end |
|
772 |
end |
|
13220
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
773 |
if getGearValue(gear, "excess") ~= true and band(GetState(gear), gstDrowning) == 0 then |
13108 | 774 |
AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
775 |
end |
|
11015 | 776 |
trackDeletion(gear) |
11909 | 777 |
elseif GetGearType(gear) == gtCase then |
778 |
-- Check if a crate has been collected |
|
779 |
if band(GetGearMessage(gear), gmDestroy) ~= 0 and CurrentHedgehog ~= nil then |
|
780 |
-- Update crate collection achievement |
|
781 |
increaseTeamValue(GetHogTeamName(CurrentHedgehog), "Crates") |
|
782 |
if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Crates") > recordCrates) then |
|
783 |
recordCrates = getTeamValue(GetHogTeamName(CurrentHedgehog), "Crates") |
|
784 |
recordCratesHogName = getGearValue(CurrentHedgehog, "Name") |
|
785 |
recordCratesTeamName = GetHogTeamName(CurrentHedgehog) |
|
786 |
end |
|
787 |
end |
|
11015 | 788 |
end |
789 |
end |
|
790 |
||
791 |
function onParameters() |
|
792 |
parseParams() |
|
793 |
winScore = tonumber(params["winscore"]) or winScore |
|
794 |
end |
|
795 |
||
796 |
--[[ |
|
797 |
S T A R R I N G |
|
798 |
prof - Coding, implementing and evangelism |
|
799 |
vos - Initial idea and script improvements |
|
800 |
mikade - Moving the `how to play` into the game so that people know `how to play`, and whitespace :D |
|
801 |
--]] |