Skip to content

Commit

Permalink
NPCBots: Fix ranged bots trying to follow the player after the target…
Browse files Browse the repository at this point in the history
… was killed even if there are other attackable targets around
  • Loading branch information
trickerer committed Dec 3, 2024
1 parent d565802 commit ede20ad
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/server/game/AI/NpcBots/bot_ai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4748,6 +4748,7 @@ bool bot_ai::CheckAttackTarget()
Evade();
}

_lastTargetGuid = ObjectGuid::Empty;
return false;
}

Expand Down Expand Up @@ -18491,7 +18492,7 @@ bool bot_ai::GlobalUpdate(uint32 diff)
return false;

//opponent unsafe
if ((IsWanderer() || (!IAmFree() && (!opponent || !master->GetBotMgr()->GetBotAllowCombatPositioning()))) &&
if ((IsWanderer() || (!IAmFree() && (!_lastTargetGuid || !master->GetBotMgr()->GetBotAllowCombatPositioning()))) &&
!HasBotCommandState(BOT_COMMAND_STAY) &&
(!me->GetVehicle() || (!CCed(me->GetVehicleBase(), true) && !me->GetVehicleBase()->GetTarget())))
{
Expand Down

0 comments on commit ede20ad

Please sign in to comment.