mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-06-20 15:39:25 +02:00
feat(Core/Travel): Soft-bias NAV_GROUND_STEEP + NAV_WATER at bot PathGenerator sites
This commit is contained in:
parent
b78ecda436
commit
502df01436
@ -4292,6 +4292,8 @@ bool ArenaTactics::Execute(Event /*event*/)
|
|||||||
if (losBlocked)
|
if (losBlocked)
|
||||||
{
|
{
|
||||||
PathGenerator path(bot);
|
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);
|
path.CalculatePath(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), false);
|
||||||
|
|
||||||
if (path.GetPathType() != PATHFIND_NOPATH)
|
if (path.GetPathType() != PATHFIND_NOPATH)
|
||||||
|
|||||||
@ -124,6 +124,8 @@ bool GoAction::Execute(Event event)
|
|||||||
if (botAI->HasStrategy("debug move", BOT_STATE_NON_COMBAT))
|
if (botAI->HasStrategy("debug move", BOT_STATE_NON_COMBAT))
|
||||||
{
|
{
|
||||||
PathGenerator path(bot);
|
PathGenerator path(bot);
|
||||||
|
path.SetNavTerrainCost(NAV_GROUND_STEEP, 5.0f);
|
||||||
|
path.SetNavTerrainCost(NAV_WATER, 10.0f);
|
||||||
|
|
||||||
path.CalculatePath(x, y, z, false);
|
path.CalculatePath(x, y, z, false);
|
||||||
|
|
||||||
|
|||||||
@ -971,6 +971,10 @@ bool MovementAction::ReachCombatTo(Unit* target, float distance)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
PathGenerator path(bot);
|
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);
|
path.CalculatePath(tx, ty, tz, false);
|
||||||
PathType type = path.GetPathType();
|
PathType type = path.GetPathType();
|
||||||
int typeOk = PATHFIND_NORMAL | PATHFIND_INCOMPLETE | PATHFIND_SHORTCUT;
|
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;
|
PathResult result;
|
||||||
PathGenerator gen(bot);
|
PathGenerator gen(bot);
|
||||||
|
gen.SetNavTerrainCost(NAV_GROUND_STEEP, 5.0f);
|
||||||
|
gen.SetNavTerrainCost(NAV_WATER, 10.0f);
|
||||||
gen.CalculatePath(x, y, z, forceDestination);
|
gen.CalculatePath(x, y, z, forceDestination);
|
||||||
result.pathType = gen.GetPathType();
|
result.pathType = gen.GetPathType();
|
||||||
result.reachable = !(result.pathType & (~acceptMask));
|
result.reachable = !(result.pathType & (~acceptMask));
|
||||||
|
|||||||
@ -1252,6 +1252,8 @@ TravelNodeRoute TravelNodeMap::FindRouteNearestNodes(WorldPosition startPos, Wor
|
|||||||
if (startNodePosition.GetMapId() == bot->GetMapId())
|
if (startNodePosition.GetMapId() == bot->GetMapId())
|
||||||
{
|
{
|
||||||
PathGenerator path(bot);
|
PathGenerator path(bot);
|
||||||
|
path.SetNavTerrainCost(NAV_GROUND_STEEP, 5.0f);
|
||||||
|
path.SetNavTerrainCost(NAV_WATER, 10.0f);
|
||||||
path.CalculatePath(startNodePosition.GetPositionX(), startNodePosition.GetPositionY(), startNodePosition.GetPositionZ());
|
path.CalculatePath(startNodePosition.GetPositionX(), startNodePosition.GetPositionY(), startNodePosition.GetPositionZ());
|
||||||
PathType type = path.GetPathType();
|
PathType type = path.GetPathType();
|
||||||
bool reachable = !(type & ~(PATHFIND_NORMAL | PATHFIND_INCOMPLETE | PATHFIND_FARFROMPOLY));
|
bool reachable = !(type & ~(PATHFIND_NORMAL | PATHFIND_INCOMPLETE | PATHFIND_FARFROMPOLY));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user