share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit02.lua
branchspacecampaign
changeset 9536 7456b28a3421
parent 9534 662edfec06be
child 9538 51596e01c5df
equal deleted inserted replaced
9534:662edfec06be 9536:7456b28a3421
    10 -- globals
    10 -- globals
    11 local campaignName = loc("A Space Adventure")
    11 local campaignName = loc("A Space Adventure")
    12 local missionName = loc("Fruit planet, Searching the Device!")
    12 local missionName = loc("Fruit planet, Searching the Device!")
    13 local inBattle = false
    13 local inBattle = false
    14 local tookPartInBattle = false
    14 local tookPartInBattle = false
       
    15 local firstRoundAfterBattle = false
       
    16 local previousHog = -1
    15 -- dialogs
    17 -- dialogs
    16 local dialog01 = {}
    18 local dialog01 = {}
    17 local dialog02 = {}
    19 local dialog02 = {}
    18 local dialog03 = {}
    20 local dialog03 = {}
    19 local dialog04 = {}
    21 local dialog04 = {}
   179 	
   181 	
   180 	SendHealthStatsOff()
   182 	SendHealthStatsOff()
   181 end
   183 end
   182 
   184 
   183 function onNewTurn()
   185 function onNewTurn()
   184 	WriteLnToConsole("TURNS "..TotalRounds.." and hog: "..CurrentHedgehog)
   186 	WriteLnToConsole("TURNS "..TotalRounds.." and hog: "..CurrentHedgehog.." PREVIOUS: "..previousHog)
   185 	if not inBattle and CurrentHedgehog == green1.gear then
   187 	if not inBattle and CurrentHedgehog == green1.gear then
       
   188 		WriteLnToConsole("1")
   186 		TurnTimeLeft = 0
   189 		TurnTimeLeft = 0
   187 	elseif CurrentHedgehog == green2.gear or CurrentHedgehog == green3.gear then
   190 	elseif CurrentHedgehog == green2.gear or CurrentHedgehog == green3.gear then
   188 		if inBattle then
   191 			WriteLnToConsole("2")
   189 			SwitchHog(hero.gear)
       
   190 			TurnTimeLeft = 20000
       
   191 		else
       
   192 			TurnTimeLeft = 0
   192 			TurnTimeLeft = 0
   193 		end
       
   194 	elseif inBattle then
   193 	elseif inBattle then
       
   194 		if CurrentHedgehog == green1.gear and previousHog ~= hero.gear then
       
   195 			WriteLnToConsole("IIIIIIIIFFFFFFFFFF")
       
   196 			TurnTimeLeft = 0
       
   197 			return
       
   198 		end
   195 		WriteLnToConsole("IN BATTLE")
   199 		WriteLnToConsole("IN BATTLE")
   196 		TurnTimeLeft = 20000
   200 		TurnTimeLeft = 20000
   197 	elseif not inBattle then
   201 	elseif not inBattle then
       
   202 	WriteLnToConsole("4")
   198 		TurnTimeLeft = -1
   203 		TurnTimeLeft = -1
   199 	end
   204 	else
       
   205 		WriteLnToConsole("6")
       
   206 		TurnTimeLeft = 0
       
   207 	end
       
   208 	previousHog = CurrentHedgehog
       
   209 	WriteLnToConsole("5")
   200 end
   210 end
   201 
   211 
   202 function onGameTick()
   212 function onGameTick()
   203 	AnimUnWait()
   213 	AnimUnWait()
   204 	if ShowAnimation() == false then
   214 	if ShowAnimation() == false then
   271 	AddEvent(onSurface, {hero.gear}, surface, {hero.gear}, 0)
   281 	AddEvent(onSurface, {hero.gear}, surface, {hero.gear}, 0)
   272 end
   282 end
   273 
   283 
   274 function surface(gear)
   284 function surface(gear)
   275 	-- TODO: after going to the surface first round must be played by the player
   285 	-- TODO: after going to the surface first round must be played by the player
   276 	AnimSwitchHog(hero.gear)
   286 	WriteLnToConsole("surface first round")
   277 	TurnTimeLeft = 20000
   287 	previousHog = -1
       
   288 	if firstRoundAfterBattle then
       
   289 		WriteLnToConsole("TRUE IT IS!")
       
   290 	end
       
   291 	WriteLnToConsole("surface in battle")
   278 	inBattle = true
   292 	inBattle = true
   279 end
   293 end
   280 
   294 
   281 -------------- ANIMATIONS ------------------
   295 -------------- ANIMATIONS ------------------
   282 
   296