only retaliate if idle
This commit is contained in:
@@ -72,18 +72,15 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
public void Damaged(Actor self, AttackInfo e)
|
public void Damaged(Actor self, AttackInfo e)
|
||||||
{
|
{
|
||||||
|
if (!self.IsIdle) return;
|
||||||
|
|
||||||
// not a lot we can do about things we can't hurt... although maybe we should automatically run away?
|
// not a lot we can do about things we can't hurt... although maybe we should automatically run away?
|
||||||
if (!Combat.HasAnyValidWeapons(self, e.Attacker))
|
if (!Combat.HasAnyValidWeapons(self, e.Attacker)) return;
|
||||||
return;
|
|
||||||
|
|
||||||
if (self.Owner.Stances[e.Attacker.Owner] == Stance.Ally)
|
// don't retaliate against own units force-firing on us. it's usually not what the player wanted.
|
||||||
return; // don't retaliate against own units force-firing on us. it's usually not what the player wanted.
|
if (self.Owner.Stances[e.Attacker.Owner] == Stance.Ally) return;
|
||||||
|
|
||||||
if (e.Damage < 0)
|
if (e.Damage < 0) return; // don't retaliate against healers
|
||||||
return; // don't retaliate against healers
|
|
||||||
|
|
||||||
var attack = self.traits.Get<AttackBase>();
|
|
||||||
if (attack.target != null) return;
|
|
||||||
|
|
||||||
AttackTarget(self, e.Attacker);
|
AttackTarget(self, e.Attacker);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user