*Fix the bug that neutral creatures do not fight back.
--HG-- branch : trunk
This commit is contained in:
1 parent
9e3c9124f2
commit
77b753b452
3 files changed
+9
-4
No files matched your search
+7
-2
@@ -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))
|
||||
|
||||
Reference in new issue
Block a user