From 0f14339763502f9251775bcd93be24586841d534 Mon Sep 17 00:00:00 2001 From: Zimmermann Gyula Date: Sun, 1 Nov 2015 05:45:16 +0100 Subject: [PATCH] Fix (HealthPercentage)DamageWarheads ignoring stances/TargetTypes. Moves the IsValidAgainst check from SpreadDamage level to Damage level and adds a duplication to HealthPercentageDamageWarhead. --- OpenRA.Mods.Common/Warheads/DamageWarhead.cs | 3 +++ OpenRA.Mods.Common/Warheads/HealthPercentageDamageWarhead.cs | 3 +++ OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs | 3 --- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Common/Warheads/DamageWarhead.cs b/OpenRA.Mods.Common/Warheads/DamageWarhead.cs index 6e00e11229..3066758953 100644 --- a/OpenRA.Mods.Common/Warheads/DamageWarhead.cs +++ b/OpenRA.Mods.Common/Warheads/DamageWarhead.cs @@ -65,6 +65,9 @@ namespace OpenRA.Mods.Common.Warheads public virtual void DoImpact(Actor victim, Actor firedBy, IEnumerable damageModifiers) { + if (!IsValidAgainst(victim, firedBy)) + return; + var damage = Util.ApplyPercentageModifiers(Damage, damageModifiers.Append(DamageVersus(victim))); victim.InflictDamage(firedBy, damage, this); } diff --git a/OpenRA.Mods.Common/Warheads/HealthPercentageDamageWarhead.cs b/OpenRA.Mods.Common/Warheads/HealthPercentageDamageWarhead.cs index e01e0a6c5e..9086227f3e 100644 --- a/OpenRA.Mods.Common/Warheads/HealthPercentageDamageWarhead.cs +++ b/OpenRA.Mods.Common/Warheads/HealthPercentageDamageWarhead.cs @@ -42,6 +42,9 @@ namespace OpenRA.Mods.Common.Warheads public override void DoImpact(Actor victim, Actor firedBy, IEnumerable damageModifiers) { + if (!IsValidAgainst(victim, firedBy)) + return; + var healthInfo = victim.Info.TraitInfoOrDefault(); if (healthInfo == null) return; diff --git a/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs b/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs index 3c93865f7c..60d3f985d7 100644 --- a/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs +++ b/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs @@ -62,9 +62,6 @@ namespace OpenRA.Mods.Common.Warheads foreach (var victim in hitActors) { - if (!IsValidAgainst(victim, firedBy)) - continue; - var healthInfo = victim.Info.TraitInfoOrDefault(); if (healthInfo == null) continue;