diff --git a/OpenRa.Game/Combat.cs b/OpenRa.Game/Combat.cs index 69bb75fd54..33365a4fc0 100644 --- a/OpenRa.Game/Combat.cs +++ b/OpenRa.Game/Combat.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using OpenRa.Game.GameRules; using OpenRa.Game.Effects; +using OpenRa.Game.Traits; namespace OpenRa.Game { @@ -50,5 +51,14 @@ namespace OpenRa.Game return rawDamage * multiplier; } + + public static bool WeaponValidForTarget(WeaponInfo weapon, Actor target) + { + var projectile = Rules.ProjectileInfo[weapon.Projectile]; + + if (projectile.ASW) return false; // we don't support ASW yet. change this when subs can be identified. + if (projectile.AA && target.traits.Contains()) return true; + return projectile.AG; + } } } diff --git a/OpenRa.Game/GameRules/ProjectileInfo.cs b/OpenRa.Game/GameRules/ProjectileInfo.cs index db21594967..97352b6f9d 100644 --- a/OpenRa.Game/GameRules/ProjectileInfo.cs +++ b/OpenRa.Game/GameRules/ProjectileInfo.cs @@ -4,7 +4,7 @@ namespace OpenRa.Game.GameRules class ProjectileInfo { public readonly bool AA = false; - public readonly bool AG = false; + public readonly bool AG = true; public readonly bool ASW = false; public readonly bool Animates = false; public readonly bool Arcing = false; diff --git a/OpenRa.Game/Traits/AttackBase.cs b/OpenRa.Game/Traits/AttackBase.cs index d679c3f480..c14d2768ea 100644 --- a/OpenRa.Game/Traits/AttackBase.cs +++ b/OpenRa.Game/Traits/AttackBase.cs @@ -63,6 +63,8 @@ namespace OpenRa.Game.Traits var weapon = Rules.WeaponInfo[weaponName]; if (weapon.Range * weapon.Range < (target.Location - self.Location).LengthSquared) return false; + if (!Combat.WeaponValidForTarget(weapon, target)) return false; + fireDelay = weapon.ROF; var projectile = Rules.ProjectileInfo[weapon.Projectile]; diff --git a/units.ini b/units.ini index ca963a9373..01a51517f8 100755 --- a/units.ini +++ b/units.ini @@ -117,7 +117,8 @@ Traits=Unit, Mobile, RenderUnit Description=Gunboat WaterBound=yes BuiltAt=syrd -Traits=Unit, Mobile, RenderUnit +Traits=Unit, Mobile, Turreted, AttackTurreted, RenderUnitTurreted +PrimaryOffset=0,-6,0,-1