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