From 65613eaeeb8d5753037527447aeca5797aa916a5 Mon Sep 17 00:00:00 2001 From: Rocco Silipo <108557877+Rorschach91@users.noreply.github.com> Date: Mon, 27 Apr 2026 22:50:16 +0200 Subject: [PATCH] fix(Core/SmartAI): Prevent NPCs from attacking invalid targets. (#25626) --- src/server/game/AI/SmartScripts/SmartAI.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index c80e2a0ac..8ce3641e8 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -818,6 +818,10 @@ bool SmartAI::AssistPlayerInCombatAgainst(Unit* who) if (!me->IsValidAssistTarget(who->GetVictim())) return false; + // Do not engage if we cannot actually attack the attacker (e.g. neutral faction) + if (!me->IsValidAttackTarget(who)) + return false; + //too far away and no free sight? if (me->IsWithinDistInMap(who, SMART_MAX_AID_DIST) && me->IsWithinLOSInMap(who)) {