From e70e2d008897170a67e6a7913f573b63cb2f99ae Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sun, 2 Jan 2022 19:15:03 -0500 Subject: [PATCH] Core/SmartAI: SmartAI creatures no longer process health-based hooks after death. Port From (https://github.com/TrinityCore/TrinityCore/commit/3db58c4d96c446b736b84d4954f8fd9c9e309e33) --- Source/Game/AI/SmartScripts/SmartAI.cs | 7 +++++++ Source/Game/Entities/Creature/Creature.cs | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Source/Game/AI/SmartScripts/SmartAI.cs b/Source/Game/AI/SmartScripts/SmartAI.cs index 2e673bac8..59d472825 100644 --- a/Source/Game/AI/SmartScripts/SmartAI.cs +++ b/Source/Game/AI/SmartScripts/SmartAI.cs @@ -322,6 +322,13 @@ namespace Game.AI public override void UpdateAI(uint diff) { + if (!me.IsAlive()) + { + if (IsEngaged()) + EngagementOver(); + return; + } + CheckConditions(diff); GetScript().OnUpdate(diff); diff --git a/Source/Game/Entities/Creature/Creature.cs b/Source/Game/Entities/Creature/Creature.cs index 47998763a..86b5a5ddd 100644 --- a/Source/Game/Entities/Creature/Creature.cs +++ b/Source/Game/Entities/Creature/Creature.cs @@ -2176,7 +2176,7 @@ namespace Game.Entities public void CallForHelp(float radius) { - if (radius <= 0.0f || !IsEngaged() || IsPet() || IsCharmed()) + if (radius <= 0.0f || !IsEngaged() || !IsAlive() || IsPet() || IsCharmed()) return; Unit target = GetThreatManager().GetCurrentVictim(); @@ -2187,7 +2187,7 @@ namespace Game.Entities if (target == null) { - Log.outError(LogFilter.Unit, $"Creature {GetEntry()} ({GetName()}) is engaged without threat list"); + Log.outError(LogFilter.Unit, $"Creature {GetEntry()} ({GetName()}) trying to call for help without being in combat."); return; }