*Fix the bug that neutral creatures do not fight back.

--HG--
branch : trunk
This commit is contained in:
megamage committed 2008-11-26 11:41:03 -06:00
1 parent 9e3c9124f2
commit 77b753b452
3 files changed
+9 -4

No files matched your search

+7 -2
View File
@@ -8557,11 +8557,16 @@ bool Unit::isTargetableForAttack() const
return isAttackableByAOE() && !hasUnitState(UNIT_STAT_DIED);
}
bool Unit::canAttack(Unit const* target) const
bool Unit::canAttack(Unit const* target, bool force) const
{
assert(target);
if(!IsHostileTo(target))
if(force)
{
if(IsFriendlyTo(target))
return false;
}
else if(!IsHostileTo(target))
return false;
if(!target->isAttackableByAOE() || target->hasUnitState(UNIT_STAT_DIED))