share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert02.lua
branchspacecampaign
changeset 9490 b93448b75fa4
parent 9484 a63307092bc6
child 9574 da3d39667881
equal deleted inserted replaced
9488:2e2bb48566ae 9490:b93448b75fa4
     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 local startChallenge = false
    15 -- dialogs
    14 -- dialogs
    16 local dialog01 = {}
    15 local dialog01 = {}
    17 -- mission objectives
    16 -- mission objectives
    18 local goals = {
    17 local goals = {
    19 	[dialog01] = {missionName, loc("Getting ready"), loc("Use the rope and get asap to the surface!"), 1, 4500},
    18 	[dialog01] = {missionName, loc("Getting ready"), loc("Use the rope and get asap to the surface!"), 1, 4500},
    20 }
    19 }
       
    20 -- health crates
       
    21 healthX = 565
       
    22 health1Y = 1400
       
    23 health2Y = 850
    21 -- hogs
    24 -- hogs
    22 local hero = {}
    25 local hero = {}
    23 -- teams
    26 -- teams
    24 local teamA = {}
    27 local teamA = {}
    25 -- hedgehogs values
    28 -- hedgehogs values
    55 	GameFlags = gfOneClanMode
    58 	GameFlags = gfOneClanMode
    56 	Seed = 1
    59 	Seed = 1
    57 	TurnTime = 8000
    60 	TurnTime = 8000
    58 	Delay = 2
    61 	Delay = 2
    59 	CaseFreq = 0
    62 	CaseFreq = 0
       
    63 	HealthCaseAmount = 50
    60 	MinesNum = 500
    64 	MinesNum = 500
    61 	MinesTime = 1000
    65 	MinesTime = 1000
    62 	MineDudPercent = 75
    66 	MineDudPercent = 75
    63 	Explosives = 0
    67 	Explosives = 0
    64 	SuddenDeathTurns = 1
    68 	SuddenDeathTurns = 1
    65 	WaterRise = 150
    69 	WaterRise = 150
       
    70 	HealthDecrease = 0
    66 	Map = "desert02_map"
    71 	Map = "desert02_map"
    67 	Theme = "Desert"
    72 	Theme = "Desert"
    68 	
    73 	
    69 	-- Hog Solo
    74 	-- Hog Solo
    70 	AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "cm_birdy")
    75 	AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "cm_birdy")
    71 	hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
    76 	hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
    72 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
    77 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
    73 	HogTurnLeft(hero.gear, true)
    78 	HogTurnLeft(hero.gear, true)
    74 	
    79 	
    75 	AnimInit()
    80 	AnimInit()
    76 	AnimationSetup()	
    81 	AnimationSetup()
    77 end
    82 end
    78 
    83 
    79 function onGameStart()
    84 function onGameStart()
    80 	AnimWait(hero.gear, 3000)
    85 	AnimWait(hero.gear, 3000)
    81 	FollowGear(hero.gear)
    86 	FollowGear(hero.gear)
    82 	
    87 	
    83 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
    88 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
    84 	AddEvent(onHeroSafe, {hero.gear}, heroSafe, {hero.gear}, 0)
    89 	AddEvent(onHeroSafe, {hero.gear}, heroSafe, {hero.gear}, 0)
    85 	
    90 	
       
    91 	SpawnHealthCrate(healthX, health1Y)
       
    92 	SpawnHealthCrate(healthX, health2Y)
       
    93 	
    86 	AddAmmo(hero.gear, amRope, 99)
    94 	AddAmmo(hero.gear, amRope, 99)
    87 	
    95 	
    88 	SendHealthStatsOff()
    96 	SendHealthStatsOff()
    89 	AddAnim(dialog01)
    97 	AddAnim(dialog01)
    90 end
       
    91 
       
    92 function onNewTurn()
       
    93 	if not hero.dead and startChallenge then
       
    94 		turnCounter = turnCounter + 1
       
    95 	end
       
    96 end
    98 end
    97 
    99 
    98 function onGameTick()
   100 function onGameTick()
    99 	AnimUnWait()
   101 	AnimUnWait()
   100 	if ShowAnimation() == false then
   102 	if ShowAnimation() == false then
   144 end
   146 end
   145 
   147 
   146 function heroSafe(gear)
   148 function heroSafe(gear)
   147 	SendStat('siGameResult', loc("Congratulations, you escaped!")) --1
   149 	SendStat('siGameResult', loc("Congratulations, you escaped!")) --1
   148 	SendStat('siCustomAchievement', loc("You have escaped successfully")) --11
   150 	SendStat('siCustomAchievement', loc("You have escaped successfully")) --11
   149 	SendStat('siCustomAchievement', loc("Your escape took you "..turnCounter.." turns")) --11
   151 	SendStat('siCustomAchievement', loc("Your escape took you "..TotalRounds.." turns")) --11
   150 	SendStat('siPlayerKills','1',teamA.name)
   152 	SendStat('siPlayerKills','1',teamA.name)
   151 	EndGame()
   153 	EndGame()
   152 end
   154 end
   153 
   155 
   154 -------------- ANIMATIONS ------------------
   156 -------------- ANIMATIONS ------------------