--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/final.lua Fri Sep 29 19:31:25 2017 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/final.lua Fri Sep 29 21:44:35 2017 +0200
@@ -16,6 +16,8 @@
loc("Red areas are indestructible.").."|"..
loc("Green areas are portal-proof.").."|"..
loc("Mines time: 0 seconds")
+
+local dialog01 = {}
local explosives = {}
local currentHealth = 1
local currentDamage = 0
@@ -88,7 +90,8 @@
AddAmmo(hero.gear, amFirePunch, 1)
AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
- AddEvent(onHeroWin, {hero.gear}, heroWin, {hero.gear}, 0)
+ AddEvent(onBoom, {hero.gear}, heroBoomReaction, {hero.gear}, 0)
+ AnimationSetup()
SendHealthStatsOff()
end
@@ -111,6 +114,9 @@
function onNewTurn()
currentDamage = 0
currentHealth = GetHealth(hero.gear)
+ if onBoom(hero.gear) then
+ heroWin(hero.gear)
+ end
end
function onGearDamage(gear, damage)
@@ -128,7 +134,7 @@
return false
end
-function onHeroWin(gear)
+function onBoom(gear)
local win = true
for i=1,table.getn(explosives) do
if GetHealth(explosives[i]) then
@@ -153,7 +159,19 @@
EndGame()
end
+function heroBoomReaction(gear)
+ if GetHealth(gear) and GetHealth(gear) > 0 then
+ HogSay(gear, loc("Kaboom! Hahahaha! Take this, stupid meteorite!"), SAY_SHOUT, 2)
+ end
+end
+
function heroWin(gear)
+ AddAnim(dialog01)
+end
+
+function win()
+ SetWeapon(amNothing)
+ AnimSetInputMask(0)
saveCompletedStatus(7)
SaveCampaignVar("Won", "true")
checkAllMissionsCompleted()
@@ -162,3 +180,41 @@
sendSimpleTeamRankings({teamA.name})
EndGame()
end
+
+------------ ANIMATION STUFF ------------
+
+function Skipanim(anim)
+ if anim == dialog01 then
+ win()
+ end
+end
+
+function onPrecise()
+ if GameTime > 3000 then
+ SetAnimSkip(true)
+ end
+end
+
+function AnimationSetup()
+ -- DIALOG 01 - Start, welcome to moon
+ AddSkipFunction(dialog01, Skipanim, {dialog01})
+ table.insert(dialog01, {func = AnimWait, args = {hero.gear, 100}})
+ table.insert(dialog01, {func = FollowGear, args = {hero.gear}})
+ table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Hooray! I actually did it! Hogera is safe!"), SAY_SHOUT, 3000}})
+ table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("I'm so glad this is finally over!"), SAY_SAY, 3000}})
+ table.insert(dialog01, {func = AnimWait, args = {hero.gear, 4000}})
+ table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Wait a moment …"), SAY_THINK, 2000}})
+ table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("If some good old explosives were enough to save Hogera …"), SAY_THINK, 5000}})
+ table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("… why did I risk my life to collect all the parts of the anti-gravity device?"), SAY_THINK, 6000}})
+ table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("It was completely useless!"), SAY_THINK, 3000}})
+ table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("We could just have blown up the meteorite from the the beginning!"), SAY_THINK, 5000}})
+ -- Hogerian = Inhabitant of the planet Hogera
+ table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Stupid, stupid Hogerians!"), SAY_SAY, 5000}})
+ table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Or maybe this was all part of an evil plan, so evil that even Prof. Hogevil can't think of it!"), SAY_THINK, 9000}})
+ table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Nah, probably everyone was just stupid."), SAY_THINK, 4000}})
+ table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Except me, of course! I just saved a whole planet!"), SAY_THINK, 5000}})
+ table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("But one thing's for sure:"), SAY_THINK, 4000}})
+ table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Hogera is definitely the last planet I saved!"), SAY_THINK, 4000}})
+ table.insert(dialog01, {func = win, args = {hero.gear}})
+end
+