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