stance wiring for AutoTarget/AutoHeal

This commit is contained in:
Chris Forbes
2010-03-19 18:31:52 +13:00
parent 36f68a4026
commit 0eb1646565
2 changed files with 3 additions and 3 deletions

View File

@@ -65,7 +65,7 @@ namespace OpenRA.Traits
var inRange = self.World.FindUnitsInCircle(self.CenterLocation, Game.CellSize * range);
return inRange
.Where(a => a.Owner == self.Owner && a != self) /* todo: one day deal with friendly players */
.Where(a => a != self && self.Owner.Stances[ a.Owner ] == Stance.Ally)
.Where(a => Combat.HasAnyValidWeapons(self, a))
.Where(a => a.Health < a.Info.Traits.Get<OwnedActorInfo>().HP)
.OrderBy(a => (a.Location - self.Location).LengthSquared)

View File

@@ -50,7 +50,7 @@ namespace OpenRA.Traits
var inRange = self.World.FindUnitsInCircle(self.CenterLocation, Game.CellSize * range);
return inRange
.Where(a => a.Owner != null && a.Owner != self.Owner) /* todo: one day deal with friendly players */
.Where(a => a.Owner != null && self.Owner.Stances[ a.Owner ] == Stance.Enemy)
.Where(a => Combat.HasAnyValidWeapons(self, a))
.OrderBy(a => (a.Location - self.Location).LengthSquared)
.FirstOrDefault();
@@ -62,7 +62,7 @@ namespace OpenRA.Traits
if (!Combat.HasAnyValidWeapons(self, e.Attacker))
return;
if (e.Attacker.Owner == self.Owner)
if (self.Owner.Stances[e.Attacker.Owner] == Stance.Ally)
return; // don't retaliate against own units force-firing on us. it's usually not what the player wanted.
if (e.Damage < 0)