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