share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice01.lua
branchspacecampaign
changeset 9400 b0c1b1972947
parent 9398 3f2ec6e1032f
child 9402 8e9d062f9a48
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice01.lua	Tue Jul 30 15:30:22 2013 +0300
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice01.lua	Tue Jul 30 16:40:43 2013 +0300
@@ -7,7 +7,6 @@
 
 -- TODO
 -- TEST TEST AND MORE TEST
--- increase health in checkpoint 3
 -- fix the stats
 
 HedgewarsScriptLoad("/Scripts/Locale.lua")
@@ -24,6 +23,7 @@
 local checkPointReached = 1 -- 1 is normal spawn
 -- dialogs
 local dialog01 = {}
+local dialog02 = {}
 -- mission objectives
 local goals = {
 	[dialog01] = {missionName, loc("Getting ready"), loc("Collect the icegun and get the device part from Thanta"), 1, 4500},
@@ -381,8 +381,8 @@
 end
 
 function onHeroWin(gear)
-	if (not hero.dead and not bandit1.dead) and (GetX(hero.gear)>=GetX(bandit1.gear)-15 and GetX(hero.gear)<=GetX(bandit1.gear)+15)
-		and (GetY(hero.gear)>=GetY(bandit1.gear)-15 and GetY(hero.gear)<=GetY(bandit1.gear)+15) then
+	if (not hero.dead and not bandit1.dead) and (GetX(hero.gear)>=GetX(bandit1.gear)-80 and GetX(hero.gear)<=GetX(bandit1.gear)+80)
+		and (GetY(hero.gear)>=GetY(bandit1.gear)-30 and GetY(hero.gear)<=GetY(bandit1.gear)+30) then
 		return true
 	end
 	return false
@@ -440,9 +440,13 @@
 end
 
 function heroWin(gear)
-	SendStat('siGameResult', loc("Congratulations, you got the part!"))
-	-- more custom stats
-	EndGame()
+	TurnTimeLeft=0
+	if GetX(hero.gear) < GetX(bandit1.gear) then
+		HogTurnLeft(bandit1.gear, true)
+	else
+		HogTurnLeft(bandit1.gear, false)
+	end
+	AddAnim(dialog02)
 end
 
 -------------- ANIMATIONS ------------------
@@ -450,7 +454,10 @@
 function Skipanim(anim)
 	if goals[anim] ~= nil then
 		ShowMission(unpack(goals[anim]))
-    end
+    end    
+    if anim == dialog02 then
+		actionsOnWin()
+	end
 end
 
 function AnimationSetup()
@@ -471,4 +478,23 @@
 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("There is one below us!"), SAY_SAY, 4000}})
 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
 	table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}})
+	-- DIALOG 02 - Hero got to Thant2
+	AddSkipFunction(dialog02, Skipanim, {dialog01})
+	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 3000}})
+	table.insert(dialog02, {func = AnimCaption, args = {hero.gear, loc("Congratulations, now you can take Thanta's part..."), 5000}})
+	table.insert(dialog02, {func = AnimSay, args = {bandit1.gear, loc("Oh! Please pare me. You can take all my treasures!"), SAY_SAY, 3000}})
+	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 5000}})
+	table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("I just want the strange device you found!"), SAY_SAY, 3000}})
+	table.insert(dialog02, {func = AnimWait, args = {bandit1.gear, 4000}})
+	table.insert(dialog02, {func = AnimSay, args = {bandit1.gear, loc("Here! Take it..."), SAY_SAY, 3000}})
+	table.insert(dialog02, {func = actionsOnWin, args = {}})	
 end
+
+-------------- Other Functions -------------------
+
+function actionsOnWin()
+	SendStat('siGameResult', loc("Congratulations, you got the part!"))
+	SaveCampaignVar("IcePlanetPartAcquired", "true")
+	-- more custom stats
+	EndGame()
+end