share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit01.lua
branchspacecampaign
changeset 9643 cddb5de11af9
parent 9642 8a691e0f117a
child 9740 d159ddae0358
equal deleted inserted replaced
9642:8a691e0f117a 9643:cddb5de11af9
    22 ----------------- VARIABLES --------------------
    22 ----------------- VARIABLES --------------------
    23 -- globals
    23 -- globals
    24 local missionName = loc("Bad timing")
    24 local missionName = loc("Bad timing")
    25 local chooseToBattle = false
    25 local chooseToBattle = false
    26 local previousHog = 0
    26 local previousHog = 0
       
    27 local heroPlayedFirstTurn = false
       
    28 local startBattleCalled = false
    27 -- dialogs
    29 -- dialogs
    28 local dialog01 = {}
    30 local dialog01 = {}
    29 local dialog02 = {}
    31 local dialog02 = {}
    30 local dialog03 = {}
    32 local dialog03 = {}
    31 -- mission objectives
    33 -- mission objectives
   200 	AddAnim(dialog01)
   202 	AddAnim(dialog01)
   201 	SendHealthStatsOff()
   203 	SendHealthStatsOff()
   202 end
   204 end
   203 
   205 
   204 function onNewTurn()
   206 function onNewTurn()
   205 	if chooseToBattle then
   207 	if not heroPlayedFirstTurn and CurrentHedgehog ~= hero.gear and startBattleCalled then
   206 		if CurrentHedgehog == green1.gear then
   208 		TurnTimeLeft = 0
   207 			TotalRounds = TotalRounds - 2
   209 	elseif not heroPlayedFirstTurn and CurrentHedgehog == hero.gear and startBattleCalled then
   208 			AnimSwitchHog(previousHog)
   210 		heroPlayedFirstTurn = true
   209 			TurnTimeLeft = 0
   211 	else
   210 		end
   212 		if chooseToBattle then
   211 		previousHog = CurrentHedgehog
   213 			if CurrentHedgehog == green1.gear then
   212 	end
   214 				TotalRounds = TotalRounds - 2
   213 	getNextWave()
   215 				AnimSwitchHog(previousHog)
       
   216 				TurnTimeLeft = 0
       
   217 			end
       
   218 			previousHog = CurrentHedgehog
       
   219 		end
       
   220 		getNextWave()
       
   221 	end
   214 end
   222 end
   215 
   223 
   216 function onGameTick()
   224 function onGameTick()
   217 	AnimUnWait()
   225 	AnimUnWait()
   218 	if ShowAnimation() == false then
   226 	if ShowAnimation() == false then
   407 	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 5000}})
   415 	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 5000}})
   408 	table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("No problem Captain! The enemies aren't many anyway, it is going to be easy!"), SAY_SAY, 5000}})
   416 	table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("No problem Captain! The enemies aren't many anyway, it is going to be easy!"), SAY_SAY, 5000}})
   409 	table.insert(dialog02, {func = AnimWait, args = {green1.gear, 5000}})
   417 	table.insert(dialog02, {func = AnimWait, args = {green1.gear, 5000}})
   410 	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("Don't be fool son, they'll be more"), SAY_SAY, 3000}})
   418 	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("Don't be fool son, they'll be more"), SAY_SAY, 3000}})
   411 	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("Try to be smart and eliminate them quickly. This way you might scare the rest!"), SAY_SAY, 5000}})
   419 	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("Try to be smart and eliminate them quickly. This way you might scare the rest!"), SAY_SAY, 5000}})
       
   420 	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 5000}})
   412 	table.insert(dialog02, {func = startBattle, args = {hero.gear}})
   421 	table.insert(dialog02, {func = startBattle, args = {hero.gear}})
   413 	-- DIALOG 03 - Hero selects to flee
   422 	-- DIALOG 03 - Hero selects to flee
   414 	AddSkipFunction(dialog03, Skipanim, {dialog03})
   423 	AddSkipFunction(dialog03, Skipanim, {dialog03})
   415 	table.insert(dialog03, {func = AnimWait, args = {green1.gear, 3000}})
   424 	table.insert(dialog03, {func = AnimWait, args = {green1.gear, 3000}})
   416 	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Too bad... Then you should really leave!"), SAY_SAY, 3000}})
   425 	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Too bad... Then you should really leave!"), SAY_SAY, 3000}})
   417 	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Things are going to get messy around here"), SAY_SAY, 3000}})
   426 	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Things are going to get messy around here"), SAY_SAY, 3000}})
   418 	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Also, you should know that the only place that you can fly would be the most left part of the map"), SAY_SAY, 5000}})
   427 	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Also, you should know that the only place that you can fly would be the most left part of the map"), SAY_SAY, 5000}})
   419 	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("All the other places are protected by our anti flying weapons"), SAY_SAY, 4000}})
   428 	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("All the other places are protected by our anti flying weapons"), SAY_SAY, 4000}})
   420 	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Now go and don't waste more of my time you coward..."), SAY_SAY, 4000}})
   429 	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Now go and don't waste more of my time you coward..."), SAY_SAY, 4000}})
       
   430 	table.insert(dialog03, {func = AnimWait, args = {hero.gear, 5000}})
   421 	table.insert(dialog03, {func = startBattle, args = {hero.gear}})
   431 	table.insert(dialog03, {func = startBattle, args = {hero.gear}})
   422 end
   432 end
   423 
   433 
   424 ------------- OTHER FUNCTIONS ---------------
   434 ------------- OTHER FUNCTIONS ---------------
   425 
   435 
   426 function startBattle()
   436 function startBattle()
   427 	RestoreHog(green1.bot)
   437 	RestoreHog(green1.bot)
   428 	DeleteGear(green1.human)
   438 	DeleteGear(green1.human)
   429 	green1.gear = green1.bot
   439 	green1.gear = green1.bot
   430 	AnimSwitchHog(hero.gear)
   440 	startBattleCalled = true
   431 	TurnTimeLeft = TurnTime
   441 	TurnTimeLeft = 0
   432 end
   442 end
   433 
   443 
   434 function gameLost()
   444 function gameLost()
   435 	if chooseToBattle then
   445 	if chooseToBattle then
   436 		SendStat(siGameResult, loc("Green Bananas lost, try again!"))
   446 		SendStat(siGameResult, loc("Green Bananas lost, try again!"))