aboutsummaryrefslogtreecommitdiff
path: root/src/game/UnitAI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/UnitAI.cpp')
-rw-r--r--src/game/UnitAI.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/game/UnitAI.cpp b/src/game/UnitAI.cpp
index 0f00cd356f2..4ba2f94e4db 100644
--- a/src/game/UnitAI.cpp
+++ b/src/game/UnitAI.cpp
@@ -165,7 +165,16 @@ Unit* UnitAI::SelectTarget(SelectAggroTarget targetType, uint32 position, float
if(targetType == SELECT_TARGET_TOPAGGRO)
advance(i, position);
else // random
- advance(i, position + rand()%(m_threatlist.size() - position));
+ {
+ //advance(i, position + rand()%(m_threatlist.size() - position));
+ //if we use "random, 1", usually we want random except current victim
+ advance(i, rand()%m_threatlist.size());
+ if(position && (*i)->getTarget() == me->getVictim())
+ {
+ m_threatlist.erase(i);
+ continue;
+ }
+ }
}
if(SelectTargetHelper(me, (*i)->getTarget(), playerOnly, dist, aura))