aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r--src/game/Unit.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index b2e214f915e..7c8c9179962 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -10409,6 +10409,10 @@ Unit* Creature::SelectHostilTarget()
//next-victim-selection algorithm and evade mode are called
//threat list sorting etc.
+ //This should not be called by unit who does not have a threatlist
+ //or who does not have threat (totem/pet/critter)
+ //otherwise enterevademode every update
+
Unit* target = NULL;
//This function only useful once AI has been initialized
@@ -10446,7 +10450,7 @@ Unit* Creature::SelectHostilTarget()
for(AttackerSet::const_iterator itr = m_attackers.begin(); itr != m_attackers.end(); ++itr)
{
if( (*itr)->IsInMap(this) && canAttack(*itr) && (*itr)->isInAccessiblePlaceFor((Creature*)this) )
- return false;
+ return NULL;
}
}*/
@@ -12902,12 +12906,7 @@ void Unit::SetFeared(bool apply)
if(!fearAuras.empty())
caster = ObjectAccessor::GetUnit(*this, fearAuras.front()->GetCasterGUID());
if(!caster)
- {
- if(getVictim())
- caster = getVictim();
- else if(m_attackers.size())
- caster = *m_attackers.begin();
- }
+ caster = getAttackerForHelper();
GetMotionMaster()->MoveFleeing(caster); // caster==NULL processed in MoveFleeing
}
else