diff options
author | maximius <none@none> | 2009-10-23 23:26:04 -0700 |
---|---|---|
committer | maximius <none@none> | 2009-10-23 23:26:04 -0700 |
commit | c9cd2f2dbeeb09c78b43b73d77254543b301928f (patch) | |
tree | 3ef23c077d7590666ff13349dfdb4de3485844d1 | |
parent | ecef2642f46d8aa16fbfc8ed92d91f95030614d0 (diff) |
*Cleanup Creature::_IsTargetAcceptable.
--HG--
branch : trunk
-rw-r--r-- | src/game/Creature.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index c627deb48e3..7f5af5f354b 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -2190,20 +2190,16 @@ bool Creature::_IsTargetAcceptable(const Unit *target) const const Unit *myVictim = getAttackerForHelper(); const Unit *targetVictim = target->getAttackerForHelper(); - // if I'm already fighting target, the target is acceptable - if (myVictim == target || targetVictim == this) - return true; - - // if I'm hostile towards the target, the target is acceptable - if (!canAttack(target, false)) + // if the target cannot be attacked, the target is not acceptable + if (!canAttack(target, true)) return false; - // if the target does not have a victim, the target is not acceptable - if (!targetVictim) - return false; + // if I'm already fighting target, or I'm hostile towards the target, the target is acceptable + if (myVictim == target || targetVictim == this || IsHostileTo(target)) + return true; // if the target's victim is friendly, and the target is neutral, the target is acceptable - if (IsFriendlyTo(targetVictim) && !IsFriendlyTo(target)) + if (targetVictim && IsFriendlyTo(targetVictim) && !IsFriendlyTo(target)) return true; // if the target's victim is not friendly, or the target is friendly, the target is not acceptable |