aboutsummaryrefslogtreecommitdiff
path: root/src/game/Creature.cpp
diff options
context:
space:
mode:
authormaximius <none@none>2009-10-23 20:01:15 -0700
committermaximius <none@none>2009-10-23 20:01:15 -0700
commitecef2642f46d8aa16fbfc8ed92d91f95030614d0 (patch)
tree4e8e8ca3da67a188d81154f61df96d6bc3d15507 /src/game/Creature.cpp
parentd9530eea573e715bd600de29b8d62f32e42276d7 (diff)
*Use some more standard functions in _IsTargetAcceptable. Should also fix the perma-unattackable boss issue.
--HG-- branch : trunk
Diffstat (limited to 'src/game/Creature.cpp')
-rw-r--r--src/game/Creature.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
index c8ff97882d8..c627deb48e3 100644
--- a/src/game/Creature.cpp
+++ b/src/game/Creature.cpp
@@ -2187,28 +2187,22 @@ 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();
+ const Unit *targetVictim = target->getAttackerForHelper();
// if I'm already fighting target, the target is acceptable
- if (myVictim == target || target->getVictim() == this)
+ if (myVictim == target || targetVictim == this)
return true;
// if I'm hostile towards the target, the target is acceptable
- if (IsHostileTo(target))
- return true;
-
- const Unit *targetVictim = target->getAttackerForHelper();
+ if (!canAttack(target, false))
+ return false;
// if the target does not have a victim, the target is not acceptable
if (!targetVictim)
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;