Core/Combat: Properly unset engagement flag on death.
Port From (https://github.com/TrinityCore/TrinityCore/commit/6b1ca0ca128425677043d36a147a019f6d2ac6e6)
This commit is contained in:
@@ -244,6 +244,12 @@ namespace Game.AI
|
||||
if (!IsEngaged())
|
||||
return false;
|
||||
|
||||
if (!me.IsAlive())
|
||||
{
|
||||
EngagementOver();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!me.HasReactState(ReactStates.Passive))
|
||||
{
|
||||
Unit victim = me.SelectVictim();
|
||||
|
||||
@@ -502,6 +502,9 @@ namespace Game.Entities
|
||||
if (m_deathState != DeathState.Corpse)
|
||||
break;
|
||||
|
||||
if (IsEngaged())
|
||||
AIUpdateTick(diff);
|
||||
|
||||
if (m_groupLootTimer != 0 && !lootingGroupLowGUID.IsEmpty())
|
||||
{
|
||||
if (m_groupLootTimer <= diff)
|
||||
@@ -583,7 +586,6 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
// do not allow the AI to be changed during update
|
||||
AIUpdateTick(diff);
|
||||
|
||||
if (!IsAlive())
|
||||
@@ -1087,7 +1089,7 @@ namespace Game.Entities
|
||||
base.AtDisengage();
|
||||
|
||||
ClearUnitState(UnitState.AttackPlayer);
|
||||
if (HasDynamicFlag(UnitDynFlags.Tapped))
|
||||
if (IsAlive() && HasDynamicFlag(UnitDynFlags.Tapped))
|
||||
SetDynamicFlags((UnitDynFlags)GetCreatureTemplate().DynamicFlags);
|
||||
|
||||
if (IsPet() || IsGuardian()) // update pets' speed for catchup OOC speed
|
||||
|
||||
@@ -858,8 +858,6 @@ namespace Game.Entities
|
||||
|
||||
if (!creature.IsPet())
|
||||
{
|
||||
creature.GetThreatManager().ClearAllThreat();
|
||||
|
||||
// must be after setDeathState which resets dynamic flags
|
||||
if (!creature.loot.IsLooted())
|
||||
creature.AddDynamicFlag(UnitDynFlags.Lootable);
|
||||
|
||||
Reference in New Issue
Block a user