share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/death01.lua
changeset 13476 b688e2ca9a8d
parent 12938 e65aa3c3d4e6
child 13479 7a63e0a2d2ca
equal deleted inserted replaced
13475:0d27f0c21b71 13476:b688e2ca9a8d
    79 thug7.y = 1960
    79 thug7.y = 1960
    80 thug7.health = 80
    80 thug7.health = 80
    81 teamA.name = loc("Hog Solo")
    81 teamA.name = loc("Hog Solo")
    82 teamA.color = 0x38D61C -- green
    82 teamA.color = 0x38D61C -- green
    83 teamB.name = loc("PAotH")
    83 teamB.name = loc("PAotH")
    84 -- FIXME: PAotH should share color with Hog Solo
    84 teamB.color = teamA.color
    85 teamB.color = 0x0072FF -- blue because otherwise enemies attack them
       
    86 teamC.name = loc("Professor")
    85 teamC.name = loc("Professor")
    87 teamC.color = 0x0072FF -- blue
    86 teamC.color = 0x0072FF -- blue
    88 
    87 
    89 -------------- LuaAPI EVENT HANDLERS ------------------
    88 -------------- LuaAPI EVENT HANDLERS ------------------
    90 
    89 
   105 
   104 
   106 	-- Hog Solo
   105 	-- Hog Solo
   107 	AddTeam(teamA.name, teamA.color, "Simple", "Island", "Default", "hedgewars")
   106 	AddTeam(teamA.name, teamA.color, "Simple", "Island", "Default", "hedgewars")
   108 	hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
   107 	hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
   109 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
   108 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
   110 	-- PAotH
   109 
   111 	AddTeam(teamB.name, teamB.color, "Earth", "Island", "Default", "cm_galaxy")
       
   112 	paoth1.gear = AddHog(paoth1.name, 0, 100, "hair_yellow")
       
   113 	AnimSetGearPosition(paoth1.gear, paoth1.x, paoth1.y)
       
   114 	HogTurnLeft(paoth1.gear, true)
       
   115 	paoth2.gear = AddHog(paoth2.name, 0, 100, "Glasses")
       
   116 	AnimSetGearPosition(paoth2.gear, paoth2.x, paoth2.y)
       
   117 	HogTurnLeft(paoth2.gear, true)
       
   118 	-- Professor and Thugs
   110 	-- Professor and Thugs
   119 	AddTeam(teamC.name, teamC.color, "star", "Island", "Default", "cm_sine")
       
   120 	professor.human = AddHog(professor.name, 0, 300, "tophats")
       
   121 	AnimSetGearPosition(professor.human, hero.x + 70, hero.y)
       
   122 	HogTurnLeft(professor.human, true)
       
   123 	AddTeam(teamC.name, teamC.color, "eyecross", "Island", "Default", "cm_sine")
   111 	AddTeam(teamC.name, teamC.color, "eyecross", "Island", "Default", "cm_sine")
   124 	professor.bot = AddHog(professor.name, 1, 300, "tophats")
   112 	professor.bot = AddHog(professor.name, 1, 300, "tophats")
   125 	AnimSetGearPosition(professor.bot, paoth1.x - 100, paoth1.y)
   113 	AnimSetGearPosition(professor.bot, paoth1.x - 100, paoth1.y)
   126 	HogTurnLeft(professor.bot, true)
   114 	HogTurnLeft(professor.bot, true)
   127 	professor.gear = professor.bot
   115 	professor.gear = professor.bot
   128 	for i=1,table.getn(thugs) do
   116 	for i=1,table.getn(thugs) do
   129 		thugs[i].gear = AddHog(string.format(loc("Thug #%d"), i), 1, thugs[i].health, "war_desertgrenadier1")
   117 		thugs[i].gear = AddHog(string.format(loc("Thug #%d"), i), 1, thugs[i].health, "war_desertgrenadier1")
   130 		AnimSetGearPosition(thugs[i].gear, thugs[i].x, thugs[i].y)
   118 		AnimSetGearPosition(thugs[i].gear, thugs[i].x, thugs[i].y)
   131 		HogTurnLeft(thugs[i].gear, not thugs[i].turnLeft)
   119 		HogTurnLeft(thugs[i].gear, not thugs[i].turnLeft)
   132 	end
   120 	end
       
   121 
       
   122 	AddTeam(teamC.name, teamC.color, "star", "Island", "Default", "cm_sine")
       
   123 	professor.human = AddHog(professor.name, 0, 300, "tophats")
       
   124 	AnimSetGearPosition(professor.human, hero.x + 70, hero.y)
       
   125 	HogTurnLeft(professor.human, true)
       
   126 
       
   127 	-- PAotH
       
   128 	AddTeam(teamB.name, teamB.color, "Earth", "Island", "Default", "cm_galaxy")
       
   129 	paoth1.gear = AddHog(paoth1.name, 0, 100, "hair_yellow")
       
   130 	AnimSetGearPosition(paoth1.gear, paoth1.x, paoth1.y)
       
   131 	HogTurnLeft(paoth1.gear, true)
       
   132 	SetGearAIHints(paoth1.gear, aihDoesntMatter)
       
   133 	paoth2.gear = AddHog(paoth2.name, 0, 100, "Glasses")
       
   134 	AnimSetGearPosition(paoth2.gear, paoth2.x, paoth2.y)
       
   135 	HogTurnLeft(paoth2.gear, true)
       
   136 	SetGearAIHints(paoth2.gear, aihDoesntMatter)
   133 
   137 
   134 	initCheckpoint("death01")
   138 	initCheckpoint("death01")
   135 
   139 
   136 	AnimInit(true)
   140 	AnimInit(true)
   137 	AnimationSetup()
   141 	AnimationSetup()
   200 	SendHealthStatsOff()
   204 	SendHealthStatsOff()
   201 end
   205 end
   202 
   206 
   203 function onNewTurn()
   207 function onNewTurn()
   204 	if CurrentHedgehog == paoth1.gear or CurrentHedgehog == paoth2.gear then
   208 	if CurrentHedgehog == paoth1.gear or CurrentHedgehog == paoth2.gear then
   205 		AnimSwitchHog(hero.gear)
   209 		if professor.gear and GetHealth(professor.gear) then
       
   210 			AnimSwitchHog(professor.gear)
       
   211 		end
   206 		EndTurn(true)
   212 		EndTurn(true)
   207 	end
   213 	end
   208 end
   214 end
   209 
   215 
   210 function onGameTick()
   216 function onGameTick()
   267 -------------- ACTIONS ------------------
   273 -------------- ACTIONS ------------------
   268 
   274 
   269 function heroDeath(gear)
   275 function heroDeath(gear)
   270 	SendStat(siGameResult, loc("Hog Solo lost, try again!"))
   276 	SendStat(siGameResult, loc("Hog Solo lost, try again!"))
   271 	SendStat(siCustomAchievement, loc("To win the game you have to eliminate all your enemies."))
   277 	SendStat(siCustomAchievement, loc("To win the game you have to eliminate all your enemies."))
   272 	sendSimpleTeamRankings({teamC.name, teamA.name})
   278 	sendSimpleTeamRankings({teamC.name, teamA.name, teamB.name})
   273 	EndGame()
   279 	EndGame()
   274 end
   280 end
   275 
   281 
   276 function enemiesDeath(gear)
   282 function enemiesDeath(gear)
   277 	saveCompletedStatus(6)
   283 	saveCompletedStatus(6)
   278 	SendStat(siGameResult, loc("Congratulations, you won!"))
   284 	SendStat(siGameResult, loc("Congratulations, you won!"))
   279 	SendStat(siCustomAchievement, loc("You have successfully eliminated Professor Hogevil."))
   285 	SendStat(siCustomAchievement, loc("You have successfully eliminated Professor Hogevil."))
   280 	SendStat(siCustomAchievement, loc("You have rescued H and Dr. Cornelius."))
   286 	SendStat(siCustomAchievement, loc("You have rescued H and Dr. Cornelius."))
   281 	SendStat(siCustomAchievement, loc("You have acquired the last device part."))
   287 	SendStat(siCustomAchievement, loc("You have acquired the last device part."))
   282 	SendStat(siCustomAchievement, loc("Now go and play the menu mission to complete the campaign."))
   288 	SendStat(siCustomAchievement, loc("Now go and play the menu mission to complete the campaign."))
   283 	sendSimpleTeamRankings({teamA.name, teamC.name})
   289 	sendSimpleTeamRankings({teamA.name, teamB.name, teamC.name})
   284 	EndGame()
   290 	EndGame()
   285 end
   291 end
   286 
   292 
   287 -------------- ANIMATIONS ------------------
   293 -------------- ANIMATIONS ------------------
   288 
   294