Battalion (mode=king): Kill the team when the king died instea of dismissing
authorWuzzy <Wuzzy2@mail.ru>
Mon, 12 Feb 2018 20:00:26 +0100
changeset 12986 1c38d4370943
parent 12985 add647b0036e
child 12987 ba99ecc53cf0
Battalion (mode=king): Kill the team when the king died instea of dismissing DismissTeam causes a lot of problems and is not suited for multiplayer. The team is not dismissed if the team is still active. It's hard to properly do a tie. And, and, and …
ChangeLog.txt
share/hedgewars/Data/Scripts/Multiplayer/Battalion.lua
--- a/ChangeLog.txt	Mon Feb 12 19:38:07 2018 +0100
+++ b/ChangeLog.txt	Mon Feb 12 20:00:26 2018 +0100
@@ -27,6 +27,9 @@
  + Racer, Tech Racer: First waypoint flashes before the hog starts moving
  + Racer: Use dark waypoints in bright themes like Bath
  + Racer, Tech Racer: Various other waypoint appearance improvements
+ + Battalion: Minor message and visual improvements
+ + Battalion (King Mode): If the king dies, the hogs die normally instead of disappearing
+ * Battalion: Some texts in the mission panel were wrong and misleading
  * Construction Mode: Remove drill strike if added by weapon scheme (it's broken)
 
 A Space Adventure:
--- a/share/hedgewars/Data/Scripts/Multiplayer/Battalion.lua	Mon Feb 12 19:38:07 2018 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Battalion.lua	Mon Feb 12 20:00:26 2018 +0100
@@ -1147,19 +1147,21 @@
   local msgColor = getHogInfo(KingHog, 'clanColor')
 
   AddCaption(string.format(loc("The king of %s has died!"), team), 0xFFFFFFFF, capgrpGameState)
-  PlaySound(sndByeBye)
-  DismissTeam(team)
 
-  -- for hog, val in pairs(hogInfo) do
-  --   if getHogInfo(hog, 'team') == team then
-  --     hp = GetHealth(hog)
-  --     if hp ~= nil and hp > 0 then
-  --       SetState(KingHog, gstHHDeath)
-  --       SetHealth(hog, 0)
-  --       SetGearValues(hog, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0)
-  --     end
-  --   end
-  -- end
+  -- Kill the rest of the team normally, just like the official King Mode game modifier
+  for hog, val in pairs(hogInfo) do
+    if getHogInfo(hog, 'team') == team then
+      hp = GetHealth(hog)
+      if hp ~= nil and hp > 0 then
+        SetState(KingHog, gstHHDeath)
+        SetHealth(hog, 0)
+        SetGearValues(hog, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0)
+      end
+    end
+  end
+
+  -- We don't use DismissTeam, it causes a lot of problems and nasty side-effects.
+
 end
 
 function onPointsKill(gear)
@@ -1654,7 +1656,7 @@
   elseif mode == 'king' then
     txt = txt .. " |"
     txt = txt .. loc("--- King Mode ---").."|"
-    txt = txt .. loc("Protect the King: When the king dies, the team is vaporized").."|"
+    txt = txt .. loc("Protect the King: When the king dies, so does the team").."|"
     txt = txt .. string.format(loc("Turns: King's health is set to %d%% of the team health"), kingLinkPerc).."|"
     icon = 0 -- Golden Crown
   elseif mode == 'points' then