16 loc("A random hedgehog will inherit the weapons of his deceased team-mates.").."|".. |
16 loc("A random hedgehog will inherit the weapons of his deceased team-mates.").."|".. |
17 loc("If you kill a hedgehog with the respective weapon your health points will be set to 100.").."|".. |
17 loc("If you kill a hedgehog with the respective weapon your health points will be set to 100.").."|".. |
18 loc("If you injure a hedgehog you'll get 35% of the damage dealt.").."|".. |
18 loc("If you injure a hedgehog you'll get 35% of the damage dealt.").."|".. |
19 loc("Every time you kill an enemy hog your ammo will get reset next turn.").."|".. |
19 loc("Every time you kill an enemy hog your ammo will get reset next turn.").."|".. |
20 loc("The rope won't get reset.") |
20 loc("The rope won't get reset.") |
21 -- dialogs |
|
22 local dialog01 = {} |
|
23 -- mission objectives |
21 -- mission objectives |
24 local goals = { |
22 local goals = { |
25 ["init"] = {missionName, loc("Challenge objectives"), challengeObjectives, 1, 35000}, |
23 ["init"] = {missionName, loc("Challenge objectives"), challengeObjectives, 1, 35000}, |
26 } |
24 } |
27 -- hogs |
25 -- hogs |
52 color = tonumber("FF0000",16) -- red |
50 color = tonumber("FF0000",16) -- red |
53 } |
51 } |
54 -- After hero killed an enemy, his weapons will be reset in the next round |
52 -- After hero killed an enemy, his weapons will be reset in the next round |
55 local heroWeaponResetPending = false |
53 local heroWeaponResetPending = false |
56 local battleStarted = false |
54 local battleStarted = false |
|
55 local firstTurn = true |
57 |
56 |
58 -------------- LuaAPI EVENT HANDLERS ------------------ |
57 -------------- LuaAPI EVENT HANDLERS ------------------ |
59 |
58 |
60 function onGameInit() |
59 function onGameInit() |
61 Seed = 1 |
60 Seed = 1 |
100 AddAmmo(hero.gear, amSkip, 100) |
98 AddAmmo(hero.gear, amSkip, 100) |
101 AddAmmo(hero.gear, amRope, 2) |
99 AddAmmo(hero.gear, amRope, 2) |
102 refreshHeroAmmo() |
100 refreshHeroAmmo() |
103 |
101 |
104 SendHealthStatsOff() |
102 SendHealthStatsOff() |
105 AddAnim(dialog01) |
|
106 end |
103 end |
107 |
104 |
108 function onNewTurn() |
105 function onNewTurn() |
|
106 battleStarted = true |
|
107 if firstTurn then |
|
108 -- Generous ready time in first turn to more time to read the mission panel |
|
109 ReadyTimeLeft = 35000 |
|
110 firstTurn = false |
|
111 end |
109 if CurrentHedgehog ~= hero.gear then |
112 if CurrentHedgehog ~= hero.gear then |
110 enemyWeapons() |
113 enemyWeapons() |
111 elseif heroWeaponResetPending then |
114 elseif heroWeaponResetPending then |
112 refreshHeroAmmo() |
115 refreshHeroAmmo() |
113 end |
116 end |
162 end |
165 end |
163 end |
166 end |
164 |
167 |
165 onHogAttack = hideMissionOnAction |
168 onHogAttack = hideMissionOnAction |
166 onAttack = hideMissionOnAction |
169 onAttack = hideMissionOnAction |
167 onLeft = hideMissionOnAction |
|
168 onRight = hideMissionOnAction |
|
169 onUp = hideMissionOnAction |
|
170 onDown = hideMissionOnAction |
|
171 onLJump = hideMissionOnAction |
|
172 onHJump = hideMissionOnAction |
|
173 onSlot = hideMissionOnAction |
170 onSlot = hideMissionOnAction |
174 onSetWeapon = hideMissionOnAction |
171 onSetWeapon = hideMissionOnAction |
175 onTimer = hideMissionOnAction |
|
176 |
|
177 function onPrecise() |
|
178 if GameTime > 3000 then |
|
179 SetAnimSkip(true) |
|
180 end |
|
181 end |
|
182 |
172 |
183 -------------- EVENTS ------------------ |
173 -------------- EVENTS ------------------ |
184 |
174 |
185 function onHeroDeath(gear) |
175 function onHeroDeath(gear) |
186 if not GetHealth(hero.gear) then |
176 if not GetHealth(hero.gear) then |
229 SaveCampaignVar("Mission11Won", "true") |
219 SaveCampaignVar("Mission11Won", "true") |
230 checkAllMissionsCompleted() |
220 checkAllMissionsCompleted() |
231 EndGame() |
221 EndGame() |
232 end |
222 end |
233 |
223 |
234 -------------- ANIMATIONS ------------------ |
|
235 |
|
236 function Skipanim(anim) |
|
237 startBattle() |
|
238 end |
|
239 |
|
240 function AnimationSetup() |
|
241 -- DIALOG 01 - Start, game instructions |
|
242 AddSkipFunction(dialog01, Skipanim, {dialog01}) |
|
243 table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}}) |
|
244 table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Somewhere on the Planet of Death ..."), 3000}}) |
|
245 table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("... Hog Solo fights for his life"), 3000}}) |
|
246 table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Each time you play this missions enemy hogs will play in a random order"), 5000}}) |
|
247 table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("At the start of the game each enemy hog has only the weapon that he is named after"), 5000}}) |
|
248 table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("A random hedgehog will inherit the weapons of his deceased team-mates"), 5000}}) |
|
249 table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("If you kill a hedgehog with the respective weapon your health points will be set to 100"), 5000}}) |
|
250 table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("If you injure a hedgehog you'll get 35% of the damage dealt"), 5000}}) |
|
251 table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Every time you kill an enemy hog your ammo will get reset next turn"), 5000}}) |
|
252 table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Rope won't get reset"), 2000}}) |
|
253 table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}}) |
|
254 table.insert(dialog01, {func = startBattle, args = {hero.gear}}) |
|
255 end |
|
256 |
|
257 ------------ Other Functions ------------------- |
224 ------------ Other Functions ------------------- |
258 |
|
259 function startBattle() |
|
260 battleStarted = true |
|
261 AnimSwitchHog(hero.gear) |
|
262 TurnTimeLeft = TurnTime |
|
263 end |
|
264 |
225 |
265 function shuffleHogs(hogs) |
226 function shuffleHogs(hogs) |
266 local hogsNumber = table.getn(hogs) |
227 local hogsNumber = table.getn(hogs) |
267 for i=1,hogsNumber do |
228 for i=1,hogsNumber do |
268 local randomHog = GetRandom(hogsNumber) + 1 |
229 local randomHog = GetRandom(hogsNumber) + 1 |