From 98804390cf903121fe369d541a7367ecfc000230 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Mon, 21 Dec 2009 19:27:12 +1300 Subject: [PATCH] oops; that logic was completely off. --- OpenRa.Game/Combat.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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; }