Added IRangeMultiplier

This commit is contained in:
atlimit8
2015-06-27 13:52:00 -05:00
parent 65c1d2f5c1
commit 74a9dc6793
14 changed files with 96 additions and 23 deletions

View File

@@ -21,15 +21,15 @@ namespace OpenRA.Mods.Common.Activities
readonly AttackBase attack;
readonly IMove move;
readonly IFacing facing;
readonly Armament armament;
readonly WDist minRange;
readonly WDist maxRange;
readonly IPositionable positionable;
public Attack(Actor self, Target target, Armament armament, bool allowMovement)
{
Target = target;
this.minRange = armament.Weapon.MinRange;
this.maxRange = armament.Weapon.Range;
this.armament = armament;
attack = self.Trait<AttackBase>();
facing = self.Trait<IFacing>();
@@ -65,6 +65,7 @@ namespace OpenRA.Mods.Common.Activities
return NextActivity;
// Try to move within range
var maxRange = armament.MaxRange();
if (move != null && (!Target.IsInRange(self.CenterPosition, maxRange) || Target.IsInRange(self.CenterPosition, minRange)))
return Util.SequenceActivities(move.MoveWithinRange(Target, minRange, maxRange), this);