fix(bg): Allow BG tactics to interrupt follow mode in battlegrounds

ROOT CAUSE: Bots in groups were just following the master instead of
executing battleground tactics because MoveToPosition() refused to
interrupt FOLLOW_MOTION_TYPE movement.

When a grouped bot enters a battleground:
1. Bot has FOLLOW_MOTION_TYPE active (following group leader)
2. BG AI calls MoveToPosition() to send bot to flag/objective
3. MoveToPosition() sees FOLLOW_MOTION_TYPE and returns false
4. Bot keeps following master, ignoring all BG tactics

SOLUTION: Add battleground exception to FOLLOW_MOTION_TYPE check.
When bot is in an active battleground (STATUS_IN_PROGRESS), the
BG movement is allowed to clear follow motion and take over.

This allows BG tactics (flag capture, defense, etc.) to work
while preserving follow behavior for normal group play outside BGs.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Signed-off-by: luis <[email protected]>
This commit is contained in:
agatho
2026-02-03 21:28:33 -03:00
committed by luis
co-authored by Claude Opus 4.5
parent 50d9687457
commit df8bea884e
@@ -10,6 +10,7 @@
*/
#include "BotMovementUtil.h"
#include "Battleground.h"
#include "Log.h"
#include "Map.h"
#include "PhaseShift.h"
@@ -227,11 +228,38 @@ bool BotMovementUtil::MoveToPosition(Player* bot, Position const& destination, u
}
// Similarly, don't interrupt FOLLOW_MOTION_TYPE (following group leader)
// CRITICAL FIX: EXCEPT in battlegrounds where BG tactics take priority over following!
// Without this exception, bots in groups just follow the master and ignore BG objectives.
if (currentMoveType == FOLLOW_MOTION_TYPE)
{
TC_LOG_DEBUG("module.playerbot.movement", "⚠️ BotMovement: Bot {} in FOLLOW mode - NOT INTERRUPTING follow to move to position",
bot->GetName());
return false; // Indicate that we did NOT start movement - follow continues
// Check if bot is in a battleground - BG tactics should override follow behavior
if (bot->InBattleground())
{
::Battleground* bg = bot->GetBattleground();
if (bg && bg->GetStatus() == STATUS_IN_PROGRESS)
{
TC_LOG_DEBUG("module.playerbot.movement",
"🎮 BotMovement: Bot {} in FOLLOW mode BUT in active BG - INTERRUPTING follow for BG tactics",
bot->GetName());
// Clear follow motion so BG movement can take over
mm->Clear(MOTION_SLOT_ACTIVE);
// Continue to execute the BG movement below
}
else
{
TC_LOG_DEBUG("module.playerbot.movement",
"⚠️ BotMovement: Bot {} in FOLLOW mode, BG not in progress - NOT INTERRUPTING",
bot->GetName());
return false;
}
}
else
{
TC_LOG_DEBUG("module.playerbot.movement",
"⚠️ BotMovement: Bot {} in FOLLOW mode - NOT INTERRUPTING follow to move to position",
bot->GetName());
return false; // Indicate that we did NOT start movement - follow continues
}
}
// If already moving via spline, check if we should interrupt