share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert01.lua
branchspacecampaign
changeset 9430 ab809b0be800
parent 9428 b483a2683d08
child 9432 6b1c42e10957
equal deleted inserted replaced
9428:b483a2683d08 9430:ab809b0be800
   208 		-- weird, if 0 bazooka isn't displayed in the weapons menu
   208 		-- weird, if 0 bazooka isn't displayed in the weapons menu
   209 		if tonumber(ammo:sub(7,7)) > 0 then
   209 		if tonumber(ammo:sub(7,7)) > 0 then
   210 			AddAmmo(hero.gear, amConstruction, tonumber(ammo:sub(7,7)))
   210 			AddAmmo(hero.gear, amConstruction, tonumber(ammo:sub(7,7)))
   211 		end
   211 		end
   212 		AddAmmo(hero.gear, amPortalGun, tonumber(ammo:sub(8,8)))
   212 		AddAmmo(hero.gear, amPortalGun, tonumber(ammo:sub(8,8)))
       
   213 		
       
   214 		-- second battle
       
   215 		heroIsInBattle = true
       
   216 		ongoingBattle = 2
   213 	end
   217 	end
   214 	
   218 	
   215 	SendHealthStatsOff()
   219 	SendHealthStatsOff()
   216 end
   220 end
   217 
   221 
   221 	elseif CurrentHedgehog == hero.gear and not heroIsInBattle then
   225 	elseif CurrentHedgehog == hero.gear and not heroIsInBattle then
   222 		TurnTimeLeft = -1
   226 		TurnTimeLeft = -1
   223 	elseif (CurrentHedgehog == smuggler2.gear or CurrentHedgehog == smuggler3.gear) and ongoingBattle == 1 then
   227 	elseif (CurrentHedgehog == smuggler2.gear or CurrentHedgehog == smuggler3.gear) and ongoingBattle == 1 then
   224 		AnimSwitchHog(hero.gear)
   228 		AnimSwitchHog(hero.gear)
   225 		TurnTimeLeft = 0
   229 		TurnTimeLeft = 0
       
   230 	elseif (CurrentHedgehog == smuggler1.gear or CurrentHedgehog == smuggler3.gear) and ongoingBattle == 2 then
       
   231 		AnimSwitchHog(hero.gear)
       
   232 		TurnTimeLeft = 0
   226 	elseif CurrentHedgehog == ally.gear then
   233 	elseif CurrentHedgehog == ally.gear then
   227 		TurnTimeLeft = 0
   234 		TurnTimeLeft = 0
   228 	end
   235 	end
   229 	WriteLnToConsole("CURRENT HEDGEHOG IS "..CurrentHedgehog)
   236 	WriteLnToConsole("CURRENT HEDGEHOG IS "..CurrentHedgehog)
   230 end
   237 end
   246 end
   253 end
   247 
   254 
   248 function onGearDelete(gear)
   255 function onGearDelete(gear)
   249 	if gear == hero.gear then
   256 	if gear == hero.gear then
   250 		hero.dead = true
   257 		hero.dead = true
       
   258 	elseif (gear == smuggler1.gear or gear == smuggler2.gear or gear == smuggler3.gear) and heroIsInBattle then
       
   259 		heroIsInBattle = false
       
   260 		ongoingBattle = 0
   251 	end
   261 	end
   252 end
   262 end
   253 
   263 
   254 function onPrecise()
   264 function onPrecise()
   255 	if GameTime > 3000 then
   265 	if GameTime > 3000 then
   280 		return true
   290 		return true
   281 	end
   291 	end
   282 	return false
   292 	return false
   283 end
   293 end
   284 
   294 
       
   295 -- saves the location of the hero and prompts him for the second battle
   285 function onHeroAtCheckpoint2(gear)
   296 function onHeroAtCheckpoint2(gear)
   286 	if not hero.dead and GetX(hero.gear) > 1000 and GetX(hero.gear) < 1100
   297 	if not hero.dead and GetX(hero.gear) > 1000 and GetX(hero.gear) < 1100
   287 			and GetY(hero.gear) > 590 then
   298 			and GetY(hero.gear) > 590 then
   288 		return true
   299 		return true
   289 	end
   300 	end
   319 	heroIsInBattle = false
   330 	heroIsInBattle = false
   320 	ongoingBattle = 0
   331 	ongoingBattle = 0
   321 end
   332 end
   322 
   333 
   323 function heroAtCheckpoint2(gear)
   334 function heroAtCheckpoint2(gear)
       
   335 	-- save checkpoint
   324 	SaveCampaignVar("Desert01CheckPoint", "2")	
   336 	SaveCampaignVar("Desert01CheckPoint", "2")	
   325 	SaveCampaignVar("HeroHealth", GetHealth(hero.gear))
   337 	SaveCampaignVar("HeroHealth", GetHealth(hero.gear))
   326 	-- bazooka - grenade - rope - parachute - deagle - btorch - construct - portal
   338 	-- bazooka - grenade - rope - parachute - deagle - btorch - construct - portal
   327 	SaveCampaignVar("HeroAmmo", GetAmmoCount(hero.gear, amBazooka)..GetAmmoCount(hero.gear, amGrenade)..
   339 	SaveCampaignVar("HeroAmmo", GetAmmoCount(hero.gear, amBazooka)..GetAmmoCount(hero.gear, amGrenade)..
   328 			GetAmmoCount(hero.gear, amRope)..GetAmmoCount(hero.gear, amParachute)..GetAmmoCount(hero.gear, amDEagle)..
   340 			GetAmmoCount(hero.gear, amRope)..GetAmmoCount(hero.gear, amParachute)..GetAmmoCount(hero.gear, amDEagle)..
   329 			GetAmmoCount(hero.gear, amBlowTorch)..GetAmmoCount(hero.gear, amConstruction)..GetAmmoCount(hero.gear, amPortalGun))
   341 			GetAmmoCount(hero.gear, amBlowTorch)..GetAmmoCount(hero.gear, amConstruction)..GetAmmoCount(hero.gear, amPortalGun))
   330 	AnimCaption(hero.gear, loc("Checkpoint reached!"), 5000)	
   342 	AnimCaption(hero.gear, loc("Checkpoint reached!"), 5000)
       
   343 	
       
   344 	-- second battle
       
   345 	heroIsInBattle = true
       
   346 	ongoingBattle = 2
       
   347 	AnimSay(smuggler2.gear, loc("This is seems like a wealthy hedgehog, nice..."), SAY_THINK, 5000)
   331 end
   348 end
   332 
   349 
   333 -------------- ANIMATIONS ------------------
   350 -------------- ANIMATIONS ------------------
   334 
   351 
   335 function Skipanim(anim)
   352 function Skipanim(anim)