diff --git a/OpenRA.Mods.RA/AttackBase.cs b/OpenRA.Mods.RA/AttackBase.cs index 5307de4e11..039a88f1e8 100644 --- a/OpenRA.Mods.RA/AttackBase.cs +++ b/OpenRA.Mods.RA/AttackBase.cs @@ -181,16 +181,7 @@ namespace OpenRA.Mods.RA return (order.OrderString == "Attack") ? "Attack" : null; } - protected virtual void QueueAttack(Actor self, Target newTarget) - { - var weapon = ChooseWeaponForTarget(newTarget); - - if (weapon != null) - self.QueueActivity( - new Activities.Attack( - newTarget, - Math.Max(0, (int)weapon.Info.Range))); - } + protected abstract void QueueAttack(Actor self, Target newTarget); public bool HasAnyValidWeapons(Target t) { return Weapons.Any(w => w.IsValidAgainst(self.World, t)); } public float GetMaximumRange() { return Weapons.Max(w => w.Info.Range); } diff --git a/OpenRA.Mods.RA/AttackFrontal.cs b/OpenRA.Mods.RA/AttackFrontal.cs index 877bdf105f..62ea298c09 100644 --- a/OpenRA.Mods.RA/AttackFrontal.cs +++ b/OpenRA.Mods.RA/AttackFrontal.cs @@ -39,5 +39,16 @@ namespace OpenRA.Mods.RA return true; } + + protected override void QueueAttack(Actor self, Target newTarget) + { + var weapon = ChooseWeaponForTarget(newTarget); + + if (weapon != null) + self.QueueActivity( + new Activities.Attack( + newTarget, + Math.Max(0, (int)weapon.Info.Range))); + } } } diff --git a/OpenRA.Mods.RA/AttackLeap.cs b/OpenRA.Mods.RA/AttackLeap.cs index 23ba4a296e..c206f79929 100644 --- a/OpenRA.Mods.RA/AttackLeap.cs +++ b/OpenRA.Mods.RA/AttackLeap.cs @@ -9,6 +9,8 @@ #endregion using OpenRA.Mods.RA.Activities; +using System; +using OpenRA.Traits; namespace OpenRA.Mods.RA { @@ -37,5 +39,16 @@ namespace OpenRA.Mods.RA self.CancelActivity(); self.QueueActivity(new Leap(self, target)); } + + protected override void QueueAttack(Actor self, Target newTarget) + { + var weapon = ChooseWeaponForTarget(newTarget); + + if (weapon != null) + self.QueueActivity( + new Activities.Attack( + newTarget, + Math.Max(0, (int)weapon.Info.Range))); + } } }