CTF: Fix clan not winning if enemy hog was time-travelling
authorWuzzy <Wuzzy2@mail.ru>
Thu, 18 Jul 2019 03:39:58 +0200
changeset 15257 515a4a317e52
parent 15256 9be05ae1b726
child 15258 000d3262244c
CTF: Fix clan not winning if enemy hog was time-travelling
ChangeLog.txt
share/hedgewars/Data/Scripts/Multiplayer/Capture_the_Flag.lua
--- a/ChangeLog.txt	Thu Jul 18 03:25:15 2019 +0200
+++ b/ChangeLog.txt	Thu Jul 18 03:39:58 2019 +0200
@@ -506,6 +506,7 @@
  * Capture the Flag: Fix many bugs caused by playing with >2 teams
  * Capture the Flag: Properly place flag when first hog uses kamikaze or TimeBox
  * Capture the Flag: Fix flag not being dropped when carrier uses piano strike
+ * Capture the Flag: Fix clan not winning if enemy was in time travel
  * CTF_Blizzard: Don't allow more than 2 clans. Excess hogs will be removed
 
 A Space Adventure:
--- a/share/hedgewars/Data/Scripts/Multiplayer/Capture_the_Flag.lua	Thu Jul 18 03:25:15 2019 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Capture_the_Flag.lua	Thu Jul 18 03:39:58 2019 +0200
@@ -89,6 +89,7 @@
 
 local gameStarted = false
 local gameOver = false
+local winningClan = -1
 local captureLimit = 3
 
 --------------------------
@@ -178,11 +179,12 @@
 
 	if fCaptures[clanID] == captureLimit then
 		gameOver = true
+		winningClan = clanID
 		-- Capture limit reached! We have a winner!
 		for i = 0, (numhhs-1) do
 			if hhs[i] ~= nil then
 				-- Kill all losers
-				if GetHogClan(hhs[i]) ~= clanID then
+				if GetHogClan(hhs[i]) ~= winningClan then
 					SetEffect(hhs[i], heResurrectable, 0)
 					SetHealth(hhs[i],0)
 				end
@@ -629,6 +631,10 @@
 			break
 		end
 	end
+	if gameOver and GetHogClan(gear) ~= winningClan then
+		SetEffect(gear, heResurrectable, 0)
+		SetHealth(gear, 0)
+	end
 end
 
 function onHogAttack(ammoType)