diff options
author | Machiavelli <none@none> | 2009-06-10 08:45:45 +0200 |
---|---|---|
committer | Machiavelli <none@none> | 2009-06-10 08:45:45 +0200 |
commit | ee9beadbc20d24ec11346858db36c029c9c04b90 (patch) | |
tree | ad8d5f89f9b7e1418c5bc00990370224b91453f3 /src/game/Creature.cpp | |
parent | f137dc02ecadb515928655dd6603f33187731fec (diff) | |
parent | c9d9ae1e491243f82be5ac84dc2ad51dfbae35eb (diff) |
Merge
--HG--
branch : trunk
Diffstat (limited to 'src/game/Creature.cpp')
-rw-r--r-- | src/game/Creature.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 7f249b36fbd..4e4cd734d5f 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -1646,15 +1646,17 @@ bool Creature::IsWithinSightDist(Unit const* u) const return IsWithinDistInMap(u, sWorld.getConfig(CONFIG_SIGHT_MONSTER)); } -bool Creature::canStartAttack(Unit const* who) const +bool Creature::canStartAttack(Unit const* who, bool force) const { - if(isCivilian() || IsNeutralToAll() + if(isCivilian() || !who->isInAccessiblePlaceFor(this) - || !canFly() && GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE - || !IsWithinDistInMap(who, GetAttackDistance(who))) + || !canFly() && GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) return false; - if(!canAttack(who, false)) + if(!force && (IsNeutralToAll() || !IsWithinDistInMap(who, GetAttackDistance(who)))) + return false; + + if(!canAttack(who, force)) return false; return IsWithinLOSInMap(who); |