mirror of
https://gitcode.com/GitHub_Trending/az/azerothcore-wotlk.git
synced 2026-07-11 03:13:10 +00:00
fix(Core/SmartAI): Prevent NPCs from attacking invalid targets. (#25626)
This commit is contained in:
@@ -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))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user