diff --git a/Source/Game/AI/CoreAI/CreatureAI.cs b/Source/Game/AI/CoreAI/CreatureAI.cs index fdd916cc8..2740b4e59 100644 --- a/Source/Game/AI/CoreAI/CreatureAI.cs +++ b/Source/Game/AI/CoreAI/CreatureAI.cs @@ -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(); diff --git a/Source/Game/Entities/Creature/Creature.cs b/Source/Game/Entities/Creature/Creature.cs index a4b1df281..c86b8cd62 100644 --- a/Source/Game/Entities/Creature/Creature.cs +++ b/Source/Game/Entities/Creature/Creature.cs @@ -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 diff --git a/Source/Game/Entities/Unit/Unit.Combat.cs b/Source/Game/Entities/Unit/Unit.Combat.cs index 13f020d99..383e058ba 100644 --- a/Source/Game/Entities/Unit/Unit.Combat.cs +++ b/Source/Game/Entities/Unit/Unit.Combat.cs @@ -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);