*Allow not to switch to charmed AI for some scripts.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-03-13 17:48:57 -06:00
parent 5f2edfc7e8
commit ce4c9cb2ae
4 changed files with 14 additions and 4 deletions
+6 -1
View File
@@ -484,7 +484,12 @@ void Creature::Update(uint32 diff)
break; break;
// if creature is charmed, switch to charmed AI // if creature is charmed, switch to charmed AI
UpdateCharmAI(); if(NeedChangeAI)
{
UpdateCharmAI();
NeedChangeAI = false;
IsAIEnabled = true;
}
if(!IsInEvadeMode() && IsAIEnabled) if(!IsInEvadeMode() && IsAIEnabled)
{ {
+6 -1
View File
@@ -63,7 +63,12 @@ void UnitAI::DoMeleeAttackIfReady()
void PlayerAI::OnCharmed(bool apply) { me->IsAIEnabled = apply; } void PlayerAI::OnCharmed(bool apply) { me->IsAIEnabled = apply; }
//Disable CreatureAI when charmed //Disable CreatureAI when charmed
void CreatureAI::OnCharmed(bool apply) { /*me->IsAIEnabled = !apply;*/ } void CreatureAI::OnCharmed(bool apply)
{
//me->IsAIEnabled = !apply;*/
me->NeedChangeAI = true;
me->IsAIEnabled = false;
}
void CreatureAI::MoveInLineOfSight(Unit *who) void CreatureAI::MoveInLineOfSight(Unit *who)
{ {
+1 -1
View File
@@ -151,7 +151,7 @@ bool IsPassiveStackableSpell( uint32 spellId )
Unit::Unit() Unit::Unit()
: WorldObject(), i_motionMaster(this), m_ThreatManager(this), m_HostilRefManager(this) : WorldObject(), i_motionMaster(this), m_ThreatManager(this), m_HostilRefManager(this)
, m_IsInNotifyList(false), m_Notified(false), IsAIEnabled(false) , m_IsInNotifyList(false), m_Notified(false), IsAIEnabled(false), NeedChangeAI(false)
, i_AI(NULL), i_disabledAI(NULL) , i_AI(NULL), i_disabledAI(NULL)
{ {
m_objectType |= TYPEMASK_UNIT; m_objectType |= TYPEMASK_UNIT;
+1 -1
View File
@@ -1422,7 +1422,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
uint32 GetReducedThreatPercent() { return m_reducedThreatPercent; } uint32 GetReducedThreatPercent() { return m_reducedThreatPercent; }
Unit *GetMisdirectionTarget() { return m_misdirectionTargetGUID ? GetUnit(*this, m_misdirectionTargetGUID) : NULL; } Unit *GetMisdirectionTarget() { return m_misdirectionTargetGUID ? GetUnit(*this, m_misdirectionTargetGUID) : NULL; }
bool IsAIEnabled; bool IsAIEnabled, NeedChangeAI;
protected: protected:
explicit Unit (); explicit Unit ();