share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon01.lua
changeset 12533 f8801c72a6c8
parent 12531 e12e2dfda06f
child 12534 34a91e2b927e
equal deleted inserted replaced
12532:3e6e7b258a33 12533:f8801c72a6c8
    73 paoth4.y = 1800
    73 paoth4.y = 1800
    74 professor.name = loc("Prof. Hogevil")
    74 professor.name = loc("Prof. Hogevil")
    75 professor.x = 3800
    75 professor.x = 3800
    76 professor.y = 1600
    76 professor.y = 1600
    77 professor.dead = false
    77 professor.dead = false
    78 professor.health = 100
    78 professor.health = 120
    79 minion1.name = loc("Minion")
    79 minion1.name = loc("Minion")
    80 minion1.x = 2460
    80 minion1.x = 2460
    81 minion1.y = 1450
    81 minion1.y = 1450
    82 minion2.name = loc("Minion")
    82 minion2.name = loc("Minion")
    83 minion2.x = 2450
    83 minion2.x = 2450
    84 minion2.y = 1900
    84 minion2.y = 1900
    85 minion3.name = loc("Minion")
    85 minion3.name = loc("Minion")
    86 minion3.x = 3500
    86 minion3.x = 3500
    87 minion3.y = 1750
    87 minion3.y = 1750
       
    88 
    88 teamA.name = loc("PAotH")
    89 teamA.name = loc("PAotH")
    89 teamA.color = tonumber("FF0000",16) -- red
    90 teamA.color = tonumber("FF0000",16) -- red
    90 teamB.name = loc("Minions")
    91 teamB.name = loc("Minions")
    91 teamB.color = tonumber("0072FF",16) -- blue
    92 teamB.color = tonumber("0072FF",16) -- blue
    92 teamC.name = loc("Professor")
    93 teamC.name = loc("Professor")
   129 	paoth4.gear = AddHog(paoth4.name, 0, 100, "scif_2001Y")
   130 	paoth4.gear = AddHog(paoth4.name, 0, 100, "scif_2001Y")
   130 	AnimSetGearPosition(paoth4.gear, paoth4.x, paoth4.y)
   131 	AnimSetGearPosition(paoth4.gear, paoth4.x, paoth4.y)
   131 	HogTurnLeft(paoth4.gear, true)
   132 	HogTurnLeft(paoth4.gear, true)
   132 	-- Professor
   133 	-- Professor
   133 	AddTeam(teamC.name, teamC.color, "Bone", "Island", "HillBilly", "cm_sine")
   134 	AddTeam(teamC.name, teamC.color, "Bone", "Island", "HillBilly", "cm_sine")
   134 	professor.gear = AddHog(professor.name, 0, 120, "tophats")
   135 	professor.gear = AddHog(professor.name, 0, professor.health, "tophats")
   135 	AnimSetGearPosition(professor.gear, professor.x, professor.y)
   136 	AnimSetGearPosition(professor.gear, professor.x, professor.y)
   136 	HogTurnLeft(professor.gear, true)
   137 	HogTurnLeft(professor.gear, true)
   137 	-- Minions
   138 	-- Minions
   138 	AddTeam(teamB.name, teamB.color, "Bone", "Island", "HillBilly", "cm_sine")
   139 	AddTeam(teamB.name, teamB.color, "Bone", "Island", "HillBilly", "cm_sine")
   139 	minion1.gear = AddHog(minion1.name, 1, 50, "Gasmask")
   140 	minion1.gear = AddHog(minion1.name, 1, 50, "Gasmask")
   183 
   184 
   184 	-- check for death has to go first
   185 	-- check for death has to go first
   185 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
   186 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
   186 	AddEvent(onProfessorDeath, {professor.gear}, professorDeath, {professor.gear}, 0)
   187 	AddEvent(onProfessorDeath, {professor.gear}, professorDeath, {professor.gear}, 0)
   187 	AddEvent(onMinionsDeath, {professor.gear}, minionsDeath, {professor.gear}, 0)
   188 	AddEvent(onMinionsDeath, {professor.gear}, minionsDeath, {professor.gear}, 0)
       
   189 	AddEvent(onProfessorAndMinionsDeath, {professor.gear}, professorAndMinionsDeath, {professor.gear}, 0)
   188 	AddEvent(onProfessorHit, {professor.gear}, professorHit, {professor.gear}, 1)
   190 	AddEvent(onProfessorHit, {professor.gear}, professorHit, {professor.gear}, 1)
   189 
   191 
   190 	if checkPointReached == 1 then
   192 	if checkPointReached == 1 then
   191 		AddAmmo(hero.gear, amRope, 2)
   193 		AddAmmo(hero.gear, amRope, 2)
   192 		SpawnAmmoCrate(bazookaX, weaponsY, amBazooka)
   194 		SpawnAmmoCrate(bazookaX, weaponsY, amBazooka)
   313 		return true
   315 		return true
   314 	end
   316 	end
   315 	return false
   317 	return false
   316 end
   318 end
   317 
   319 
       
   320 function onProfessorAndMinionsDeath(gear)
       
   321 	if professor.dead and (not (GetHealth(minion1.gear) or GetHealth(minion2.gear) or GetHealth(minion3.gear))) then
       
   322 		return true
       
   323 	end
       
   324 	return false
       
   325 end
       
   326 
   318 -------------- ACTIONS ------------------
   327 -------------- ACTIONS ------------------
   319 
   328 
   320 function weaponsPlatform(gear)
   329 function weaponsPlatform(gear)
   321 	saveCheckpoint("2")
   330 	saveCheckpoint("2")
   322 	SaveCampaignVar("HeroHealth",GetHealth(hero.gear))
   331 	SaveCampaignVar("HeroHealth",GetHealth(hero.gear))
   352 	if currentHedgehog ~= hero.gear then
   361 	if currentHedgehog ~= hero.gear then
   353 		AnimSay(professor.gear,loc("Don't hit me, you fools!"), SAY_SHOUT, 2000)
   362 		AnimSay(professor.gear,loc("Don't hit me, you fools!"), SAY_SHOUT, 2000)
   354 	end
   363 	end
   355 end
   364 end
   356 
   365 
   357 function professorDeath(gear)
   366 function victory()
   358 	if gameOver then return end
   367 	AnimCaption(hero.gear, loc("Congrats! You won!"), 6000)
   359 	if GetHealth(minion1.gear) then
       
   360 		AnimSay(minion1.gear, loc("The boss has fallen! Retreat!"), SAY_SHOUT, 6000)
       
   361 	elseif GetHealth(minion2.gear) then
       
   362 		AnimSay(minion2.gear, loc("The boss has fallen! Retreat!"), SAY_SHOUT, 6000)
       
   363 	elseif GetHealth(minion3.gear) then
       
   364 		AnimSay(minion3.gear, loc("The boss has fallen! Retreat!"), SAY_SHOUT, 6000)
       
   365 	end
       
   366 	DismissTeam(teamB.name)
       
   367 	AnimCaption(hero.gear, loc("Congrats! You made them run away!"), 6000)
       
   368 	AnimWait(hero.gear,5000)
       
   369 
       
   370 	saveCompletedStatus(1)
   368 	saveCompletedStatus(1)
   371 	SendStat(siGameResult, loc("Hog Solo wins, congratulations!"))
   369 	SendStat(siGameResult, loc("Hog Solo wins, congratulations!"))
   372 	SendStat(siCustomAchievement, loc("You have eliminated Professor Hogevil."))
       
   373 	SendStat(siCustomAchievement, loc("You drove the minions away."))
       
   374 	SendStat(siPlayerKills,'1',teamD.name)
   370 	SendStat(siPlayerKills,'1',teamD.name)
   375 	SendStat(siPlayerKills,'0',teamC.name)
   371 	SendStat(siPlayerKills,'0',teamC.name)
   376 	SaveCampaignVar("CosmosCheckPoint", "5") -- hero got fuels
   372 	SaveCampaignVar("CosmosCheckPoint", "5") -- hero got fuels
   377 	resetCheckpoint() -- reset this mission
   373 	resetCheckpoint() -- reset this mission
   378 	gameOver = true
   374 	gameOver = true
   379 	EndGame()
   375 	EndGame()
   380 end
   376 end
   381 
   377 
       
   378 function professorAndMinionsDeath(gear)
       
   379 	if gameOver then return end
       
   380 	AnimCaption(hero.gear, loc("Congrats! You destroyed the enemy!"), 6000)
       
   381 	SendStat(siCustomAchievement, loc("You have eliminated the whole evil team. You're pretty tough!"))
       
   382 
       
   383 	victory()
       
   384 end
       
   385 
       
   386 function professorDeath(gear)
       
   387 	if gameOver then return end
       
   388 	local m1h = GetHealth(minion1.gear)
       
   389 	local m2h = GetHealth(minion2.gear)
       
   390 	local m3h = GetHealth(minion3.gear)
       
   391 	if m1h == 0 or m2h == 0 or m3h == 0 then return end
       
   392 
       
   393 	if m1h and m1h > 0 and StoppedGear(minion1.gear) then
       
   394 		AnimSay(minion1.gear, loc("The boss has fallen! Retreat!"), SAY_SHOUT, 6000)
       
   395 	elseif m2h and m2h > 0 and StoppedGear(minion2.gear) then
       
   396 		AnimSay(minion2.gear, loc("The boss has fallen! Retreat!"), SAY_SHOUT, 6000)
       
   397 	elseif m3h and m3h > 0 and StoppedGear(minion3.gear) then
       
   398 		AnimSay(minion3.gear, loc("The boss has fallen! Retreat!"), SAY_SHOUT, 6000)
       
   399 	end
       
   400 
       
   401 	AnimCaption(hero.gear, loc("Congrats! You made them run away!"), 6000)
       
   402 	SendStat(siCustomAchievement, loc("You have eliminated Professor Hogevil."))
       
   403 	SendStat(siCustomAchievement, loc("You drove the minions away."))
       
   404 	DismissTeam(teamB.name)
       
   405 	AnimWait(hero.gear,5000)
       
   406 
       
   407 	victory()
       
   408 end
       
   409 
   382 function minionsDeath(gear)
   410 function minionsDeath(gear)
       
   411 	if professor.dead or GetHealth(professor.gear) == nil or GetHealth(professor.gear) == 0 then return end
   383 	if gameOver then return end
   412 	if gameOver then return end
   384 	-- do staffs here
   413 
   385 	AnimSay(professor.gear, loc("I may lost this battle, but I haven't lost the war yet!"), SAY_SHOUT, 6000)
   414 	AnimSay(professor.gear, loc("I may lost this battle, but I haven't lost the war yet!"), SAY_SHOUT, 6000)
   386 	DismissTeam(teamC.name)
   415 	DismissTeam(teamC.name)
   387 	AnimCaption(hero.gear, loc("Congrats! You won!"), 6000)
       
   388 	AnimWait(hero.gear,5000)
   416 	AnimWait(hero.gear,5000)
   389 
       
   390 	saveCompletedStatus(1)
       
   391 	SendStat(siGameResult, loc("Congratulations, you won!"))
       
   392 	SendStat(siCustomAchievement, loc("You have eliminated the evil minions."))
   417 	SendStat(siCustomAchievement, loc("You have eliminated the evil minions."))
   393 	SendStat(siCustomAchievement, loc("You drove Professor Hogevil away."))
   418 	SendStat(siCustomAchievement, loc("You drove Professor Hogevil away."))
   394 	SendStat(siPlayerKills,'1',teamD.name)
   419 
   395 	SendStat(siPlayerKills,'0',teamC.name)
   420 	victory()
   396 	SaveCampaignVar("CosmosCheckPoint", "5") -- hero got fuels
       
   397 	resetCheckpoint() -- reset this mission
       
   398 	gameOver = true
       
   399 	EndGame()
       
   400 end
   421 end
   401 
   422 
   402 -------------- ANIMATIONS ------------------
   423 -------------- ANIMATIONS ------------------
   403 
   424 
   404 function Skipanim(anim)
   425 function Skipanim(anim)