diff options
| author | maximius <none@none> | 2009-10-22 02:19:30 -0700 |
|---|---|---|
| committer | maximius <none@none> | 2009-10-22 02:19:30 -0700 |
| commit | 2a7ca1c87e097ae13cabf69713e4e094bdf0aacd (patch) | |
| tree | f3ba531a1f83afd6bf89d5427b53889cfe79d7ed | |
| parent | 25e36147aa2c75f3f39213009e08a8fdc665e40d (diff) | |
*Ignore unattackables, they are not suitable attackers or victims.
--HG--
branch : trunk
| -rw-r--r-- | src/game/Creature.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 5ba7427bcbe..c8ff97882d8 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -2185,6 +2185,12 @@ bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction / // friendlies and other mobs they shouldn't attack bool Creature::_IsTargetAcceptable(const Unit *target) const { + assert(target); + + // if the target or myself are unattackable, the target is not acceptable + if (!isAttackableByAOE() || !target->isAttackableByAOE()) + return false; + const Unit *myVictim = getAttackerForHelper(); // if I'm already fighting target, the target is acceptable @@ -2202,6 +2208,7 @@ bool Creature::_IsTargetAcceptable(const Unit *target) const return false; // if the target's victim is friendly, and the target is neutral, the target is acceptable + // NOTE: !IsHostileTo(target) is true at this point if (IsFriendlyTo(targetVictim) && !IsFriendlyTo(target)) return true; |
