From 502df01436afc0cdf4699615fccfcd4a131eab35 Mon Sep 17 00:00:00 2001 From: bash Date: Sun, 31 May 2026 20:21:14 +0200 Subject: [PATCH] feat(Core/Travel): Soft-bias NAV_GROUND_STEEP + NAV_WATER at bot PathGenerator sites --- src/Ai/Base/Actions/BattleGroundTactics.cpp | 2 ++ src/Ai/Base/Actions/GoAction.cpp | 2 ++ src/Ai/Base/Actions/MovementActions.cpp | 6 ++++++ src/Mgr/Travel/TravelNode.cpp | 2 ++ 4 files changed, 12 insertions(+) diff --git a/src/Ai/Base/Actions/BattleGroundTactics.cpp b/src/Ai/Base/Actions/BattleGroundTactics.cpp index 26271446b..2a76db141 100644 --- a/src/Ai/Base/Actions/BattleGroundTactics.cpp +++ b/src/Ai/Base/Actions/BattleGroundTactics.cpp @@ -4292,6 +4292,8 @@ bool ArenaTactics::Execute(Event /*event*/) if (losBlocked) { PathGenerator path(bot); + path.SetNavTerrainCost(NAV_GROUND_STEEP, 5.0f); + path.SetNavTerrainCost(NAV_WATER, 10.0f); path.CalculatePath(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), false); if (path.GetPathType() != PATHFIND_NOPATH) diff --git a/src/Ai/Base/Actions/GoAction.cpp b/src/Ai/Base/Actions/GoAction.cpp index 61a7550c2..1c3fd81ab 100644 --- a/src/Ai/Base/Actions/GoAction.cpp +++ b/src/Ai/Base/Actions/GoAction.cpp @@ -124,6 +124,8 @@ bool GoAction::Execute(Event event) if (botAI->HasStrategy("debug move", BOT_STATE_NON_COMBAT)) { PathGenerator path(bot); + path.SetNavTerrainCost(NAV_GROUND_STEEP, 5.0f); + path.SetNavTerrainCost(NAV_WATER, 10.0f); path.CalculatePath(x, y, z, false); diff --git a/src/Ai/Base/Actions/MovementActions.cpp b/src/Ai/Base/Actions/MovementActions.cpp index 8091e8617..cb45e8e29 100644 --- a/src/Ai/Base/Actions/MovementActions.cpp +++ b/src/Ai/Base/Actions/MovementActions.cpp @@ -971,6 +971,10 @@ bool MovementAction::ReachCombatTo(Unit* target, float distance) return false; PathGenerator path(bot); + // Soft bias: STEEP / WATER are reachable but de-prioritised so the + // bot picks normal ground when an alternative exists. + path.SetNavTerrainCost(NAV_GROUND_STEEP, 5.0f); + path.SetNavTerrainCost(NAV_WATER, 10.0f); path.CalculatePath(tx, ty, tz, false); PathType type = path.GetPathType(); int typeOk = PATHFIND_NORMAL | PATHFIND_INCOMPLETE | PATHFIND_SHORTCUT; @@ -1878,6 +1882,8 @@ PathResult MovementAction::GeneratePath(float x, float y, float z, uint32 accept { PathResult result; PathGenerator gen(bot); + gen.SetNavTerrainCost(NAV_GROUND_STEEP, 5.0f); + gen.SetNavTerrainCost(NAV_WATER, 10.0f); gen.CalculatePath(x, y, z, forceDestination); result.pathType = gen.GetPathType(); result.reachable = !(result.pathType & (~acceptMask)); diff --git a/src/Mgr/Travel/TravelNode.cpp b/src/Mgr/Travel/TravelNode.cpp index 01ecea09b..653bfd6e2 100644 --- a/src/Mgr/Travel/TravelNode.cpp +++ b/src/Mgr/Travel/TravelNode.cpp @@ -1252,6 +1252,8 @@ TravelNodeRoute TravelNodeMap::FindRouteNearestNodes(WorldPosition startPos, Wor if (startNodePosition.GetMapId() == bot->GetMapId()) { PathGenerator path(bot); + path.SetNavTerrainCost(NAV_GROUND_STEEP, 5.0f); + path.SetNavTerrainCost(NAV_WATER, 10.0f); path.CalculatePath(startNodePosition.GetPositionX(), startNodePosition.GetPositionY(), startNodePosition.GetPositionZ()); PathType type = path.GetPathType(); bool reachable = !(type & ~(PATHFIND_NORMAL | PATHFIND_INCOMPLETE | PATHFIND_FARFROMPOLY));