diff --git a/OpenRA.Game/Traits/AI/AutoHeal.cs b/OpenRA.Game/Traits/AI/AutoHeal.cs index 34e035e87a..1fd7243da3 100644 --- a/OpenRA.Game/Traits/AI/AutoHeal.cs +++ b/OpenRA.Game/Traits/AI/AutoHeal.cs @@ -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().HP) .OrderBy(a => (a.Location - self.Location).LengthSquared) diff --git a/OpenRA.Game/Traits/AI/AutoTarget.cs b/OpenRA.Game/Traits/AI/AutoTarget.cs index e8ada3ea56..5fc774351d 100644 --- a/OpenRA.Game/Traits/AI/AutoTarget.cs +++ b/OpenRA.Game/Traits/AI/AutoTarget.cs @@ -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)