From 52273b4971c923220bcbefa5c8bcaefe648a1968 Mon Sep 17 00:00:00 2001 From: kadeshar Date: Tue, 21 Apr 2026 19:37:54 +0200 Subject: [PATCH] Pull multiplier fix (#2317) ## Pull Request Description Fix for pull strategy multiplier and ending pull command ## How to Test the Changes 1. Invite tank bot 2. Order him to attack mob (not pull) ## 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 --- src/Ai/Base/Strategy/PullStrategy.cpp | 3 +++ src/Ai/Base/Trigger/PullTriggers.cpp | 8 +------- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Ai/Base/Strategy/PullStrategy.cpp b/src/Ai/Base/Strategy/PullStrategy.cpp index 3d5e3e94a..31351c571 100644 --- a/src/Ai/Base/Strategy/PullStrategy.cpp +++ b/src/Ai/Base/Strategy/PullStrategy.cpp @@ -170,6 +170,9 @@ float PullMultiplier::GetValue(Action* action) if (!strategy || !strategy->HasTarget() || !action) return 1.0f; + if (!strategy->IsPullPendingToStart() && !strategy->HasPullStarted()) + return 1.0f; + std::string const actionName = action->getName(); if (actionName == "pull my target" || actionName == "pull rti target" || diff --git a/src/Ai/Base/Trigger/PullTriggers.cpp b/src/Ai/Base/Trigger/PullTriggers.cpp index 84c550faf..4d23b3896 100644 --- a/src/Ai/Base/Trigger/PullTriggers.cpp +++ b/src/Ai/Base/Trigger/PullTriggers.cpp @@ -20,15 +20,12 @@ bool PullStartTrigger::IsActive() bool PullEndTrigger::IsActive() { PullStrategy const* strategy = PullStrategy::Get(botAI); - Player* bot = botAI->GetBot(); - if (!bot) - return false; if (!strategy || !strategy->HasPullStarted()) return false; Unit* target = strategy->GetTarget(); - if (!target || !target->IsInWorld()) + if (!target || !target->IsInWorld() || !target->IsAlive()) return true; time_t const secondsSincePullStarted = time(nullptr) - strategy->GetPullStartTime(); @@ -53,9 +50,6 @@ bool PullEndTrigger::IsActive() bool ReturnToPullPositionTrigger::IsActive() { PullStrategy const* strategy = PullStrategy::Get(botAI); - Player* bot = botAI->GetBot(); - if (!bot) - return false; Unit* target = strategy ? strategy->GetTarget() : nullptr; if (!strategy || !strategy->HasPullStarted() || !target || !target->IsInCombat() ||