author | Wuzzy <Wuzzy2@mail.ru> |
Tue, 07 Jan 2020 13:21:04 +0100 | |
changeset 15559 | bbb98e22a303 |
parent 15483 | 19e987301674 |
child 16000 | a803428704fd |
permissions | -rw-r--r-- |
11015 | 1 |
--[[ ___ ___ |
2 |
( ) ( ) |
|
3 |
___ .-. .-. ___ ___ | |_ .---. ___ .-. | |_ |
|
4 |
( ) ' ( )( ( __) / .-, ( ) ( __) |
|
5 |
| .-. .-. | | | | | | (__) ; || .-. .| | |
|
6 |
| | | | | | | | | | | ___ .'` || | | || | ___ |
|
7 |
| | | | | | | | | | |( / .'| || | | || |( ) |
|
8 |
| | | | | | | | | | | | | / | || | | || | | | |
|
9 |
| | | | | | | ; ' | ' | ; | ; || | | || ' | | |
|
10 |
| | | | | ' `-' / ' `-' ' `-' || | | |' `-' ; |
|
11 |
(___)(___)(___'.__.' `.__.`.__.'_(___)(___)`.__. |
|
12 |
||
13 |
||
14 |
---- Recommended settings: |
|
14290
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14287
diff
changeset
|
15 |
---- * one hedgehog per team (forced by game) |
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14287
diff
changeset
|
16 |
---- * one team per clan |
11015 | 17 |
---- * 'Small' one-island map |
18 |
||
19 |
--]] |
|
20 |
||
21 |
HedgewarsScriptLoad("/Scripts/Locale.lua") |
|
22 |
HedgewarsScriptLoad("/Scripts/Tracker.lua") |
|
23 |
HedgewarsScriptLoad("/Scripts/Params.lua") |
|
24 |
||
25 |
--[[ |
|
26 |
MUTANT SCRIPT |
|
14290
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14287
diff
changeset
|
27 |
]] |
11015 | 28 |
|
29 |
local hhs = {} |
|
14285 | 30 |
local crates = {} |
11015 | 31 |
local numhhs = 0 |
32 |
local meh = false |
|
33 |
||
34 |
local gameOver=false |
|
35 |
||
36 |
local mutant = nil |
|
37 |
local mutant_base_health = 200 |
|
38 |
local mutant_base_disease = 25 |
|
39 |
local disease_timer = 2000 |
|
40 |
||
41 |
local kill_reward = nil |
|
42 |
local mt_hurt=false |
|
43 |
||
44 |
local killsCounter = 0 |
|
45 |
||
46 |
local team_fire_punishment = 3 |
|
47 |
local mutant_kill_reward = 2 |
|
48 |
||
49 |
local hh_weapons = { amBazooka, amGrenade, amShotgun, amMine} |
|
50 |
||
51 |
local mt_weapons = {amWatermelon, amHellishBomb, amBallgun, amRCPlane, amTeleport} |
|
52 |
||
53 |
local disease=0 |
|
54 |
local timer=0 |
|
55 |
||
56 |
local winScore = 15 |
|
57 |
local hogsLimit = 1 |
|
58 |
||
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
|
59 |
local teamsDead = {} |
15290
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
60 |
local teamsDeleted = {} |
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
61 |
local hogLimitHit = false |
15483
19e987301674
Mutant: Add message for excess teams
Wuzzy <Wuzzy2@mail.ru>
parents:
15290
diff
changeset
|
62 |
local teamLimitHit = false |
15290
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
63 |
local cnthhs |
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 |
||
14290
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14287
diff
changeset
|
106 |
local mineStr |
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14287
diff
changeset
|
107 |
if MinesTime < 0 then |
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14287
diff
changeset
|
108 |
mineStr = loc("Mines time: 0s-5s") |
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14287
diff
changeset
|
109 |
else |
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14287
diff
changeset
|
110 |
mineStr = string.format(loc("Mines explode after %d s."), div(MinesTime, 1000)) |
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14287
diff
changeset
|
111 |
end |
14285 | 112 |
local ruleSet = loc("Hedgehogs will be revived after their death.") .. "|" .. |
14290
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14287
diff
changeset
|
113 |
mineStr .. "|" .. |
14285 | 114 |
loc("The first hedgehog to kill someone becomes the Mutant.") .. "|" .. |
115 |
loc("The Mutant has super weapons and a lot of health.") .. "|" .. |
|
116 |
loc("The Mutant loses health quickly, but gains health by killing.") .. "|" .. |
|
117 |
" |" .. |
|
118 |
loc("Score points by killing other hedgehogs.") .. "|" .. |
|
119 |
loc("The hedgehog with least points (or most deaths) becomes the Bottom Feeder.") .. "|" .. |
|
120 |
loc("The score and deaths are shown next to the team bar.") .. "|" .. |
|
121 |
string.format(loc("Goal: Score %d points or more to win!"), winScore) .. "|" .. |
|
11909 | 122 |
" |" .. |
14285 | 123 |
loc("Scoring: ") .. "|" .. |
124 |
loc("+2 for becoming the Mutant") .. "|" .. |
|
125 |
loc("+1 to the Mutant for killing anyone") .. "|" .. |
|
126 |
loc("+1 to the Bottom Feeder for killing anyone") .. "|" .. |
|
127 |
loc("-1 to anyone for a suicide") |
|
11015 | 128 |
|
14285 | 129 |
return ruleSet |
11909 | 130 |
|
131 |
end |
|
132 |
||
133 |
function showStartingInfo() |
|
134 |
||
15090
e16f906224fd
Change mission panel icons for a couple of game styles
Wuzzy <Wuzzy2@mail.ru>
parents:
15010
diff
changeset
|
135 |
ShowMission(loc("Mutant"), loc("A Hedgewars tag game"), rules(), -amWatermelon, 5000) |
11015 | 136 |
|
137 |
end |
|
138 |
||
139 |
function onGameInit() |
|
14290
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14287
diff
changeset
|
140 |
-- Sudden Death would be weird |
11015 | 141 |
WaterRise = 0 |
11909 | 142 |
HealthDecrease = 0 |
14290
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14287
diff
changeset
|
143 |
-- Weapons must be reset for the Mutant mechanic to work |
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14287
diff
changeset
|
144 |
EnableGameFlags(gfResetWeps) |
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14287
diff
changeset
|
145 |
-- King Mode messes with game too much |
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14287
diff
changeset
|
146 |
DisableGameFlags(gfKing) |
11015 | 147 |
end |
148 |
||
149 |
||
15290
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
150 |
function limitHogsTeam(gear) |
11015 | 151 |
cnthhs = cnthhs + 1 |
13108 | 152 |
if cnthhs > 1 then |
153 |
hogLimitHit = true |
|
154 |
SetEffect(gear, heResurrectable, 0) |
|
155 |
setGearValue(gear, "excess", true) |
|
156 |
DeleteGear(gear) |
|
157 |
end |
|
11015 | 158 |
end |
159 |
||
15290
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
160 |
function limitHogsClan(gear) |
15483
19e987301674
Mutant: Add message for excess teams
Wuzzy <Wuzzy2@mail.ru>
parents:
15290
diff
changeset
|
161 |
teamLimitHit = true |
15290
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
162 |
SetEffect(gear, heResurrectable, 0) |
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
163 |
setGearValue(gear, "excess", true) |
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
164 |
DeleteGear(gear) |
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
165 |
end |
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
166 |
|
11015 | 167 |
function onGameStart() |
13798
e874bfe563c7
Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents:
13685
diff
changeset
|
168 |
if ClansCount >= 2 then |
e874bfe563c7
Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents:
13685
diff
changeset
|
169 |
SendHealthStatsOff() |
e874bfe563c7
Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents:
13685
diff
changeset
|
170 |
SendAchievementsStatsOff() |
e874bfe563c7
Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents:
13685
diff
changeset
|
171 |
end |
12335
8f693d25be2f
Show traditional winning animation in Mutant again
Wuzzy <almikes@aol.com>
parents:
12288
diff
changeset
|
172 |
SendRankingStatsOff() |
11015 | 173 |
trackTeams() |
174 |
teamScan() |
|
175 |
runOnHogs(saveStuff) |
|
176 |
||
15290
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
177 |
-- Enforce team and hog limits |
11015 | 178 |
hogLimitHit = false |
15290
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
179 |
|
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
180 |
-- Rule 1: One team per clan |
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
181 |
if TeamsCount > ClansCount then |
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
182 |
local usedClans = {} |
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
183 |
for i=0, TeamsCount - 1 do |
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
184 |
local teamName = GetTeamName(i) |
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
185 |
local clanNumber = GetTeamClan(teamName) |
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
186 |
if not usedClans[clanNumber] then |
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
187 |
usedClans[clanNumber] = true |
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
188 |
else |
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
189 |
runOnHogsInTeam(limitHogsClan, teamName) |
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
190 |
teamsDeleted[teamName] = true |
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
191 |
setTeamValue(teamName, "Score", getTeamValue(teamName, "Score") -99999) |
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
192 |
end |
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
193 |
end |
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
194 |
end |
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
195 |
|
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
196 |
-- Rule 2: One hog per team |
11015 | 197 |
for i=0 , TeamsCount - 1 do |
198 |
cnthhs = 0 |
|
15290
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
199 |
runOnHogsInTeam(limitHogsTeam, GetTeamName(i)) |
11015 | 200 |
end |
15483
19e987301674
Mutant: Add message for excess teams
Wuzzy <Wuzzy2@mail.ru>
parents:
15290
diff
changeset
|
201 |
if teamLimitHit then |
19e987301674
Mutant: Add message for excess teams
Wuzzy <Wuzzy2@mail.ru>
parents:
15290
diff
changeset
|
202 |
WriteLnToChat(loc("Only one team per clan allowed! Excess teams will be removed.")) |
19e987301674
Mutant: Add message for excess teams
Wuzzy <Wuzzy2@mail.ru>
parents:
15290
diff
changeset
|
203 |
end |
11015 | 204 |
if hogLimitHit then |
13108 | 205 |
WriteLnToChat(loc("Only one hog per team allowed! Excess hogs will be removed.")) |
11015 | 206 |
end |
15290
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
207 |
trackTeams() |
11015 | 208 |
showStartingInfo() |
209 |
end |
|
210 |
||
211 |
||
212 |
||
213 |
function giveWeapons(gear) |
|
214 |
if gear == mutant then |
|
215 |
AddAmmo(gear, amRope) |
|
216 |
for i=1, #mt_weapons do |
|
217 |
AddAmmo(gear, mt_weapons[i]) |
|
218 |
end |
|
219 |
||
220 |
else |
|
221 |
for i=1, #hh_weapons do |
|
222 |
AddAmmo(gear,hh_weapons[i]) |
|
223 |
end |
|
224 |
end |
|
225 |
end |
|
226 |
||
227 |
function onAmmoStoreInit() |
|
228 |
||
229 |
SetAmmo(amSkip, 9, 0, 0, 0) |
|
230 |
SetAmmo(amRope,0,1,0,5) |
|
231 |
SetAmmo(amSnowball,0,1,0,1) |
|
232 |
||
233 |
for i=1, #hh_weapons do |
|
234 |
SetAmmo(hh_weapons[i], 0, 0, 0, 1) |
|
235 |
end |
|
236 |
||
237 |
for i=1, #mt_weapons do |
|
238 |
SetAmmo(mt_weapons[i], 0, 3, 0, 1) |
|
239 |
end |
|
240 |
||
241 |
end |
|
242 |
||
243 |
function drawCircles() |
|
244 |
for i = 0, #hhs do |
|
245 |
if circles[hhs[i]] ~= nil then |
|
246 |
DeleteVisualGear(circles[hhs[i]]) |
|
247 |
circles[hhs[i]] = nil |
|
248 |
end |
|
249 |
||
250 |
if hhs[i] ~= CurrentHedgehog then |
|
251 |
if mutant == nil then |
|
252 |
circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false) |
|
253 |
SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 5, 0xff000080) |
|
254 |
elseif CurrentHedgehog == mutant then |
|
255 |
circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false) |
|
256 |
SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 3, 0xaa000070) |
|
257 |
elseif getGearValue(CurrentHedgehog, "Feeder") and hhs[i] ~= mutant then |
|
258 |
circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false) |
|
259 |
SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 3, 0xaa000070) |
|
260 |
elseif hhs[i] == mutant then |
|
261 |
circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false) |
|
262 |
SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 5, 0xff000080) |
|
263 |
end |
|
264 |
end |
|
265 |
end |
|
266 |
circleFrame = 0 |
|
267 |
end |
|
268 |
||
269 |
function onNewTurn() |
|
270 |
||
271 |
killsCounter = 0 |
|
272 |
||
14290
47af42f7ca8b
Add Mutant game scheme, and adapt Mutant for the newly unlocked settings
Wuzzy <Wuzzy2@mail.ru>
parents:
14287
diff
changeset
|
273 |
if mutant == nil and TotalRounds >= 0 then |
13643 | 274 |
AddCaption( loc("First killer will mutate"), capcolDefault, capgrpGameState ) |
11015 | 275 |
end |
276 |
||
277 |
checkScore() |
|
11909 | 278 |
|
279 |
for i=0, TeamsCount-1 do |
|
15290
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
280 |
local teamName = GetTeamName(i) |
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
281 |
if not teamsDeleted[teamName] then |
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
282 |
SendStat(siClanHealth, getTeamValue(teamName, "Score"), teamName) |
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
283 |
end |
11909 | 284 |
end |
285 |
||
11015 | 286 |
giveWeapons(CurrentHedgehog) |
287 |
drawCircles() |
|
288 |
setAIHints() |
|
289 |
kill_reward= numhhs*10 |
|
290 |
||
291 |
if CurrentHedgehog == mutant then |
|
292 |
mt_hurt=true |
|
293 |
disease= mutant_base_disease - numhhs |
|
294 |
else |
|
295 |
mt_hurt=false |
|
296 |
end |
|
297 |
||
298 |
setGearValue(CurrentHedgehog, "Alive", true) |
|
299 |
||
300 |
end |
|
301 |
||
302 |
function countBodies() |
|
303 |
if killsCounter == 2 then |
|
13643 | 304 |
AddCaption(loc("Double kill!"), capcolDefault, capgrpGameState ) |
11015 | 305 |
elseif killsCounter == 3 then |
13643 | 306 |
AddCaption(loc("Mega kill!"), capcolDefault, capgrpGameState ) |
11015 | 307 |
PlaySound(sndRegret) |
308 |
elseif killsCounter == 4 then |
|
13643 | 309 |
AddCaption(loc("Ultra kill!"), capcolDefault, capgrpGameState ) |
11015 | 310 |
elseif killsCounter == 5 then |
13643 | 311 |
AddCaption(loc("Monster kill!"), capcolDefault, capgrpGameState ) |
11015 | 312 |
PlaySound(sndIllGetYou) |
313 |
elseif killsCounter == 6 then |
|
13643 | 314 |
AddCaption(loc("Ludicrous kill!"), capcolDefault, capgrpGameState ) |
11015 | 315 |
PlaySound(sndNutter) |
316 |
elseif killsCounter == 7 then |
|
13643 | 317 |
AddCaption(loc("Holy shit!"), capcolDefault, capgrpGameState ) |
11015 | 318 |
PlaySound(sndLaugh) |
319 |
elseif killsCounter > 8 then |
|
13643 | 320 |
AddCaption(loc("Insanity!"), capcolDefault, capgrpGameState ) |
11909 | 321 |
end |
322 |
||
323 |
if killsCounter > recordKills then |
|
324 |
recordKills = killsCounter |
|
325 |
recordKillsHogName = getGearValue(CurrentHedgehog, "Name") |
|
326 |
recordKillsTeamName = GetHogTeamName(CurrentHedgehog) |
|
11015 | 327 |
end |
328 |
end |
|
329 |
||
330 |
function onGameTick() |
|
331 |
||
332 |
if circleFrame > -1 then |
|
333 |
for i = 0, #hhs do |
|
334 |
if circles[hhs[i]] ~= nil and hhs[i]~= nil then |
|
335 |
hhx, hhy = GetGearPosition(hhs[i]) |
|
13685
09ea1faf97ca
Remove calls to GetVisualGearValues where it's not needed
Wuzzy <Wuzzy2@mail.ru>
parents:
13643
diff
changeset
|
336 |
SetVisualGearValues(circles[hhs[i]], hhx + 1, hhy - 3, 0, 0, 0, 0, 0, 40 - (circleFrame % 25)) |
11015 | 337 |
end |
338 |
end |
|
339 |
||
340 |
circleFrame = circleFrame + 0.06 |
|
341 |
||
342 |
if circleFrame >= 25 then |
|
343 |
for i = 0, #hhs do |
|
344 |
if circles[hhs[i]] ~= nil then |
|
345 |
DeleteVisualGear(circles[hhs[i]]) |
|
346 |
circles[hhs[i]] = nil |
|
347 |
end |
|
348 |
end |
|
349 |
end |
|
350 |
end |
|
351 |
||
14346
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14290
diff
changeset
|
352 |
if (TurnTimeLeft==0 or band(GetState(mutant), gstHHDriven) == 0) and mt_hurt then |
11015 | 353 |
mt_hurt = false |
354 |
end |
|
355 |
||
14346
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14290
diff
changeset
|
356 |
-- Mutant's disease |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14290
diff
changeset
|
357 |
-- Hurt Mutant during its turn time |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14290
diff
changeset
|
358 |
-- Mutant's health is safe in ready phase |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14290
diff
changeset
|
359 |
if mt_hurt and mutant~=nil and ReadyTimeLeft == 0 then |
11015 | 360 |
timer = timer + 1 |
14346
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14290
diff
changeset
|
361 |
if timer > disease_timer then |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14290
diff
changeset
|
362 |
timer = 0 |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14290
diff
changeset
|
363 |
local h = GetHealth(mutant)-disease |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14290
diff
changeset
|
364 |
SetHealth(mutant, h) |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14290
diff
changeset
|
365 |
-- Low health warning |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14290
diff
changeset
|
366 |
if h <= 75 then |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14290
diff
changeset
|
367 |
PlaySound(sndPoisonMoan, mutant) |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14290
diff
changeset
|
368 |
elseif h <= 150 then |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14290
diff
changeset
|
369 |
PlaySound(sndPoisonCough, mutant) |
11015 | 370 |
end |
14346
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14290
diff
changeset
|
371 |
local tag = AddVisualGear(GetX(mutant), GetY(mutant)-5, vgtHealthTag, disease, true) |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14290
diff
changeset
|
372 |
SetVisualGearValues(tag, nil, nil, nil, nil, nil, nil, nil, nil, nil, GetClanColor(GetHogClan(mutant))) |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14290
diff
changeset
|
373 |
if GetHealth(mutant)<=0 then |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14290
diff
changeset
|
374 |
SetHealth(mutant,0) |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14290
diff
changeset
|
375 |
mt_hurt= false |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14290
diff
changeset
|
376 |
setGearValue(mutant,"SelfDestruct",true) |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14290
diff
changeset
|
377 |
EndTurn() |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14290
diff
changeset
|
378 |
end |
bd2bbd607f5e
Mutant: Don't reduce mutant health in ready phase. Play poison hurt sound as health warning
Wuzzy <Wuzzy2@mail.ru>
parents:
14290
diff
changeset
|
379 |
end |
11015 | 380 |
end |
381 |
||
382 |
end |
|
383 |
||
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
|
384 |
--[[ |
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
|
385 |
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
|
386 |
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
|
387 |
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
|
388 |
]] |
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
|
389 |
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
|
390 |
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
|
391 |
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
|
392 |
-- 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
|
393 |
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
|
394 |
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
|
395 |
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
|
396 |
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
|
397 |
-- 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
|
398 |
-- 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
|
399 |
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
|
400 |
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
|
401 |
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
|
402 |
-- 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
|
403 |
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
|
404 |
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
|
405 |
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
|
406 |
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
|
407 |
|
11015 | 408 |
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
|
409 |
exposeIdentityTheft(gear) |
11015 | 410 |
setGearValue(gear,"Name",GetHogName(gear)) |
411 |
setGearValue(gear,"Hat",GetHogHat(gear)) |
|
412 |
end |
|
413 |
||
414 |
function armageddon(gear) |
|
415 |
SetState(gear, gstLoser) |
|
13108 | 416 |
SetEffect(gear, heResurrectable, 0) |
11015 | 417 |
SetHealth(gear, 0) |
418 |
end |
|
419 |
||
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
|
420 |
function renderScores() |
11015 | 421 |
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
|
422 |
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
|
423 |
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
|
424 |
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
|
425 |
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
|
426 |
|
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 |
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
|
428 |
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
|
429 |
|
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 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
|
431 |
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
|
432 |
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
|
433 |
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
|
434 |
|
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 |
-- 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
|
436 |
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
|
437 |
--- 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
|
438 |
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
|
439 |
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
|
440 |
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
|
441 |
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
|
442 |
--- 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
|
443 |
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
|
444 |
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
|
445 |
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
|
446 |
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
|
447 |
--- 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
|
448 |
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
|
449 |
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
|
450 |
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
|
451 |
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
|
452 |
--- 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
|
453 |
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
|
454 |
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
|
455 |
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
|
456 |
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
|
457 |
--- 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
|
458 |
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
|
459 |
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
|
460 |
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
|
461 |
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
|
462 |
--- 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
|
463 |
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
|
464 |
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
|
465 |
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
|
466 |
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
|
467 |
--- 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
|
468 |
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
|
469 |
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
|
470 |
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
|
471 |
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
|
472 |
|
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 |
-- 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
|
474 |
local showScore = "" |
15010
5188ecbf726f
Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
14599
diff
changeset
|
475 |
local rank = 0 |
5188ecbf726f
Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
14599
diff
changeset
|
476 |
local rankPlus = 1 |
5188ecbf726f
Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
14599
diff
changeset
|
477 |
local prevScore |
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
|
478 |
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
|
479 |
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
|
480 |
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
|
481 |
local deaths = getTeamValue(teamsSorted[i], "DeadHogs") |
15010
5188ecbf726f
Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
14599
diff
changeset
|
482 |
if i == 1 or score < prevScore then |
5188ecbf726f
Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
14599
diff
changeset
|
483 |
rank = rank + rankPlus |
5188ecbf726f
Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
14599
diff
changeset
|
484 |
rankPlus = 1 |
5188ecbf726f
Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
14599
diff
changeset
|
485 |
prevScore = score |
5188ecbf726f
Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
14599
diff
changeset
|
486 |
else |
5188ecbf726f
Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
14599
diff
changeset
|
487 |
rankPlus = rankPlus + 1 |
5188ecbf726f
Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
14599
diff
changeset
|
488 |
end |
5188ecbf726f
Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
14599
diff
changeset
|
489 |
SendStat(siPointType, "!POINTS") |
5188ecbf726f
Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents:
14599
diff
changeset
|
490 |
SendStat(siTeamRank, rank) |
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
|
491 |
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
|
492 |
|
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
493 |
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
|
494 |
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
|
495 |
|
1c390781f72f
Mutant: When game ends prematurely due to missing land, declare highest-scoring team the winner
Wuzzy <Wuzzy2@mail.ru>
parents:
13219
diff
changeset
|
496 |
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
|
497 |
-- 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
|
498 |
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
|
499 |
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
|
500 |
|
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 |
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
|
502 |
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
|
503 |
string.format(loc("Winner: %s"), teamsSorted[1]) .. "| |" .. loc("Scores:") .. " |" .. |
15090
e16f906224fd
Change mission panel icons for a couple of game styles
Wuzzy <Wuzzy2@mail.ru>
parents:
15010
diff
changeset
|
504 |
showScore, 4, 15000) |
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 |
|
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 |
-- 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
|
507 |
return teamsSorted[1] |
11015 | 508 |
end |
509 |
end |
|
510 |
||
511 |
function checkScore() |
|
512 |
local lowest_score_team = nil |
|
513 |
local min_score=nil |
|
514 |
local winTeam = nil |
|
515 |
||
516 |
local only_low_score = true |
|
517 |
||
518 |
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
|
519 |
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
|
520 |
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
|
521 |
local curr_score = getTeamValue(teamName, "Score") |
11015 | 522 |
|
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
|
523 |
runOnHogsInTeam(removeFeeder, teamName) |
11015 | 524 |
|
525 |
if curr_score >= winScore then |
|
526 |
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
|
527 |
winTeam = teamName |
11015 | 528 |
end |
529 |
||
530 |
if min_score==nil then |
|
531 |
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
|
532 |
lowest_score_team = teamName |
11015 | 533 |
else |
534 |
if curr_score <= min_score then |
|
535 |
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
|
536 |
if getTeamValue(teamName, "DeadHogs") == getTeamValue(lowest_score_team, "DeadHogs") then |
11015 | 537 |
only_low_score = false |
538 |
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
|
539 |
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
|
540 |
lowest_score_team = teamName |
11015 | 541 |
end |
542 |
only_low_score = true |
|
543 |
end |
|
544 |
||
545 |
else |
|
546 |
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
|
547 |
lowest_score_team = teamName |
11015 | 548 |
only_low_score = true |
549 |
end |
|
550 |
end |
|
551 |
end |
|
552 |
end |
|
553 |
end |
|
554 |
||
555 |
if gameOver then |
|
12341
c73521104fac
Mutant: Fix “Boring” taunt being played when becoming the mutant
Wuzzy <almikes@aol.com>
parents:
12335
diff
changeset
|
556 |
EndTurn(true) |
11909 | 557 |
|
558 |
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
|
559 |
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
|
560 |
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
|
561 |
runOnHogsInTeam(armageddon, teamName) |
11015 | 562 |
end |
563 |
end |
|
564 |
||
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
|
565 |
createEndGameStats() |
11015 | 566 |
else |
567 |
||
568 |
if only_low_score then |
|
569 |
runOnHogsInTeam(setFeeder, lowest_score_team) |
|
570 |
end |
|
571 |
||
572 |
if meh == false then |
|
14285 | 573 |
meh = true |
574 |
end |
|
11015 | 575 |
|
576 |
end |
|
577 |
end |
|
578 |
||
579 |
function backToNormal(gear) |
|
580 |
SetHogName(gear, getGearValue(gear,"Name")) |
|
581 |
SetHogHat(gear, 'NoHat') |
|
582 |
SetHogHat(gear, getGearValue(gear,"Hat")) |
|
583 |
setGearValue(mutant,"SelfDestruct",false) |
|
584 |
mt_hurt=false |
|
585 |
mutant=nil |
|
586 |
end |
|
587 |
||
588 |
function setAIHints() |
|
589 |
for i = 0, #hhs do |
|
590 |
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
|
591 |
SetGearAIHints(hhs[i], aihUsualProcessing) |
11015 | 592 |
else |
593 |
SetGearAIHints(hhs[i], aihDoesntMatter) |
|
594 |
end |
|
595 |
end |
|
14287
9b5a8147386f
I think this is correct way to use iterate over it as a hashmap. don't have much lua practice
nemo
parents:
14286
diff
changeset
|
596 |
for k,v in pairs(crates) do |
9b5a8147386f
I think this is correct way to use iterate over it as a hashmap. don't have much lua practice
nemo
parents:
14286
diff
changeset
|
597 |
if CurrentHedgehog == mutant and v ~= nil then |
9b5a8147386f
I think this is correct way to use iterate over it as a hashmap. don't have much lua practice
nemo
parents:
14286
diff
changeset
|
598 |
SetGearAIHints(v, aihDoesntMatter) |
14285 | 599 |
else |
14287
9b5a8147386f
I think this is correct way to use iterate over it as a hashmap. don't have much lua practice
nemo
parents:
14286
diff
changeset
|
600 |
SetGearAIHints(v, aihUsualProcessing) |
14285 | 601 |
end |
602 |
end |
|
11015 | 603 |
end |
604 |
||
605 |
function removeFeeder(gear) |
|
606 |
if gear~=nil then |
|
607 |
setGearValue(gear,"Feeder",false) |
|
608 |
if gear~= mutant then |
|
609 |
SetHogName(gear, getGearValue(gear,"Name") ) |
|
610 |
SetHogHat(gear, 'NoHat') |
|
611 |
SetHogHat(gear, getGearValue(gear,"Hat")) |
|
612 |
end |
|
613 |
end |
|
614 |
end |
|
615 |
||
616 |
function setFeeder(gear) |
|
617 |
if gear~= mutant and gear~= nil then |
|
11909 | 618 |
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
|
619 |
SetHogHat(gear, feederHat) |
11015 | 620 |
setGearValue(gear,"Feeder", true) |
621 |
end |
|
622 |
end |
|
623 |
||
624 |
function setMutantStuff(gear) |
|
625 |
mutant = gear |
|
626 |
||
11909 | 627 |
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
|
628 |
SetHogHat(gear, mutantHat) |
11015 | 629 |
SetHealth(gear, ( mutant_base_health + numhhs*25) ) |
630 |
SetEffect(gear, hePoisoned, 1) |
|
631 |
setGearValue(mutant,"SelfDestruct",false) |
|
632 |
setGearValue(gear, "Feeder", false) |
|
633 |
||
11909 | 634 |
AddCaption(string.format(loc("%s has mutated! +2 points"), getGearValue(gear, "Name")), GetClanColor(GetHogClan(gear)), capgrpMessage) |
11015 | 635 |
|
12430
c461a224ec09
Mutant: Fix turn skip of next hog after mutating when TurnTimeLeft = 0
Wuzzy <almikes@aol.com>
parents:
12341
diff
changeset
|
636 |
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
|
637 |
EndTurn(true) |
c461a224ec09
Mutant: Fix turn skip of next hog after mutating when TurnTimeLeft = 0
Wuzzy <almikes@aol.com>
parents:
12341
diff
changeset
|
638 |
end |
11015 | 639 |
|
640 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
641 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
642 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
643 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
644 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
645 |
PlaySound(sndSuddenDeath) |
|
646 |
end |
|
647 |
||
648 |
function teamScan() |
|
649 |
||
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
|
650 |
for j=0, TeamsCount-1 do |
15290
96fbf9bb960a
Mutant: Remove excess teams if a clan has more than one team
Wuzzy <Wuzzy2@mail.ru>
parents:
15090
diff
changeset
|
651 |
local teamName = GetTeamName(j) |
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
|
652 |
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
|
653 |
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
|
654 |
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
|
655 |
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
|
656 |
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
|
657 |
setTeamValue(teamName, "DeadHogs",0) |
11015 | 658 |
end |
659 |
||
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
|
660 |
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
|
661 |
|
11015 | 662 |
---***--- |
663 |
end |
|
664 |
||
665 |
function set_Mutant_and_Score(gear) |
|
666 |
||
667 |
local curr_team = GetHogTeamName(CurrentHedgehog) |
|
668 |
||
669 |
if gear == CurrentHedgehog then |
|
670 |
if CurrentHedgehog == mutant then |
|
671 |
PlaySound(sndHomerun) |
|
672 |
if getGearValue(gear, "SelfDestruct")==false then |
|
673 |
decreaseTeamValue(curr_team,"Score") |
|
674 |
end |
|
675 |
backToNormal(gear) |
|
676 |
else |
|
677 |
decreaseTeamValue(curr_team,"Score") |
|
678 |
end |
|
679 |
||
680 |
else |
|
681 |
if gear == mutant then |
|
682 |
backToNormal(mutant) |
|
683 |
if curr_team ~=GetHogTeamName(gear) then |
|
684 |
if getGearValue(CurrentHedgehog, "Alive") then |
|
685 |
setMutantStuff(CurrentHedgehog) |
|
686 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") + mutant_kill_reward)) |
|
687 |
end |
|
688 |
else |
|
689 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment)) |
|
11909 | 690 |
increaseTeamValue(curr_team,"Suicides") |
691 |
if(getTeamValue(curr_team, "Suicides") > recordSuicides) then |
|
692 |
recordSuicides = getTeamValue(curr_team, "Suicides") |
|
693 |
recordSuicidesHogName = getGearValue(CurrentHedgehog, "Name") |
|
694 |
recordSuicidesTeamName = curr_team |
|
695 |
end |
|
696 |
AddCaption(loc("-1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage) |
|
11015 | 697 |
end |
698 |
else |
|
699 |
if mutant==nil then |
|
700 |
if curr_team ~=GetHogTeamName(gear) then |
|
701 |
if getGearValue(CurrentHedgehog, "Alive") then |
|
702 |
setMutantStuff(CurrentHedgehog) |
|
703 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") + mutant_kill_reward)) |
|
704 |
else |
|
705 |
increaseTeamValue(curr_team,"Score") |
|
706 |
end |
|
707 |
else |
|
708 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment)) |
|
11909 | 709 |
increaseTeamValue(curr_team,"Suicides") |
710 |
if(getTeamValue(curr_team, "Suicides") > recordSuicides) then |
|
711 |
recordSuicides = getTeamValue(curr_team, "Suicides") |
|
712 |
recordSuicidesHogName = getGearValue(CurrentHedgehog, "Name") |
|
713 |
recordSuicidesTeamName = curr_team |
|
714 |
end |
|
715 |
AddCaption(loc("-1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage) |
|
11015 | 716 |
end |
717 |
else |
|
718 |
if curr_team ~=GetHogTeamName(gear) then |
|
719 |
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
|
720 |
HealHog(CurrentHedgehog, kill_reward) |
12288
a5a7d0c6d3f3
Fix incorrect Mutant score message color
Wuzzy <almikes@aol.com>
parents:
11909
diff
changeset
|
721 |
AddCaption(loc("+1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage) |
11015 | 722 |
increaseTeamValue(curr_team,"Score") |
723 |
end |
|
724 |
if getGearValue(CurrentHedgehog,"Feeder") then |
|
725 |
increaseTeamValue(curr_team,"Score") |
|
11909 | 726 |
AddCaption(loc("+1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage) |
11015 | 727 |
end |
728 |
else |
|
729 |
setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment)) |
|
11909 | 730 |
AddCaption(loc("+1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage) |
11015 | 731 |
end |
732 |
end |
|
733 |
end |
|
734 |
end |
|
735 |
end |
|
736 |
||
737 |
function onGearResurrect(gear) |
|
738 |
if not gameOver then |
|
739 |
if GetGearType(gear) == gtHedgehog then |
|
740 |
||
741 |
increaseTeamValue(GetHogTeamName(gear), "DeadHogs") |
|
11909 | 742 |
totalKills = totalKills + 1 |
743 |
if(getTeamValue(GetHogTeamName(gear), "DeadHogs") > recordDeaths) then |
|
744 |
recordDeaths = getTeamValue(GetHogTeamName(gear), "DeadHogs") |
|
745 |
recordDeathsHogName = getGearValue(gear, "Name") |
|
746 |
recordDeathsTeamName = GetHogTeamName(gear) |
|
747 |
end |
|
11015 | 748 |
|
749 |
if gear==CurrentHedgehog then |
|
750 |
setGearValue(CurrentHedgehog, "Alive", false) |
|
751 |
end |
|
752 |
set_Mutant_and_Score(gear) |
|
753 |
if gear~=CurrentHedgehog then |
|
754 |
killsCounter = killsCounter + 1 |
|
755 |
countBodies() |
|
756 |
end |
|
757 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false) |
|
758 |
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
|
759 |
renderScores() |
11015 | 760 |
end |
761 |
end |
|
762 |
end |
|
763 |
||
11909 | 764 |
function onGearDamage(gear, damage) |
14285 | 765 |
if not gameOver and GetGearType(gear) == gtHedgehog then |
766 |
totalDamage = totalDamage + damage |
|
767 |
end |
|
11909 | 768 |
end |
769 |
||
13172
159004144897
Use onSkipTurn in scripts to detect turn skips
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
770 |
function onSkipTurn() |
14285 | 771 |
-- Record skips for achievement |
772 |
local team = GetHogTeamName(CurrentHedgehog) |
|
773 |
increaseTeamValue(team, "Skips") |
|
774 |
if(getTeamValue(team, "Skips") > recordSkips) then |
|
775 |
recordSkips = getTeamValue(team, "Skips") |
|
776 |
recordSkipsHogName = getGearValue(CurrentHedgehog, "Name") |
|
777 |
recordSkipsTeamName = team |
|
778 |
end |
|
11909 | 779 |
end |
780 |
||
11015 | 781 |
function onGearAdd(gear) |
782 |
||
783 |
-- Catch hedgehogs for the tracker |
|
784 |
if GetGearType(gear) == gtHedgehog then |
|
785 |
trackGear(gear) |
|
786 |
hhs[numhhs] = gear |
|
787 |
numhhs = numhhs + 1 |
|
788 |
SetEffect(gear, heResurrectable, 1) |
|
14285 | 789 |
elseif GetGearType(gear) == gtCase then |
14287
9b5a8147386f
I think this is correct way to use iterate over it as a hashmap. don't have much lua practice
nemo
parents:
14286
diff
changeset
|
790 |
crates[gear] = gear |
13219
b229b3259a76
Mutant: Fix graph title on game draw
Wuzzy <Wuzzy2@mail.ru>
parents:
13172
diff
changeset
|
791 |
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
|
792 |
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
|
793 |
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
|
794 |
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
|
795 |
SendStat(siGameResult, string.format(loc("%s wins!"), winner)) |
13643 | 796 |
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
|
797 |
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
|
798 |
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
|
799 |
end |
11015 | 800 |
end |
801 |
end |
|
802 |
||
803 |
function checkEmptyTeam (teamName) |
|
804 |
for i=0 , #hhs do |
|
805 |
if hhs[i]~=nil then |
|
806 |
if teamName == GetHogTeamName(hhs[i]) then |
|
807 |
return false |
|
808 |
end |
|
809 |
end |
|
810 |
end |
|
811 |
return true |
|
812 |
end |
|
813 |
||
814 |
function onGearDelete(gear) |
|
815 |
-- Remove hogs that are gone |
|
816 |
if GetGearType(gear) == gtHedgehog then |
|
817 |
numhhs = numhhs - 1 |
|
818 |
||
15559
bbb98e22a303
Fix impossible to become mutant after mutant gear got deleted (bug 804)
Wuzzy <Wuzzy2@mail.ru>
parents:
15483
diff
changeset
|
819 |
if (not gameOver) and (gear == mutant) then |
bbb98e22a303
Fix impossible to become mutant after mutant gear got deleted (bug 804)
Wuzzy <Wuzzy2@mail.ru>
parents:
15483
diff
changeset
|
820 |
mutant = nil |
bbb98e22a303
Fix impossible to become mutant after mutant gear got deleted (bug 804)
Wuzzy <Wuzzy2@mail.ru>
parents:
15483
diff
changeset
|
821 |
mt_hurt = false |
bbb98e22a303
Fix impossible to become mutant after mutant gear got deleted (bug 804)
Wuzzy <Wuzzy2@mail.ru>
parents:
15483
diff
changeset
|
822 |
end |
bbb98e22a303
Fix impossible to become mutant after mutant gear got deleted (bug 804)
Wuzzy <Wuzzy2@mail.ru>
parents:
15483
diff
changeset
|
823 |
|
11015 | 824 |
local found |
825 |
for i=0, #hhs do |
|
826 |
if hhs[i] == gear then |
|
827 |
found = i |
|
828 |
break |
|
829 |
end |
|
830 |
end |
|
831 |
for i = found, #hhs - 1 do |
|
832 |
hhs[i] = hhs[i + 1] |
|
833 |
end |
|
834 |
hhs[#hhs] = nil |
|
835 |
||
836 |
local t_name = GetHogTeamName(gear) |
|
837 |
if checkEmptyTeam(t_name) then |
|
838 |
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
|
839 |
if GetTeamName(i) == t_name then |
11015 | 840 |
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
|
841 |
teamsDead[t_name] = true |
11015 | 842 |
break |
843 |
end |
|
844 |
end |
|
845 |
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
|
846 |
if getGearValue(gear, "excess") ~= true and band(GetState(gear), gstDrowning) == 0 then |
13108 | 847 |
AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
848 |
end |
|
11015 | 849 |
trackDeletion(gear) |
11909 | 850 |
elseif GetGearType(gear) == gtCase then |
14285 | 851 |
crates[gear] = nil |
11909 | 852 |
-- Check if a crate has been collected |
853 |
if band(GetGearMessage(gear), gmDestroy) ~= 0 and CurrentHedgehog ~= nil then |
|
854 |
-- Update crate collection achievement |
|
855 |
increaseTeamValue(GetHogTeamName(CurrentHedgehog), "Crates") |
|
856 |
if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Crates") > recordCrates) then |
|
857 |
recordCrates = getTeamValue(GetHogTeamName(CurrentHedgehog), "Crates") |
|
858 |
recordCratesHogName = getGearValue(CurrentHedgehog, "Name") |
|
859 |
recordCratesTeamName = GetHogTeamName(CurrentHedgehog) |
|
860 |
end |
|
861 |
end |
|
11015 | 862 |
end |
863 |
end |
|
864 |
||
865 |
function onParameters() |
|
866 |
parseParams() |
|
867 |
winScore = tonumber(params["winscore"]) or winScore |
|
868 |
end |
|
869 |
||
870 |
--[[ |
|
871 |
S T A R R I N G |
|
872 |
prof - Coding, implementing and evangelism |
|
873 |
vos - Initial idea and script improvements |
|
874 |
mikade - Moving the `how to play` into the game so that people know `how to play`, and whitespace :D |
|
875 |
--]] |