Fix inconsitency between AttackEntityInZone and ShouldAbandonChase for units in defensive stance. Patch by mimo. Fixes #1866.

This was SVN commit r13502.
This commit is contained in:
leper 2013-06-26 13:24:03 +00:00
parent 2fcd52b657
commit d5e081d55f

View File

@ -3447,7 +3447,8 @@ UnitAI.prototype.AttackEntityInZone = function(ents, forceResponse)
for each (var target in ents)
{
var type = this.GetBestAttackAgainst(target);
if (this.CanAttack(target, forceResponse) && this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, type))
if (this.CanAttack(target, forceResponse) && this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, type)
&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target)))
{
this.PushOrderFront("Attack", { "target": target, "force": false, "forceResponse": forceResponse });
return true;