From fa29b1696777e8ca18d66a589bbcae10e512825f Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sun, 25 Oct 2015 11:58:12 +0100 Subject: [PATCH] Skip DoImpact if actor has no Health trait --- OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs b/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs index 925a85aaee..511d10f8a8 100644 --- a/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs +++ b/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs @@ -65,13 +65,13 @@ namespace OpenRA.Mods.Common.Warheads if (!IsValidAgainst(victim, firedBy)) continue; - var localModifiers = damageModifiers; var healthInfo = victim.Info.TraitInfoOrDefault(); - if (healthInfo != null) - { - var distance = Math.Max(0, (victim.CenterPosition - pos).Length - healthInfo.Radius.Length); - localModifiers = localModifiers.Append(GetDamageFalloff(distance)); - } + if (healthInfo == null) + continue; + + var localModifiers = damageModifiers; + var distance = Math.Max(0, (victim.CenterPosition - pos).Length - healthInfo.Radius.Length); + localModifiers = localModifiers.Append(GetDamageFalloff(distance)); DoImpact(victim, firedBy, localModifiers); }