Second implementation of Sandworms
Fix tabs in AttackSwallow.cs
This commit is contained in:
@@ -25,6 +25,8 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
public readonly string Cursor = "attack";
|
||||
public readonly string OutsideRangeCursor = "attackoutsiderange";
|
||||
[Desc("Does the attack type requires the attacker to enter the target's cell?")]
|
||||
public readonly bool AttackRequiresEnteringCell = false;
|
||||
|
||||
public abstract object Create(ActorInitializer init);
|
||||
}
|
||||
@@ -38,12 +40,12 @@ namespace OpenRA.Mods.RA
|
||||
protected Func<IEnumerable<Armament>> GetArmaments;
|
||||
|
||||
readonly Actor self;
|
||||
readonly AttackBaseInfo info;
|
||||
public readonly AttackBaseInfo Info;
|
||||
|
||||
public AttackBase(Actor self, AttackBaseInfo info)
|
||||
{
|
||||
this.self = self;
|
||||
this.info = info;
|
||||
Info = info;
|
||||
|
||||
var armaments = Exts.Lazy(() => self.TraitsImplementing<Armament>()
|
||||
.Where(a => info.Armaments.Contains(a.Info.Name)));
|
||||
@@ -179,8 +181,8 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
var a = ab.ChooseArmamentForTarget(target);
|
||||
cursor = a != null && !target.IsInRange(self.CenterPosition, a.Weapon.Range)
|
||||
? ab.info.OutsideRangeCursor
|
||||
: ab.info.Cursor;
|
||||
? ab.Info.OutsideRangeCursor
|
||||
: ab.Info.Cursor;
|
||||
|
||||
if (target.Type == TargetType.Actor && target.Actor == self)
|
||||
return false;
|
||||
@@ -210,7 +212,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
IsQueued = modifiers.HasModifier(TargetModifiers.ForceQueue);
|
||||
|
||||
cursor = ab.info.Cursor;
|
||||
cursor = ab.Info.Cursor;
|
||||
|
||||
if (negativeDamage)
|
||||
return false;
|
||||
@@ -223,7 +225,7 @@ namespace OpenRA.Mods.RA
|
||||
var maxRange = ab.GetMaximumRange().Range;
|
||||
var targetRange = (self.World.Map.CenterOfCell(location) - self.CenterPosition).HorizontalLengthSquared;
|
||||
if (targetRange > maxRange * maxRange)
|
||||
cursor = ab.info.OutsideRangeCursor;
|
||||
cursor = ab.Info.OutsideRangeCursor;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace OpenRA.Mods.RA
|
||||
public void TickIdle(Actor self)
|
||||
{
|
||||
var target = self.CenterPosition + new WVec(0, -1024*Info.MoveRadius, 0).Rotate(WRot.FromFacing(self.World.SharedRandom.Next(255)));
|
||||
// TODO: This needs to be looked into again. The bigger MoveRadius is, the bigger chance that the selected coordinates will be invalid.
|
||||
self.Trait<AttackMove>().ResolveOrder(self, new Order("AttackMove", self, false) { TargetLocation = self.World.Map.CellContaining(target) });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.RA.Move;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
@@ -163,12 +164,15 @@ namespace OpenRA.Mods.RA
|
||||
nextScanTime = self.World.SharedRandom.Next(info.MinimumScanTimeInterval, info.MaximumScanTimeInterval);
|
||||
var inRange = self.World.FindActorsInCircle(self.CenterPosition, range);
|
||||
|
||||
var mobile = self.TraitOrDefault<Mobile>();
|
||||
return inRange
|
||||
.Where(a =>
|
||||
a.AppearsHostileTo(self) &&
|
||||
!a.HasTrait<AutoTargetIgnore>() &&
|
||||
attack.HasAnyValidWeapons(Target.FromActor(a)) &&
|
||||
self.Owner.Shroud.IsTargetable(a))
|
||||
a.AppearsHostileTo(self) &&
|
||||
!a.HasTrait<AutoTargetIgnore>() &&
|
||||
attack.HasAnyValidWeapons(Target.FromActor(a)) &&
|
||||
self.Owner.Shroud.IsTargetable(a) &&
|
||||
(!attack.Info.AttackRequiresEnteringCell || (mobile != null && mobile.MovementSpeedForCell(self, a.Location) != 0))
|
||||
)
|
||||
.ClosestTo(self);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user