mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-05 16:39:08 +01:00
Core/SmartAI: Reset Actions will not be processed until creature reaches home.
This commit is contained in:
@@ -68,6 +68,8 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c)
|
||||
mFollowArrivedEntry = 0;
|
||||
mFollowCreditType = 0;
|
||||
mInvincibilityHpLevel = 0;
|
||||
|
||||
mJustReset = false;
|
||||
}
|
||||
|
||||
void SmartAI::UpdateDespawn(const uint32 diff)
|
||||
@@ -88,13 +90,6 @@ void SmartAI::UpdateDespawn(const uint32 diff)
|
||||
} else mDespawnTime -= diff;
|
||||
}
|
||||
|
||||
void SmartAI::Reset()
|
||||
{
|
||||
if (!HasEscortState(SMART_ESCORT_ESCORTING))//dont mess up escort movement after combat
|
||||
SetRun(mRun);
|
||||
GetScript()->OnReset();
|
||||
}
|
||||
|
||||
WayPoint* SmartAI::GetNextWayPoint()
|
||||
{
|
||||
if (!mWayPoints || mWayPoints->empty())
|
||||
@@ -476,7 +471,8 @@ void SmartAI::EnterEvadeMode()
|
||||
else
|
||||
me->GetMotionMaster()->MoveTargetedHome();
|
||||
|
||||
Reset();
|
||||
if (!HasEscortState(SMART_ESCORT_ESCORTING))//dont mess up escort movement after combat
|
||||
SetRun(mRun);
|
||||
}
|
||||
|
||||
void SmartAI::MoveInLineOfSight(Unit* who)
|
||||
@@ -567,7 +563,8 @@ void SmartAI::JustRespawned()
|
||||
if (me->getFaction() != me->GetCreatureTemplate()->faction_A)
|
||||
me->RestoreFaction();
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
|
||||
Reset();
|
||||
mJustReset = true;
|
||||
JustReachedHome();
|
||||
mFollowGuid = 0;//do not reset follower on Reset(), we need it after combat evade
|
||||
mFollowDist = 0;
|
||||
mFollowAngle = 0;
|
||||
@@ -586,10 +583,17 @@ int SmartAI::Permissible(const Creature* creature)
|
||||
|
||||
void SmartAI::JustReachedHome()
|
||||
{
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_REACHED_HOME);
|
||||
GetScript()->OnReset();
|
||||
|
||||
if (!UpdateVictim() && me->GetMotionMaster()->GetCurrentMovementGeneratorType() == IDLE_MOTION_TYPE && me->GetWaypointPath())
|
||||
me->ToCreature()->GetMotionMaster()->MovePath(me->GetWaypointPath(), true);
|
||||
if (!mJustReset)
|
||||
{
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_REACHED_HOME);
|
||||
|
||||
if (!UpdateVictim() && me->GetMotionMaster()->GetCurrentMovementGeneratorType() == IDLE_MOTION_TYPE && me->GetWaypointPath())
|
||||
me->ToCreature()->GetMotionMaster()->MovePath(me->GetWaypointPath(), true);
|
||||
}
|
||||
|
||||
mJustReset = false;
|
||||
}
|
||||
|
||||
void SmartAI::EnterCombat(Unit* enemy)
|
||||
@@ -689,7 +693,8 @@ void SmartAI::InitializeAI()
|
||||
{
|
||||
GetScript()->OnInitialize(me);
|
||||
if (!me->isDead())
|
||||
Reset();
|
||||
mJustReset = true;
|
||||
JustReachedHome();
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
|
||||
}
|
||||
|
||||
|
||||
@@ -71,10 +71,7 @@ class SmartAI : public CreatureAI
|
||||
// Called when creature is spawned or respawned
|
||||
void JustRespawned();
|
||||
|
||||
// Called after InitializeAI(), EnterEvadeMode() for resetting variables
|
||||
void Reset();
|
||||
|
||||
// Called at reaching home after evade
|
||||
// Called at reaching home after evade, InitializeAI(), EnterEvadeMode() for resetting variables
|
||||
void JustReachedHome();
|
||||
|
||||
// Called for reaction at enter to combat if not in combat yet (enemy can be NULL)
|
||||
@@ -232,6 +229,7 @@ class SmartAI : public CreatureAI
|
||||
uint32 mDespawnState;
|
||||
void UpdateDespawn(const uint32 diff);
|
||||
uint32 mEscortInvokerCheckTimer;
|
||||
bool mJustReset;
|
||||
};
|
||||
|
||||
class SmartGameObjectAI : public GameObjectAI
|
||||
|
||||
Reference in New Issue
Block a user