From d8d94f33ee92cd5c83cdb477a60354d7af1b8bcd Mon Sep 17 00:00:00 2001 From: EricksOliveira Date: Sun, 27 Jul 2025 18:35:43 -0300 Subject: [PATCH] Improve Arena Bot Behavior When Target is Behind Obstacles This update enhances bot behavior in arena scenarios by addressing the issue where bots remain idle if their target moves behind line-of-sight (LoS obstacles). The bot now attempts to reposition near the target to regain LoS instead of standing still, preventing situations where enemies can recover without pressure. Could someone test it? --- src/strategy/actions/BattleGroundTactics.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/strategy/actions/BattleGroundTactics.cpp b/src/strategy/actions/BattleGroundTactics.cpp index d43c1d22..63e1512f 100644 --- a/src/strategy/actions/BattleGroundTactics.cpp +++ b/src/strategy/actions/BattleGroundTactics.cpp @@ -4152,7 +4152,6 @@ bool ArenaTactics::Execute(Event event) if (bot->isMoving()) return false; - // startup phase if (bg->GetStartDelayTime() > 0) return false; @@ -4163,12 +4162,15 @@ bool ArenaTactics::Execute(Event event) if (botAI->HasStrategy("buff", BOT_STATE_NON_COMBAT)) botAI->ChangeStrategy("-buff", BOT_STATE_NON_COMBAT); - // this causes bot to reset constantly in arena - // if (sBattlegroundMgr->IsArenaType(bg->GetBgTypeID())) - // { - // botAI->ResetStrategies(false); - // botAI->SetMaster(nullptr); - // } + // Repositioning if the target is out of line of sight + Unit* target = botAI->GetCombatTarget(); + if (target && !bot->IsWithinLOSInMap(target)) + { + float x, y, z; + target->GetPosition(x, y, z); + botAI->TellMasterNoFacing("Repositioning to exit LoS"); + return MoveTo(target->GetMapId(), x + frand(-1, +1), y + frand(-1, +1), z, false, true); + } if (!bot->IsInCombat()) return moveToCenter(bg);