mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-09 00:08:01 +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()))
|
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))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user