share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit03.lua
changeset 12227 6ffb18cf4c57
parent 12093 1da37e2ba6fd
child 12473 d652c6f5d5f1
equal deleted inserted replaced
12226:c6034081cac2 12227:6ffb18cf4c57
     9 HedgewarsScriptLoad("/Missions/Campaign/A_Space_Adventure/global_functions.lua")
     9 HedgewarsScriptLoad("/Missions/Campaign/A_Space_Adventure/global_functions.lua")
    10 
    10 
    11 ----------------- VARIABLES --------------------
    11 ----------------- VARIABLES --------------------
    12 -- globals
    12 -- globals
    13 local missionName = loc("Precise shooting")
    13 local missionName = loc("Precise shooting")
    14 local timeLeft = 10000
    14 local timeLeft = 0
    15 local lastWeaponUsed = amSniperRifle
    15 local lastWeaponUsed = amNothing
       
    16 local firstTurn = true
    16 local challengeObjectives = loc("Use your available weapons in order to eliminate the enemies.").."|"..
    17 local challengeObjectives = loc("Use your available weapons in order to eliminate the enemies.").."|"..
    17 	loc("You can only use the sniper rifle or the watermelon bomb.").."|"..
    18 	loc("You can only use the sniper rifle or the watermelon bomb.").."|"..
    18 	loc("You'll have only 2 watermelon bombs during the game.").."|"..
    19 	loc("You'll have only 2 watermelon bombs during the game.").."|"..
    19 	loc("You'll get an extra sniper rifle every time you kill an enemy hog with a limit of max 4 rifles.").."|"..
    20 	loc("You'll get an extra sniper rifle every time you kill an enemy hog with a limit of max 4 rifles.").."|"..
    20 	loc("You'll get an extra teleport every time you kill an enemy hog with a limit of max 2 teleports.").."|"..
    21 	loc("You'll get an extra teleport every time you kill an enemy hog with a limit of max 2 teleports.").."|"..
   130 	AddAnim(dialog01)
   131 	AddAnim(dialog01)
   131 end
   132 end
   132 
   133 
   133 function onNewTurn()
   134 function onNewTurn()
   134 	if CurrentHedgehog == hero.gear then
   135 	if CurrentHedgehog == hero.gear then
   135 		if GetAmmoCount(hero.gear, amSkip) == 0 then
   136 		if firstTurn then
       
   137 			TurnTimeLeft = 25000
       
   138 		end
       
   139 		if lastWeaponUsed == amSkip then
   136 			TurnTimeLeft = TurnTime + timeLeft
   140 			TurnTimeLeft = TurnTime + timeLeft
   137 			AddAmmo(hero.gear, amSkip, 1)
       
   138 		end
   141 		end
   139 		timeLeft = 0
   142 		timeLeft = 0
   140 	end
   143 	end
   141 	turnHogs()
   144 	turnHogs()
   142 end
   145 end
   285 
   288 
   286 function startBattle()
   289 function startBattle()
   287 	AnimSwitchHog(enemiesOdd[table.getn(enemiesOdd)].gear)
   290 	AnimSwitchHog(enemiesOdd[table.getn(enemiesOdd)].gear)
   288 	TurnTimeLeft = 0
   291 	TurnTimeLeft = 0
   289 	-- these 2 are needed in order hero has 10 sec more in the first turn
   292 	-- these 2 are needed in order hero has 10 sec more in the first turn
   290 	timeLeft = 10000
   293 	timeLeft = 0
   291 	AddAmmo(hero.gear, amSkip, 0)
   294 	AddAmmo(hero.gear, amSkip, 100)
   292 end
   295 end
   293 
   296 
   294 function isHog(gear)
   297 function isHog(gear)
   295 	local hog = false
   298 	local hog = false
   296 	for i=1,table.getn(enemiesOdd) do
   299 	for i=1,table.getn(enemiesOdd) do