fix(Core/SmartAI): Prevent NPCs from attacking invalid targets. (#25626)
This commit is contained in:
parent
9dc68434c8
commit
65613eaeeb
1 changed files with 4 additions and 0 deletions
|
|
@ -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))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue