fix(Core/SmartAI): Prevent NPCs from attacking invalid targets. (#25626)

This commit is contained in:
Rocco Silipo 2026-04-27 22:50:16 +02:00 committed by GitHub
parent 9dc68434c8
commit 65613eaeeb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -818,6 +818,10 @@ bool SmartAI::AssistPlayerInCombatAgainst(Unit* who)
if (!me->IsValidAssistTarget(who->GetVictim())) if (!me->IsValidAssistTarget(who->GetVictim()))
return false; 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? //too far away and no free sight?
if (me->IsWithinDistInMap(who, SMART_MAX_AID_DIST) && me->IsWithinLOSInMap(who)) if (me->IsWithinDistInMap(who, SMART_MAX_AID_DIST) && me->IsWithinLOSInMap(who))
{ {