From 339c2896b212cf41d7d53ada727166e167af2017 Mon Sep 17 00:00:00 2001 From: maximius Date: Sun, 27 Sep 2009 19:22:42 -0700 Subject: *Make sure the target actually has a victim, otherwise checking hostility is pointless. --HG-- branch : trunk --- src/game/Unit.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') 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) -- cgit v1.2.3