diff options
author | megamage <none@none> | 2009-05-16 14:49:30 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-05-16 14:49:30 -0500 |
commit | 819326f2863aa6ce0d4ada9e21ae9134eb4ea06a (patch) | |
tree | 682545ca1d3bde25145b19ba093732e08f39d317 /src/game/CreatureAI.cpp | |
parent | bb6e0dba89e01b59854750b2b84624dc8653295e (diff) |
*Update some instance script functions.
--HG--
branch : trunk
Diffstat (limited to 'src/game/CreatureAI.cpp')
-rw-r--r-- | src/game/CreatureAI.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/game/CreatureAI.cpp b/src/game/CreatureAI.cpp index 67458f5a157..350e9d7ee13 100644 --- a/src/game/CreatureAI.cpp +++ b/src/game/CreatureAI.cpp @@ -51,7 +51,7 @@ void CreatureAI::DoZoneInCombat(Creature* creature) if(!creature->HasReactState(REACT_PASSIVE) && !creature->getVictim()) { - if(Unit *target = creature->SelectNearestTarget()) + if(Unit *target = creature->SelectNearestTarget(50)) creature->AI()->AttackStart(target); else if(creature->isSummon()) { @@ -97,6 +97,26 @@ void CreatureAI::MoveInLineOfSight(Unit *who) AttackStart(who->getVictim()); } +bool CreatureAI::UpdateVictimByReact() +{ + if(!me->isInCombat()) + return false; + + if(me->HasReactState(REACT_AGGRESSIVE)) + { + if(Unit *victim = me->SelectVictim()) + AttackStart(victim); + return me->getVictim(); + } + else if(me->getThreatManager().isThreatListEmpty()) + { + EnterEvadeMode(); + return false; + } + + return true; +} + bool CreatureAI::UpdateVictim() { if(!me->isInCombat()) |