From 9c5b1d0027a7cbdb337437e5a373c1f932bc62eb Mon Sep 17 00:00:00 2001 From: kadeshar Date: Sun, 19 Apr 2026 18:49:09 +0200 Subject: [PATCH] Pull strategy GetTarget fix (#2316) ## Pull Request Description Added safe-guard condition for PullStrategy.GetTarget ## How to Test the Changes 1. Invite bot tank 2. Use `reset boAI` or `nc +pull,+pull back` + `co +pull,+pull back` 3. Order bot to pull using command `pull my target` or `pull rti target` on dead creature 4. Bot should run to mob, use ranged skill and back to point where he started pull Without `pull back` strategy bot run to mob, use ranged skill and wait on mob until he come to bot ## Impact Assessment - Does this change increase per-bot/per-tick processing or risk scaling poorly with thousands of bots? - - [x] No, not at all - - [ ] Minimal impact (**explain below**) - - [ ] Moderate impact (**explain below**) - Does this change modify default bot behavior? - - [x] No - - [ ] Yes (**explain why**) - Does this change add new decision branches or increase maintenance complexity? - - [x] No - - [ ] Yes (**explain below**) ## AI Assistance Was AI assistance used while working on this change? - - [x] No - - [ ] Yes (**explain below**) ## Final Checklist - - [x] Stability is not compromised. - - [x] Performance impact is understood, tested, and acceptable. - - [x] Added logic complexity is justified and explained. - - [x] Any new bot dialogue lines are translated. - - [x] Documentation updated if needed (Conf comments, WiKi commands). ## Notes for Reviewers Fix proposed by @brighton-chi --- src/Ai/Base/Strategy/PullStrategy.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Ai/Base/Strategy/PullStrategy.cpp b/src/Ai/Base/Strategy/PullStrategy.cpp index fce917279..3d5e3e94a 100644 --- a/src/Ai/Base/Strategy/PullStrategy.cpp +++ b/src/Ai/Base/Strategy/PullStrategy.cpp @@ -55,7 +55,8 @@ Unit* PullStrategy::GetTarget() const Unit* target = botAI->GetUnit(guid); Player* bot = botAI->GetBot(); - if (!bot || !target || !target->IsInWorld() || target->GetMapId() != bot->GetMapId()) + if (!bot || !target || !target->IsAlive() || !target->IsInWorld() || + target->GetMapId() != bot->GetMapId()) return nullptr; return target;