share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert02.lua
branchspacecampaign
changeset 9474 c255f6c46e33
parent 9471 867f020b0621
child 9484 a63307092bc6
equal deleted inserted replaced
9471:867f020b0621 9474:c255f6c46e33
     8 
     8 
     9 ----------------- VARIABLES --------------------
     9 ----------------- VARIABLES --------------------
    10 -- globals
    10 -- globals
    11 local campaignName = loc("A Space Adventure")
    11 local campaignName = loc("A Space Adventure")
    12 local missionName = loc("Desert planet, Journey down below!")
    12 local missionName = loc("Desert planet, Journey down below!")
       
    13 local turnCounter = 0
       
    14 local startChallenge = false
    13 -- dialogs
    15 -- dialogs
    14 local dialog01 = {}
    16 local dialog01 = {}
    15 -- mission objectives
    17 -- mission objectives
    16 local goals = {
    18 local goals = {
    17 	[dialog01] = {missionName, loc("Getting ready"), loc("Use the rope and get asap to the surface!"), 1, 4500},
    19 	[dialog01] = {missionName, loc("Getting ready"), loc("Use the rope and get asap to the surface!"), 1, 4500},
    51 -------------- LuaAPI EVENT HANDLERS ------------------
    53 -------------- LuaAPI EVENT HANDLERS ------------------
    52 
    54 
    53 function onGameInit()
    55 function onGameInit()
    54 	GameFlags = gfOneClanMode
    56 	GameFlags = gfOneClanMode
    55 	Seed = 1
    57 	Seed = 1
    56 	TurnTime = 6000
    58 	TurnTime = 8000
    57 	Delay = 2
    59 	Delay = 2
    58 	CaseFreq = 0
    60 	CaseFreq = 0
    59 	MinesNum = 500
    61 	MinesNum = 500
    60 	MinesTime = 1000
    62 	MinesTime = 1000
    61 	MineDudPercent = 75
    63 	MineDudPercent = 75
    87 	SendHealthStatsOff()
    89 	SendHealthStatsOff()
    88 	AddAnim(dialog01)
    90 	AddAnim(dialog01)
    89 end
    91 end
    90 
    92 
    91 function onNewTurn()
    93 function onNewTurn()
    92 	if not hero.dead and CurrentHedgehog == ally.gear and challengeStarted then
    94 	if not hero.dead and startChallenge then
    93 		heroLost()
    95 		turnCounter = turnCounter + 1
    94 	end
    96 	end
    95 end
    97 end
    96 
    98 
    97 function onGameTick()
    99 function onGameTick()
    98 	AnimUnWait()
   100 	AnimUnWait()
   123 	end
   125 	end
   124 	return false
   126 	return false
   125 end
   127 end
   126 
   128 
   127 function onHeroSafe(gear)
   129 function onHeroSafe(gear)
   128 	if not hero.dead and GetY(hero.gear) < 200 and StoppedGear(hero.gear) then
   130 	if not hero.dead and GetY(hero.gear) < 170 and StoppedGear(hero.gear) then
   129 		return true
   131 		return true
   130 	end
   132 	end
   131 	return false
   133 	return false
   132 end
   134 end
   133 
   135 
   134 -------------- OUTCOMES ------------------
   136 -------------- OUTCOMES ------------------
   135 
   137 
   136 function heroDeath(gear)
   138 function heroDeath(gear)
   137 	-- hero lost stuff
   139 	SendStat('siGameResult', loc("Hog Solo lost, try again!")) --1
       
   140 	SendStat('siCustomAchievement', loc("To win the game you have to go to the surface")) --11
       
   141 	SendStat('siCustomAchievement', loc("Most mines are not active")) --11
       
   142 	SendStat('siCustomAchievement', loc("From the second turn and beyond the water rises")) --11
       
   143 	SendStat('siPlayerKills','0',teamA.name)
   138 	EndGame()
   144 	EndGame()
   139 end
   145 end
   140 
   146 
   141 function heroSafe(gear)
   147 function heroSafe(gear)
   142 	-- hero win stuff
   148 	SendStat('siGameResult', loc("Congratulations, you escaped!")) --1
       
   149 	SendStat('siCustomAchievement', loc("You have escaped successfully")) --11
       
   150 	SendStat('siCustomAchievement', loc("Your escape took you "..turnCounter.." turns")) --11
       
   151 	SendStat('siPlayerKills','1',teamA.name)
   143 	EndGame()
   152 	EndGame()
   144 end
   153 end
   145 
   154 
   146 -------------- ANIMATIONS ------------------
   155 -------------- ANIMATIONS ------------------
   147 
   156 
   148 function Skipanim(anim)
   157 function Skipanim(anim)
   149 	if goals[anim] ~= nil then
   158 	if goals[anim] ~= nil then
   150 		ShowMission(unpack(goals[anim]))
   159 		ShowMission(unpack(goals[anim]))
   151     end    
   160     end
   152 	TurnTimeLeft = 0
   161 	challengeStart()
   153 end
   162 end
   154 
   163 
   155 function AnimationSetup()
   164 function AnimationSetup()
   156 	-- DIALOG 01 - Start
   165 	-- DIALOG 01 - Start
   157 	AddSkipFunction(dialog01, Skipanim, {dialog01})
   166 	AddSkipFunction(dialog01, Skipanim, {dialog01})
   164 end
   173 end
   165 
   174 
   166 ------------------ Other Functions -------------------
   175 ------------------ Other Functions -------------------
   167 
   176 
   168 function challengeStart()
   177 function challengeStart()
       
   178 	startChallenge = true
   169 	TurnTimeLeft = 0
   179 	TurnTimeLeft = 0
   170 end
   180 end