Scenarios: Drawn games count as mission failure
authorWuzzy <Wuzzy2@mail.ru>
Mon, 20 May 2019 16:18:35 +0200
changeset 15036 a1165392c9db
parent 15035 f877fbeaee6c
child 15037 ba49de0c0e38
Scenarios: Drawn games count as mission failure
share/hedgewars/Data/Missions/Scenario/User_Mission_-_Bamboo_Thicket.lua
share/hedgewars/Data/Missions/Scenario/User_Mission_-_Diver.lua
share/hedgewars/Data/Missions/Scenario/User_Mission_-_Spooky_Tree.lua
--- a/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Bamboo_Thicket.lua	Mon May 20 14:59:26 2019 +0200
+++ b/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Bamboo_Thicket.lua	Mon May 20 16:18:35 2019 +0200
@@ -75,9 +75,9 @@
 
 end
 
-function onGearDelete(gear)
+function onGameResult(winner)
 
-	if (gear == enemy) then
+	if (winner == 0) then
 		
 		SaveMissionVar("Won", "true")
 		ShowMission(loc("Bamboo Thicket"), loc("MISSION SUCCESSFUL"), loc("Congratulations!"), 0, 0)
@@ -86,7 +86,7 @@
 			awardAchievement(loc("Energetic Engineer"))
 		end
 
-	elseif gear == player then
+	else
 		ShowMission(loc("Bamboo Thicket"), loc("MISSION FAILED"), loc("Oh no! Just try again!"), -amSkip, 0)
 	end
 
--- a/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Diver.lua	Mon May 20 14:59:26 2019 +0200
+++ b/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Diver.lua	Mon May 20 16:18:35 2019 +0200
@@ -94,12 +94,13 @@
 
 end
 
-function onGearDelete(gear)
+function onGameResult(winner)
 
-	if (gear == enemy) and (GameOver == false) then
+	if winner == 0 then
 		ShowMission(loc("Diver"), loc("MISSION SUCCESSFUL"), loc("Congratulations!"), 0, 0)
 		SaveMissionVar("Won", "true")
-	elseif gear == player then
+		GameOver = true
+	else
 		ShowMission(loc("Diver"), loc("MISSION FAILED"), loc("Oh no! Just try again!"), -amSkip, 0)		
 		GameOver = true
 	end
--- a/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Spooky_Tree.lua	Mon May 20 14:59:26 2019 +0200
+++ b/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Spooky_Tree.lua	Mon May 20 16:18:35 2019 +0200
@@ -146,12 +146,15 @@
 		SetTurnTimeLeft(TurnTimeLeft + 5000)
 	end
 
-	if (gear == enemy) and (GameOver == false) then
+end
+
+function onGameResult(winner)
+	if winner == 0 then
 		ShowMission(loc("Spooky Tree"), loc("MISSION SUCCESSFUL"), loc("Congratulations!"), 0, 0);
 		SaveMissionVar("Won", "true")
-	elseif gear == player then
+		GameOver = true
+	else
 		ShowMission(loc("Spooky Tree"), loc("MISSION FAILED"), loc("Oh no! Just try again!"), -amSkip, 0)
 		GameOver = true
 	end
-
 end