From ede20adedbcb32821d310f09621223663cf99536 Mon Sep 17 00:00:00 2001 From: trickerer Date: Tue, 3 Dec 2024 08:49:17 +0700 Subject: [PATCH] NPCBots: Fix ranged bots trying to follow the player after the target was killed even if there are other attackable targets around --- src/server/game/AI/NpcBots/bot_ai.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/server/game/AI/NpcBots/bot_ai.cpp b/src/server/game/AI/NpcBots/bot_ai.cpp index 4871744feba0f..870ea3bab5fc9 100644 --- a/src/server/game/AI/NpcBots/bot_ai.cpp +++ b/src/server/game/AI/NpcBots/bot_ai.cpp @@ -4748,6 +4748,7 @@ bool bot_ai::CheckAttackTarget() Evade(); } + _lastTargetGuid = ObjectGuid::Empty; return false; } @@ -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()))) {