mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Combat: Properly unset engagement flag on death.
This commit is contained in:
@@ -61,7 +61,7 @@ void GuardAI::EnterEvadeMode(EvadeReason /*why*/)
|
||||
return;
|
||||
}
|
||||
|
||||
TC_LOG_TRACE("scritps.ai", "GuardAI::EnterEvadeMode: %s enters evade mode.", me->GetGUID().ToString().c_str());
|
||||
TC_LOG_TRACE("scripts.ai", "GuardAI::EnterEvadeMode: %s enters evade mode.", me->GetGUID().ToString().c_str());
|
||||
|
||||
me->RemoveAllAuras();
|
||||
me->CombatStop(true);
|
||||
|
||||
@@ -240,6 +240,12 @@ bool CreatureAI::UpdateVictim()
|
||||
if (!IsEngaged())
|
||||
return false;
|
||||
|
||||
if (!me->IsAlive())
|
||||
{
|
||||
EngagementOver();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!me->HasReactState(REACT_PASSIVE))
|
||||
{
|
||||
if (Unit* victim = me->SelectVictim())
|
||||
|
||||
@@ -702,6 +702,9 @@ void Creature::Update(uint32 diff)
|
||||
if (m_deathState != CORPSE)
|
||||
break;
|
||||
|
||||
if (IsEngaged())
|
||||
Unit::AIUpdateTick(diff);
|
||||
|
||||
if (m_groupLootTimer && lootingGroupLowGUID)
|
||||
{
|
||||
if (m_groupLootTimer <= diff)
|
||||
@@ -788,8 +791,6 @@ void Creature::Update(uint32 diff)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// do not allow the AI to be changed during update
|
||||
Unit::AIUpdateTick(diff);
|
||||
|
||||
// creature can be dead after UpdateAI call
|
||||
@@ -3272,7 +3273,7 @@ void Creature::AtDisengage()
|
||||
Unit::AtDisengage();
|
||||
|
||||
ClearUnitState(UNIT_STATE_ATTACK_PLAYER);
|
||||
if (HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED))
|
||||
if (IsAlive() && HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED))
|
||||
SetUInt32Value(UNIT_DYNAMIC_FLAGS, GetCreatureTemplate()->dynamicflags);
|
||||
|
||||
if (IsPet() || IsGuardian()) // update pets' speed for catchup OOC speed
|
||||
|
||||
@@ -10950,8 +10950,6 @@ bool Unit::InitTamedPet(Pet* pet, uint8 level, uint32 spell_id)
|
||||
|
||||
if (!creature->IsPet())
|
||||
{
|
||||
creature->GetThreatManager().ClearAllThreat();
|
||||
|
||||
// must be after setDeathState which resets dynamic flags
|
||||
if (!creature->loot.isLooted())
|
||||
creature->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
|
||||
|
||||
Reference in New Issue
Block a user