From 27b86f8b1f306a045a63b0309b0a03118aafa3e5 Mon Sep 17 00:00:00 2001 From: avirar Date: Fri, 31 Jan 2025 00:16:34 +1100 Subject: [PATCH] Eye of the Storm changes (#924) * EoTS: Changed FC logic to use MoveNear while not in combat Similar to WSG commit from a few days ago * Changed action priorities in EotS to ACTION_MOVE + x * Adjusted EotS flag carrier objective selection Random chance reduced from 1/2 to 1/3 Distance threshold before objective switch is considered reduced to 15.0yds --- src/strategy/actions/BattleGroundTactics.cpp | 28 +++++++++++++------ src/strategy/generic/BattlegroundStrategy.cpp | 12 ++++---- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/strategy/actions/BattleGroundTactics.cpp b/src/strategy/actions/BattleGroundTactics.cpp index 44cad2a9..4f457d29 100644 --- a/src/strategy/actions/BattleGroundTactics.cpp +++ b/src/strategy/actions/BattleGroundTactics.cpp @@ -3153,8 +3153,8 @@ bool BGTactics::selectObjective(bool reset) // or distance difference is insignificantly better and coinflip // the reason it doesn't just check if distance is better is to avoid bot going to same point every time if (closestObjectiveOwnership < ownership || - closestObjectiveDist - 30 > dist || - (closestObjectiveDist > dist && urand(0, 1))) + closestObjectiveDist - 15 > dist || + (closestObjectiveDist > dist && urand(0, 2))) { closestObjectiveOwnership = ownership; closestObjectiveDist = dist; @@ -3309,13 +3309,25 @@ bool BGTactics::selectObjective(bool reset) { // Get the flag or defend flag carrier Unit* teamFC = AI_VALUE(Unit*, "team flag carrier"); - if (teamFC) + if (teamFC && teamFC != bot) // Ensure there's a flag carrier and it's not the bot { - BgObjective = teamFC; - // pos.Set(teamFC->GetPositionX(), teamFC->GetPositionY(), teamFC->GetPositionZ(), - // bot->GetMapId()); - if (sServerFacade->GetDistance2d(bot, teamFC) < 50.0f) - Follow(teamFC); + BgObjective = teamFC; // Set the objective to the flag carrier + + if (!bot->IsInCombat()) // Only act if the bot is not in combat + { + // If the bot is too far, move closer + if (!bot->IsWithinDistInMap(teamFC, 20.0f)) + { + // Get the flag carrier's position + float fcX = teamFC->GetPositionX(); + float fcY = teamFC->GetPositionY(); + float fcZ = teamFC->GetPositionZ(); + uint32 mapId = teamFC->GetMapId(); + + // Move near the flag carrier + MoveNear(mapId, fcX, fcY, fcZ, 5.0f, MovementPriority::MOVEMENT_NORMAL); + } + } } else { diff --git a/src/strategy/generic/BattlegroundStrategy.cpp b/src/strategy/generic/BattlegroundStrategy.cpp index e4a0b21d..b90697b8 100644 --- a/src/strategy/generic/BattlegroundStrategy.cpp +++ b/src/strategy/generic/BattlegroundStrategy.cpp @@ -67,16 +67,16 @@ void BattlegroundStrategy::InitTriggers(std::vector& triggers) void EyeStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( - new TriggerNode("bg active", NextAction::array(0, new NextAction("bg check flag", 70.0f), nullptr))); - triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("bg use buff", 30.0f), nullptr))); + new TriggerNode("bg active", NextAction::array(0, new NextAction("bg check flag", ACTION_MOVE + 7.0f), nullptr))); + triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("bg use buff", ACTION_MOVE), nullptr))); triggers.push_back( - new TriggerNode("low health", NextAction::array(0, new NextAction("bg use buff", 30.0f), nullptr))); + new TriggerNode("low health", NextAction::array(0, new NextAction("bg use buff", ACTION_MOVE), nullptr))); triggers.push_back( - new TriggerNode("low mana", NextAction::array(0, new NextAction("bg use buff", 30.0f), nullptr))); + new TriggerNode("low mana", NextAction::array(0, new NextAction("bg use buff", ACTION_MOVE), nullptr))); triggers.push_back(new TriggerNode( - "enemy flagcarrier near", NextAction::array(0, new NextAction("attack enemy flag carrier", 80.0f), nullptr))); + "enemy flagcarrier near", NextAction::array(0, new NextAction("attack enemy flag carrier", ACTION_MOVE + 8.0f), nullptr))); triggers.push_back(new TriggerNode("player has flag", - NextAction::array(0, new NextAction("bg move to objective", 90.0f), nullptr))); + NextAction::array(0, new NextAction("bg move to objective", ACTION_MOVE + 9.0f), nullptr))); } void IsleStrategy::InitTriggers(std::vector& triggers)