fixed the time adding in new hero turn spacecampaign
authorPeriklis Ntanasis <pntanasis@gmail.com>
Thu, 29 Aug 2013 19:50:45 +0300
branchspacecampaign
changeset 9594 749ef5bd0eaf
parent 9593 ac522dd06f00
child 9595 1acc5c3dc066
fixed the time adding in new hero turn
share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit03.lua
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit03.lua	Thu Aug 29 19:36:27 2013 +0300
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit03.lua	Thu Aug 29 19:50:45 2013 +0300
@@ -95,7 +95,6 @@
 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
 	
 	--hero ammo
-	AddAmmo(hero.gear, amSkip, 1)
 	AddAmmo(hero.gear, amTeleport, 2)
 	AddAmmo(hero.gear, amSniperRifle, 2)
 	AddAmmo(hero.gear, amWatermelon, 2)
@@ -114,7 +113,10 @@
 
 function onNewTurn()
 	if CurrentHedgehog == hero.gear then
-		TurnTimeLeft = TurnTime + timeLeft
+		if GetAmmoCount(hero.gear, amSkip) == 0 then
+			TurnTimeLeft = TurnTime + timeLeft
+			AddAmmo(hero.gear, amSkip, 1)
+		end
 		timeLeft = 0
 	end
 	turnHogs()
@@ -122,14 +124,8 @@
 end
 
 function onGameTick20()
-	--WriteLnToConsole("TURN TIME LEFT : "..timeLeft)
-	if CurrentHedgehog == hero.gear and GetAmmoCount(hero.gear, amSkip) == 0 then
-		AddAmmo(hero.gear, amSkip, 1)
-		--WriteLnToConsole("----- TURN TIME LEFT : "..TurnTimeLeft)
+	if CurrentHedgehog == hero.gear and TurnTimeLeft ~= 0 then
 		timeLeft = TurnTimeLeft
-		--WriteLnToConsole("***** TURN TIME LEFT : "..timeLeft)
-		TurnTimeLeft = 0
-	--WriteLnToConsole("NEW TURN TIME LEFT : "..timeLeft)
 	end
 end