aboutsummaryrefslogtreecommitdiff
path: root/src/game/UnitAI.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-08-21 23:38:04 -0500
committermegamage <none@none>2009-08-21 23:38:04 -0500
commit189d9fdd51ba37182b0c0ca1c2698076153cc6f3 (patch)
treef87f8a363e7d2f1122fd5034972e81992afb15c1 /src/game/UnitAI.cpp
parent0ee9bffd5a28933599addd146536e713a108cbba (diff)
*Some cleanup of Kalecgos script.
--HG-- branch : trunk
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))