139 AddAmmo(smuggler1.gear, amGrenade, 2) |
139 AddAmmo(smuggler1.gear, amGrenade, 2) |
140 AddAmmo(smuggler1.gear, amDEagle, 2) |
140 AddAmmo(smuggler1.gear, amDEagle, 2) |
141 AddAmmo(smuggler3.gear, amRope, 2) |
141 AddAmmo(smuggler3.gear, amRope, 2) |
142 |
142 |
143 -- spawn crates |
143 -- spawn crates |
144 SpawnAmmoCrate(btorch2X, btorch2Y, amBlowTorch) |
|
145 SpawnAmmoCrate(btorch3X, btorch3Y, amBlowTorch) |
144 SpawnAmmoCrate(btorch3X, btorch3Y, amBlowTorch) |
146 SpawnUtilityCrate(rope1X, rope1Y, amRope) |
145 SpawnUtilityCrate(rope1X, rope1Y, amRope) |
147 SpawnUtilityCrate(rope2X, rope2Y, amRope) |
146 SpawnUtilityCrate(rope2X, rope2Y, amRope) |
148 SpawnUtilityCrate(rope3X, rope3Y, amRope) |
147 SpawnUtilityCrate(rope3X, rope3Y, amRope) |
149 SpawnUtilityCrate(portalX, portalY, amPortalGun) |
148 SpawnUtilityCrate(portalX, portalY, amPortalGun) |
150 SpawnUtilityCrate(girderX, girderY, amGirder) |
|
151 |
|
152 SpawnHealthCrate(3300, 970) |
149 SpawnHealthCrate(3300, 970) |
|
150 |
|
151 -- the win crates, collect both to win |
|
152 btorch2.gear = SpawnAmmoCrate(btorch2X, btorch2Y, amBlowTorch) |
|
153 girder.gear = SpawnUtilityCrate(girderX, girderY, amGirder) |
153 |
154 |
154 -- adding mines - BOOM! |
155 -- adding mines - BOOM! |
155 AddGear(1280, 460, gtMine, 0, 0, 0, 0) |
156 AddGear(1280, 460, gtMine, 0, 0, 0, 0) |
156 AddGear(270, 460, gtMine, 0, 0, 0, 0) |
157 AddGear(270, 460, gtMine, 0, 0, 0, 0) |
157 AddGear(3460, 60, gtMine, 0, 0, 0, 0) |
158 AddGear(3460, 60, gtMine, 0, 0, 0, 0) |
231 SetAmmo(amBlowTorch, 0, 0, 0, 1) |
232 SetAmmo(amBlowTorch, 0, 0, 0, 1) |
232 SetAmmo(amRope, 0, 0, 0, 1) |
233 SetAmmo(amRope, 0, 0, 0, 1) |
233 SetAmmo(amPortalGun, 0, 0, 0, 1) |
234 SetAmmo(amPortalGun, 0, 0, 0, 1) |
234 SetAmmo(amGirder, 0, 0, 0, 3) |
235 SetAmmo(amGirder, 0, 0, 0, 3) |
235 SetAmmo(amSkip, 9, 0, 0, 1) |
236 SetAmmo(amSkip, 9, 0, 0, 1) |
236 end |
237 |
237 |
238 SetAmmo(amTeleport, 9, 0, 0, 1) |
238 function onGearAdd(gear) |
239 end |
239 if GetGearType(gear) == gtCase then |
240 |
240 if GetX(gear) == btorch2X and GetY(gear) == btorch2Y then |
241 function onGearDelete(gear) |
241 btorch2.gear = gear |
242 local foundDeviceCrateCandidate = function(candidate_crate_table, other_crate_table) |
242 btorch2.destroyed = false |
243 candidate_crate_table.deleted = true |
243 btorch2.deleted = false |
244 -- Evaluates to false if crate has been collected |
244 elseif GetX(gear) == girderX and GetY(gear) == girderY then |
245 if (band(GetGearMessage(candidate_crate_table.gear), gmDestroy) == 0) then |
245 girder.gear = gear |
246 candidate_crate_table.destroyed = true |
246 girder.destroyed = false |
|
247 girder.deleted = false |
|
248 end |
247 end |
249 end |
248 |
250 end |
249 if cratesFound == 0 then |
251 |
250 -- First win crate collected: |
252 function onGearDamage(gear, damage) |
251 -- Turn the other crate into a fake crate; this will “contain” the device. |
|
252 SetGearPos(other_crate_table.gear, bor(GetGearPos(other_crate_table.gear), 0x8)) |
|
253 elseif cratesFound == 1 then |
|
254 -- Second win crate collected: |
|
255 -- This crate contains the anti-gravity part! VICTORY! |
|
256 PlaySound(sndShotgunReload) |
|
257 -- It's displayed as if collecting a normal ammo/utility crate. :-) |
|
258 AddCaption(loc("Anti-Gravity Device Part (+1)"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo) |
|
259 end |
|
260 end |
|
261 |
253 if gear == girder.gear then |
262 if gear == girder.gear then |
254 girder.destroyed = true |
263 foundDeviceCrateCandidate(girder, btorch2) |
255 elseif gear == btorch2.gear then |
264 elseif gear == btorch2.gear then |
256 btorch2.destroyed = true |
265 foundDeviceCrateCandidate(btorch2, girder) |
257 end |
|
258 end |
|
259 |
|
260 function onGearDelete(gear) |
|
261 if gear == girder.gear then |
|
262 girder.deleted = true |
|
263 elseif gear == btorch2.gear then |
|
264 btorch2.deleted = true |
|
265 end |
266 end |
266 if gear == hero.gear then |
267 if gear == hero.gear then |
267 hero.dead = true |
268 hero.dead = true |
268 elseif (gear == smuggler1.gear or gear == smuggler2.gear or gear == smuggler3.gear) and heroIsInBattle then |
269 elseif (gear == smuggler1.gear or gear == smuggler2.gear or gear == smuggler3.gear) and heroIsInBattle then |
269 heroIsInBattle = false |
270 heroIsInBattle = false |
485 AnimSay(hero.gear, loc("Haven't found it yet ..."), SAY_THINK, 5000) |
486 AnimSay(hero.gear, loc("Haven't found it yet ..."), SAY_THINK, 5000) |
486 cratesFound = cratesFound + 1 |
487 cratesFound = cratesFound + 1 |
487 elseif cratesFound == 1 then |
488 elseif cratesFound == 1 then |
488 -- end game |
489 -- end game |
489 saveCompletedStatus(5) |
490 saveCompletedStatus(5) |
490 AnimSay(hero.gear, loc("Hooray!"), SAY_SHOUT, 5000) |
491 AnimSay(hero.gear, loc("I found it! Hooray!"), SAY_SHOUT, 5000) |
|
492 PlaySound(sndVictory, hero.gear) |
491 SendStat(siGameResult, loc("Congratulations, you won!")) |
493 SendStat(siGameResult, loc("Congratulations, you won!")) |
492 SendStat(siCustomAchievement, loc("To win the game you had to collect the 2 crates with no specific order.")) |
494 SendStat(siCustomAchievement, loc("To win the game you had to collect the 2 crates with no specific order.")) |
493 SendStat(siPlayerKills,'1',teamC.name) |
495 SendStat(siPlayerKills,'1',teamC.name) |
494 SendStat(siPlayerKills,'0',teamB.name) |
496 SendStat(siPlayerKills,'0',teamB.name) |
495 EndGame() |
497 EndGame() |