diff --git a/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs b/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs index 0af56bdbbb..f03debc8b9 100644 --- a/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs +++ b/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs @@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits public readonly bool ResetOnHoldLost = true; [Desc("Percentage of all strategic points the player has to hold to win.")] - public readonly float RatioRequired = 0.5f; + public readonly int RatioRequired = 50; [Desc("Delay for the end game notification in milliseconds.")] public readonly int NotificationDelay = 1500; @@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Traits public int Total { get { return AllPoints.Count(); } } int Owned { get { return AllPoints.Count(a => WorldUtils.AreMutualAllies(player, a.Owner)); } } - public bool Holding { get { return Owned >= info.RatioRequired * Total; } } + public bool Holding { get { return Owned >= info.RatioRequired * Total / 100; } } public void Tick(Actor self) { diff --git a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs index 443799e906..76dd0657a7 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs @@ -660,6 +660,22 @@ namespace OpenRA.Mods.Common.UtilityCommands } } + // Migrated StrategicVictoryConditions RatioRequired to use int percentage instead of float + if (engineVersion < 20160325) + { + if (node.Key.StartsWith("StrategicVictoryConditions")) + { + var ratioNode = node.Value.Nodes.FirstOrDefault(x => x.Key == "RatioRequired"); + if (ratioNode != null) + { + // The RatioRequired value is now an int percentage, so multiply the float with 100. + var oldValue = FieldLoader.GetValue("RatioRequired", ratioNode.Value.Value); + var newValue = (int)(oldValue * 100); + ratioNode.Value.Value = newValue.ToString(); + } + } + } + UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1); } } diff --git a/mods/ra/maps/koth-hopes-anchor/rules.yaml b/mods/ra/maps/koth-hopes-anchor/rules.yaml index 310ea4ba70..311f3d5b58 100644 --- a/mods/ra/maps/koth-hopes-anchor/rules.yaml +++ b/mods/ra/maps/koth-hopes-anchor/rules.yaml @@ -18,6 +18,5 @@ Player: StrategicVictoryConditions: HoldDuration: 3000 ResetOnHoldLost: true - RatioRequired: 0.65 - CriticalRatioRequired: 0.65 + RatioRequired: 65 -ConquestVictoryConditions: