aboutsummaryrefslogtreecommitdiff
path: root/src/game/CreatureAIImpl.h
diff options
context:
space:
mode:
authormegamage <none@none>2009-08-31 13:56:26 -0500
committermegamage <none@none>2009-08-31 13:56:26 -0500
commitad1acedea73a37a7b3cee07c0088fc40ae8c5f43 (patch)
tree4171521ebbc5840c0ce2e3741a7b34b0c72507c2 /src/game/CreatureAIImpl.h
parenta4f6659f7a483a73dbc3d5d78748ffe7a077dad7 (diff)
*Use updatecombatstate to replace updatevictim. This should fix the bug of MoveSeekAssistance is replace by MoveChase immediately. Thanks to totoro
--HG-- branch : trunk
Diffstat (limited to 'src/game/CreatureAIImpl.h')
-rw-r--r--src/game/CreatureAIImpl.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/game/CreatureAIImpl.h b/src/game/CreatureAIImpl.h
index 2ed0219ad6a..09efb138574 100644
--- a/src/game/CreatureAIImpl.h
+++ b/src/game/CreatureAIImpl.h
@@ -287,6 +287,47 @@ inline bool CreatureAI::UpdateVictimWithGaze()
return me->getVictim();
}
+inline bool CreatureAI::UpdateCombatState()
+{
+ if(!me->isInCombat())
+ return false;
+
+ if(!me->HasReactState(REACT_PASSIVE))
+ {
+ if(Unit *victim = me->SelectVictim())
+ AttackStart(victim);
+ return me->getVictim();
+ }
+ else if(me->getThreatManager().isThreatListEmpty())
+ {
+ EnterEvadeMode();
+ return false;
+ }
+
+ return true;
+}
+
+inline bool CreatureAI::UpdateVictim()
+{
+ if(!me->isInCombat())
+ return false;
+
+ if(!me->HasReactState(REACT_PASSIVE))
+ {
+ if(Unit *victim = me->SelectVictim())
+ AttackStart(victim);
+ return me->getVictim();
+ }
+ else if(me->getThreatManager().isThreatListEmpty())
+ {
+ EnterEvadeMode();
+ return false;
+ }
+
+ return true;
+}
+
+/*
inline bool CreatureAI::UpdateVictim()
{
if(!me->isInCombat())
@@ -295,6 +336,7 @@ inline bool CreatureAI::UpdateVictim()
AttackStart(victim);
return me->getVictim();
}
+*/
inline bool CreatureAI::_EnterEvadeMode()
{