Battalion: Mutate hogs by default again, but not the names. Add script param mutatenames. Force crowns in King Mode
--- a/ChangeLog.txt Mon Feb 12 20:00:26 2018 +0100
+++ b/ChangeLog.txt Mon Feb 12 20:47:45 2018 +0100
@@ -28,6 +28,9 @@
+ Racer: Use dark waypoints in bright themes like Bath
+ Racer, Tech Racer: Various other waypoint appearance improvements
+ Battalion: Minor message and visual improvements
+ + Battalion: Mutate hog hats by default, but not the names
+ + Battalion: Script parameter “mutatenames=true” to also change the hog names (default: false)
+ + Battalion (King Mode): Kings always wear crowns and non-kings don't, regardless of settings
+ 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/share/hedgewars/Data/Scripts/Multiplayer/Battalion.lua Mon Feb 12 20:00:26 2018 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Battalion.lua Mon Feb 12 20:47:45 2018 +0100
@@ -247,7 +247,9 @@
local modeExplicit = false -- Whether the mode was set in script param
local luck = 100 -- Multiplier for bonuses like crates
local strength = 1 -- Multiplier for more weapons
-local mutate = false -- Whether or not to mutate the hogs
+local useVariantHats = true -- Whether to overwrite the hog hats to those of their variants
+ -- In King Mode, crowns are always enforced regardless of this setting
+local useVariantNames = false -- Whether to overwrite the hog names to those of their variants
local highHasBonusWeps = false -- whether or not a hog got bonus weapons on current turn
local highHasBonusHelp = false -- whether or not a hog got bonus helpers on current turn
@@ -633,11 +635,28 @@
##############################################################################
]]--
-function MutateHog(hog)
+-- Overwrite hog hat to that of its variant
+function SetHogVariantHat(hog)
local var = getHogInfo(hog, 'variant')
+ SetHogHat(hog, variants[var]["hat"])
+end
+-- Give a crown if the hog is a king.
+-- Strip the hog from its crown if
+-- it is not a king.
+function SetHogVariantHatKingMode(hog)
+ local var = getHogInfo(hog, 'variant')
+ if var == "King" then
+ SetHogHat(hog, variants[var]["hat"])
+ elseif GetHogHat(hog) == "crown" then
+ SetHogHat(hog, "NoHat")
+ end
+end
+
+-- Overwrite hog name to that of its variant
+function SetHogVariantName(hog)
+ local var = getHogInfo(hog, 'variant')
SetHogName(hog, variants[var]["name"])
- SetHogHat(hog, variants[var]["hat"])
end
function GetRandomVariant()
@@ -1481,8 +1500,11 @@
end
end
+ if params['mutatenames'] ~= nil then
+ useVariantNames = params['mutatenames']
+ end
if params['mutate'] ~= nil then
- mutate = params['mutate']
+ useVariantHats = params['mutate']
end
if params['strength'] ~= nil and tonumber(params['strength']) > 0 then
@@ -1605,8 +1627,16 @@
if mode ~= 'points' then
runOnGears(setHogVariant)
runOnGears(setupHogTurn)
- if mutate ~= false and mutate ~= 'false' then
- runOnGears(MutateHog)
+ if useVariantNames ~= false and useVariantNames ~= 'false' then
+ runOnGears(SetHogVariantName)
+ end
+ if useVariantHats ~= false and useVariantHats ~= 'false' then
+ runOnGears(SetHogVariantHat)
+ elseif mode == 'king' then
+ -- If variant hats are disabled but we're in King Mode,
+ -- we still change *some* hats to make sure only kings
+ -- wear crows. Otherwise, you don't know who's the king!
+ runOnGears(SetHogVariantHatKingMode)
end
end