share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice01.lua
branchspacecampaign
changeset 9622 db9f6b7955ba
parent 9582 bf314b2258b3
child 9623 d3f7d1b8b46d
equal deleted inserted replaced
9621:0e633b929825 9622:db9f6b7955ba
     1 ------------------- ABOUT ----------------------
     1 ------------------- ABOUT ----------------------
     2 --
     2 --
     3 -- In this cold planet hero seeks for a part of the
     3 -- In this cold planet hero seeks for a part of the
     4 -- antigravity device. He has to capture Icy Pit who
     4 -- antigravity device. He has to capture Thanta who
     5 -- knows where the device is hidden. Hero will be
     5 -- knows where the device is hidden. Hero will be
     6 -- able to use only the ice gun for this mission.
     6 -- able to use only the ice gun for this mission.
     7 
     7 
     8 -- TODO
     8 -- TODO
     9 -- TEST TEST AND MORE TEST
     9 -- TEST TEST AND MORE TEST
    19 local heroAtAntiFlyArea = false
    19 local heroAtAntiFlyArea = false
    20 local heroVisitedAntiFlyArea = false
    20 local heroVisitedAntiFlyArea = false
    21 local heroAtFinalStep = false
    21 local heroAtFinalStep = false
    22 local iceGunTaken = false
    22 local iceGunTaken = false
    23 local checkPointReached = 1 -- 1 is normal spawn
    23 local checkPointReached = 1 -- 1 is normal spawn
       
    24 local heroDamageAtCurrentTurn = 0
    24 -- dialogs
    25 -- dialogs
    25 local dialog01 = {}
    26 local dialog01 = {}
    26 local dialog02 = {}
    27 local dialog02 = {}
    27 -- mission objectives
    28 -- mission objectives
    28 local goals = {
    29 local goals = {
   195 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
   196 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
   196 	AddEvent(onHeroFinalStep, {hero.gear}, heroFinalStep, {hero.gear}, 0)
   197 	AddEvent(onHeroFinalStep, {hero.gear}, heroFinalStep, {hero.gear}, 0)
   197 	AddEvent(onAntiFlyArea, {hero.gear}, antiFlyArea, {hero.gear}, 1)
   198 	AddEvent(onAntiFlyArea, {hero.gear}, antiFlyArea, {hero.gear}, 1)
   198 	AddEvent(onNonAntiFlyArea, {hero.gear}, nonAntiFlyArea, {hero.gear}, 1)
   199 	AddEvent(onNonAntiFlyArea, {hero.gear}, nonAntiFlyArea, {hero.gear}, 1)
   199 	AddEvent(onThantaDeath, {bandit1.gear}, thantaDeath, {bandit1.gear}, 1)
   200 	AddEvent(onThantaDeath, {bandit1.gear}, thantaDeath, {bandit1.gear}, 1)
   200 	AddEvent(onHeroWin, {hero.gear}, heroWin, {hero.gear}, 1)
   201 	AddEvent(onHeroWin, {hero.gear}, heroWin, {hero.gear}, 0)
   201 	
   202 	
   202 	AddAmmo(hero.gear, amJetpack, 99)
   203 	AddAmmo(hero.gear, amJetpack, 99)
       
   204 	AddAmmo(hero.gear, amTeleport, 99)
   203 	AddAmmo(bandit1.gear, amBazooka, 5)
   205 	AddAmmo(bandit1.gear, amBazooka, 5)
   204 	AddAmmo(bandit2.gear, amBazooka, 4)
   206 	AddAmmo(bandit2.gear, amBazooka, 4)
   205 	AddAmmo(bandit3.gear, amMine, 2)
   207 	AddAmmo(bandit3.gear, amMine, 2)
   206 	AddAmmo(bandit3.gear, amGrenade, 3)
   208 	AddAmmo(bandit3.gear, amGrenade, 3)
   207 	AddAmmo(bandit4.gear, amBazooka, 5)
   209 	AddAmmo(bandit4.gear, amBazooka, 5)
   222 	end
   224 	end
   223 	
   225 	
   224 	SendHealthStatsOff()
   226 	SendHealthStatsOff()
   225 end
   227 end
   226 
   228 
   227 function onNewTurn()		
   229 function onNewTurn()
       
   230 	heroDamageAtCurrentTurn = 0
   228 	-- round has to start if hero goes near the column
   231 	-- round has to start if hero goes near the column
   229 	if not heroVisitedAntiFlyArea and CurrentHedgehog ~= hero.gear then
   232 	if not heroVisitedAntiFlyArea and CurrentHedgehog ~= hero.gear then
   230 		TurnTimeLeft = 0
   233 		TurnTimeLeft = 0
   231 	elseif not heroVisitedAntiFlyArea and CurrentHedgehog == hero.gear then
   234 	elseif not heroVisitedAntiFlyArea and CurrentHedgehog == hero.gear then
   232 		TurnTimeLeft = -1
   235 		TurnTimeLeft = -1
   325 	if GameTime > 3000 then
   328 	if GameTime > 3000 then
   326 		SetAnimSkip(true)   
   329 		SetAnimSkip(true)   
   327 	end
   330 	end
   328 end
   331 end
   329 
   332 
       
   333 function onGearDamage(gear, damage)
       
   334 	if gear == hero.gear then
       
   335 		heroDamageAtCurrentTurn = heroDamageAtCurrentTurn + damage
       
   336 	end
       
   337 end
       
   338 
   330 -------------- EVENTS ------------------
   339 -------------- EVENTS ------------------
   331 
   340 
   332 function onAntiFlyArea(gear)
   341 function onAntiFlyArea(gear)
   333 	if not hero.dead and (GetX(gear) > 860 or GetY(gear) < 1400) and not heroAtAntiFlyArea then
   342 	if not hero.dead and (GetX(gear) > 860 or GetY(gear) < 1400) and not heroAtAntiFlyArea then
   334 		return true
   343 		return true
   377 	end
   386 	end
   378 	return false
   387 	return false
   379 end
   388 end
   380 
   389 
   381 function onHeroWin(gear)
   390 function onHeroWin(gear)
   382 	if (not hero.dead and not bandit1.dead) and (GetX(hero.gear)>=GetX(bandit1.gear)-80 and GetX(hero.gear)<=GetX(bandit1.gear)+80)
   391 	if (not hero.dead and not bandit1.dead) and heroDamageAtCurrentTurn == 0 and (GetX(hero.gear)>=GetX(bandit1.gear)-80
   383 		and (GetY(hero.gear)>=GetY(bandit1.gear)-30 and GetY(hero.gear)<=GetY(bandit1.gear)+30) then
   392 		and GetX(hero.gear)<=GetX(bandit1.gear)+80)	and (GetY(hero.gear)>=GetY(bandit1.gear)-30 and GetY(hero.gear)<=GetY(bandit1.gear)+30) then
   384 		return true
   393 		return true
   385 	end
   394 	end
   386 	return false
   395 	return false
   387 end
   396 end
   388 
   397