author | Wuzzy <Wuzzy2@mail.ru> |
Mon, 08 Apr 2019 16:00:15 +0200 | |
changeset 14774 | dd4daa216398 |
parent 14772 | 458a8c4e65ca |
child 15130 | 9e1e234a417c |
permissions | -rwxr-xr-x |
12417 | 1 |
--[[ |
2 |
######################################################################## |
|
3 |
Name: Battalion |
|
4 |
Made by: Anachron |
|
5 |
######################################################################## |
|
6 |
]]-- |
|
7 |
||
8 |
--[[ |
|
9 |
||
10 |
Readme: |
|
12424
6944a9161cdb
Update readme link in Battalion script
Wuzzy <almikes@aol.com>
parents:
12423
diff
changeset
|
11 |
https://hedgewars.org/wiki/Battalion |
12417 | 12 |
|
13 |
######################################################################## |
|
14 |
]]-- |
|
15 |
||
16 |
--[[ |
|
17 |
######################################################################## |
|
12985
263d006c56a9
Battalion: Clean up and remove dead code
Wuzzy <Wuzzy2@mail.ru>
parents:
12984
diff
changeset
|
18 |
TODO / ideas list |
12417 | 19 |
######################################################################## |
20 |
||
21 |
- Make Hogs sorted by rareness for teams with less hogs (more fair) |
|
22 |
- Keep first picked up unused crate utitlity until next round |
|
23 |
- Ship default scheme but let user overwrite it |
|
24 |
- Make SuddenDeathWaterRise dynamic |
|
25 |
- Make SuddenDeathTurns dynamic |
|
26 |
- Add Hog Variants like Crazy Scientist or Astronaut |
|
27 |
||
28 |
######################################################################## |
|
29 |
]]-- |
|
30 |
||
31 |
--[[ |
|
32 |
############################################################################## |
|
33 |
### GENERAL SCRIPT LOADING AND VARIABLE INITIALISATION ### |
|
34 |
############################################################################## |
|
35 |
]]-- |
|
36 |
||
37 |
HedgewarsScriptLoad("/Scripts/Locale.lua") |
|
38 |
HedgewarsScriptLoad("/Scripts/Tracker.lua") |
|
39 |
HedgewarsScriptLoad("/Scripts/Params.lua") |
|
40 |
||
41 |
-- List of all hog variants with belonging weapons, |
|
42 |
-- hitpoints, chances and more |
|
43 |
local variants = {} |
|
44 |
local varName = "" |
|
12985
263d006c56a9
Battalion: Clean up and remove dead code
Wuzzy <Wuzzy2@mail.ru>
parents:
12984
diff
changeset
|
45 |
local newLine = "" |
12417 | 46 |
local gmAny = 0xFFFFFFFF |
47 |
||
48 |
--[[ |
|
49 |
############################################################################## |
|
50 |
### VARIANT SETUP ### |
|
51 |
############################################################################## |
|
52 |
]]-- |
|
53 |
||
54 |
varName = "Pyromancer" |
|
55 |
variants[varName] = {} |
|
12425
bdf81e6c00eb
Battalion: Make mutated hog names translatable
Wuzzy <almikes@aol.com>
parents:
12424
diff
changeset
|
56 |
variants[varName]["name"] = loc("Pyromancer") |
12417 | 57 |
variants[varName]["chance"] = 7 |
58 |
variants[varName]["hat"] = "Gasmask" |
|
59 |
variants[varName]["hp"] = 70 |
|
60 |
variants[varName]["hogLimit"] = 2 |
|
61 |
variants[varName]["weaponLimit"] = 1 |
|
62 |
variants[varName]["weapons"] = {amFlamethrower, amMolotov, amWhip} |
|
63 |
variants[varName]["helperLimit"] = 1 |
|
64 |
variants[varName]["helpers"] = {amRope, amParachute} |
|
65 |
variants[varName]["special"] = false |
|
66 |
||
67 |
varName = "Builder" |
|
68 |
variants[varName] = {} |
|
12425
bdf81e6c00eb
Battalion: Make mutated hog names translatable
Wuzzy <almikes@aol.com>
parents:
12424
diff
changeset
|
69 |
variants[varName]["name"] = loc("Builder") |
12417 | 70 |
variants[varName]["chance"] = 10 |
71 |
variants[varName]["hat"] = "constructor" |
|
72 |
variants[varName]["hp"] = 100 |
|
73 |
variants[varName]["hogLimit"] = 1 |
|
74 |
variants[varName]["weaponLimit"] = 1 |
|
75 |
variants[varName]["weapons"] = {amDynamite, amWhip, amHammer} |
|
76 |
variants[varName]["helperLimit"] = 1 |
|
77 |
variants[varName]["helpers"] = {amGirder, amBlowTorch} |
|
78 |
variants[varName]["special"] = false |
|
79 |
||
80 |
varName = "Rifleman" |
|
81 |
variants[varName] = {} |
|
12425
bdf81e6c00eb
Battalion: Make mutated hog names translatable
Wuzzy <almikes@aol.com>
parents:
12424
diff
changeset
|
82 |
variants[varName]["name"] = loc("Rifleman") |
12417 | 83 |
variants[varName]["chance"] = 7 |
84 |
variants[varName]["hat"] = "Sniper" |
|
85 |
variants[varName]["hp"] = 70 |
|
86 |
variants[varName]["hogLimit"] = 2 |
|
87 |
variants[varName]["weaponLimit"] = 1 |
|
88 |
variants[varName]["weapons"] = {amRCPlane, amShotgun, amSniperRifle} |
|
89 |
variants[varName]["helperLimit"] = 1 |
|
90 |
variants[varName]["helpers"] = {amLowGravity, amParachute} |
|
91 |
variants[varName]["special"] = false |
|
92 |
||
93 |
varName = "Warrior" |
|
94 |
variants[varName] = {} |
|
12425
bdf81e6c00eb
Battalion: Make mutated hog names translatable
Wuzzy <almikes@aol.com>
parents:
12424
diff
changeset
|
95 |
variants[varName]["name"] = loc("Warrior") |
12417 | 96 |
variants[varName]["chance"] = 12 |
97 |
variants[varName]["hat"] = "spartan" |
|
98 |
variants[varName]["hp"] = 120 |
|
99 |
variants[varName]["hogLimit"] = 2 |
|
100 |
variants[varName]["weaponLimit"] = 1 |
|
101 |
variants[varName]["weapons"] = {amClusterBomb, amGrenade, amBazooka} |
|
102 |
variants[varName]["helperLimit"] = 1 |
|
103 |
variants[varName]["helpers"] = {amParachute, amRope} |
|
104 |
variants[varName]["special"] = false |
|
105 |
||
106 |
varName = "Chef" |
|
107 |
variants[varName] = {} |
|
12425
bdf81e6c00eb
Battalion: Make mutated hog names translatable
Wuzzy <almikes@aol.com>
parents:
12424
diff
changeset
|
108 |
variants[varName]["name"] = loc("Chef") |
12417 | 109 |
variants[varName]["chance"] = 7 |
110 |
variants[varName]["hat"] = "chef" |
|
111 |
variants[varName]["hp"] = 70 |
|
112 |
variants[varName]["hogLimit"] = 1 |
|
113 |
variants[varName]["weaponLimit"] = 1 |
|
114 |
variants[varName]["weapons"] = {amCake, amKnife, amWhip} |
|
115 |
variants[varName]["helperLimit"] = 1 |
|
116 |
variants[varName]["helpers"] = {amRubber, amParachute} |
|
117 |
variants[varName]["special"] = false |
|
118 |
||
119 |
varName = "Medic" |
|
120 |
variants[varName] = {} |
|
12425
bdf81e6c00eb
Battalion: Make mutated hog names translatable
Wuzzy <almikes@aol.com>
parents:
12424
diff
changeset
|
121 |
variants[varName]["name"] = loc("Medic") |
12417 | 122 |
variants[varName]["chance"] = 12 |
123 |
variants[varName]["hat"] = "war_desertmedic" |
|
124 |
variants[varName]["hp"] = 120 |
|
125 |
variants[varName]["hogLimit"] = 1 |
|
126 |
variants[varName]["weaponLimit"] = 1 |
|
127 |
variants[varName]["weapons"] = {amResurrector, amMine, amGasBomb} |
|
128 |
variants[varName]["helperLimit"] = 1 |
|
129 |
variants[varName]["helpers"] = {amTeleport, amParachute} |
|
130 |
variants[varName]["special"] = false |
|
131 |
||
132 |
varName = "Ninja" |
|
133 |
variants[varName] = {} |
|
12425
bdf81e6c00eb
Battalion: Make mutated hog names translatable
Wuzzy <almikes@aol.com>
parents:
12424
diff
changeset
|
134 |
variants[varName]["name"] = loc("Ninja") |
12417 | 135 |
variants[varName]["chance"] = 8 |
136 |
variants[varName]["hat"] = "NinjaTriangle" |
|
137 |
variants[varName]["hp"] = 80 |
|
138 |
variants[varName]["hogLimit"] = 2 |
|
139 |
variants[varName]["weaponLimit"] = 1 |
|
140 |
variants[varName]["weapons"] = {amSMine, amMine, amFirePunch} |
|
141 |
variants[varName]["helperLimit"] = 1 |
|
142 |
variants[varName]["helpers"] = {amRope, amParachute} |
|
143 |
variants[varName]["special"] = false |
|
144 |
||
145 |
varName = "Athlete" |
|
146 |
variants[varName] = {} |
|
12425
bdf81e6c00eb
Battalion: Make mutated hog names translatable
Wuzzy <almikes@aol.com>
parents:
12424
diff
changeset
|
147 |
variants[varName]["name"] = loc("Athlete") |
12417 | 148 |
variants[varName]["chance"] = 8 |
149 |
variants[varName]["hat"] = "footballhelmet" |
|
150 |
variants[varName]["hp"] = 80 |
|
151 |
variants[varName]["hogLimit"] = 1 |
|
152 |
variants[varName]["weaponLimit"] = 1 |
|
153 |
variants[varName]["weapons"] = {amBaseballBat, amFirePunch, amSeduction} |
|
154 |
variants[varName]["helperLimit"] = 1 |
|
155 |
variants[varName]["helpers"] = {amRope, amPickHammer} |
|
156 |
variants[varName]["special"] = false |
|
157 |
||
158 |
varName = "Scientist" |
|
159 |
variants[varName] = {} |
|
12425
bdf81e6c00eb
Battalion: Make mutated hog names translatable
Wuzzy <almikes@aol.com>
parents:
12424
diff
changeset
|
160 |
variants[varName]["name"] = loc("Scientist") |
12417 | 161 |
variants[varName]["chance"] = 7 |
162 |
variants[varName]["hat"] = "doctor" |
|
163 |
variants[varName]["hp"] = 80 |
|
164 |
variants[varName]["hogLimit"] = 1 |
|
165 |
variants[varName]["weaponLimit"] = 1 |
|
166 |
variants[varName]["weapons"] = {amPortalGun, amSineGun, amIceGun} |
|
167 |
variants[varName]["helperLimit"] = 1 |
|
168 |
variants[varName]["helpers"] = {amTeleport, amJetpack} |
|
169 |
variants[varName]["special"] = false |
|
170 |
||
12422
f6fc84c55bfa
Battalion: Rename “Air-General” to “Air General”
Wuzzy <almikes@aol.com>
parents:
12421
diff
changeset
|
171 |
varName = "Air General" |
12417 | 172 |
variants[varName] = {} |
12425
bdf81e6c00eb
Battalion: Make mutated hog names translatable
Wuzzy <almikes@aol.com>
parents:
12424
diff
changeset
|
173 |
variants[varName]["name"] = loc("Air General") |
12417 | 174 |
variants[varName]["chance"] = 5 |
175 |
variants[varName]["hat"] = "war_desertofficer" |
|
176 |
variants[varName]["hp"] = 50 |
|
177 |
variants[varName]["hogLimit"] = 1 |
|
178 |
variants[varName]["weaponLimit"] = 1 |
|
179 |
variants[varName]["weapons"] = {amMineStrike, amNapalm, amAirAttack} |
|
180 |
variants[varName]["helperLimit"] = 1 |
|
181 |
variants[varName]["helpers"] = {amRope, amParachute} |
|
182 |
variants[varName]["special"] = true |
|
183 |
||
184 |
varName = "Hunter" |
|
185 |
variants[varName] = {} |
|
12425
bdf81e6c00eb
Battalion: Make mutated hog names translatable
Wuzzy <almikes@aol.com>
parents:
12424
diff
changeset
|
186 |
variants[varName]["name"] = loc("Hunter") |
12417 | 187 |
variants[varName]["chance"] = 10 |
188 |
variants[varName]["hat"] = "Skull" |
|
189 |
variants[varName]["hp"] = 100 |
|
190 |
variants[varName]["hogLimit"] = 1 |
|
191 |
variants[varName]["weaponLimit"] = 1 |
|
192 |
variants[varName]["weapons"] = {amBee, amMortar, amDrill} |
|
193 |
variants[varName]["helperLimit"] = 1 |
|
194 |
variants[varName]["helpers"] = {amRope, amParachute} |
|
195 |
variants[varName]["special"] = false |
|
196 |
||
197 |
varName = "King" |
|
198 |
variants[varName] = {} |
|
12425
bdf81e6c00eb
Battalion: Make mutated hog names translatable
Wuzzy <almikes@aol.com>
parents:
12424
diff
changeset
|
199 |
variants[varName]["name"] = loc("King") |
12417 | 200 |
variants[varName]["chance"] = 3 |
201 |
variants[varName]["hat"] = "crown" |
|
202 |
variants[varName]["hp"] = 60 |
|
203 |
variants[varName]["hogLimit"] = 1 |
|
204 |
variants[varName]["weaponLimit"] = 1 |
|
205 |
variants[varName]["weapons"] = {amWatermelon, amHellishBomb, amBallgun} |
|
206 |
variants[varName]["helperLimit"] = 1 |
|
207 |
variants[varName]["helpers"] = {amRope, amParachute} |
|
208 |
variants[varName]["special"] = true |
|
209 |
||
210 |
varName = "Knight" |
|
211 |
variants[varName] = {} |
|
12425
bdf81e6c00eb
Battalion: Make mutated hog names translatable
Wuzzy <almikes@aol.com>
parents:
12424
diff
changeset
|
212 |
variants[varName]["name"] = loc("Knight") |
12417 | 213 |
variants[varName]["chance"] = 0 |
214 |
variants[varName]["hat"] = "knight" |
|
215 |
variants[varName]["hp"] = 80 |
|
216 |
variants[varName]["hogLimit"] = 1 |
|
217 |
variants[varName]["weaponLimit"] = 1 |
|
218 |
variants[varName]["weapons"] = {amShotgun, amBazooka, amMine} |
|
219 |
variants[varName]["helperLimit"] = 1 |
|
220 |
variants[varName]["helpers"] = {amParachute, amRope} |
|
221 |
variants[varName]["special"] = true |
|
222 |
||
223 |
--[[ |
|
224 |
############################################################################## |
|
225 |
### GENERAL VARIABLES USED FOR GAMEPLAY ### |
|
226 |
############################################################################## |
|
227 |
]]-- |
|
228 |
||
229 |
local unused = {amSnowball, amDrillStrike, amTardis} |
|
230 |
local lowWeaps = {amKamikaze} |
|
231 |
local lowTresh = 25 |
|
232 |
||
233 |
local counter = {} -- Saves how many hogs of a variant a team has |
|
234 |
local group = {} -- Saves randomized variants for all teams |
|
235 |
local teamIndex = {} -- Temporary counter for amount of mutated hogs in team |
|
236 |
local teamHogs = {} -- Saves a list of all hogs belonging to a team |
|
237 |
local hogCount = {} -- Saves how many hogs a team has |
|
238 |
local teamNames = {} -- Saves all teams and names |
|
239 |
local hogInfo = {} -- Saves all hogs with their original values |
|
240 |
||
241 |
local LastHog = nil -- Last Hedgehog |
|
242 |
local CurHog = nil -- Current Hedgehog |
|
243 |
local LastTeam = nil -- Last Team |
|
244 |
local CurTeam = nil -- Current Team |
|
245 |
||
246 |
local mode = 'default' -- Which game type to play |
|
12989
353603f5cec3
Tweak some misleading Battalion texts
Wuzzy <Wuzzy2@mail.ru>
parents:
12988
diff
changeset
|
247 |
local modeExplicit = false -- Whether the mode was set in script param |
12417 | 248 |
local luck = 100 -- Multiplier for bonuses like crates |
249 |
local strength = 1 -- Multiplier for more weapons |
|
12992
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
250 |
local useVariantHats = true -- Whether to overwrite the hog hats to those of their variants |
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
251 |
-- In King Mode, crowns are always enforced regardless of this setting |
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
252 |
local useVariantNames = false -- Whether to overwrite the hog names to those of their variants |
12417 | 253 |
|
254 |
local highHasBonusWeps = false -- whether or not a hog got bonus weapons on current turn |
|
255 |
local highHasBonusHelp = false -- whether or not a hog got bonus helpers on current turn |
|
256 |
local highPickupCount = 1 |
|
257 |
local highPickupSDCount = 2 |
|
258 |
local highHelperCount = 1 |
|
259 |
local highHelperSDCount = 1 |
|
260 |
local highEnemyKillHPBonus = 10 |
|
261 |
local highFriendlyKillHPBonus = 15 |
|
262 |
local highWeapons = {} -- Saves the weapons from kills |
|
263 |
local highHelpers = {} -- Saves the helpers from kills |
|
264 |
local highSpecialBonus = {amTeleport, amJetpack} |
|
265 |
local highSpecialPool = {amExtraDamage, amVampiric} |
|
266 |
||
267 |
local kingLinkPerc = 50 -- Percentage of life to share from the team |
|
268 |
||
269 |
local pointsWepBase = 5 -- Game start points weapons |
|
270 |
local pointsHlpBase = 2 -- Game start points helpers |
|
271 |
local pointsKeepPerc = 80 -- Percentage of points to take to next round |
|
272 |
local pointsWepTurn = 5 -- Round bonus points weapons |
|
273 |
local pointsHlpTurn = 2 -- Round bonus points helpers |
|
274 |
local pointsWepMax = 25 -- Maximum points for weapons |
|
275 |
local pointsHlpMax = 10 -- Maximum points for helpers |
|
276 |
local pointsKeepSDPerc = 60 -- Percentage of points to take to next round on SD |
|
277 |
local pointsWepSDTurn = 7 -- Round bonus points weapons on SD |
|
278 |
local pointsHlpSDTurn = 3 -- Round bonus points helpers on SD |
|
279 |
local pointsWepSDMax = 35 -- Maximum points for weapons on SD |
|
280 |
local pointsHlpSDMax = 15 -- Maximum points for helpers on SD |
|
281 |
||
282 |
local pointsWeaponVal = {} |
|
283 |
pointsWeaponVal[amBazooka] = 5 |
|
284 |
pointsWeaponVal[amShotgun] = 4 |
|
285 |
pointsWeaponVal[amFirePunch] = 3 |
|
286 |
pointsWeaponVal[amMine] = 5 |
|
287 |
--pointsWeaponVal[amAirAttack] = 10 |
|
288 |
pointsWeaponVal[amBee] = 6 |
|
289 |
pointsWeaponVal[amClusterBomb] = 7 |
|
290 |
pointsWeaponVal[amGrenade] = 5 |
|
291 |
pointsWeaponVal[amDEagle] = 3 |
|
292 |
pointsWeaponVal[amWhip] = 3 |
|
293 |
pointsWeaponVal[amDynamite] = 7 |
|
294 |
--pointsWeaponVal[amMineStrike] = 14 |
|
295 |
pointsWeaponVal[amMortar] = 4 |
|
296 |
pointsWeaponVal[amWatermelon] = 30 |
|
297 |
pointsWeaponVal[amSniperRifle] = 3 |
|
298 |
pointsWeaponVal[amBaseballBat] = 3 |
|
299 |
pointsWeaponVal[amCake] = 7 |
|
300 |
--pointsWeaponVal[amNapalm] = 11 |
|
301 |
pointsWeaponVal[amDrill] = 6 |
|
302 |
pointsWeaponVal[amHellishBomb] = 20 |
|
303 |
pointsWeaponVal[amSineGun] = 4 |
|
304 |
--pointsWeaponVal[amKamikaze] = 3 |
|
305 |
--pointsWeaponVal[amBallgun] = 12 |
|
306 |
--pointsWeaponVal[amPianoStrike] = 15 |
|
307 |
pointsWeaponVal[amSnowball] = 2 |
|
308 |
pointsWeaponVal[amMolotov] = 3 |
|
309 |
pointsWeaponVal[amFlamethrower] = 4 |
|
310 |
pointsWeaponVal[amRCPlane] = 7 |
|
311 |
--pointsWeaponVal[amDrillStrike] = 12 |
|
312 |
pointsWeaponVal[amGasBomb] = 2 |
|
313 |
pointsWeaponVal[amHammer] = 3 |
|
314 |
pointsWeaponVal[amSMine] = 4 |
|
315 |
pointsWeaponVal[amAirMine] = 3 |
|
316 |
pointsWeaponVal[amKnife] = 3 |
|
317 |
pointsWeaponVal[amPortalGun] = 5 |
|
318 |
--pointsWeaponVal[amIceGun] = 6 |
|
319 |
pointsWeaponVal[amSeduction] = 2 |
|
320 |
||
321 |
local pointsHelperVal = {} |
|
322 |
pointsHelperVal[amRope] = 5 |
|
323 |
pointsHelperVal[amParachute] = 2 |
|
324 |
--pointsHelperVal[amGirder] = 3 |
|
325 |
pointsHelperVal[amBlowTorch] = 2 |
|
326 |
pointsHelperVal[amLowGravity] = 3 |
|
327 |
--pointsHelperVal[amRubber] = 4 |
|
328 |
pointsHelperVal[amPickHammer] = 2 |
|
329 |
pointsHelperVal[amTeleport] = 10 |
|
330 |
pointsHelperVal[amJetpack] = 8 |
|
331 |
||
332 |
local pointsPerTeam = {} |
|
333 |
local pointsToWep = {} -- List of [points] = {ammo1, ammo2} |
|
334 |
local pointsToHlp = {} -- List of [points] = {ammo1, ammo2} |
|
335 |
local wepPoints = {} |
|
336 |
local hlpPoints = {} |
|
337 |
||
12990
add647b0036e
Battalion: Reduce amount of SD messages
Wuzzy <Wuzzy2@mail.ru>
parents:
12989
diff
changeset
|
338 |
local firstTurnOver = false |
12417 | 339 |
local suddenDeath = false |
340 |
||
341 |
local healthCrateChance = 7 |
|
342 |
local utilCrateChance = 9 |
|
343 |
local weaponCrateChance = 12 |
|
344 |
||
345 |
local healthCrateChanceSD = 12 |
|
346 |
local utilCrateChanceSD = 16 |
|
347 |
local weaponCrateChanceSD = 21 |
|
348 |
||
349 |
local emptyCrateChance = 7 |
|
350 |
local bonusCrateChance = 5 |
|
351 |
local cratePickupGap = 35 |
|
352 |
||
353 |
local utilities = {amInvulnerable, amVampiric, amExtraTime, amExtraDamage, amRope, amLandGun} |
|
354 |
local autoSelectHelpers = {amRope, amParachute} |
|
355 |
||
356 |
local LastWaterLine = 0 -- Saves WaterLine to make sure a water rise wont trigger highland kill |
|
357 |
||
358 |
local helpers = {} |
|
359 |
helpers[amSkip] = true |
|
360 |
helpers[amRope] = true |
|
361 |
helpers[amParachute] = true |
|
362 |
helpers[amBlowTorch] = true |
|
363 |
helpers[amGirder] = true |
|
364 |
helpers[amTeleport] = true |
|
365 |
helpers[amSwitch] = true |
|
366 |
helpers[amJetpack] = true |
|
367 |
helpers[amBirdy] = true |
|
368 |
helpers[amPortalGun] = true |
|
369 |
helpers[amResurrector] = true |
|
370 |
helpers[amTardis] = true |
|
371 |
helpers[amLandGun] = true |
|
372 |
helpers[amRubber] = true |
|
373 |
--helpers[amKamikaze] = true |
|
374 |
||
375 |
local posCaseAmmo = 1 |
|
376 |
local posCaseHealth = 2 |
|
377 |
local posCaseUtility = 4 |
|
378 |
local posCaseDummy = 8 |
|
379 |
||
380 |
--[[ |
|
381 |
############################################################################## |
|
382 |
### GENERAL BONUS LUA FUNCTIONS ### |
|
383 |
############################################################################## |
|
384 |
]]-- |
|
385 |
||
386 |
function swap(array, index1, index2) |
|
387 |
array[index1], array[index2] = array[index2], array[index1] |
|
388 |
end |
|
389 |
||
390 |
function shuffle(array) |
|
391 |
local cnt = #array |
|
392 |
while cnt > 1 do |
|
393 |
local index = GetRandom(cnt) +1 |
|
394 |
swap(array, index, cnt) |
|
395 |
cnt = cnt - 1 |
|
396 |
end |
|
397 |
end |
|
398 |
||
399 |
function table.clone(org) |
|
400 |
local copy = {} |
|
401 |
for orig_key, orig_value in pairs(org) do |
|
402 |
copy[orig_key] = orig_value |
|
403 |
end |
|
404 |
return copy |
|
405 |
end |
|
406 |
||
407 |
--[[ |
|
408 |
############################################################################## |
|
409 |
### WEAPON, UTILITY AND AMMO FUNCTIONS ### |
|
410 |
############################################################################## |
|
411 |
]]-- |
|
412 |
||
413 |
function clearHogAmmo(hog) |
|
13034
905449169319
Battalion: Use AmmoTypeMax for ammo type iterations
Wuzzy <Wuzzy2@mail.ru>
parents:
12992
diff
changeset
|
414 |
for val=0, AmmoTypeMax do |
12417 | 415 |
AddAmmo(hog, val, 0) |
416 |
end |
|
417 |
end |
|
418 |
||
419 |
function autoSelectAmmo(hog, var) |
|
420 |
-- Check if hog has any "useful" helper, select helper, if yes |
|
421 |
for key, val in pairs(autoSelectHelpers) do |
|
422 |
if GetAmmoCount(hog, val) > 0 then |
|
423 |
SetWeapon(val) |
|
424 |
return |
|
425 |
end |
|
426 |
end |
|
427 |
end |
|
428 |
||
429 |
function AddHogAmmo(hog, ammo) |
|
430 |
-- Add weapons of variant |
|
431 |
for key, val in pairs(ammo) do |
|
432 |
AddAmmo(hog, val, GetAmmoCount(hog, val) +1) |
|
433 |
end |
|
434 |
end |
|
435 |
||
436 |
function GetRandomAmmo(hog, sourceType) |
|
437 |
local var = getHogInfo(hog, 'variant') |
|
438 |
ammo = {} |
|
439 |
local source = '' |
|
440 |
||
441 |
if variants[var] == nil then |
|
442 |
return ammo |
|
443 |
end |
|
444 |
||
445 |
if sourceType == "weapons" then |
|
446 |
source = variants[var][sourceType] |
|
447 |
sourceLimit = variants[var]["weaponLimit"] |
|
448 |
elseif sourceType == "helpers" then |
|
449 |
source = variants[var][sourceType] |
|
450 |
sourceLimit = variants[var]["helperLimit"] |
|
451 |
elseif sourceType == 'poolWeapons' then |
|
452 |
if highWeapons[hog] == nil then |
|
453 |
highWeapons[hog] = {} |
|
454 |
end |
|
455 |
source = highWeapons[hog] |
|
456 |
if suddenDeath == false then |
|
457 |
sourceLimit = highPickupCount |
|
458 |
else |
|
459 |
sourceLimit = highPickupSDCount |
|
460 |
end |
|
461 |
elseif sourceType == 'poolHelpers' then |
|
462 |
if highHelpers[hog] == nil then |
|
463 |
highHelpers[hog] = {} |
|
464 |
end |
|
465 |
source = highHelpers[hog] |
|
466 |
if suddenDeath == false then |
|
467 |
sourceLimit = highHelperCount |
|
468 |
else |
|
469 |
sourceLimit = highHelperSDCount |
|
470 |
end |
|
471 |
else |
|
472 |
return ammo |
|
473 |
end |
|
474 |
||
475 |
local varAmmo = {} |
|
476 |
for key, val in pairs(source) do |
|
477 |
varAmmo[key] = val |
|
478 |
end |
|
479 |
||
480 |
-- If the amount of random weapons is equally to the amount of weapons possible |
|
481 |
-- We don't need to randomize |
|
482 |
if sourceLimit >= table.getn(source) then |
|
483 |
return varAmmo |
|
484 |
end |
|
485 |
||
486 |
local randIndex = 0 |
|
487 |
local i = 0 |
|
488 |
while i < sourceLimit and #varAmmo > 0 do |
|
489 |
randIndex = GetRandom(#varAmmo) +1 |
|
490 |
ammo[i] = varAmmo[randIndex] |
|
491 |
||
492 |
-- Shift last value to the current index |
|
493 |
varAmmo[randIndex] = varAmmo[#varAmmo] |
|
494 |
-- And remove the last index from the array |
|
495 |
varAmmo[#varAmmo] = nil |
|
496 |
i = i +1 |
|
497 |
end |
|
498 |
||
499 |
return ammo |
|
500 |
end |
|
501 |
||
13035
da691787fcd2
Battalion, Points Mode: Show points next to team bars
Wuzzy <Wuzzy2@mail.ru>
parents:
13034
diff
changeset
|
502 |
function updatePointsLabel(team) |
da691787fcd2
Battalion, Points Mode: Show points next to team bars
Wuzzy <Wuzzy2@mail.ru>
parents:
13034
diff
changeset
|
503 |
SetTeamLabel(team, string.format(loc("%d / %d"), pointsPerTeam[team]["weapons"], pointsPerTeam[team]["helpers"])) |
da691787fcd2
Battalion, Points Mode: Show points next to team bars
Wuzzy <Wuzzy2@mail.ru>
parents:
13034
diff
changeset
|
504 |
end |
da691787fcd2
Battalion, Points Mode: Show points next to team bars
Wuzzy <Wuzzy2@mail.ru>
parents:
13034
diff
changeset
|
505 |
|
12417 | 506 |
function addTurnAmmo(hog) |
507 |
-- Check if hog is valid |
|
508 |
if hog == nil then |
|
509 |
return |
|
510 |
end |
|
511 |
||
512 |
-- Check if hog is alive |
|
513 |
local hp = GetHealth(hog) |
|
514 |
if hp == nil or hp <= 0 then |
|
515 |
return |
|
516 |
end |
|
517 |
||
518 |
-- Unless its points mode, get weapons normally by variant |
|
519 |
if mode ~= "points" then |
|
520 |
local maxHp = getHogInfo(hog, 'maxHp') |
|
521 |
local hpPer = div(hp * 100, maxHp) |
|
522 |
||
523 |
local wep = getHogInfo(hog, 'weapons') |
|
524 |
local hlp = getHogInfo(hog, 'helpers') |
|
525 |
||
526 |
if wep == nil or table.getn(wep) == 0 then |
|
527 |
hogInfo[hog]['weapons'] = GetRandomAmmo(hog, "weapons") |
|
528 |
wep = getHogInfo(hog, 'weapons') |
|
529 |
end |
|
530 |
||
531 |
if hlp == nil or table.getn(hlp) == 0 then |
|
532 |
hogInfo[hog]['helpers'] = GetRandomAmmo(hog, "helpers") |
|
533 |
hlp = getHogInfo(hog, 'helpers') |
|
534 |
end |
|
535 |
||
536 |
AddHogAmmo(hog, wep) |
|
537 |
AddHogAmmo(hog, hlp) |
|
538 |
||
539 |
if mode == 'highland' then |
|
540 |
local poolWeapons = GetRandomAmmo(hog, 'poolWeapons') |
|
541 |
local poolHelpers = GetRandomAmmo(hog, 'poolHelpers') |
|
542 |
||
543 |
AddHogAmmo(hog, poolWeapons) |
|
544 |
AddHogAmmo(hog, poolHelpers) |
|
545 |
end |
|
546 |
||
547 |
if hpPer < lowTresh or suddenDeath == true then |
|
548 |
AddHogAmmo(hog, lowWeaps) |
|
549 |
end |
|
550 |
-- We are on points mode, so we need to generate weapons based on points |
|
551 |
else |
|
552 |
setupPointsAmmo(hog) |
|
553 |
end |
|
554 |
||
555 |
AddAmmo(hog, amSkip, -1) |
|
556 |
end |
|
557 |
||
558 |
function setupPointsAmmo(hog) |
|
559 |
local teamName = getHogInfo(hog, 'team') |
|
560 |
local turnWepPoints = pointsPerTeam[teamName]['weapons'] |
|
561 |
local turnHlpPoints = pointsPerTeam[teamName]['helpers'] |
|
562 |
local weps = {} |
|
563 |
local help = {} |
|
564 |
||
565 |
local wepPointsTmp = table.clone(wepPoints) |
|
566 |
local wepMinPnt = wepPointsTmp[1] |
|
567 |
local wepMaxPnt = wepPointsTmp[#wepPointsTmp] |
|
568 |
||
569 |
--AddCaption("Hog: " .. hog .. " Wep: " .. turnWepPoints .. " - Hlp: " .. turnHlpPoints, GetClanColor(GetHogClan(CurHog)), capgrpGameState) |
|
570 |
--WriteLnToConsole("BEFORE ## Team: " .. teamName .. " Wep: " .. pointsPerTeam[teamName]['weapons'] .. " - Hlp: " .. pointsPerTeam[teamName]['helpers']) |
|
571 |
||
572 |
while true do |
|
573 |
if turnWepPoints < wepMinPnt then |
|
574 |
break |
|
575 |
end |
|
576 |
||
577 |
if wepPointsTmp[#wepPointsTmp] > turnWepPoints then |
|
578 |
while wepPointsTmp[#wepPointsTmp] > turnWepPoints do |
|
579 |
table.remove(wepPointsTmp) |
|
580 |
end |
|
581 |
wepMaxPnt = turnWepPoints |
|
582 |
end |
|
583 |
||
584 |
local randPoint = wepPointsTmp[GetRandom(#wepPointsTmp) +1] |
|
585 |
local randWepList = pointsToWep[randPoint] |
|
586 |
local randWep = randWepList[GetRandom(#randWepList) +1] |
|
587 |
||
588 |
table.insert(weps, randWep) |
|
589 |
turnWepPoints = turnWepPoints -randPoint |
|
590 |
end |
|
591 |
||
592 |
local hlpPointsTmp = table.clone(hlpPoints) |
|
593 |
local hlpMinPnt = hlpPointsTmp[1] |
|
594 |
local hlpMaxPnt = hlpPointsTmp[#hlpPointsTmp] |
|
595 |
||
596 |
while true do |
|
597 |
if turnHlpPoints < hlpMinPnt then |
|
598 |
break |
|
599 |
end |
|
600 |
||
601 |
if hlpPointsTmp[#hlpPointsTmp] > turnHlpPoints then |
|
602 |
while hlpPointsTmp[#hlpPointsTmp] > turnHlpPoints do |
|
603 |
table.remove(hlpPointsTmp) |
|
604 |
end |
|
605 |
hlpMaxPnt = turnHlpPoints |
|
606 |
end |
|
607 |
||
608 |
local randPoint = hlpPointsTmp[GetRandom(#hlpPointsTmp) +1] |
|
609 |
local randHlpList = pointsToHlp[randPoint] |
|
610 |
local randHlp = randHlpList[GetRandom(#randHlpList) +1] |
|
611 |
||
612 |
table.insert(help, randHlp) |
|
613 |
turnHlpPoints = turnHlpPoints -randPoint |
|
614 |
end |
|
615 |
||
616 |
AddHogAmmo(hog, weps) |
|
617 |
AddHogAmmo(hog, help) |
|
618 |
||
619 |
-- Save remaining points |
|
620 |
pointsPerTeam[teamName]['weaponsRem'] = turnWepPoints |
|
621 |
pointsPerTeam[teamName]['helpersRem'] = turnHlpPoints |
|
622 |
||
623 |
-- Save already collected points so that they wont be "taxed" |
|
624 |
pointsPerTeam[teamName]['weaponsFix'] = pointsPerTeam[teamName]['weapons'] |
|
625 |
pointsPerTeam[teamName]['helpersFix'] = pointsPerTeam[teamName]['helpers'] |
|
626 |
||
627 |
--WriteLnToConsole("AFTER ## Team: " .. teamName .. " Wep: " .. pointsPerTeam[teamName]['weapons'] .. " - Hlp: " .. pointsPerTeam[teamName]['helpers']) |
|
628 |
end |
|
629 |
||
630 |
--[[ |
|
631 |
############################################################################## |
|
632 |
### HOG SETUP FUNCTIONS ### |
|
633 |
############################################################################## |
|
634 |
]]-- |
|
635 |
||
12992
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
636 |
-- Overwrite hog hat to that of its variant |
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
637 |
function SetHogVariantHat(hog) |
12417 | 638 |
local var = getHogInfo(hog, 'variant') |
12992
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
639 |
SetHogHat(hog, variants[var]["hat"]) |
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
640 |
end |
12417 | 641 |
|
12992
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
642 |
-- Give a crown if the hog is a king. |
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
643 |
-- Strip the hog from its crown if |
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
644 |
-- it is not a king. |
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
645 |
function SetHogVariantHatKingMode(hog) |
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
646 |
local var = getHogInfo(hog, 'variant') |
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
647 |
if var == "King" then |
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
648 |
SetHogHat(hog, variants[var]["hat"]) |
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
649 |
elseif GetHogHat(hog) == "crown" then |
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
650 |
SetHogHat(hog, "NoHat") |
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
651 |
end |
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
652 |
end |
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
653 |
|
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
654 |
-- Overwrite hog name to that of its variant |
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
655 |
function SetHogVariantName(hog) |
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
656 |
local var = getHogInfo(hog, 'variant') |
12425
bdf81e6c00eb
Battalion: Make mutated hog names translatable
Wuzzy <almikes@aol.com>
parents:
12424
diff
changeset
|
657 |
SetHogName(hog, variants[var]["name"]) |
12417 | 658 |
end |
659 |
||
660 |
function GetRandomVariant() |
|
661 |
local maxNum = 0 |
|
662 |
||
663 |
for key, val in pairs(variants) do |
|
664 |
maxNum = maxNum + variants[key]["chance"] |
|
665 |
end |
|
666 |
||
667 |
local rand = GetRandom(maxNum) |
|
668 |
local lowBound = 0 |
|
669 |
local highBound = 0 |
|
670 |
local var = nil |
|
671 |
||
672 |
for key, val in pairs(variants) do |
|
673 |
highBound = lowBound + variants[key]["chance"] |
|
674 |
if rand <= highBound then |
|
675 |
var = key |
|
676 |
break |
|
677 |
end |
|
678 |
lowBound = highBound |
|
679 |
end |
|
680 |
||
681 |
return var |
|
682 |
end |
|
683 |
||
684 |
function addRandomVariantToTeam(team) |
|
685 |
if counter[team] == nil then |
|
686 |
counter[team] = {} |
|
687 |
end |
|
688 |
||
689 |
while true do |
|
690 |
local var = GetRandomVariant() |
|
691 |
if counter[team][var] == nil and variants[var]["hogLimit"] > 0 then |
|
692 |
counter[team][var] = 1 |
|
693 |
break |
|
694 |
elseif counter[team][var] ~= nil and counter[team][var] < variants[var]["hogLimit"] then |
|
695 |
counter[team][var] = counter[team][var] +1 |
|
696 |
break |
|
697 |
end |
|
698 |
end |
|
699 |
||
700 |
return var |
|
701 |
end |
|
702 |
||
703 |
function setTeamHogs(team) |
|
704 |
local maxHog = hogCount[team] |
|
705 |
||
706 |
group[team] = {} |
|
707 |
counter[team] = {} |
|
708 |
||
709 |
if mode == 'king' then |
|
710 |
maxHog = maxHog -1 |
|
711 |
end |
|
712 |
||
713 |
for i=1,maxHog do |
|
714 |
table.insert(group[team], group['all'][i]) |
|
715 |
end |
|
716 |
||
717 |
if mode == 'king' then |
|
718 |
counter[team]['King'] = 1 |
|
719 |
table.insert(group[team], 'King') |
|
720 |
end |
|
721 |
end |
|
722 |
||
723 |
function countTeamHogs(hog) |
|
724 |
local team = GetHogTeamName(hog) |
|
725 |
||
726 |
if hogCount[team] == nil then |
|
727 |
hogCount[team] = 1 |
|
728 |
teamHogs[team] = {} |
|
729 |
else |
|
730 |
hogCount[team] = hogCount[team] +1 |
|
731 |
end |
|
732 |
||
733 |
teamHogs[team][hogCount[team]] = hog |
|
734 |
||
735 |
teamNames[team] = 1 |
|
736 |
end |
|
737 |
||
738 |
function setHogVariant(hog) |
|
739 |
local team = getHogInfo(hog, 'team') |
|
740 |
||
741 |
if teamIndex[team] == nil then |
|
742 |
teamIndex[team] = 1 |
|
743 |
else |
|
744 |
teamIndex[team] = teamIndex[team] +1 |
|
745 |
end |
|
746 |
||
747 |
local hogNum = teamIndex[team] |
|
748 |
local hogVar = group[team][hogNum] |
|
749 |
||
750 |
hogInfo[hog]['variant'] = hogVar |
|
751 |
SetHealth(hog, variants[hogVar]["hp"]) |
|
752 |
end |
|
753 |
||
754 |
function getHogInfo(hog, info) |
|
755 |
if hog == nil then |
|
12985
263d006c56a9
Battalion: Clean up and remove dead code
Wuzzy <Wuzzy2@mail.ru>
parents:
12984
diff
changeset
|
756 |
WriteLnToChat("ERROR [getHogInfo]: hog is nil!") |
263d006c56a9
Battalion: Clean up and remove dead code
Wuzzy <Wuzzy2@mail.ru>
parents:
12984
diff
changeset
|
757 |
WriteLnToConsole("ERROR [getHogInfo]: hog is nil!") |
12417 | 758 |
return |
759 |
end |
|
760 |
||
761 |
if hogInfo[hog] == nil then |
|
762 |
return nil |
|
763 |
end |
|
764 |
||
765 |
return hogInfo[hog][info] |
|
766 |
end |
|
767 |
||
768 |
function setHogInfo(hog) |
|
769 |
if hog == nil then |
|
12985
263d006c56a9
Battalion: Clean up and remove dead code
Wuzzy <Wuzzy2@mail.ru>
parents:
12984
diff
changeset
|
770 |
WriteLnToChat("ERROR [setHogInfo]: hog is nil!") |
263d006c56a9
Battalion: Clean up and remove dead code
Wuzzy <Wuzzy2@mail.ru>
parents:
12984
diff
changeset
|
771 |
WriteLnToConsole("ERROR [setHogInfo]: hog is nil!") |
12417 | 772 |
return |
773 |
end |
|
774 |
||
775 |
hogInfo[hog] = {} |
|
776 |
hogInfo[hog]['maxHp'] = GetHealth(hog) |
|
777 |
hogInfo[hog]['name'] = GetHogName(hog) |
|
778 |
hogInfo[hog]['hat'] = GetHogHat(hog) |
|
779 |
hogInfo[hog]['team'] = GetHogTeamName(hog) |
|
780 |
hogInfo[hog]['clan'] = GetHogClan(hog) |
|
781 |
hogInfo[hog]['clanColor'] = GetClanColor(hogInfo[hog]['clan']) |
|
782 |
end |
|
783 |
||
784 |
--[[ |
|
785 |
############################################################################## |
|
786 |
### CRATE SPAWN AND PICKUP FUNCTIONS ### |
|
787 |
############################################################################## |
|
788 |
]]-- |
|
789 |
||
790 |
--[[ |
|
791 |
: Heals either 10 (95% chance) or 15 (5% chance) hitpoints |
|
792 |
: Plus 10% of the hogs base hitpoints. |
|
793 |
: |
|
794 |
: Has a 7% chance to be empty. |
|
795 |
]]-- |
|
796 |
function onHealthCratePickup() |
|
797 |
local factor = 2 |
|
798 |
local msgColor = getHogInfo(CurHog, 'clanColor') |
|
799 |
local healHp = 0 |
|
800 |
PlaySound(sndShotgunReload) |
|
801 |
||
802 |
if GetRandom(100) < emptyCrateChance then |
|
12420
e11758f70cce
Rewrite all Battalion strings to be more translator-friendly
Wuzzy <almikes@aol.com>
parents:
12417
diff
changeset
|
803 |
AddCaption(loc("It's empty!"), msgColor, capgrpMessage) |
12417 | 804 |
return |
805 |
elseif GetRandom(100) < bonusCrateChance then |
|
806 |
factor = 3 |
|
807 |
end |
|
808 |
||
809 |
local var = getHogInfo(CurHog, 'variant') |
|
810 |
local hogHealth = GetHealth(CurHog) |
|
811 |
healHp = 5 * factor |
|
812 |
||
813 |
-- Add extra 10% of hogs base hp to heal |
|
814 |
healHp = healHp + div(getHogInfo(CurHog, 'maxHp'), 10) |
|
815 |
||
12984
b6d67e975b51
Battalion: Standardize the crate pickup message
Wuzzy <Wuzzy2@mail.ru>
parents:
12983
diff
changeset
|
816 |
HealHog(CurHog, healHp) |
12417 | 817 |
|
818 |
SetEffect(CurHog, hePoisoned, 0) |
|
819 |
end |
|
820 |
||
821 |
--[[ |
|
822 |
: Adds either 1 (95% chance) or 2 (5% chance) random weapon(s) based on the hog variant. |
|
823 |
: |
|
824 |
: Has a 7% chance to be empty. |
|
825 |
]]-- |
|
12988
7c3454083489
Battalion: Move crate pickup animation to crate
Wuzzy <Wuzzy2@mail.ru>
parents:
12987
diff
changeset
|
826 |
function onWeaponCratePickup(crate) |
12417 | 827 |
local factor = 1 * strength |
828 |
local msgColor = GetClanColor(GetHogClan(CurHog)) |
|
829 |
PlaySound(sndShotgunReload) |
|
830 |
||
831 |
if GetRandom(100) < emptyCrateChance then |
|
12633
96e30c42c318
Battalion: Only show collected ammo to local player
Wuzzy <almikes@aol.com>
parents:
12427
diff
changeset
|
832 |
if IsHogLocal(CurHog) then |
96e30c42c318
Battalion: Only show collected ammo to local player
Wuzzy <almikes@aol.com>
parents:
12427
diff
changeset
|
833 |
AddCaption(loc("It's empty!"), msgColor, capgrpMessage) |
96e30c42c318
Battalion: Only show collected ammo to local player
Wuzzy <almikes@aol.com>
parents:
12427
diff
changeset
|
834 |
end |
12417 | 835 |
return |
836 |
elseif GetRandom(100) < bonusCrateChance then |
|
837 |
factor = 2 * strength |
|
838 |
end |
|
839 |
||
840 |
local randIndex |
|
841 |
local randAmmo |
|
842 |
||
843 |
if mode ~= 'points' then |
|
844 |
local var = getHogInfo(CurHog, 'variant') |
|
845 |
randIndex = GetRandom(table.getn(variants[var]["weapons"])) +1 |
|
846 |
randAmmo = variants[var]["weapons"][randIndex] |
|
847 |
else |
|
848 |
local possibleWeapons = {} |
|
849 |
||
850 |
for key, val in pairs(pointsWeaponVal) do |
|
851 |
if val > 2 and val < 8 then |
|
852 |
table.insert(possibleWeapons, key) |
|
853 |
end |
|
854 |
end |
|
855 |
||
856 |
randIndex = GetRandom(table.getn(possibleWeapons)) +1 |
|
857 |
randAmmo = possibleWeapons[randIndex] |
|
858 |
end |
|
859 |
||
860 |
AddAmmo(CurHog, randAmmo, GetAmmoCount(CurHog, randAmmo) +factor) |
|
12633
96e30c42c318
Battalion: Only show collected ammo to local player
Wuzzy <almikes@aol.com>
parents:
12427
diff
changeset
|
861 |
if IsHogLocal(CurHog) then |
12984
b6d67e975b51
Battalion: Standardize the crate pickup message
Wuzzy <Wuzzy2@mail.ru>
parents:
12983
diff
changeset
|
862 |
AddCaption(string.format(loc("%s (+%d)"), GetAmmoName(randAmmo), factor), msgColor, capgrpMessage) |
12988
7c3454083489
Battalion: Move crate pickup animation to crate
Wuzzy <Wuzzy2@mail.ru>
parents:
12987
diff
changeset
|
863 |
local effect = AddVisualGear(GetX(crate), GetY(crate) +cratePickupGap, vgtAmmo, 0, true) |
12633
96e30c42c318
Battalion: Only show collected ammo to local player
Wuzzy <almikes@aol.com>
parents:
12427
diff
changeset
|
864 |
SetVisualGearValues(effect, nil, nil, nil, nil, nil, randAmmo, nil, nil, nil, msgColor) |
96e30c42c318
Battalion: Only show collected ammo to local player
Wuzzy <almikes@aol.com>
parents:
12427
diff
changeset
|
865 |
end |
12417 | 866 |
end |
867 |
--[[ |
|
868 |
: Adds either 1 (95% chance) or 2 (5% chance) random helper(s) based on the hog variant. |
|
869 |
: |
|
870 |
: Has a 7% chance to be empty. |
|
871 |
]]-- |
|
12988
7c3454083489
Battalion: Move crate pickup animation to crate
Wuzzy <Wuzzy2@mail.ru>
parents:
12987
diff
changeset
|
872 |
function onUtilityCratePickup(crate) |
12417 | 873 |
local factor = 1 * strength |
874 |
local msgColor = GetClanColor(GetHogClan(CurHog)) |
|
875 |
PlaySound(sndShotgunReload) |
|
876 |
||
877 |
if GetRandom(100) < emptyCrateChance then |
|
12633
96e30c42c318
Battalion: Only show collected ammo to local player
Wuzzy <almikes@aol.com>
parents:
12427
diff
changeset
|
878 |
if IsHogLocal(CurHog) then |
96e30c42c318
Battalion: Only show collected ammo to local player
Wuzzy <almikes@aol.com>
parents:
12427
diff
changeset
|
879 |
AddCaption(loc("It's empty!"), msgColor, capgrpMessage) |
96e30c42c318
Battalion: Only show collected ammo to local player
Wuzzy <almikes@aol.com>
parents:
12427
diff
changeset
|
880 |
end |
12417 | 881 |
return |
882 |
elseif GetRandom(100) < bonusCrateChance then |
|
883 |
factor = 2 * strength |
|
884 |
end |
|
885 |
||
886 |
local randIndex |
|
887 |
local randUtility |
|
888 |
||
889 |
if mode ~= 'points' then |
|
890 |
randIndex = GetRandom(table.getn(utilities)) +1 |
|
891 |
randUtility = utilities[randIndex] |
|
892 |
else |
|
893 |
local possibleHelpers = {} |
|
894 |
||
895 |
for key, val in pairs(pointsHelperVal) do |
|
896 |
table.insert(possibleHelpers, key) |
|
897 |
end |
|
898 |
||
899 |
randIndex = GetRandom(table.getn(possibleHelpers)) +1 |
|
900 |
randUtility = possibleHelpers[randIndex] |
|
901 |
end |
|
902 |
||
903 |
AddAmmo(CurHog, randUtility, GetAmmoCount(CurHog, randUtility) +factor) |
|
12633
96e30c42c318
Battalion: Only show collected ammo to local player
Wuzzy <almikes@aol.com>
parents:
12427
diff
changeset
|
904 |
if IsHogLocal(CurHog) then |
12984
b6d67e975b51
Battalion: Standardize the crate pickup message
Wuzzy <Wuzzy2@mail.ru>
parents:
12983
diff
changeset
|
905 |
AddCaption(string.format(loc("%s (+%d)"), GetAmmoName(randUtility), factor), msgColor, capgrpMessage) |
12988
7c3454083489
Battalion: Move crate pickup animation to crate
Wuzzy <Wuzzy2@mail.ru>
parents:
12987
diff
changeset
|
906 |
local effect = AddVisualGear(GetX(crate), GetY(crate) +cratePickupGap, vgtAmmo, 0, true) |
12633
96e30c42c318
Battalion: Only show collected ammo to local player
Wuzzy <almikes@aol.com>
parents:
12427
diff
changeset
|
907 |
SetVisualGearValues(effect, nil, nil, nil, nil, nil, randUtility, nil, nil, nil, msgColor) |
96e30c42c318
Battalion: Only show collected ammo to local player
Wuzzy <almikes@aol.com>
parents:
12427
diff
changeset
|
908 |
end |
12417 | 909 |
end |
910 |
||
911 |
function onPickupCrate(crate) |
|
912 |
local pos = GetGearPos(crate) |
|
913 |
||
914 |
-- Check if the crate is fake |
|
915 |
if pos % posCaseDummy >= 1 then |
|
916 |
if pos % posCaseDummy == posCaseAmmo then |
|
12988
7c3454083489
Battalion: Move crate pickup animation to crate
Wuzzy <Wuzzy2@mail.ru>
parents:
12987
diff
changeset
|
917 |
onWeaponCratePickup(crate) |
12417 | 918 |
elseif pos % posCaseDummy == posCaseHealth then |
919 |
onHealthCratePickup() |
|
920 |
elseif pos % posCaseDummy == posCaseUtility then |
|
12988
7c3454083489
Battalion: Move crate pickup animation to crate
Wuzzy <Wuzzy2@mail.ru>
parents:
12987
diff
changeset
|
921 |
onUtilityCratePickup(crate) |
12417 | 922 |
end |
923 |
end |
|
924 |
end |
|
925 |
||
14774
dd4daa216398
Battalion: Properly spawn crate between turns
Wuzzy <Wuzzy2@mail.ru>
parents:
14772
diff
changeset
|
926 |
function onCaseDrop() |
12417 | 927 |
if GetRandom(100) < weaponCrateChance then |
928 |
SpawnFakeAmmoCrate(0, 0, false, false) |
|
14774
dd4daa216398
Battalion: Properly spawn crate between turns
Wuzzy <Wuzzy2@mail.ru>
parents:
14772
diff
changeset
|
929 |
PlaySound(sndReinforce, CurrentHedgehog) |
12417 | 930 |
elseif GetRandom(100) < utilCrateChance then |
931 |
SpawnFakeUtilityCrate(0, 0, false, false) |
|
14774
dd4daa216398
Battalion: Properly spawn crate between turns
Wuzzy <Wuzzy2@mail.ru>
parents:
14772
diff
changeset
|
932 |
PlaySound(sndReinforce, CurrentHedgehog) |
12417 | 933 |
elseif GetRandom(100) < healthCrateChance then |
934 |
SpawnFakeHealthCrate(0, 0, false, false) |
|
14774
dd4daa216398
Battalion: Properly spawn crate between turns
Wuzzy <Wuzzy2@mail.ru>
parents:
14772
diff
changeset
|
935 |
PlaySound(sndReinforce, CurrentHedgehog) |
12417 | 936 |
end |
937 |
end |
|
938 |
||
939 |
--[[ |
|
940 |
############################################################################## |
|
941 |
### SUDDEN DEATH FUNCTIONS ### |
|
942 |
############################################################################## |
|
943 |
]]-- |
|
944 |
||
945 |
function onSuddenDeathDamage(hog) |
|
14772
458a8c4e65ca
Clean up Sudden Death messages and animations in Battalion
Wuzzy <Wuzzy2@mail.ru>
parents:
13648
diff
changeset
|
946 |
if GetEffect(hog, heInvulnerable) ~= 0 then |
458a8c4e65ca
Clean up Sudden Death messages and animations in Battalion
Wuzzy <Wuzzy2@mail.ru>
parents:
13648
diff
changeset
|
947 |
return |
458a8c4e65ca
Clean up Sudden Death messages and animations in Battalion
Wuzzy <Wuzzy2@mail.ru>
parents:
13648
diff
changeset
|
948 |
end |
12417 | 949 |
local hp = GetHealth(hog) |
950 |
local maxHp = getHogInfo(hog, 'maxHp') |
|
951 |
local newHp = 0 |
|
952 |
local hpDec = 0 |
|
953 |
local hpPer = div(hp * 100, maxHp) |
|
954 |
||
955 |
if hp > 1 then |
|
956 |
local msgColor = GetClanColor(GetHogClan(hog)) |
|
957 |
if hpPer <= 25 then |
|
958 |
newHp = hp -2 |
|
959 |
elseif hpPer <= 50 then |
|
960 |
newHp = hp -3 |
|
961 |
elseif hpPer <= 75 then |
|
962 |
newHp = hp -4 |
|
963 |
elseif hpPer <= 100 then |
|
964 |
newHp = hp -5 |
|
965 |
elseif hpPer <= 125 then |
|
966 |
newHp = hp -6 |
|
967 |
elseif hpPer <= 150 then |
|
968 |
newHp = hp -7 |
|
969 |
else |
|
970 |
newHp = div(hp * 93, 100) |
|
971 |
end |
|
972 |
||
973 |
if newHp <= 0 then |
|
974 |
newHp = 1 |
|
975 |
end |
|
976 |
||
977 |
hpDec = hp - newHp |
|
978 |
||
979 |
SetHealth(hog, newHp) |
|
14772
458a8c4e65ca
Clean up Sudden Death messages and animations in Battalion
Wuzzy <Wuzzy2@mail.ru>
parents:
13648
diff
changeset
|
980 |
if hpDec > 0 then |
458a8c4e65ca
Clean up Sudden Death messages and animations in Battalion
Wuzzy <Wuzzy2@mail.ru>
parents:
13648
diff
changeset
|
981 |
local r = math.random(1, 2) |
458a8c4e65ca
Clean up Sudden Death messages and animations in Battalion
Wuzzy <Wuzzy2@mail.ru>
parents:
13648
diff
changeset
|
982 |
if r == 1 then |
458a8c4e65ca
Clean up Sudden Death messages and animations in Battalion
Wuzzy <Wuzzy2@mail.ru>
parents:
13648
diff
changeset
|
983 |
PlaySound(sndPoisonCough, hog, true) |
458a8c4e65ca
Clean up Sudden Death messages and animations in Battalion
Wuzzy <Wuzzy2@mail.ru>
parents:
13648
diff
changeset
|
984 |
else |
458a8c4e65ca
Clean up Sudden Death messages and animations in Battalion
Wuzzy <Wuzzy2@mail.ru>
parents:
13648
diff
changeset
|
985 |
PlaySound(sndPoisonMoan, hog, true) |
458a8c4e65ca
Clean up Sudden Death messages and animations in Battalion
Wuzzy <Wuzzy2@mail.ru>
parents:
13648
diff
changeset
|
986 |
end |
458a8c4e65ca
Clean up Sudden Death messages and animations in Battalion
Wuzzy <Wuzzy2@mail.ru>
parents:
13648
diff
changeset
|
987 |
local effect = AddVisualGear(GetX(hog), GetY(hog) +cratePickupGap, vgtHealthTag, hpDec, false) |
458a8c4e65ca
Clean up Sudden Death messages and animations in Battalion
Wuzzy <Wuzzy2@mail.ru>
parents:
13648
diff
changeset
|
988 |
SetVisualGearValues(effect, nil, nil, nil, nil, nil, nil, nil, nil, nil, msgColor) |
458a8c4e65ca
Clean up Sudden Death messages and animations in Battalion
Wuzzy <Wuzzy2@mail.ru>
parents:
13648
diff
changeset
|
989 |
end |
12417 | 990 |
end |
991 |
end |
|
992 |
||
993 |
function onSuddenDeathTurn() |
|
994 |
runOnGears(onSuddenDeathDamage) |
|
995 |
end |
|
996 |
||
997 |
function onSuddenDeath() |
|
998 |
suddenDeath = true |
|
999 |
||
1000 |
healthCrateChance = healthCrateChanceSD |
|
1001 |
utilCrateChance = utilCrateChanceSD |
|
1002 |
weaponCrateChance = weaponCrateChanceSD |
|
1003 |
||
1004 |
if mode == 'highland' then |
|
1005 |
highEnemyKillHPBonus = highEnemyKillHPBonus +5 |
|
1006 |
highFriendlyKillHPBonus = highFriendlyKillHPBonus +10 |
|
1007 |
end |
|
1008 |
||
1009 |
if mode ~= 'points' then |
|
1010 |
for key, val in pairs(variants) do |
|
1011 |
if not variants[key]["special"] then |
|
1012 |
variants[key]["weaponLimit"] = variants[key]["weaponLimit"] +1 |
|
1013 |
end |
|
1014 |
end |
|
1015 |
end |
|
1016 |
||
1017 |
if mode ~= 'points' then |
|
1018 |
for hog, val in pairs(hogInfo) do |
|
1019 |
hogInfo[hog]['weapons'] = {} |
|
1020 |
hogInfo[hog]['helpers'] = {} |
|
1021 |
end |
|
1022 |
||
1023 |
runOnGears(setupHogTurn) |
|
1024 |
end |
|
1025 |
end |
|
1026 |
||
1027 |
--[[ |
|
1028 |
############################################################################## |
|
1029 |
### GEAR TRACKING FUNCTIONS ### |
|
1030 |
############################################################################## |
|
1031 |
]]-- |
|
1032 |
||
1033 |
function onGearAdd(gear) |
|
1034 |
local gearType = GetGearType(gear) |
|
1035 |
||
1036 |
if gearType == gtHedgehog then |
|
1037 |
trackGear(gear) |
|
1038 |
elseif gearType == gtRCPlane then |
|
12427
959d1f4dff25
Battalion: RC Plane gets 2 bombs, set air bomb dmg to 20
Wuzzy <almikes@aol.com>
parents:
12426
diff
changeset
|
1039 |
SetHealth(gear, 2) |
12417 | 1040 |
elseif gearType == gtAirBomb then |
12985
263d006c56a9
Battalion: Clean up and remove dead code
Wuzzy <Wuzzy2@mail.ru>
parents:
12984
diff
changeset
|
1041 |
-- Set Boom |
12427
959d1f4dff25
Battalion: RC Plane gets 2 bombs, set air bomb dmg to 20
Wuzzy <almikes@aol.com>
parents:
12426
diff
changeset
|
1042 |
SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 20) |
12417 | 1043 |
elseif gearType == gtCake then |
12985
263d006c56a9
Battalion: Clean up and remove dead code
Wuzzy <Wuzzy2@mail.ru>
parents:
12984
diff
changeset
|
1044 |
-- Set Boom |
12417 | 1045 |
SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 50) |
1046 |
elseif gearType == gtDEagleShot then |
|
12985
263d006c56a9
Battalion: Clean up and remove dead code
Wuzzy <Wuzzy2@mail.ru>
parents:
12984
diff
changeset
|
1047 |
-- Set Boom |
12417 | 1048 |
SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 12) |
1049 |
end |
|
1050 |
end |
|
1051 |
||
1052 |
function onHighlandKill(gear) |
|
1053 |
local deathVar = getHogInfo(gear, 'variant') |
|
1054 |
local killVar = getHogInfo(CurHog, 'variant') |
|
1055 |
local bonAmmo = {} |
|
1056 |
local deathMaxHP = getHogInfo(gear, 'maxHp') |
|
1057 |
local curHP = GetHealth(CurHog) |
|
1058 |
local newHP = 0 |
|
1059 |
local hpDiff = 0 |
|
1060 |
local addAmmo = false |
|
1061 |
||
1062 |
-- Killer hog is dead! Don't do anything |
|
1063 |
if curHP == nil or curHP <= 0 then |
|
1064 |
return |
|
1065 |
end |
|
1066 |
||
1067 |
-- Killer and victim is equal! Don't do anything |
|
1068 |
if CurHog == gear then |
|
1069 |
return |
|
1070 |
end |
|
1071 |
||
1072 |
-- Hog drowned because of water, not enemy |
|
1073 |
if LastWaterLine ~= WaterLine then |
|
1074 |
return |
|
1075 |
end |
|
1076 |
||
1077 |
-- Enemy kill! Add weapons to pool and to hog |
|
1078 |
if getHogInfo(gear, 'clan') ~= getHogInfo(CurHog, 'clan') then |
|
1079 |
||
1080 |
-- Initialize weapons if required |
|
1081 |
if highWeapons[CurHog] == nil then |
|
1082 |
highWeapons[CurHog] = {} |
|
1083 |
end |
|
1084 |
||
1085 |
if highHelpers[CurHog] == nil then |
|
1086 |
highHelpers[CurHog] = {} |
|
1087 |
end |
|
1088 |
||
1089 |
-- If not a special hog, use the victims weapons |
|
1090 |
if variants[deathVar]['special'] == false then |
|
1091 |
bonAmmo = variants[deathVar]['weapons'] |
|
1092 |
||
1093 |
if suddenDeath == true then |
|
1094 |
ammoCount = highPickupSDCount |
|
1095 |
else |
|
1096 |
ammoCount = highPickupCount |
|
1097 |
end |
|
1098 |
||
1099 |
-- Check if hog already got bonus weapons |
|
1100 |
if table.getn(highWeapons[CurHog]) == 0 and highHasBonusWeps == false then |
|
1101 |
highHasBonusWeps = true |
|
1102 |
addAmmo = true |
|
1103 |
end |
|
1104 |
||
1105 |
-- Pass turn bonus weapons to hog pool |
|
1106 |
for key, val in pairs(bonAmmo) do |
|
1107 |
local idx = table.getn(highWeapons[CurHog]) +1 |
|
1108 |
highWeapons[CurHog][idx] = val |
|
1109 |
end |
|
1110 |
-- It's a special hog, use special pool |
|
1111 |
else |
|
1112 |
bonAmmo = highSpecialBonus |
|
1113 |
||
1114 |
ammoCount = 1 |
|
1115 |
||
1116 |
-- Check if hog already got bonus helpers |
|
1117 |
if table.getn(highWeapons[CurHog]) == 0 and highHasBonusHelp == false then |
|
1118 |
highHasBonusHelp = true |
|
1119 |
addAmmo = true |
|
1120 |
end |
|
1121 |
||
1122 |
-- Pass turn bonus weapons to hog pool |
|
1123 |
for key, val in pairs(highSpecialPool) do |
|
1124 |
local idx = table.getn(highHelpers[CurHog]) +1 |
|
1125 |
highHelpers[CurHog][idx] = val |
|
1126 |
end |
|
1127 |
end |
|
1128 |
||
1129 |
if addAmmo then |
|
1130 |
local i = 1 |
|
1131 |
while i <= ammoCount and #bonAmmo > 0 do |
|
1132 |
local randAmmo = GetRandom(#bonAmmo) +1 |
|
1133 |
local randAmmoType = bonAmmo[randAmmo] |
|
1134 |
||
1135 |
-- Remove the randomized weapon so it cannot be picked up twice |
|
1136 |
table.remove(bonAmmo, randAmmo) |
|
1137 |
||
1138 |
AddAmmo(CurHog, randAmmoType, GetAmmoCount(CurHog, randAmmoType) +1) |
|
1139 |
||
12633
96e30c42c318
Battalion: Only show collected ammo to local player
Wuzzy <almikes@aol.com>
parents:
12427
diff
changeset
|
1140 |
if IsHogLocal(CurHog) then |
96e30c42c318
Battalion: Only show collected ammo to local player
Wuzzy <almikes@aol.com>
parents:
12427
diff
changeset
|
1141 |
local effect = AddVisualGear(GetX(CurHog), GetY(CurHog) + (cratePickupGap * i), vgtAmmo, 0, true) |
96e30c42c318
Battalion: Only show collected ammo to local player
Wuzzy <almikes@aol.com>
parents:
12427
diff
changeset
|
1142 |
SetVisualGearValues(effect, nil, nil, nil, nil, nil, randAmmoType, nil, nil, nil, nil) |
96e30c42c318
Battalion: Only show collected ammo to local player
Wuzzy <almikes@aol.com>
parents:
12427
diff
changeset
|
1143 |
end |
12417 | 1144 |
|
1145 |
i = i +1 |
|
1146 |
end |
|
1147 |
end |
|
1148 |
||
1149 |
hpDiff = div(deathMaxHP * highEnemyKillHPBonus, 100) |
|
1150 |
newHP = curHP + hpDiff |
|
12986
4c7472d3d483
Battalion: Add more health change effects
Wuzzy <Wuzzy2@mail.ru>
parents:
12985
diff
changeset
|
1151 |
HealHog(CurHog, newHP) |
4c7472d3d483
Battalion: Add more health change effects
Wuzzy <Wuzzy2@mail.ru>
parents:
12985
diff
changeset
|
1152 |
-- Friendly fire! Punish hog by removing weapons and helpers from pool |
4c7472d3d483
Battalion: Add more health change effects
Wuzzy <Wuzzy2@mail.ru>
parents:
12985
diff
changeset
|
1153 |
-- and reduce health |
12417 | 1154 |
else |
1155 |
highWeapons[CurHog] = {} |
|
1156 |
highHelpers[CurHog] = {} |
|
1157 |
||
1158 |
hpDiff = div(deathMaxHP * highFriendlyKillHPBonus, 100) |
|
1159 |
newHP = curHP - hpDiff |
|
1160 |
if newHP > 0 then |
|
1161 |
SetHealth(CurHog, newHP) |
|
1162 |
else |
|
1163 |
SetHealth(CurHog, 0) |
|
1164 |
end |
|
1165 |
||
1166 |
local effect = AddVisualGear(GetX(CurHog), GetY(CurHog) - cratePickupGap, vgtHealthTag, hpDiff, false) |
|
12985
263d006c56a9
Battalion: Clean up and remove dead code
Wuzzy <Wuzzy2@mail.ru>
parents:
12984
diff
changeset
|
1167 |
-- Set Tint |
12417 | 1168 |
SetVisualGearValues(effect, nil, nil, nil, nil, nil, nil, nil, nil, nil, GetClanColor(GetHogClan(CurHog))) |
1169 |
end |
|
1170 |
end |
|
1171 |
||
1172 |
function onKingDeath(KingHog) |
|
1173 |
local team = getHogInfo(KingHog, 'team') |
|
1174 |
local msgColor = getHogInfo(KingHog, 'clanColor') |
|
1175 |
||
13648 | 1176 |
AddCaption(string.format(loc("The king of %s has died!"), team), capcolDefault, capgrpGameState) |
12417 | 1177 |
|
12991
1c38d4370943
Battalion (mode=king): Kill the team when the king died instea of dismissing
Wuzzy <Wuzzy2@mail.ru>
parents:
12990
diff
changeset
|
1178 |
-- Kill the rest of the team normally, just like the official King Mode game modifier |
1c38d4370943
Battalion (mode=king): Kill the team when the king died instea of dismissing
Wuzzy <Wuzzy2@mail.ru>
parents:
12990
diff
changeset
|
1179 |
for hog, val in pairs(hogInfo) do |
1c38d4370943
Battalion (mode=king): Kill the team when the king died instea of dismissing
Wuzzy <Wuzzy2@mail.ru>
parents:
12990
diff
changeset
|
1180 |
if getHogInfo(hog, 'team') == team then |
1c38d4370943
Battalion (mode=king): Kill the team when the king died instea of dismissing
Wuzzy <Wuzzy2@mail.ru>
parents:
12990
diff
changeset
|
1181 |
hp = GetHealth(hog) |
1c38d4370943
Battalion (mode=king): Kill the team when the king died instea of dismissing
Wuzzy <Wuzzy2@mail.ru>
parents:
12990
diff
changeset
|
1182 |
if hp ~= nil and hp > 0 then |
1c38d4370943
Battalion (mode=king): Kill the team when the king died instea of dismissing
Wuzzy <Wuzzy2@mail.ru>
parents:
12990
diff
changeset
|
1183 |
SetState(KingHog, gstHHDeath) |
1c38d4370943
Battalion (mode=king): Kill the team when the king died instea of dismissing
Wuzzy <Wuzzy2@mail.ru>
parents:
12990
diff
changeset
|
1184 |
SetHealth(hog, 0) |
1c38d4370943
Battalion (mode=king): Kill the team when the king died instea of dismissing
Wuzzy <Wuzzy2@mail.ru>
parents:
12990
diff
changeset
|
1185 |
SetGearValues(hog, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0) |
1c38d4370943
Battalion (mode=king): Kill the team when the king died instea of dismissing
Wuzzy <Wuzzy2@mail.ru>
parents:
12990
diff
changeset
|
1186 |
end |
1c38d4370943
Battalion (mode=king): Kill the team when the king died instea of dismissing
Wuzzy <Wuzzy2@mail.ru>
parents:
12990
diff
changeset
|
1187 |
end |
1c38d4370943
Battalion (mode=king): Kill the team when the king died instea of dismissing
Wuzzy <Wuzzy2@mail.ru>
parents:
12990
diff
changeset
|
1188 |
end |
1c38d4370943
Battalion (mode=king): Kill the team when the king died instea of dismissing
Wuzzy <Wuzzy2@mail.ru>
parents:
12990
diff
changeset
|
1189 |
|
1c38d4370943
Battalion (mode=king): Kill the team when the king died instea of dismissing
Wuzzy <Wuzzy2@mail.ru>
parents:
12990
diff
changeset
|
1190 |
-- We don't use DismissTeam, it causes a lot of problems and nasty side-effects. |
1c38d4370943
Battalion (mode=king): Kill the team when the king died instea of dismissing
Wuzzy <Wuzzy2@mail.ru>
parents:
12990
diff
changeset
|
1191 |
|
12417 | 1192 |
end |
1193 |
||
1194 |
function onPointsKill(gear) |
|
1195 |
local deathVar = getHogInfo(gear, 'variant') |
|
1196 |
local killVar = getHogInfo(CurHog, 'variant') |
|
1197 |
local deathClan = getHogInfo(gear, 'clan') |
|
1198 |
local killClan = getHogInfo(CurHog, 'clan') |
|
1199 |
local team = getHogInfo(CurHog, 'team') |
|
1200 |
||
1201 |
local curHP = GetHealth(CurHog) |
|
1202 |
||
1203 |
-- Killer hog is dead! Don't do anything |
|
1204 |
if curHP == nil or curHP <= 0 then |
|
1205 |
return |
|
1206 |
end |
|
1207 |
||
1208 |
-- Hog drowned because of water, not enemy |
|
1209 |
if LastWaterLine ~= WaterLine then |
|
1210 |
return |
|
1211 |
end |
|
1212 |
||
1213 |
-- Same clan, friendly kill, skip |
|
1214 |
if killClan == deathClan then |
|
1215 |
return |
|
1216 |
end |
|
1217 |
||
1218 |
pointsPerTeam[team]['weapons'] = pointsPerTeam[team]['weapons'] + 2 |
|
1219 |
pointsPerTeam[team]['helpers'] = pointsPerTeam[team]['helpers'] + 1 |
|
13035
da691787fcd2
Battalion, Points Mode: Show points next to team bars
Wuzzy <Wuzzy2@mail.ru>
parents:
13034
diff
changeset
|
1220 |
updatePointsLabel(team) |
12417 | 1221 |
|
1222 |
local effect = AddVisualGear(GetX(CurHog) - (cratePickupGap / 2), GetY(CurHog), vgtHealthTag, 2, false) |
|
12985
263d006c56a9
Battalion: Clean up and remove dead code
Wuzzy <Wuzzy2@mail.ru>
parents:
12984
diff
changeset
|
1223 |
-- Set Tint |
12417 | 1224 |
SetVisualGearValues(effect, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xFFFFFFFF) |
1225 |
||
1226 |
local effect = AddVisualGear(GetX(CurHog) + (cratePickupGap / 2), GetY(CurHog), vgtHealthTag, 1, false) |
|
12985
263d006c56a9
Battalion: Clean up and remove dead code
Wuzzy <Wuzzy2@mail.ru>
parents:
12984
diff
changeset
|
1227 |
-- Set Tint |
12417 | 1228 |
SetVisualGearValues(effect, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0x444444FF) |
1229 |
end |
|
1230 |
||
1231 |
function onGearDelete(gear) |
|
1232 |
trackDeletion(gear) |
|
1233 |
||
1234 |
if GetGearType(gear) == gtCase and band(GetGearMessage(gear), gmDestroy) ~= 0 then |
|
1235 |
onPickupCrate(gear) |
|
1236 |
end |
|
1237 |
||
1238 |
if GetGearType(gear) == gtHedgehog then |
|
1239 |
if mode ~= 'points' then |
|
1240 |
hogInfo[gear]['weapons'] = {} |
|
1241 |
hogInfo[gear]['helpers'] = {} |
|
1242 |
end |
|
1243 |
||
1244 |
-- If dying gear is a hog and mode is highland, check for kills |
|
1245 |
if mode == 'highland' then |
|
1246 |
onHighlandKill(gear) |
|
1247 |
-- If current hog is dying and we are on points mode, we need to save the unused weapons/helpers |
|
1248 |
elseif mode == 'points' and CurHog == gear then |
|
1249 |
savePoints(gear) |
|
1250 |
elseif mode == 'points' and CurHog ~= gear then |
|
1251 |
onPointsKill(gear) |
|
1252 |
end |
|
1253 |
||
1254 |
if mode == 'king' and getHogInfo(gear, 'variant') == 'King' then |
|
1255 |
onKingDeath(gear) |
|
1256 |
end |
|
1257 |
end |
|
1258 |
end |
|
1259 |
||
1260 |
--[[ |
|
1261 |
############################################################################## |
|
1262 |
### TURN BASED FUNCTIONS ### |
|
1263 |
############################################################################## |
|
1264 |
]]-- |
|
1265 |
||
12986
4c7472d3d483
Battalion: Add more health change effects
Wuzzy <Wuzzy2@mail.ru>
parents:
12985
diff
changeset
|
1266 |
function calcKingHP(doEffects) |
4c7472d3d483
Battalion: Add more health change effects
Wuzzy <Wuzzy2@mail.ru>
parents:
12985
diff
changeset
|
1267 |
if doEffects == nil then |
4c7472d3d483
Battalion: Add more health change effects
Wuzzy <Wuzzy2@mail.ru>
parents:
12985
diff
changeset
|
1268 |
doEffects = true |
4c7472d3d483
Battalion: Add more health change effects
Wuzzy <Wuzzy2@mail.ru>
parents:
12985
diff
changeset
|
1269 |
end |
12417 | 1270 |
local teamKings = {} |
1271 |
local teamHealth = {} |
|
1272 |
||
1273 |
for hog, val in pairs(hogInfo) do |
|
1274 |
local hp = GetHealth(hog) |
|
1275 |
||
1276 |
if hp ~= nil and hp > 0 then |
|
1277 |
local team = getHogInfo(hog, 'team') |
|
1278 |
||
1279 |
if teamHealth[team] == nil then |
|
1280 |
teamHealth[team] = 0 |
|
1281 |
end |
|
1282 |
||
1283 |
if getHogInfo(hog, 'variant') == 'King' then |
|
1284 |
teamKings[team] = hog |
|
1285 |
else |
|
1286 |
teamHealth[team] = teamHealth[team] + hp |
|
1287 |
end |
|
1288 |
end |
|
1289 |
end |
|
1290 |
||
1291 |
for team, hog in pairs(teamKings) do |
|
1292 |
local hp = GetHealth(hog) |
|
1293 |
local newHP = div(teamHealth[team] * kingLinkPerc, 100) |
|
1294 |
||
1295 |
-- Set hitpoints to 1 if no other hog is alive or only has 1 hitpoint |
|
1296 |
if newHP <= 0 then |
|
1297 |
newHP = 1 |
|
1298 |
end |
|
1299 |
||
12986
4c7472d3d483
Battalion: Add more health change effects
Wuzzy <Wuzzy2@mail.ru>
parents:
12985
diff
changeset
|
1300 |
local diff = math.abs(newHP - hp) |
12417 | 1301 |
|
12986
4c7472d3d483
Battalion: Add more health change effects
Wuzzy <Wuzzy2@mail.ru>
parents:
12985
diff
changeset
|
1302 |
-- Change HP and do some nice effects |
4c7472d3d483
Battalion: Add more health change effects
Wuzzy <Wuzzy2@mail.ru>
parents:
12985
diff
changeset
|
1303 |
if newHP ~= hp then |
4c7472d3d483
Battalion: Add more health change effects
Wuzzy <Wuzzy2@mail.ru>
parents:
12985
diff
changeset
|
1304 |
if not doEffects then |
4c7472d3d483
Battalion: Add more health change effects
Wuzzy <Wuzzy2@mail.ru>
parents:
12985
diff
changeset
|
1305 |
SetHealth(hog, newHP) |
4c7472d3d483
Battalion: Add more health change effects
Wuzzy <Wuzzy2@mail.ru>
parents:
12985
diff
changeset
|
1306 |
else |
4c7472d3d483
Battalion: Add more health change effects
Wuzzy <Wuzzy2@mail.ru>
parents:
12985
diff
changeset
|
1307 |
if newHP > hp then |
4c7472d3d483
Battalion: Add more health change effects
Wuzzy <Wuzzy2@mail.ru>
parents:
12985
diff
changeset
|
1308 |
HealHog(hog, diff, false) |
4c7472d3d483
Battalion: Add more health change effects
Wuzzy <Wuzzy2@mail.ru>
parents:
12985
diff
changeset
|
1309 |
elseif newHP < hp then |
4c7472d3d483
Battalion: Add more health change effects
Wuzzy <Wuzzy2@mail.ru>
parents:
12985
diff
changeset
|
1310 |
SetHealth(hog, newHP) |
4c7472d3d483
Battalion: Add more health change effects
Wuzzy <Wuzzy2@mail.ru>
parents:
12985
diff
changeset
|
1311 |
if doEffects then |
4c7472d3d483
Battalion: Add more health change effects
Wuzzy <Wuzzy2@mail.ru>
parents:
12985
diff
changeset
|
1312 |
local effect = AddVisualGear(GetX(hog), GetY(hog) - cratePickupGap, vgtHealthTag, diff, false) |
4c7472d3d483
Battalion: Add more health change effects
Wuzzy <Wuzzy2@mail.ru>
parents:
12985
diff
changeset
|
1313 |
-- Set Tint |
4c7472d3d483
Battalion: Add more health change effects
Wuzzy <Wuzzy2@mail.ru>
parents:
12985
diff
changeset
|
1314 |
SetVisualGearValues(effect, nil, nil, nil, nil, nil, nil, nil, nil, nil, GetClanColor(GetHogClan(hog))) |
4c7472d3d483
Battalion: Add more health change effects
Wuzzy <Wuzzy2@mail.ru>
parents:
12985
diff
changeset
|
1315 |
end |
4c7472d3d483
Battalion: Add more health change effects
Wuzzy <Wuzzy2@mail.ru>
parents:
12985
diff
changeset
|
1316 |
end |
4c7472d3d483
Battalion: Add more health change effects
Wuzzy <Wuzzy2@mail.ru>
parents:
12985
diff
changeset
|
1317 |
end |
12417 | 1318 |
end |
1319 |
end |
|
1320 |
end |
|
1321 |
||
1322 |
function setupHogTurn(hog) |
|
1323 |
clearHogAmmo(hog) |
|
1324 |
addTurnAmmo(hog) |
|
1325 |
end |
|
1326 |
||
12987
ba577e0b8c27
Battalion: Use official onEndTurn callback
Wuzzy <Wuzzy2@mail.ru>
parents:
12986
diff
changeset
|
1327 |
function onEndTurn() |
12990
add647b0036e
Battalion: Reduce amount of SD messages
Wuzzy <Wuzzy2@mail.ru>
parents:
12989
diff
changeset
|
1328 |
if not firstTurnOver then |
add647b0036e
Battalion: Reduce amount of SD messages
Wuzzy <Wuzzy2@mail.ru>
parents:
12989
diff
changeset
|
1329 |
firstTurnOver = true |
add647b0036e
Battalion: Reduce amount of SD messages
Wuzzy <Wuzzy2@mail.ru>
parents:
12989
diff
changeset
|
1330 |
end |
12417 | 1331 |
local anyHog = nil |
1332 |
for team, val in pairs(teamNames) do |
|
1333 |
-- Count amount of alive hogs in team |
|
1334 |
local c = 0 |
|
1335 |
for idx, hog in pairs(teamHogs[team]) do |
|
1336 |
if GetHealth(hog) ~= nil then |
|
1337 |
anyHog = hog |
|
1338 |
c = c + 1 |
|
1339 |
end |
|
1340 |
end |
|
1341 |
||
1342 |
-- Only one hog left, unfreeze the hog |
|
1343 |
if c == 1 then |
|
1344 |
if GetHealth(anyHog) ~= nil then |
|
1345 |
SetEffect(anyHog, heFrozen, 0) |
|
1346 |
end |
|
1347 |
end |
|
1348 |
end |
|
1349 |
||
1350 |
-- When we are on points mode count remaining weapon/helper points |
|
1351 |
if mode == 'points' and GetHealth(CurHog) ~= nil then |
|
1352 |
savePoints(CurHog) |
|
1353 |
end |
|
1354 |
end |
|
1355 |
||
1356 |
function savePoints(hog) |
|
1357 |
local team = getHogInfo(hog, 'team') |
|
1358 |
local hogWepPoints = 0 |
|
1359 |
local hogHlpPoints = 0 |
|
1360 |
||
13034
905449169319
Battalion: Use AmmoTypeMax for ammo type iterations
Wuzzy <Wuzzy2@mail.ru>
parents:
12992
diff
changeset
|
1361 |
for ammoType=0, AmmoTypeMax do |
12417 | 1362 |
local ammoCount = GetAmmoCount(hog, ammoType) |
1363 |
||
1364 |
if pointsWeaponVal[ammoType] ~= nil then |
|
1365 |
hogWepPoints = hogWepPoints + (pointsWeaponVal[ammoType] * ammoCount) |
|
1366 |
elseif pointsHelperVal[ammoType] ~= nil then |
|
1367 |
hogHlpPoints = hogHlpPoints + (pointsHelperVal[ammoType] * ammoCount) |
|
1368 |
end |
|
1369 |
end |
|
1370 |
||
1371 |
local wepWoTax = pointsPerTeam[team]['weaponsFix'] |
|
1372 |
local hlpWoTax = pointsPerTeam[team]['helpersFix'] |
|
1373 |
local wepToTax = 0 |
|
1374 |
local hlpToTax = 0 |
|
1375 |
||
1376 |
if hogWepPoints <= wepWoTax then |
|
1377 |
wepWoTax = hogWepPoints |
|
1378 |
else |
|
1379 |
wepToTax = hogWepPoints - wepWoTax |
|
1380 |
end |
|
1381 |
||
1382 |
if hogHlpPoints <= hlpWoTax then |
|
1383 |
hlpWoTax = hogHlpPoints |
|
1384 |
else |
|
1385 |
hlpToTax = hogHlpPoints - hlpWoTax |
|
1386 |
end |
|
1387 |
||
1388 |
if suddenDeath == false then |
|
1389 |
pointsPerTeam[team]['weapons'] = pointsPerTeam[team]['weaponsRem'] + wepWoTax + div(wepToTax * pointsKeepPerc, 100) |
|
1390 |
pointsPerTeam[team]['helpers'] = pointsPerTeam[team]['helpersRem'] + hlpWoTax + div(hlpToTax * pointsKeepPerc, 100) |
|
1391 |
else |
|
1392 |
pointsPerTeam[team]['weapons'] = pointsPerTeam[team]['weaponsRem'] + wepWoTax + div(wepToTax * pointsKeepSDPerc, 100) |
|
1393 |
pointsPerTeam[team]['helpers'] = pointsPerTeam[team]['helpersRem'] + hlpWoTax + div(hlpToTax * pointsKeepSDPerc, 100) |
|
1394 |
end |
|
1395 |
||
13035
da691787fcd2
Battalion, Points Mode: Show points next to team bars
Wuzzy <Wuzzy2@mail.ru>
parents:
13034
diff
changeset
|
1396 |
updatePointsLabel(team) |
da691787fcd2
Battalion, Points Mode: Show points next to team bars
Wuzzy <Wuzzy2@mail.ru>
parents:
13034
diff
changeset
|
1397 |
|
12417 | 1398 |
local effect = AddVisualGear(GetX(hog) - (cratePickupGap / 2), GetY(hog), vgtHealthTag, pointsPerTeam[team]['weapons'], false) |
12985
263d006c56a9
Battalion: Clean up and remove dead code
Wuzzy <Wuzzy2@mail.ru>
parents:
12984
diff
changeset
|
1399 |
-- Set Tint |
12417 | 1400 |
SetVisualGearValues(effect, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xFFFFFFFF) |
1401 |
||
1402 |
local effect = AddVisualGear(GetX(hog) + (cratePickupGap / 2), GetY(hog), vgtHealthTag, pointsPerTeam[team]['helpers'], false) |
|
12985
263d006c56a9
Battalion: Clean up and remove dead code
Wuzzy <Wuzzy2@mail.ru>
parents:
12984
diff
changeset
|
1403 |
-- Set Tint |
12417 | 1404 |
SetVisualGearValues(effect, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0x444444FF) |
1405 |
end |
|
1406 |
||
1407 |
function onPointsTurn() |
|
1408 |
local hogWepPoints = 0 |
|
1409 |
local hogHlpPoints = 0 |
|
1410 |
||
1411 |
if suddenDeath == false then |
|
1412 |
pointsPerTeam[LastTeam]['weapons'] = pointsPerTeam[LastTeam]['weapons'] + pointsWepTurn |
|
1413 |
pointsPerTeam[LastTeam]['helpers'] = pointsPerTeam[LastTeam]['helpers'] + pointsHlpTurn |
|
1414 |
||
1415 |
if pointsPerTeam[LastTeam]['weapons'] > pointsWepMax then |
|
1416 |
pointsPerTeam[LastTeam]['weapons'] = pointsWepMax |
|
1417 |
end |
|
1418 |
||
1419 |
if pointsPerTeam[LastTeam]['helpers'] > pointsHlpMax then |
|
1420 |
pointsPerTeam[LastTeam]['helpers'] = pointsHlpMax |
|
1421 |
end |
|
1422 |
else |
|
1423 |
pointsPerTeam[LastTeam]['weapons'] = pointsPerTeam[LastTeam]['weapons'] + pointsWepSDTurn |
|
1424 |
pointsPerTeam[LastTeam]['helpers'] = pointsPerTeam[LastTeam]['helpers'] + pointsHlpSDTurn |
|
1425 |
||
1426 |
if pointsPerTeam[LastTeam]['weapons'] > pointsWepSDMax then |
|
1427 |
pointsPerTeam[LastTeam]['weapons'] = pointsWepSDMax |
|
1428 |
end |
|
1429 |
||
1430 |
if pointsPerTeam[LastTeam]['helpers'] > pointsHlpSDMax then |
|
1431 |
pointsPerTeam[LastTeam]['helpers'] = pointsHlpSDMax |
|
1432 |
end |
|
1433 |
end |
|
1434 |
||
1435 |
-- Take the first alive hog from LastTeam and setup new weapons and helpers |
|
1436 |
-- Since the weapons and helpers are shared the whole team, this is sufficent |
|
1437 |
for idx, teamHog in pairs(teamHogs[LastTeam]) do |
|
1438 |
if GetHealth(teamHog) ~= nil then |
|
1439 |
clearHogAmmo(teamHog) |
|
1440 |
addTurnAmmo(teamHog) |
|
1441 |
break |
|
1442 |
end |
|
1443 |
end |
|
1444 |
end |
|
1445 |
||
1446 |
function onNewTurn() |
|
1447 |
LastHog = CurHog |
|
1448 |
LastTeam = CurTeam |
|
1449 |
CurHog = CurrentHedgehog |
|
1450 |
CurTeam = getHogInfo(CurHog, 'team') |
|
1451 |
||
1452 |
if suddenDeath == true then |
|
1453 |
onSuddenDeathTurn() |
|
1454 |
end |
|
1455 |
||
1456 |
-- Generate new weapons for last hog if it's still alive |
|
1457 |
if LastHog ~= nil and LastHog ~= CurHog then |
|
1458 |
if mode == 'points' then |
|
1459 |
onPointsTurn() |
|
1460 |
else |
|
1461 |
hogInfo[LastHog]['weapons'] = {} |
|
1462 |
hogInfo[LastHog]['helpers'] = {} |
|
1463 |
setupHogTurn(LastHog) |
|
1464 |
end |
|
1465 |
end |
|
1466 |
||
1467 |
-- Recalculate the kings hp if required |
|
1468 |
if mode == 'king' then |
|
1469 |
calcKingHP() |
|
1470 |
end |
|
1471 |
||
1472 |
if mode == 'highland' then |
|
1473 |
highHasBonusWeps = false |
|
1474 |
highHasBonusHelp = false |
|
1475 |
end |
|
1476 |
||
1477 |
-- Set LastWaterLine to the current water line |
|
1478 |
LastWaterLine = WaterLine |
|
1479 |
end |
|
1480 |
||
1481 |
--[[ |
|
1482 |
############################################################################## |
|
1483 |
### GAME START FUNCTIONS ### |
|
1484 |
############################################################################## |
|
1485 |
]]-- |
|
1486 |
||
1487 |
function onAmmoStoreInit() |
|
13034
905449169319
Battalion: Use AmmoTypeMax for ammo type iterations
Wuzzy <Wuzzy2@mail.ru>
parents:
12992
diff
changeset
|
1488 |
for val=0, AmmoTypeMax do |
12417 | 1489 |
SetAmmo(val, 0, 0, 0, 0) |
1490 |
end |
|
1491 |
end |
|
1492 |
||
1493 |
function onParameters() |
|
1494 |
parseParams() |
|
1495 |
||
1496 |
if params['mode'] ~= nil then |
|
1497 |
mode = params['mode'] |
|
12989
353603f5cec3
Tweak some misleading Battalion texts
Wuzzy <Wuzzy2@mail.ru>
parents:
12988
diff
changeset
|
1498 |
if mode == "default" or mode == "king" or mode == "points" or mode == "highland" then |
353603f5cec3
Tweak some misleading Battalion texts
Wuzzy <Wuzzy2@mail.ru>
parents:
12988
diff
changeset
|
1499 |
modeExplicit = true |
353603f5cec3
Tweak some misleading Battalion texts
Wuzzy <Wuzzy2@mail.ru>
parents:
12988
diff
changeset
|
1500 |
end |
12417 | 1501 |
end |
1502 |
||
12992
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
1503 |
if params['mutatenames'] ~= nil then |
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
1504 |
useVariantNames = params['mutatenames'] |
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
1505 |
end |
12417 | 1506 |
if params['mutate'] ~= nil then |
12992
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
1507 |
useVariantHats = params['mutate'] |
12417 | 1508 |
end |
1509 |
||
1510 |
if params['strength'] ~= nil and tonumber(params['strength']) > 0 then |
|
1511 |
strength = tonumber(params['strength']) |
|
1512 |
-- Highland |
|
1513 |
if mode == 'highland' then |
|
1514 |
highPickupCount = highPickupCount * strength |
|
1515 |
highPickupSDCount = highPickupSDCount * strength |
|
1516 |
highHelperCount = highHelperCount * strength |
|
1517 |
highHelperSDCount = highHelperSDCount * strength |
|
1518 |
-- Points |
|
1519 |
elseif mode == 'points' then |
|
1520 |
pointsWepBase = pointsWepBase * strength |
|
1521 |
pointsHlpBase = pointsHlpBase * strength |
|
1522 |
pointsWepTurn = pointsWepTurn * strength |
|
1523 |
pointsHlpTurn = pointsHlpTurn * strength |
|
1524 |
pointsWepMax = pointsWepMax * strength |
|
1525 |
pointsHlpMax = pointsHlpMax * strength |
|
1526 |
pointsWepSDTurn = pointsWepSDTurn * strength |
|
1527 |
pointsHlpSDTurn = pointsHlpSDTurn * strength |
|
1528 |
pointsWepSDMax = pointsWepSDMax * strength |
|
1529 |
pointsHlpSDMax = pointsHlpSDMax * strength |
|
1530 |
-- Either king or normal mode, change variants |
|
1531 |
else |
|
1532 |
for name, data in pairs(variants) do |
|
1533 |
variants[name]["weaponLimit"] = variants[name]["weaponLimit"] * strength |
|
1534 |
variants[name]["helperLimit"] = variants[name]["helperLimit"] * strength |
|
1535 |
end |
|
1536 |
end |
|
1537 |
end |
|
1538 |
||
1539 |
if params['luck'] ~= nil and tonumber(params['luck']) > 0 then |
|
1540 |
luck = tonumber(params['luck']) |
|
1541 |
||
1542 |
healthCrateChance = div(healthCrateChance * luck, 100) |
|
1543 |
utilCrateChance = div(utilCrateChance * luck, 100) |
|
1544 |
weaponCrateChance = div(weaponCrateChance * luck, 100) |
|
1545 |
||
1546 |
healthCrateChanceSD = div(healthCrateChanceSD * luck, 100) |
|
1547 |
utilCrateChanceSD = div(utilCrateChanceSD * luck, 100) |
|
1548 |
weaponCrateChanceSD = div(weaponCrateChanceSD * luck, 100) |
|
1549 |
||
1550 |
emptyCrateChance = div(emptyCrateChance * 100, luck) |
|
1551 |
bonusCrateChance = div(bonusCrateChance * luck, 100) |
|
1552 |
end |
|
1553 |
end |
|
1554 |
||
1555 |
function onGameStart() |
|
1556 |
-- If we are not on points mode, we start randomizing everything |
|
1557 |
if mode ~= 'points' then |
|
1558 |
if GetGameFlag(gfBorder) or MapHasBorder() then |
|
12422
f6fc84c55bfa
Battalion: Rename “Air-General” to “Air General”
Wuzzy <almikes@aol.com>
parents:
12421
diff
changeset
|
1559 |
variants["Air General"] = nil |
12417 | 1560 |
variants['Athlete'] = nil |
1561 |
end |
|
1562 |
||
1563 |
if mode == 'king' then |
|
1564 |
variants['King']['chance'] = 0 |
|
1565 |
end |
|
1566 |
||
1567 |
for i=1,8 do |
|
1568 |
addRandomVariantToTeam("all") |
|
1569 |
end |
|
1570 |
||
1571 |
-- Translate randomized team to a flat group |
|
1572 |
group['all'] = {} |
|
1573 |
for key, val in pairs(counter["all"]) do |
|
1574 |
for i=1, counter["all"][key] do |
|
1575 |
table.insert(group['all'], key) |
|
1576 |
end |
|
1577 |
end |
|
1578 |
||
1579 |
-- Shuffle group for more randomness |
|
1580 |
shuffle(group['all']) |
|
1581 |
-- We are in points mode, setup other weapons |
|
1582 |
elseif mode == 'points' then |
|
1583 |
-- Translate [ammo] -> points to [points] -> {ammo1, ammo2} |
|
1584 |
for ammoType, ammoPoints in pairs(pointsWeaponVal) do |
|
1585 |
if pointsToWep[ammoPoints] == nil then |
|
1586 |
pointsToWep[ammoPoints] = {} |
|
1587 |
end |
|
1588 |
||
1589 |
table.insert(pointsToWep[ammoPoints], ammoType) |
|
1590 |
end |
|
1591 |
||
1592 |
for ammoType, ammoPoints in pairs(pointsHelperVal) do |
|
1593 |
if pointsToHlp[ammoPoints] == nil then |
|
1594 |
pointsToHlp[ammoPoints] = {} |
|
1595 |
end |
|
1596 |
||
1597 |
table.insert(pointsToHlp[ammoPoints], ammoType) |
|
1598 |
end |
|
1599 |
||
1600 |
for points, ammoList in pairs(pointsToWep) do |
|
1601 |
table.insert(wepPoints, points) |
|
1602 |
end |
|
1603 |
||
1604 |
for points, ammoList in pairs(pointsToHlp) do |
|
1605 |
table.insert(hlpPoints, points) |
|
1606 |
end |
|
1607 |
||
1608 |
table.sort(wepPoints) |
|
1609 |
table.sort(hlpPoints) |
|
1610 |
end |
|
1611 |
||
1612 |
-- Initial Hog Setup |
|
1613 |
runOnGears(countTeamHogs) |
|
1614 |
||
1615 |
for key, val in pairs(teamNames) do |
|
1616 |
if mode == 'points' then |
|
1617 |
pointsPerTeam[key] = {} |
|
1618 |
pointsPerTeam[key]['weapons'] = pointsWepBase |
|
1619 |
pointsPerTeam[key]['helpers'] = pointsHlpBase |
|
13035
da691787fcd2
Battalion, Points Mode: Show points next to team bars
Wuzzy <Wuzzy2@mail.ru>
parents:
13034
diff
changeset
|
1620 |
updatePointsLabel(key) |
12417 | 1621 |
else |
1622 |
setTeamHogs(key) |
|
1623 |
end |
|
1624 |
end |
|
1625 |
||
1626 |
runOnGears(setHogInfo) |
|
1627 |
||
1628 |
if mode ~= 'points' then |
|
1629 |
runOnGears(setHogVariant) |
|
1630 |
runOnGears(setupHogTurn) |
|
12992
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
1631 |
if useVariantNames ~= false and useVariantNames ~= 'false' then |
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
1632 |
runOnGears(SetHogVariantName) |
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
1633 |
end |
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
1634 |
if useVariantHats ~= false and useVariantHats ~= 'false' then |
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
1635 |
runOnGears(SetHogVariantHat) |
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
1636 |
elseif mode == 'king' then |
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
1637 |
-- If variant hats are disabled but we're in King Mode, |
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
1638 |
-- we still change *some* hats to make sure only kings |
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
1639 |
-- wear crows. Otherwise, you don't know who's the king! |
ba99ecc53cf0
Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12991
diff
changeset
|
1640 |
runOnGears(SetHogVariantHatKingMode) |
12417 | 1641 |
end |
1642 |
end |
|
1643 |
||
1644 |
if mode == 'points' then |
|
1645 |
for key, val in pairs(teamNames) do |
|
1646 |
clearHogAmmo(teamHogs[key][1]) |
|
1647 |
addTurnAmmo(teamHogs[key][1]) |
|
1648 |
end |
|
1649 |
end |
|
1650 |
||
1651 |
if mode == 'king' then |
|
12986
4c7472d3d483
Battalion: Add more health change effects
Wuzzy <Wuzzy2@mail.ru>
parents:
12985
diff
changeset
|
1652 |
calcKingHP(false) |
12417 | 1653 |
end |
1654 |
||
1655 |
local txt = '' |
|
1656 |
local icon = 0 |
|
1657 |
||
1658 |
if mode ~= 'points' then |
|
12420
e11758f70cce
Rewrite all Battalion strings to be more translator-friendly
Wuzzy <almikes@aol.com>
parents:
12417
diff
changeset
|
1659 |
txt = txt .. loc("Variants: Hogs will be randomized from 12 different variants") .. "|" |
e11758f70cce
Rewrite all Battalion strings to be more translator-friendly
Wuzzy <almikes@aol.com>
parents:
12417
diff
changeset
|
1660 |
txt = txt .. loc("Weapons: Hogs will get 1 out of 3 weapons randomly each turn") .. "|" |
e11758f70cce
Rewrite all Battalion strings to be more translator-friendly
Wuzzy <almikes@aol.com>
parents:
12417
diff
changeset
|
1661 |
txt = txt .. loc("Helpers: Hogs will get 1 out of 2 helpers randomly each turn") .. "|" |
e11758f70cce
Rewrite all Battalion strings to be more translator-friendly
Wuzzy <almikes@aol.com>
parents:
12417
diff
changeset
|
1662 |
txt = txt .. loc("Crates: Crates drop randomly with chance of being empty") .. "|" |
e11758f70cce
Rewrite all Battalion strings to be more translator-friendly
Wuzzy <almikes@aol.com>
parents:
12417
diff
changeset
|
1663 |
txt = txt .. loc("Last Resort: Having less than 25% base health gives kamikaze") .. "|" |
12989
353603f5cec3
Tweak some misleading Battalion texts
Wuzzy <Wuzzy2@mail.ru>
parents:
12988
diff
changeset
|
1664 |
txt = txt .. loc("Modifiers: Unlimited attacks, per-hog ammo") .. "|" |
12417 | 1665 |
else |
12420
e11758f70cce
Rewrite all Battalion strings to be more translator-friendly
Wuzzy <almikes@aol.com>
parents:
12417
diff
changeset
|
1666 |
txt = txt .. loc("Crates: Crates drop randomly and may be empty") .. "|" |
12989
353603f5cec3
Tweak some misleading Battalion texts
Wuzzy <Wuzzy2@mail.ru>
parents:
12988
diff
changeset
|
1667 |
txt = txt .. loc("Modifiers: Unlimited attacks, shared clan ammo") .. "|" |
12417 | 1668 |
end |
1669 |
||
1670 |
if luck ~= 100 then |
|
12420
e11758f70cce
Rewrite all Battalion strings to be more translator-friendly
Wuzzy <almikes@aol.com>
parents:
12417
diff
changeset
|
1671 |
txt = txt .. string.format(loc("Luck: %d%% (modifier for crates)"), luck) .. "|" |
12417 | 1672 |
end |
1673 |
||
1674 |
if strength > 1 then |
|
12420
e11758f70cce
Rewrite all Battalion strings to be more translator-friendly
Wuzzy <almikes@aol.com>
parents:
12417
diff
changeset
|
1675 |
txt = txt .. string.format(loc("Strength: %d (multiplier for ammo)"), strength) .. "|" |
12417 | 1676 |
end |
1677 |
||
1678 |
if mode == 'highland' then |
|
12420
e11758f70cce
Rewrite all Battalion strings to be more translator-friendly
Wuzzy <almikes@aol.com>
parents:
12417
diff
changeset
|
1679 |
txt = txt .. " |" |
12989
353603f5cec3
Tweak some misleading Battalion texts
Wuzzy <Wuzzy2@mail.ru>
parents:
12988
diff
changeset
|
1680 |
txt = txt .. loc("--- Highland Mode ---").."|" |
12420
e11758f70cce
Rewrite all Battalion strings to be more translator-friendly
Wuzzy <almikes@aol.com>
parents:
12417
diff
changeset
|
1681 |
txt = txt .. string.format(loc("Enemy kills: Collect victim's weapons and +%d%% of its base health"), highEnemyKillHPBonus).."|" |
e11758f70cce
Rewrite all Battalion strings to be more translator-friendly
Wuzzy <almikes@aol.com>
parents:
12417
diff
changeset
|
1682 |
txt = txt .. string.format(loc("Friendly kills: Clear killer's pool and -%d%% of its base health"), highFriendlyKillHPBonus).."|" |
e11758f70cce
Rewrite all Battalion strings to be more translator-friendly
Wuzzy <almikes@aol.com>
parents:
12417
diff
changeset
|
1683 |
txt = txt .. string.format(loc("Turns: Hogs get %d random weapon(s) from their pool"), highPickupCount).."|" |
e11758f70cce
Rewrite all Battalion strings to be more translator-friendly
Wuzzy <almikes@aol.com>
parents:
12417
diff
changeset
|
1684 |
txt = txt .. loc("Hint: Kills won't transfer a hog's pool to the killer's pool").."|" |
e11758f70cce
Rewrite all Battalion strings to be more translator-friendly
Wuzzy <almikes@aol.com>
parents:
12417
diff
changeset
|
1685 |
txt = txt .. loc("Specials: Kings and air generals drop helpers, not weapons").."|" |
12417 | 1686 |
icon = 1 -- Target |
1687 |
elseif mode == 'king' then |
|
12420
e11758f70cce
Rewrite all Battalion strings to be more translator-friendly
Wuzzy <almikes@aol.com>
parents:
12417
diff
changeset
|
1688 |
txt = txt .. " |" |
12989
353603f5cec3
Tweak some misleading Battalion texts
Wuzzy <Wuzzy2@mail.ru>
parents:
12988
diff
changeset
|
1689 |
txt = txt .. loc("--- King Mode ---").."|" |
12991
1c38d4370943
Battalion (mode=king): Kill the team when the king died instea of dismissing
Wuzzy <Wuzzy2@mail.ru>
parents:
12990
diff
changeset
|
1690 |
txt = txt .. loc("Protect the King: When the king dies, so does the team").."|" |
12420
e11758f70cce
Rewrite all Battalion strings to be more translator-friendly
Wuzzy <almikes@aol.com>
parents:
12417
diff
changeset
|
1691 |
txt = txt .. string.format(loc("Turns: King's health is set to %d%% of the team health"), kingLinkPerc).."|" |
12985
263d006c56a9
Battalion: Clean up and remove dead code
Wuzzy <Wuzzy2@mail.ru>
parents:
12984
diff
changeset
|
1692 |
icon = 0 -- Golden Crown |
12417 | 1693 |
elseif mode == 'points' then |
12420
e11758f70cce
Rewrite all Battalion strings to be more translator-friendly
Wuzzy <almikes@aol.com>
parents:
12417
diff
changeset
|
1694 |
txt = txt .. " |" |
12989
353603f5cec3
Tweak some misleading Battalion texts
Wuzzy <Wuzzy2@mail.ru>
parents:
12988
diff
changeset
|
1695 |
txt = txt .. loc("--- Points Mode ---").."|" |
12422
f6fc84c55bfa
Battalion: Rename “Air-General” to “Air General”
Wuzzy <almikes@aol.com>
parents:
12421
diff
changeset
|
1696 |
txt = txt .. loc("Variants: Kings and air generals are disabled").."|" |
12420
e11758f70cce
Rewrite all Battalion strings to be more translator-friendly
Wuzzy <almikes@aol.com>
parents:
12417
diff
changeset
|
1697 |
txt = txt .. string.format(loc("Weapons: Each team starts with %d weapon points"), pointsWepBase).."|" |
e11758f70cce
Rewrite all Battalion strings to be more translator-friendly
Wuzzy <almikes@aol.com>
parents:
12417
diff
changeset
|
1698 |
txt = txt .. string.format(loc("Helpers: Each team starts with %d helper points"), pointsHlpBase).."|" |
e11758f70cce
Rewrite all Battalion strings to be more translator-friendly
Wuzzy <almikes@aol.com>
parents:
12417
diff
changeset
|
1699 |
txt = txt .. string.format(loc("Turns: Refill %d weapon and %d helper points|and randomize weapons and helpers based on team points"), pointsWepTurn, pointsHlpTurn).."|" |
12417 | 1700 |
icon = 4 -- Golden Star |
1701 |
else |
|
1702 |
icon = -amGrenade -- Grenade |
|
1703 |
end |
|
1704 |
||
12420
e11758f70cce
Rewrite all Battalion strings to be more translator-friendly
Wuzzy <almikes@aol.com>
parents:
12417
diff
changeset
|
1705 |
txt = txt .. " |" |
e11758f70cce
Rewrite all Battalion strings to be more translator-friendly
Wuzzy <almikes@aol.com>
parents:
12417
diff
changeset
|
1706 |
txt = txt .. loc("--- Sudden Death ---").."|" |
e11758f70cce
Rewrite all Battalion strings to be more translator-friendly
Wuzzy <almikes@aol.com>
parents:
12417
diff
changeset
|
1707 |
txt = txt .. loc("Weapons: Nearly every hog variant gets 1 kamikaze").."|" |
e11758f70cce
Rewrite all Battalion strings to be more translator-friendly
Wuzzy <almikes@aol.com>
parents:
12417
diff
changeset
|
1708 |
txt = txt .. loc("Crates: Crates drop more often with a higher chance of bonus ammo").."|" |
e11758f70cce
Rewrite all Battalion strings to be more translator-friendly
Wuzzy <almikes@aol.com>
parents:
12417
diff
changeset
|
1709 |
txt = txt .. loc("Water: Rises by 37 per turn").."|" |
e11758f70cce
Rewrite all Battalion strings to be more translator-friendly
Wuzzy <almikes@aol.com>
parents:
12417
diff
changeset
|
1710 |
txt = txt .. loc("Health: Hogs lose up to 7% base health per turn").."|" |
12417 | 1711 |
|
12989
353603f5cec3
Tweak some misleading Battalion texts
Wuzzy <Wuzzy2@mail.ru>
parents:
12988
diff
changeset
|
1712 |
-- Add hint if mode was not set in script parameter, or set incorrectly |
353603f5cec3
Tweak some misleading Battalion texts
Wuzzy <Wuzzy2@mail.ru>
parents:
12988
diff
changeset
|
1713 |
if not modeExplicit then |
12420
e11758f70cce
Rewrite all Battalion strings to be more translator-friendly
Wuzzy <almikes@aol.com>
parents:
12417
diff
changeset
|
1714 |
txt = txt .. " |" |
e11758f70cce
Rewrite all Battalion strings to be more translator-friendly
Wuzzy <almikes@aol.com>
parents:
12417
diff
changeset
|
1715 |
txt = txt .. loc("--- Hint ---").."|" |
e11758f70cce
Rewrite all Battalion strings to be more translator-friendly
Wuzzy <almikes@aol.com>
parents:
12417
diff
changeset
|
1716 |
txt = txt .. loc("Modes: Activate “highland”, “king” or “points” mode by putting mode=<name>|into the script parameter").."|" |
12417 | 1717 |
end |
1718 |
||
1719 |
if mode == 'highland' then |
|
12420
e11758f70cce
Rewrite all Battalion strings to be more translator-friendly
Wuzzy <almikes@aol.com>
parents:
12417
diff
changeset
|
1720 |
txt = txt .. string.format(loc("Highland: Hogs get %d random weapons from their pool"), highPickupSDCount) .. "|" |
12417 | 1721 |
end |
1722 |
||
12427
959d1f4dff25
Battalion: RC Plane gets 2 bombs, set air bomb dmg to 20
Wuzzy <almikes@aol.com>
parents:
12426
diff
changeset
|
1723 |
SetAmmoDescriptionAppendix(amRCPlane, loc("The RC plane only carries 2 weak bombs.")) |
12426
a0c655e38cc8
Battalion: Extend weapon tooltips for modified weapons
Wuzzy <almikes@aol.com>
parents:
12425
diff
changeset
|
1724 |
SetAmmoDescriptionAppendix(amAirAttack, loc("The air bombs are weaker than usual.")) |
a0c655e38cc8
Battalion: Extend weapon tooltips for modified weapons
Wuzzy <almikes@aol.com>
parents:
12425
diff
changeset
|
1725 |
SetAmmoDescriptionAppendix(amCake, loc("The explosion is weaker than usual.")) |
a0c655e38cc8
Battalion: Extend weapon tooltips for modified weapons
Wuzzy <almikes@aol.com>
parents:
12425
diff
changeset
|
1726 |
SetAmmoDescriptionAppendix(amDEagle, loc("Base damage has been modified to 12 per shot.")) |
a0c655e38cc8
Battalion: Extend weapon tooltips for modified weapons
Wuzzy <almikes@aol.com>
parents:
12425
diff
changeset
|
1727 |
|
12423
665317ace94e
Show Battalion mission panel for the default time
Wuzzy <almikes@aol.com>
parents:
12422
diff
changeset
|
1728 |
ShowMission(loc("Battalion"), loc("Less tools, more fun"), txt, icon, 0) |
12417 | 1729 |
end |
1730 |
||
1731 |
function onGameInit() |
|
1732 |
--[[ CONFIGURATEABLE FOR PLAYERS ]]-- |
|
1733 |
--[[ ONCE IT HAS BEEN ADDED TO HW ]]-- |
|
1734 |
||
1735 |
--[[ REQUIRED CONFIGURATIONS ]]-- |
|
1736 |
||
1737 |
WaterRise = 37 -- Water rises by 37 |
|
1738 |
HealthDecrease = 0 -- No health decrease by game, script with 7% |
|
1739 |
CaseFreq = 0 -- don't spawn crates |
|
1740 |
||
1741 |
-- Removed gfResetWeps to see weapons next turn |
|
1742 |
EnableGameFlags(gfInfAttack) |
|
1743 |
DisableGameFlags(gfResetWeps) |
|
1744 |
||
1745 |
if mode ~= 'points' then |
|
1746 |
EnableGameFlags(gfPerHogAmmo) |
|
1747 |
else |
|
1748 |
DisableGameFlags(gfPerHogAmmo) |
|
1749 |
end |
|
1750 |
end |