diff options
author | maximius <none@none> | 2009-09-27 19:22:42 -0700 |
---|---|---|
committer | maximius <none@none> | 2009-09-27 19:22:42 -0700 |
commit | 339c2896b212cf41d7d53ada727166e167af2017 (patch) | |
tree | 41cdd4767a1f33467acfb79fab4ba7d2bdd54178 /src | |
parent | 15dbc456bb973e9a9e427470ba3b8a2f90a55d21 (diff) |
*Make sure the target actually has a victim, otherwise checking hostility is pointless.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Unit.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index a05cc8929ea..a9faa5e72d8 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -11314,7 +11314,7 @@ Unit* Creature::SelectVictim() if (CanHaveThreatList()) { if ( !target && !m_ThreatManager.isThreatListEmpty() ) - // No taunt aura or taunt aura caster is dead standart target selection + // No taunt aura or taunt aura caster is dead standard target selection target = m_ThreatManager.getHostilTarget(); } else if(!HasReactState(REACT_PASSIVE)) @@ -11344,7 +11344,7 @@ Unit* Creature::SelectVictim() else return NULL; - if(target && (!target->isAttackingPlayer() || IsFriendlyTo(target->getVictim()))) // if the victim of target is a player, only defend the victim if we are friendly + if(target && (!target->getVictim() || !target->isAttackingPlayer() || IsFriendlyTo(target->getVictim()))) // if the victim of target is a player, only defend the victim if we are friendly { SetInFront(target); return target; @@ -11358,7 +11358,7 @@ Unit* Creature::SelectVictim() { if(canCreatureAttack(*itr) && (*itr)->GetTypeId() != TYPEID_PLAYER && !((Creature*)(*itr))->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN) - && (!(*itr)->isAttackingPlayer() || IsFriendlyTo(target->getVictim()))) // if the victim of target is a player, only defend the victim if we are friendly + && (!(*itr)->getVictim() || !(*itr)->isAttackingPlayer() || IsFriendlyTo(target->getVictim()))) // if the victim of target is a player, only defend the victim if we are friendly return NULL; } @@ -11369,7 +11369,7 @@ Unit* Creature::SelectVictim() // search nearby enemy before enter evade mode if(HasReactState(REACT_AGGRESSIVE)) if(target = SelectNearestTarget()) - if(!target->isAttackingPlayer() || IsFriendlyTo(target->getVictim())) // if the victim of target is a player, only defend the victim if we are friendly + if(!target->getVictim() || !target->isAttackingPlayer() || IsFriendlyTo(target->getVictim())) // if the victim of target is a player, only defend the victim if we are friendly return target; if(m_invisibilityMask) |