diff --git a/OpenRa.Game/Combat.cs b/OpenRa.Game/Combat.cs index 37aa3ff088..9d42af2457 100644 --- a/OpenRa.Game/Combat.cs +++ b/OpenRa.Game/Combat.cs @@ -55,10 +55,17 @@ namespace OpenRa.Game public static bool WeaponValidForTarget(WeaponInfo weapon, Actor target) { var projectile = Rules.ProjectileInfo[weapon.Projectile]; + var unit = target.traits.GetOrDefault(); + + if (target.traits.Contains()) + return projectile.ASW; + + if (unit != null && unit.Altitude > 0) + return projectile.AA; + + if (projectile.UnderWater && !target.Info.WaterBound) + return false; - if (projectile.ASW && target.traits.Contains()) return true; - if (projectile.AA && target.traits.Contains()) return true; - if (projectile.UnderWater && !target.Info.WaterBound) return false; return projectile.AG; }