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?
This commit is contained in:
EricksOliveira
2025-07-27 18:35:43 -03:00
committed by GitHub
parent eef2e8c1ef
commit d8d94f33ee

View File

@@ -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);