Backed out changeset 82951b9b3c2f
authorWuzzy <almikes@aol.com>
Tue, 25 Apr 2017 02:13:18 +0200
changeset 12320 a85212a8d0e0
parent 12319 09b0a709c4bb
child 12321 1be56fa243c8
Backed out changeset 82951b9b3c2f Reason: People think giving hogs the weapons again in consecutive turns is OP
ChangeLog.txt
share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua
--- a/ChangeLog.txt	Mon Apr 24 23:11:51 2017 +0200
+++ b/ChangeLog.txt	Tue Apr 25 02:13:18 2017 +0200
@@ -45,7 +45,6 @@
 Highlander:
  + Show collected weapons after kill and play sound
  + Mission panel now shows all game modifiers (e.g. mines time, vampirism, etc.)
- * Fix hog not receiving new ammo when it takes two consecutive turns (happens when all enemy hogs are frozen)
 
 Construction Mode:
  + Added script parameter support:
--- a/share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua	Mon Apr 24 23:11:51 2017 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua	Tue Apr 25 02:13:18 2017 +0200
@@ -118,6 +118,8 @@
 local atkChoices = {}
 local utilChoices = {}
 
+local currHog
+local lastHog
 local started = false
 local switchStage = 0
 
@@ -128,7 +130,6 @@
 local atktot = 0
 local utiltot = 0
 
-local lastHog = nil
 local someHog = nil -- just for looking up the weps
 
 local mode = nil
@@ -310,23 +311,33 @@
 	runOnGears(ConvertValues)
 end
 
-function AssignHogAmmo()
+function CheckForHogSwitch()
+
 	if (CurrentHedgehog ~= nil) then
-		-- Re-assign ammo to this guy, so that his entire ammo set will
-		-- be visible during another player's turn
-		if lastHog ~= nil then
-			ConvertValues(lastHog)
+
+		currHog = CurrentHedgehog
+
+		if currHog ~= lastHog then
+
+			-- re-assign ammo to this guy, so that his entire ammo set will
+			-- be visible during another player's turn
+			if lastHog ~= nil then
+				ConvertValues(lastHog)
+			end
+
+			-- give the new hog what he is supposed to have, too
+			ConvertValues(CurrentHedgehog)
+
 		end
 
-		-- Give the new hog what he is supposed to have, too
-		ConvertValues(CurrentHedgehog)
+		lastHog = currHog
 
-		lastHog = CurrentHedgehog
 	end
+
 end
 
 function onNewTurn()
-	AssignHogAmmo()
+	CheckForHogSwitch()
 end
 
 --function onGameTick20()