diff --git a/OpenRA.Game/GameRules/WeaponInfo.cs b/OpenRA.Game/GameRules/WeaponInfo.cs index 019e869c8b..8eaed63881 100644 --- a/OpenRA.Game/GameRules/WeaponInfo.cs +++ b/OpenRA.Game/GameRules/WeaponInfo.cs @@ -48,12 +48,15 @@ namespace OpenRA.GameRules [Desc("Whether we should prevent prone response for infantry.")] public readonly bool PreventProne = false; - public float EffectivenessAgainst(Actor self) + public float EffectivenessAgainst(ActorInfo ai) { - var health = self.Info.Traits.GetOrDefault(); - if (health == null) return 0f; - var armor = self.Info.Traits.GetOrDefault(); - if (armor == null || armor.Type == null) return 1; + var health = ai.Traits.GetOrDefault(); + if (health == null) + return 0f; + + var armor = ai.Traits.GetOrDefault(); + if (armor == null || armor.Type == null) + return 1; float versus; return Versus.TryGetValue(armor.Type, out versus) ? versus : 1; @@ -140,7 +143,7 @@ namespace OpenRA.GameRules if (targetable == null || !ValidTargets.Intersect(targetable.TargetTypes).Any()) return false; - if (Warheads.All(w => w.EffectivenessAgainst(a) <= 0)) + if (Warheads.All(w => w.EffectivenessAgainst(a.Info) <= 0)) return false; return true; diff --git a/OpenRA.Mods.RA/Combat.cs b/OpenRA.Mods.RA/Combat.cs index 37b751f09f..c50613a2a0 100755 --- a/OpenRA.Mods.RA/Combat.cs +++ b/OpenRA.Mods.RA/Combat.cs @@ -118,7 +118,7 @@ namespace OpenRA.Mods.RA foreach (var t in world.FindTilesInCircle(targetTile, warhead.Size[0])) foreach (var unit in world.FindActorsInBox(t, t)) unit.InflictDamage(firedBy, - (int)(warhead.Damage * warhead.EffectivenessAgainst(unit)), warhead); + (int)(warhead.Damage * warhead.EffectivenessAgainst(unit.Info)), warhead); } break; } } @@ -173,7 +173,7 @@ namespace OpenRA.Mods.RA var distance = (int)Math.Max(0, (target.CenterPosition - pos).Length * Game.CellSize / 1024 - health.Radius); var falloff = (float)GetDamageFalloff(distance / warhead.Spread); var rawDamage = (float)(warhead.Damage * modifier * falloff); - var multiplier = (float)warhead.EffectivenessAgainst(target); + var multiplier = (float)warhead.EffectivenessAgainst(target.Info); return (float)(rawDamage * multiplier); }