author | Wuzzy <Wuzzy2@mail.ru> |
Tue, 07 Aug 2018 13:04:02 +0200 | |
changeset 13630 | fe7d2bbf5f3f |
parent 13220 | 1c390781f72f |
child 13643 | 690cc84e9fd6 |
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() |
|
11909 | 156 |
SendHealthStatsOff() |
12335
8f693d25be2f
Show traditional winning animation in Mutant again
Wuzzy <almikes@aol.com>
parents:
12288
diff
changeset
|
157 |
SendRankingStatsOff() |
8f693d25be2f
Show traditional winning animation in Mutant again
Wuzzy <almikes@aol.com>
parents:
12288
diff
changeset
|
158 |
SendAchievementsStatsOff() |
11015 | 159 |
trackTeams() |
160 |
teamScan() |
|
161 |
runOnHogs(saveStuff) |
|
162 |
||
163 |
hogLimitHit = false |
|
164 |
for i=0 , TeamsCount - 1 do |
|
165 |
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
|
166 |
runOnHogsInTeam(limitHogs, GetTeamName(i)) |
11015 | 167 |
end |
168 |
if hogLimitHit then |
|
13108 | 169 |
WriteLnToChat(loc("Only one hog per team allowed! Excess hogs will be removed.")) |
11015 | 170 |
end |
171 |
showStartingInfo() |
|
172 |
end |
|
173 |
||
174 |
||
175 |
||
176 |
function giveWeapons(gear) |
|
177 |
if gear == mutant then |
|
178 |
AddAmmo(gear, amRope) |
|
179 |
for i=1, #mt_weapons do |
|
180 |
AddAmmo(gear, mt_weapons[i]) |
|
181 |
end |
|
182 |
||
183 |
else |
|
184 |
for i=1, #hh_weapons do |
|
185 |
AddAmmo(gear,hh_weapons[i]) |
|
186 |
end |
|
187 |
end |
|
188 |
end |
|
189 |
||
190 |
function onAmmoStoreInit() |
|
191 |
||
192 |
SetAmmo(amSkip, 9, 0, 0, 0) |
|
193 |
SetAmmo(amRope,0,1,0,5) |
|
194 |
SetAmmo(amSnowball,0,1,0,1) |
|
195 |
||
196 |
for i=1, #hh_weapons do |
|
197 |
SetAmmo(hh_weapons[i], 0, 0, 0, 1) |
|
198 |
end |
|
199 |
||
200 |
for i=1, #mt_weapons do |
|
201 |
SetAmmo(mt_weapons[i], 0, 3, 0, 1) |
|
202 |
end |
|
203 |
||
204 |
end |
|
205 |
||
206 |
function drawCircles() |
|
207 |
for i = 0, #hhs do |
|
208 |
if circles[hhs[i]] ~= nil then |
|
209 |
DeleteVisualGear(circles[hhs[i]]) |
|
210 |
circles[hhs[i]] = nil |
|
211 |
end |
|
212 |
||
213 |
if hhs[i] ~= CurrentHedgehog then |
|
214 |
if mutant == nil then |
|
215 |
circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false) |
|
216 |
SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 5, 0xff000080) |
|
217 |
elseif CurrentHedgehog == mutant then |
|
218 |
circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false) |
|
219 |
SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 3, 0xaa000070) |
|
220 |
elseif getGearValue(CurrentHedgehog, "Feeder") and hhs[i] ~= mutant then |
|
221 |
circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false) |
|
222 |
SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 3, 0xaa000070) |
|
223 |
elseif hhs[i] == mutant then |
|
224 |
circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false) |
|
225 |
SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 5, 0xff000080) |
|
226 |
end |
|
227 |
end |
|
228 |
end |
|
229 |
circleFrame = 0 |
|
230 |
end |
|
231 |
||
232 |
function onNewTurn() |
|
233 |
||
234 |
trackTeams() |
|
235 |
killsCounter = 0 |
|
236 |
||
237 |
if mutant == nil then |
|
11909 | 238 |
AddCaption( loc("First killer will mutate"), 0xFFFFFFFF, capgrpGameState ) |
11015 | 239 |
end |
240 |
||
241 |
checkScore() |
|
11909 | 242 |
|
243 |
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
|
244 |
SendStat(siClanHealth, getTeamValue(GetTeamName(i), "Score"), GetTeamName(i)) |
11909 | 245 |
end |
246 |
||
11015 | 247 |
giveWeapons(CurrentHedgehog) |
248 |
drawCircles() |
|
249 |
setAIHints() |
|
250 |
kill_reward= numhhs*10 |
|
251 |
||
252 |
if CurrentHedgehog == mutant then |
|
253 |
mt_hurt=true |
|
254 |
disease= mutant_base_disease - numhhs |
|
255 |
else |
|
256 |
mt_hurt=false |
|
257 |
end |
|
258 |
||
259 |
setGearValue(CurrentHedgehog, "Alive", true) |
|
260 |
||
261 |
end |
|
262 |
||
263 |
function countBodies() |
|
264 |
if killsCounter == 2 then |
|
11909 | 265 |
AddCaption(loc("Double kill!"), 0xFFFFFFFF, capgrpGameState ) |
11015 | 266 |
elseif killsCounter == 3 then |
11909 | 267 |
AddCaption(loc("Mega kill!"), 0xFFFFFFFF, capgrpGameState ) |
11015 | 268 |
PlaySound(sndRegret) |
269 |
elseif killsCounter == 4 then |
|
11909 | 270 |
AddCaption(loc("Ultra kill!"), 0xFFFFFFFF, capgrpGameState ) |
11015 | 271 |
elseif killsCounter == 5 then |
11909 | 272 |
AddCaption(loc("Monster kill!"), 0xFFFFFFFF, capgrpGameState ) |
11015 | 273 |
PlaySound(sndIllGetYou) |
274 |
elseif killsCounter == 6 then |
|
11909 | 275 |
AddCaption(loc("Ludicrous kill!"), 0xFFFFFFFF, capgrpGameState ) |
11015 | 276 |
PlaySound(sndNutter) |
277 |
elseif killsCounter == 7 then |
|
11909 | 278 |
AddCaption(loc("Holy shit!"), 0xFFFFFFFF, capgrpGameState ) |
11015 | 279 |
PlaySound(sndLaugh) |
280 |
elseif killsCounter > 8 then |
|
11909 | 281 |
AddCaption(loc("Insanity!"), 0xFFFFFFFF, capgrpGameState ) |
282 |
end |
|
283 |
||
284 |
if killsCounter > recordKills then |
|
285 |
recordKills = killsCounter |
|
286 |
recordKillsHogName = getGearValue(CurrentHedgehog, "Name") |
|
287 |
recordKillsTeamName = GetHogTeamName(CurrentHedgehog) |
|
11015 | 288 |
end |
289 |
end |
|
290 |
||
291 |
function onGameTick() |
|
292 |
||
293 |
if circleFrame > -1 then |
|
294 |
for i = 0, #hhs do |
|
295 |
if circles[hhs[i]] ~= nil and hhs[i]~= nil then |
|
296 |
hhx, hhy = GetGearPosition(hhs[i]) |
|
297 |
X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint = GetVisualGearValues(circles[hhs[i]]) |
|
298 |
SetVisualGearValues(circles[hhs[i]], hhx + 1, hhy - 3, 0, 0, 0, 0, 0, 40 - (circleFrame % 25), Timer, Tint) |
|
299 |
end |
|
300 |
end |
|
301 |
||
302 |
circleFrame = circleFrame + 0.06 |
|
303 |
||
304 |
if circleFrame >= 25 then |
|
305 |
for i = 0, #hhs do |
|
306 |
if circles[hhs[i]] ~= nil then |
|
307 |
DeleteVisualGear(circles[hhs[i]]) |
|
308 |
circles[hhs[i]] = nil |
|
309 |
end |
|
310 |
end |
|
311 |
end |
|
312 |
end |
|
313 |
||
314 |
if TurnTimeLeft==0 and mt_hurt then |
|
315 |
mt_hurt = false |
|
316 |
end |
|
317 |
||
318 |
if mt_hurt and mutant~=nil then |
|
319 |
timer = timer + 1 |
|
320 |
if timer > disease_timer then |
|
321 |
timer = 0 |
|
322 |
SetHealth(mutant, GetHealth(mutant)-disease ) |
|
323 |
AddVisualGear(GetX(mutant), GetY(mutant)-5, vgtHealthTag, disease, true) |
|
324 |
if GetHealth(mutant)<=0 then |
|
325 |
SetHealth(mutant,0) |
|
326 |
mt_hurt= false |
|
327 |
setGearValue(mutant,"SelfDestruct",true) |
|
12341
c73521104fac
Mutant: Fix “Boring” taunt being played when becoming the mutant
Wuzzy <almikes@aol.com>
parents:
12335
diff
changeset
|
328 |
EndTurn() |
11015 | 329 |
end |
330 |
end |
|
331 |
end |
|
332 |
||
333 |
end |
|
334 |
||
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
|
335 |
--[[ |
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 |
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
|
337 |
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
|
338 |
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
|
339 |
]] |
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 |
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
|
341 |
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
|
342 |
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
|
343 |
-- 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
|
344 |
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
|
345 |
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
|
346 |
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
|
347 |
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
|
348 |
-- 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
|
349 |
-- 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
|
350 |
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
|
351 |
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
|
352 |
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
|
353 |
-- 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
|
354 |
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
|
355 |
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
|
356 |
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
|
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 |
|
11015 | 359 |
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
|
360 |
exposeIdentityTheft(gear) |
11015 | 361 |
setGearValue(gear,"Name",GetHogName(gear)) |
362 |
setGearValue(gear,"Hat",GetHogHat(gear)) |
|
363 |
end |
|
364 |
||
365 |
function armageddon(gear) |
|
366 |
SetState(gear, gstLoser) |
|
13108 | 367 |
SetEffect(gear, heResurrectable, 0) |
11015 | 368 |
SetHealth(gear, 0) |
369 |
end |
|
370 |
||
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
|
371 |
function renderScores() |
11015 | 372 |
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
|
373 |
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
|
374 |
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
|
375 |
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
|
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 |
|
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 |
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
|
379 |
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
|
380 |
|
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 |
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
|
382 |
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
|
383 |
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
|
384 |
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
|
385 |
|
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 |
-- 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
|
387 |
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
|
388 |
--- 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
|
389 |
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
|
390 |
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
|
391 |
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
|
392 |
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
|
393 |
--- 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
|
394 |
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
|
395 |
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
|
396 |
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
|
397 |
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
|
398 |
--- 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
|
399 |
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
|
400 |
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
|
401 |
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
|
402 |
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
|
403 |
--- 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
|
404 |
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
|
405 |
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
|
406 |
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
|
407 |
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
|
408 |
--- 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
|
409 |
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
|
410 |
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
|
411 |
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
|
412 |
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
|
413 |
--- 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
|
414 |
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
|
415 |
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
|
416 |
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
|
417 |
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
|
418 |
--- 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
|
419 |
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
|
420 |
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
|
421 |
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
|
422 |
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
|
423 |
|
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 |
-- 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
|
425 |
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
|
426 |
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
|
427 |
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
|
428 |
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
|
429 |
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
|
430 |
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
|
431 |
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
|
432 |
|
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 |
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
|
434 |
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
|
435 |
|
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 |
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
|
437 |
-- 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
|
438 |
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
|
439 |
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
|
440 |
|
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 |
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
|
442 |
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
|
443 |
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
|
444 |
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
|
445 |
|
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 |
-- 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
|
447 |
return teamsSorted[1] |
11015 | 448 |
end |
449 |
end |
|
450 |
||
451 |
function checkScore() |
|
452 |
local lowest_score_team = nil |
|
453 |
local min_score=nil |
|
454 |
local winTeam = nil |
|
455 |
||
456 |
local only_low_score = true |
|
457 |
||
458 |
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
|
459 |
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
|
460 |
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
|
461 |
local curr_score = getTeamValue(teamName, "Score") |
11015 | 462 |
|
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
|
463 |
runOnHogsInTeam(removeFeeder, teamName) |
11015 | 464 |
|
465 |
if curr_score >= winScore then |
|
466 |
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
|
467 |
winTeam = teamName |
11015 | 468 |
end |
469 |
||
470 |
if min_score==nil then |
|
471 |
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
|
472 |
lowest_score_team = teamName |
11015 | 473 |
else |
474 |
if curr_score <= min_score then |
|
475 |
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
|
476 |
if getTeamValue(teamName, "DeadHogs") == getTeamValue(lowest_score_team, "DeadHogs") then |
11015 | 477 |
only_low_score = false |
478 |
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
|
479 |
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
|
480 |
lowest_score_team = teamName |
11015 | 481 |
end |
482 |
only_low_score = true |
|
483 |
end |
|
484 |
||
485 |
else |
|
486 |
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
|
487 |
lowest_score_team = teamName |
11015 | 488 |
only_low_score = true |
489 |
end |
|
490 |
end |
|
491 |
end |
|
492 |
end |
|
493 |
end |
|
494 |
||
495 |
if gameOver then |
|
12341
c73521104fac
Mutant: Fix “Boring” taunt being played when becoming the mutant
Wuzzy <almikes@aol.com>
parents:
12335
diff
changeset
|
496 |
EndTurn(true) |
11909 | 497 |
|
498 |
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
|
499 |
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
|
500 |
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
|
501 |
runOnHogsInTeam(armageddon, teamName) |
11015 | 502 |
end |
503 |
end |
|
504 |
||
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
|
505 |
createEndGameStats() |
11015 | 506 |
else |
507 |
||
508 |
if only_low_score then |
|
509 |
runOnHogsInTeam(setFeeder, lowest_score_team) |
|
510 |
end |
|
511 |
||
512 |
if meh == false then |
|
513 |
meh = true |
|
514 |
end |
|
515 |
||
516 |
end |
|
517 |
end |
|
518 |
||
519 |
function backToNormal(gear) |
|
520 |
SetHogName(gear, getGearValue(gear,"Name")) |
|
521 |
SetHogHat(gear, 'NoHat') |
|
522 |
SetHogHat(gear, getGearValue(gear,"Hat")) |
|
523 |
setGearValue(mutant,"SelfDestruct",false) |
|
524 |
mt_hurt=false |
|
525 |
mutant=nil |
|
526 |
end |
|
527 |
||
528 |
function setAIHints() |
|
529 |
for i = 0, #hhs do |
|
530 |
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
|
531 |
SetGearAIHints(hhs[i], aihUsualProcessing) |
11015 | 532 |
else |
533 |
SetGearAIHints(hhs[i], aihDoesntMatter) |
|
534 |
end |
|
535 |
end |
|
536 |
end |
|
537 |
||
538 |
function removeFeeder(gear) |
|
539 |
if gear~=nil then |
|
540 |
setGearValue(gear,"Feeder",false) |
|
541 |
if gear~= mutant then |
|
542 |
SetHogName(gear, getGearValue(gear,"Name") ) |
|
543 |
SetHogHat(gear, 'NoHat') |
|
544 |
SetHogHat(gear, getGearValue(gear,"Hat")) |
|
545 |
end |
|
546 |
end |
|
547 |
end |
|
548 |
||
549 |
function setFeeder(gear) |
|
550 |
if gear~= mutant and gear~= nil then |
|
11909 | 551 |
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
|
552 |
SetHogHat(gear, feederHat) |
11015 | 553 |
setGearValue(gear,"Feeder", true) |
554 |
end |
|
555 |
end |
|
556 |
||
557 |
function setMutantStuff(gear) |
|
558 |
mutant = gear |
|
559 |
||
11909 | 560 |
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
|
561 |
SetHogHat(gear, mutantHat) |
11015 | 562 |
SetHealth(gear, ( mutant_base_health + numhhs*25) ) |
563 |
SetEffect(gear, hePoisoned, 1) |
|
564 |
setGearValue(mutant,"SelfDestruct",false) |
|
565 |
setGearValue(gear, "Feeder", false) |
|
566 |
||
11909 | 567 |
AddCaption(string.format(loc("%s has mutated! +2 points"), getGearValue(gear, "Name")), GetClanColor(GetHogClan(gear)), capgrpMessage) |
11015 | 568 |
|
12430
c461a224ec09
Mutant: Fix turn skip of next hog after mutating when TurnTimeLeft = 0
Wuzzy <almikes@aol.com>
parents:
12341
diff
changeset
|
569 |
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
|
570 |
EndTurn(true) |
c461a224ec09
Mutant: Fix turn skip of next hog after mutating when TurnTimeLeft = 0
Wuzzy <almikes@aol.com>
parents:
12341
diff
changeset
|
571 |
end |
11015 | 572 |
|
573 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
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 |
PlaySound(sndSuddenDeath) |
|
579 |
end |
|
580 |
||
581 |
function teamScan() |
|
582 |
||
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
|
583 |
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
|
584 |
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
|
585 |
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
|
586 |
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
|
587 |
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
|
588 |
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
|
589 |
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
|
590 |
setTeamValue(teamName, "DeadHogs",0) |
11015 | 591 |
end |
592 |
||
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
|
593 |
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
|
594 |
|
11015 | 595 |
---***--- |
596 |
end |
|
597 |
||
598 |
function set_Mutant_and_Score(gear) |
|
599 |
||
600 |
local curr_team = GetHogTeamName(CurrentHedgehog) |
|
601 |
||
602 |
if gear == CurrentHedgehog then |
|
603 |
if CurrentHedgehog == mutant then |
|
604 |
PlaySound(sndHomerun) |
|
605 |
if getGearValue(gear, "SelfDestruct")==false then |
|
606 |
decreaseTeamValue(curr_team,"Score") |
|
607 |
end |
|
608 |
backToNormal(gear) |
|
609 |
else |
|
610 |
decreaseTeamValue(curr_team,"Score") |
|
611 |
end |
|
612 |
||
613 |
else |
|
614 |
if gear == mutant then |
|
615 |
backToNormal(mutant) |
|
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 |
end |
|
621 |
else |
|
622 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment)) |
|
11909 | 623 |
increaseTeamValue(curr_team,"Suicides") |
624 |
if(getTeamValue(curr_team, "Suicides") > recordSuicides) then |
|
625 |
recordSuicides = getTeamValue(curr_team, "Suicides") |
|
626 |
recordSuicidesHogName = getGearValue(CurrentHedgehog, "Name") |
|
627 |
recordSuicidesTeamName = curr_team |
|
628 |
end |
|
629 |
AddCaption(loc("-1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage) |
|
11015 | 630 |
end |
631 |
else |
|
632 |
if mutant==nil then |
|
633 |
if curr_team ~=GetHogTeamName(gear) then |
|
634 |
if getGearValue(CurrentHedgehog, "Alive") then |
|
635 |
setMutantStuff(CurrentHedgehog) |
|
636 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") + mutant_kill_reward)) |
|
637 |
else |
|
638 |
increaseTeamValue(curr_team,"Score") |
|
639 |
end |
|
640 |
else |
|
641 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment)) |
|
11909 | 642 |
increaseTeamValue(curr_team,"Suicides") |
643 |
if(getTeamValue(curr_team, "Suicides") > recordSuicides) then |
|
644 |
recordSuicides = getTeamValue(curr_team, "Suicides") |
|
645 |
recordSuicidesHogName = getGearValue(CurrentHedgehog, "Name") |
|
646 |
recordSuicidesTeamName = curr_team |
|
647 |
end |
|
648 |
AddCaption(loc("-1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage) |
|
11015 | 649 |
end |
650 |
else |
|
651 |
if curr_team ~=GetHogTeamName(gear) then |
|
652 |
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
|
653 |
HealHog(CurrentHedgehog, kill_reward) |
12288
a5a7d0c6d3f3
Fix incorrect Mutant score message color
Wuzzy <almikes@aol.com>
parents:
11909
diff
changeset
|
654 |
AddCaption(loc("+1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage) |
11015 | 655 |
increaseTeamValue(curr_team,"Score") |
656 |
end |
|
657 |
if getGearValue(CurrentHedgehog,"Feeder") then |
|
658 |
increaseTeamValue(curr_team,"Score") |
|
11909 | 659 |
AddCaption(loc("+1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage) |
11015 | 660 |
end |
661 |
else |
|
662 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment)) |
|
11909 | 663 |
AddCaption(loc("+1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage) |
11015 | 664 |
end |
665 |
end |
|
666 |
end |
|
667 |
end |
|
668 |
end |
|
669 |
||
670 |
function onGearResurrect(gear) |
|
671 |
if not gameOver then |
|
672 |
if GetGearType(gear) == gtHedgehog then |
|
673 |
||
674 |
increaseTeamValue(GetHogTeamName(gear), "DeadHogs") |
|
11909 | 675 |
totalKills = totalKills + 1 |
676 |
if(getTeamValue(GetHogTeamName(gear), "DeadHogs") > recordDeaths) then |
|
677 |
recordDeaths = getTeamValue(GetHogTeamName(gear), "DeadHogs") |
|
678 |
recordDeathsHogName = getGearValue(gear, "Name") |
|
679 |
recordDeathsTeamName = GetHogTeamName(gear) |
|
680 |
end |
|
11015 | 681 |
|
682 |
if gear==CurrentHedgehog then |
|
683 |
setGearValue(CurrentHedgehog, "Alive", false) |
|
684 |
end |
|
685 |
set_Mutant_and_Score(gear) |
|
686 |
if gear~=CurrentHedgehog then |
|
687 |
killsCounter = killsCounter + 1 |
|
688 |
countBodies() |
|
689 |
end |
|
690 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
691 |
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
|
692 |
renderScores() |
11015 | 693 |
end |
694 |
end |
|
695 |
end |
|
696 |
||
11909 | 697 |
function onGearDamage(gear, damage) |
698 |
if not gameOver and GetGearType(gear) == gtHedgehog then |
|
699 |
totalDamage = totalDamage + damage |
|
700 |
end |
|
701 |
end |
|
702 |
||
13172
159004144897
Use onSkipTurn in scripts to detect turn skips
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
703 |
function onSkipTurn() |
11909 | 704 |
-- Record skips for achievement |
13172
159004144897
Use onSkipTurn in scripts to detect turn skips
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
705 |
local team = GetHogTeamName(CurrentHedgehog) |
159004144897
Use onSkipTurn in scripts to detect turn skips
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
706 |
increaseTeamValue(team, "Skips") |
159004144897
Use onSkipTurn in scripts to detect turn skips
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
707 |
if(getTeamValue(team, "Skips") > recordSkips) then |
159004144897
Use onSkipTurn in scripts to detect turn skips
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
708 |
recordSkips = getTeamValue(team, "Skips") |
159004144897
Use onSkipTurn in scripts to detect turn skips
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
709 |
recordSkipsHogName = getGearValue(CurrentHedgehog, "Name") |
159004144897
Use onSkipTurn in scripts to detect turn skips
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
710 |
recordSkipsTeamName = team |
11909 | 711 |
end |
712 |
end |
|
713 |
||
11015 | 714 |
function onGearAdd(gear) |
715 |
||
716 |
-- Catch hedgehogs for the tracker |
|
717 |
if GetGearType(gear) == gtHedgehog then |
|
718 |
trackGear(gear) |
|
719 |
hhs[numhhs] = gear |
|
720 |
numhhs = numhhs + 1 |
|
721 |
SetEffect(gear, heResurrectable, 1) |
|
13219
b229b3259a76
Mutant: Fix graph title on game draw
Wuzzy <Wuzzy2@mail.ru>
parents:
13172
diff
changeset
|
722 |
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
|
723 |
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
|
724 |
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
|
725 |
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
|
726 |
SendStat(siGameResult, string.format(loc("%s wins!"), winner)) |
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 |
AddCaption(string.format(loc("%s wins!"), winner), 0xFFFFFFFF, capgrpGameState) |
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
728 |
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
|
729 |
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
|
730 |
end |
11015 | 731 |
end |
732 |
end |
|
733 |
||
734 |
function checkEmptyTeam (teamName) |
|
735 |
for i=0 , #hhs do |
|
736 |
if hhs[i]~=nil then |
|
737 |
if teamName == GetHogTeamName(hhs[i]) then |
|
738 |
return false |
|
739 |
end |
|
740 |
end |
|
741 |
end |
|
742 |
return true |
|
743 |
end |
|
744 |
||
745 |
function onGearDelete(gear) |
|
746 |
-- Remove hogs that are gone |
|
747 |
if GetGearType(gear) == gtHedgehog then |
|
748 |
numhhs = numhhs - 1 |
|
749 |
||
750 |
local found |
|
751 |
for i=0, #hhs do |
|
752 |
if hhs[i] == gear then |
|
753 |
found = i |
|
754 |
break |
|
755 |
end |
|
756 |
end |
|
757 |
for i = found, #hhs - 1 do |
|
758 |
hhs[i] = hhs[i + 1] |
|
759 |
end |
|
760 |
hhs[#hhs] = nil |
|
761 |
||
762 |
local t_name = GetHogTeamName(gear) |
|
763 |
if checkEmptyTeam(t_name) then |
|
764 |
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
|
765 |
if GetTeamName(i) == t_name then |
11015 | 766 |
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
|
767 |
teamsDead[t_name] = true |
11015 | 768 |
break |
769 |
end |
|
770 |
end |
|
771 |
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
|
772 |
if getGearValue(gear, "excess") ~= true and band(GetState(gear), gstDrowning) == 0 then |
13108 | 773 |
AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
774 |
end |
|
11015 | 775 |
trackDeletion(gear) |
11909 | 776 |
elseif GetGearType(gear) == gtCase then |
777 |
-- Check if a crate has been collected |
|
778 |
if band(GetGearMessage(gear), gmDestroy) ~= 0 and CurrentHedgehog ~= nil then |
|
779 |
-- Update crate collection achievement |
|
780 |
increaseTeamValue(GetHogTeamName(CurrentHedgehog), "Crates") |
|
781 |
if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Crates") > recordCrates) then |
|
782 |
recordCrates = getTeamValue(GetHogTeamName(CurrentHedgehog), "Crates") |
|
783 |
recordCratesHogName = getGearValue(CurrentHedgehog, "Name") |
|
784 |
recordCratesTeamName = GetHogTeamName(CurrentHedgehog) |
|
785 |
end |
|
786 |
end |
|
11015 | 787 |
end |
788 |
end |
|
789 |
||
790 |
function onParameters() |
|
791 |
parseParams() |
|
792 |
winScore = tonumber(params["winscore"]) or winScore |
|
793 |
end |
|
794 |
||
795 |
--[[ |
|
796 |
S T A R R I N G |
|
797 |
prof - Coding, implementing and evangelism |
|
798 |
vos - Initial idea and script improvements |
|
799 |
mikade - Moving the `how to play` into the game so that people know `how to play`, and whitespace :D |
|
800 |
--]] |