diff --git a/OpenRA.Mods.Common/Traits/SelfHealing.cs b/OpenRA.Mods.Common/Traits/SelfHealing.cs index ca4b2dd6b7..98a782b613 100644 --- a/OpenRA.Mods.Common/Traits/SelfHealing.cs +++ b/OpenRA.Mods.Common/Traits/SelfHealing.cs @@ -18,7 +18,8 @@ namespace OpenRA.Mods.Common.Traits { public readonly int Step = 5; public readonly int Delay = 5; - public readonly float HealIfBelow = .5f; + [Desc("Heal if current health is below this percentage of full health.")] + public readonly int HealIfBelow = 50; public readonly int DamageCooldown = 0; public override object Create(ActorInitializer init) { return new SelfHealing(init.Self, this); } @@ -42,7 +43,7 @@ namespace OpenRA.Mods.Common.Traits if (self.IsDead || IsTraitDisabled) return; - if (health.HP >= Info.HealIfBelow * health.MaxHP) + if (health.HP >= Info.HealIfBelow * health.MaxHP / 100) return; if (damageTicks > 0) diff --git a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs index 2a144f97e1..a42e679d39 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs @@ -692,6 +692,22 @@ namespace OpenRA.Mods.Common.UtilityCommands } } + // Migrated SelfHealing to use int percentage instead of float + if (engineVersion < 20160325) + { + if (node.Key == "SelfHealing") + { + var healIfBelowNode = node.Value.Nodes.FirstOrDefault(x => x.Key == "HealIfBelow"); + if (healIfBelowNode != null) + { + // The HealIfBelow value is now an int percentage, so multiply the float with 100. + var oldValue = FieldLoader.GetValue("HealIfBelow", healIfBelowNode.Value.Value); + var newValue = (int)(oldValue * 100); + healIfBelowNode.Value.Value = newValue.ToString(); + } + } + } + UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1); } } diff --git a/mods/cnc/maps/gdi06/rules.yaml b/mods/cnc/maps/gdi06/rules.yaml index e0c9cafecb..d19de9dfd1 100644 --- a/mods/cnc/maps/gdi06/rules.yaml +++ b/mods/cnc/maps/gdi06/rules.yaml @@ -70,7 +70,7 @@ RMBO.easy: HP: 300 SelfHealing: Delay: 10 - HealIfBelow: 50% + HealIfBelow: 50 DamageCooldown: 200 RenderSprites: Image: RMBO diff --git a/mods/cnc/rules/vehicles.yaml b/mods/cnc/rules/vehicles.yaml index 76d4f81bb4..04984c3f61 100644 --- a/mods/cnc/rules/vehicles.yaml +++ b/mods/cnc/rules/vehicles.yaml @@ -411,7 +411,7 @@ HTNK: AutoTarget: SelfHealing: Delay: 10 - HealIfBelow: 50% + HealIfBelow: 50 DamageCooldown: 200 SpawnActorOnDeath: Actor: HTNK.Husk diff --git a/mods/d2k/rules/aircraft.yaml b/mods/d2k/rules/aircraft.yaml index aa41a11d0b..d0d73bdfee 100644 --- a/mods/d2k/rules/aircraft.yaml +++ b/mods/d2k/rules/aircraft.yaml @@ -39,7 +39,7 @@ carryall.reinforce: SelfHealing: Step: 5 Delay: 3 - HealIfBelow: 50% + HealIfBelow: 50 carryall: Inherits: carryall.reinforce diff --git a/mods/d2k/rules/vehicles.yaml b/mods/d2k/rules/vehicles.yaml index c5a82a4c15..760dbf3857 100644 --- a/mods/d2k/rules/vehicles.yaml +++ b/mods/d2k/rules/vehicles.yaml @@ -44,7 +44,7 @@ mcv: SelfHealing: Step: 5 Delay: 3 - HealIfBelow: 50% + HealIfBelow: 50 harvester: Inherits: ^Vehicle @@ -95,7 +95,7 @@ harvester: SelfHealing: Step: 5 Delay: 3 - HealIfBelow: 50% + HealIfBelow: 50 trike: Inherits: ^Vehicle @@ -336,7 +336,7 @@ devastator: SelfHealing: Step: 5 Delay: 3 - HealIfBelow: 50% + HealIfBelow: 50 raider: Inherits: ^Vehicle diff --git a/mods/ra/maps/bomber-john/rules.yaml b/mods/ra/maps/bomber-john/rules.yaml index c7834f7bb0..2043a106df 100644 --- a/mods/ra/maps/bomber-john/rules.yaml +++ b/mods/ra/maps/bomber-john/rules.yaml @@ -160,7 +160,7 @@ MINVV: SelfHealing: Step: -1 Delay: 1 - HealIfBelow: 101% + HealIfBelow: 101 DamageCooldown: 0 Explodes: Weapon: CrateNuke diff --git a/mods/ra/maps/fort-lonestar/rules.yaml b/mods/ra/maps/fort-lonestar/rules.yaml index c4c48f89a7..c2717eb3ef 100644 --- a/mods/ra/maps/fort-lonestar/rules.yaml +++ b/mods/ra/maps/fort-lonestar/rules.yaml @@ -307,7 +307,7 @@ V2RL: SelfHealing: Step: 2 Delay: 1 - HealIfBelow: 40% + HealIfBelow: 40 BADR.Bomber: Health: diff --git a/mods/ra/maps/monster-tank-madness/rules.yaml b/mods/ra/maps/monster-tank-madness/rules.yaml index 2fd5c2b1fc..2f091e1cae 100644 --- a/mods/ra/maps/monster-tank-madness/rules.yaml +++ b/mods/ra/maps/monster-tank-madness/rules.yaml @@ -160,7 +160,7 @@ PBOX: SelfHealing: Step: 1 Delay: 1 - HealIfBelow: 100% + HealIfBelow: 100 DamageCooldown: 150 Selectable: Bounds: 44,38,0,-4 diff --git a/mods/ra/rules/vehicles.yaml b/mods/ra/rules/vehicles.yaml index 80278c6aa3..88e4685976 100644 --- a/mods/ra/rules/vehicles.yaml +++ b/mods/ra/rules/vehicles.yaml @@ -192,7 +192,7 @@ V2RL: SelfHealing: Step: 1 Delay: 3 - HealIfBelow: 50% + HealIfBelow: 50 DamageCooldown: 150 SelectionDecorations: VisualBounds: 44,38,0,-4 diff --git a/mods/ts/rules/civilian-vehicles.yaml b/mods/ts/rules/civilian-vehicles.yaml index 2df93e87e7..c918bf7478 100644 --- a/mods/ts/rules/civilian-vehicles.yaml +++ b/mods/ts/rules/civilian-vehicles.yaml @@ -28,7 +28,7 @@ AutoTarget: SelfHealing: Delay: 10 - HealIfBelow: 50% + HealIfBelow: 50 DamageCooldown: 200 WithVoxelTurret: WithVoxelBarrel: diff --git a/mods/ts/rules/nod-vehicles.yaml b/mods/ts/rules/nod-vehicles.yaml index 35b35e49b9..90cf5ca203 100644 --- a/mods/ts/rules/nod-vehicles.yaml +++ b/mods/ts/rules/nod-vehicles.yaml @@ -246,7 +246,7 @@ WEED: HP: 600 SelfHealing: Delay: 10 - HealIfBelow: 50% + HealIfBelow: 50 DamageCooldown: 200 Armor: Type: Heavy diff --git a/mods/ts/rules/shared-vehicles.yaml b/mods/ts/rules/shared-vehicles.yaml index b4d8151f66..d1e192c882 100644 --- a/mods/ts/rules/shared-vehicles.yaml +++ b/mods/ts/rules/shared-vehicles.yaml @@ -76,7 +76,7 @@ HARV: HP: 1000 SelfHealing: Delay: 10 - HealIfBelow: 50% + HealIfBelow: 50 DamageCooldown: 200 Armor: Type: Heavy