event for escape win spacecampaign
authorPeriklis Ntanasis <pntanasis@gmail.com>
Sat, 10 Aug 2013 03:56:50 +0300
branchspacecampaign
changeset 9504 cdba61cfba93
parent 9502 6aebf7a3b655
child 9506 adc05ca2cb10
event for escape win
share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit01.lua
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit01.lua	Sat Aug 10 02:55:28 2013 +0300
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit01.lua	Sat Aug 10 03:56:50 2013 +0300
@@ -251,6 +251,13 @@
 	return win
 end
 
+function onEscapeWin(gear)
+	if not hero.dead and GetX(hero.gear) < 170 and GetY(hero.gear > 1980) and StoppedGear(hero.gear) then
+		return true
+	end
+	return false
+end
+
 function onHeroSelect(gear)
 	if GetX(hero.gear) ~= hero.x then
 		return true
@@ -273,6 +280,11 @@
 	EndGame()
 end
 
+function escapeWin(gear)
+	-- add stats
+	EndGame()
+end
+
 function heroSelect(gear)
 	TurnTimeLeft = 0
 	FollowGear(hero.gear)
@@ -282,6 +294,11 @@
 		AddEvent(onBattleWin, {hero.gear}, battleWin, {hero.gear}, 0)
 		AddAnim(dialog02)
 	elseif GetX(hero.gear) > hero.x then
+		AddEvent(onEscapeWin, {hero.gear}, escapeWin, {hero.gear}, 0)
+		local greenTeam = { green2, green3, green4 }
+		for i=1,3 do
+			SetHogLevel(greenTeam[i].gear, 1)
+		end
 		AddAnim(dialog03)
 	end
 end