diff --git a/OpenRA.Game/Traits/Health.cs b/OpenRA.Game/Traits/Health.cs index b170dd28e6..e2df65ef12 100644 --- a/OpenRA.Game/Traits/Health.cs +++ b/OpenRA.Game/Traits/Health.cs @@ -43,8 +43,12 @@ namespace OpenRA.Traits } public int HP { get { return hp; } } - public readonly int MaxHP; - public float HPFraction { get { return hp*1f/MaxHP; } } + public readonly int MaxHP; + public float HPFraction + { + get { return hp * 1f / MaxHP; } + set { hp = (int)(value * MaxHP); } + } public bool IsDead { get { return hp <= 0; } } public bool RemoveOnDeath = true; diff --git a/OpenRA.Mods.RA/Bridge.cs b/OpenRA.Mods.RA/Bridge.cs index 2943389501..0d0c0346f5 100644 --- a/OpenRA.Mods.RA/Bridge.cs +++ b/OpenRA.Mods.RA/Bridge.cs @@ -90,9 +90,9 @@ namespace OpenRA.Mods.RA { currentTemplate = template; if (template == Info.DamagedTemplate) - Health.InflictDamage(self, self, Health.MaxHP/2, null); + Health.HPFraction = .5f; else if (template != Info.Template) - Health.InflictDamage(self, self, Health.MaxHP, null); + Health.HPFraction = 0f; // Create a new cache to store the tile data if (cachedTileset != self.World.Map.Tileset)