second battle A spacecampaign
authorPeriklis Ntanasis <pntanasis@gmail.com>
Thu, 01 Aug 2013 17:55:37 +0300
branchspacecampaign
changeset 9430 ab809b0be800
parent 9428 b483a2683d08
child 9432 6b1c42e10957
second battle A
share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert01.lua
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert01.lua	Thu Aug 01 16:34:18 2013 +0300
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert01.lua	Thu Aug 01 17:55:37 2013 +0300
@@ -210,6 +210,10 @@
 			AddAmmo(hero.gear, amConstruction, tonumber(ammo:sub(7,7)))
 		end
 		AddAmmo(hero.gear, amPortalGun, tonumber(ammo:sub(8,8)))
+		
+		-- second battle
+		heroIsInBattle = true
+		ongoingBattle = 2
 	end
 	
 	SendHealthStatsOff()
@@ -223,6 +227,9 @@
 	elseif (CurrentHedgehog == smuggler2.gear or CurrentHedgehog == smuggler3.gear) and ongoingBattle == 1 then
 		AnimSwitchHog(hero.gear)
 		TurnTimeLeft = 0
+	elseif (CurrentHedgehog == smuggler1.gear or CurrentHedgehog == smuggler3.gear) and ongoingBattle == 2 then
+		AnimSwitchHog(hero.gear)
+		TurnTimeLeft = 0
 	elseif CurrentHedgehog == ally.gear then
 		TurnTimeLeft = 0
 	end
@@ -248,6 +255,9 @@
 function onGearDelete(gear)
 	if gear == hero.gear then
 		hero.dead = true
+	elseif (gear == smuggler1.gear or gear == smuggler2.gear or gear == smuggler3.gear) and heroIsInBattle then
+		heroIsInBattle = false
+		ongoingBattle = 0
 	end
 end
 
@@ -282,6 +292,7 @@
 	return false
 end
 
+-- saves the location of the hero and prompts him for the second battle
 function onHeroAtCheckpoint2(gear)
 	if not hero.dead and GetX(hero.gear) > 1000 and GetX(hero.gear) < 1100
 			and GetY(hero.gear) > 590 then
@@ -321,13 +332,19 @@
 end
 
 function heroAtCheckpoint2(gear)
+	-- save checkpoint
 	SaveCampaignVar("Desert01CheckPoint", "2")	
 	SaveCampaignVar("HeroHealth", GetHealth(hero.gear))
 	-- bazooka - grenade - rope - parachute - deagle - btorch - construct - portal
 	SaveCampaignVar("HeroAmmo", GetAmmoCount(hero.gear, amBazooka)..GetAmmoCount(hero.gear, amGrenade)..
 			GetAmmoCount(hero.gear, amRope)..GetAmmoCount(hero.gear, amParachute)..GetAmmoCount(hero.gear, amDEagle)..
 			GetAmmoCount(hero.gear, amBlowTorch)..GetAmmoCount(hero.gear, amConstruction)..GetAmmoCount(hero.gear, amPortalGun))
-	AnimCaption(hero.gear, loc("Checkpoint reached!"), 5000)	
+	AnimCaption(hero.gear, loc("Checkpoint reached!"), 5000)
+	
+	-- second battle
+	heroIsInBattle = true
+	ongoingBattle = 2
+	AnimSay(smuggler2.gear, loc("This is seems like a wealthy hedgehog, nice..."), SAY_THINK, 5000)
 end
 
 -------------- ANIMATIONS ------------------