*Allow not to switch to charmed AI for some scripts.
--HG-- branch : trunk
This commit is contained in:
@@ -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)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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
@@ -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
@@ -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 ();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user