share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit03.lua
changeset 12583 5b23c42ef150
parent 12582 e2b5c6e805e8
child 12591 7510fe66bfbb
equal deleted inserted replaced
12582:e2b5c6e805e8 12583:5b23c42ef150
   120 	--hero ammo
   120 	--hero ammo
   121 	AddAmmo(hero.gear, amTeleport, 2)
   121 	AddAmmo(hero.gear, amTeleport, 2)
   122 	AddAmmo(hero.gear, amSniperRifle, 2)
   122 	AddAmmo(hero.gear, amSniperRifle, 2)
   123 	AddAmmo(hero.gear, amWatermelon, 2)
   123 	AddAmmo(hero.gear, amWatermelon, 2)
   124 
   124 
   125 	-- these 2 are needed in order hero has 10 sec more in the first turn
       
   126 	AddAmmo(hero.gear, amSkip, 100)
   125 	AddAmmo(hero.gear, amSkip, 100)
   127 	timeLeft = 0
   126 	timeLeft = 0
   128 
   127 
   129 	--enemies ammo
   128 	--enemies ammo
   130 	AddAmmo(enemiesOdd[1].gear, amDEagle, 100)
   129 	AddAmmo(enemiesOdd[1].gear, amDEagle, 100)
   140 end
   139 end
   141 
   140 
   142 function onNewTurn()
   141 function onNewTurn()
   143 	if CurrentHedgehog == hero.gear then
   142 	if CurrentHedgehog == hero.gear then
   144 		if firstTurn then
   143 		if firstTurn then
   145 			-- Unique game rule in this mission
   144 			-- Unique game rule in this mission: First turn has more time
   146 			TurnTimeLeft = 25000
   145 			TurnTimeLeft = 25000
   147 			-- Generous ready time on first turn to give more time to read
   146 			-- Generous ready time on first turn to give more time to read
   148 			ReadyTimeLeft = 35000
   147 			ReadyTimeLeft = 35000
   149 			battleStarted = true
   148 			battleStarted = true
   150 			firstTurn = false
   149 			firstTurn = false
   190 	if battleStarted then
   189 	if battleStarted then
   191 		HideMission()
   190 		HideMission()
   192 	end
   191 	end
   193 end
   192 end
   194 
   193 
   195 onHogAttack = hideMissionOnAction
       
   196 onAttack = hideMissionOnAction
       
   197 onSlot = hideMissionOnAction
   194 onSlot = hideMissionOnAction
   198 onSetWeapon = hideMissionOnAction
   195 onSetWeapon = hideMissionOnAction
       
   196 onAttack = hideMissionOnAction
       
   197 function onHogAttack(ammoType)
       
   198 	hideMissionOnAction()
       
   199 	if CurrentHedgehog == hero.gear then
       
   200 		lastWeaponUsed = ammoType
       
   201 	end
       
   202 end
   199 
   203 
   200 -------------- EVENTS ------------------
   204 -------------- EVENTS ------------------
   201 
   205 
   202 function onHeroDeath(gear)
   206 function onHeroDeath(gear)
   203 	if not GetHealth(hero.gear) then
   207 	if not GetHealth(hero.gear) then
   275 			end
   279 			end
   276 		end
   280 		end
   277 	end
   281 	end
   278 end
   282 end
   279 
   283 
   280 function onSwitch()
       
   281 	ReadyTimeLeft = ReadyTimeLeft + 2000
       
   282 	PlaySound(sndExtraTime)
       
   283 end
       
   284 
       
   285 function isHog(gear)
   284 function isHog(gear)
   286 	local hog = false
   285 	local hog = false
   287 	for i=1,table.getn(enemiesOdd) do
   286 	for i=1,table.getn(enemiesOdd) do
   288 		if gear == enemiesOdd[i].gear then
   287 		if gear == enemiesOdd[i].gear then
   289 			hog = true
   288 			hog = true