Tweaked Alterac Valley so bots kill final bosses (#886)

* Updated AV strategy so only 2 towers need to be down before final boss

* Adjusted role assignments for AV: less defenders, more forward attackers

* Added strategy for team has flag in WSG

team has flag triggers bg protect fc action @ 75 priority

* Updated protectFC function with MoveNear instead of follow
This commit is contained in:
avirar
2025-01-23 02:45:09 +11:00
committed by GitHub
parent 4e7d00b1a3
commit 1e9fd1607a
2 changed files with 46 additions and 14 deletions

View File

@@ -2454,8 +2454,8 @@ bool BGTactics::selectObjective(bool reset)
{
BattlegroundAV* alterValleyBG = (BattlegroundAV*)bg;
uint32 role = context->GetValue<uint32>("bg role")->Get();
bool supportDefense = role < 3; // defensive role and mine capture (mine capture disabled for now)
bool advancedAttack = role > 5; // doesnt wait for point to be fully captured before moving on
bool supportDefense = role < 2; // defensive role and mine capture (mine capture disabled for now)
bool advancedAttack = role > 4; // doesnt wait for point to be fully captured before moving on
// some of the code below is a bit inefficent (lots of rechecking same variables, could be made more
// efficient with a refactor) but it's been left this way so it can be easily reordered. in future we could
@@ -2463,11 +2463,19 @@ bool BGTactics::selectObjective(bool reset)
if (bot->GetTeamId() == TEAM_HORDE)
{
bool enemyTowersDown =
alterValleyBG->GetAVNodeInfo(BG_AV_NODES_DUNBALDAR_NORTH).State == POINT_DESTROYED &&
alterValleyBG->GetAVNodeInfo(BG_AV_NODES_DUNBALDAR_SOUTH).State == POINT_DESTROYED &&
alterValleyBG->GetAVNodeInfo(BG_AV_NODES_ICEWING_BUNKER).State == POINT_DESTROYED &&
alterValleyBG->GetAVNodeInfo(BG_AV_NODES_STONEHEART_BUNKER).State == POINT_DESTROYED;
int towersDestroyed = 0;
if (alterValleyBG->GetAVNodeInfo(BG_AV_NODES_DUNBALDAR_NORTH).State == POINT_DESTROYED)
++towersDestroyed;
if (alterValleyBG->GetAVNodeInfo(BG_AV_NODES_DUNBALDAR_SOUTH).State == POINT_DESTROYED)
++towersDestroyed;
if (alterValleyBG->GetAVNodeInfo(BG_AV_NODES_ICEWING_BUNKER).State == POINT_DESTROYED)
++towersDestroyed;
if (alterValleyBG->GetAVNodeInfo(BG_AV_NODES_STONEHEART_BUNKER).State == POINT_DESTROYED)
++towersDestroyed;
// Now require only 2 to be destroyed
bool enemyTowersDown = (towersDestroyed >= 2);
// End Boss
if (enemyTowersDown &&
alterValleyBG->GetAVNodeInfo(BG_AV_NODES_FIRSTAID_STATION).OwnerId != TEAM_ALLIANCE &&
@@ -2652,11 +2660,19 @@ bool BGTactics::selectObjective(bool reset)
}
else // TEAM_ALLIANCE
{
bool enemyTowersDown =
alterValleyBG->GetAVNodeInfo(BG_AV_NODES_FROSTWOLF_WTOWER).State == POINT_DESTROYED &&
alterValleyBG->GetAVNodeInfo(BG_AV_NODES_FROSTWOLF_ETOWER).State == POINT_DESTROYED &&
alterValleyBG->GetAVNodeInfo(BG_AV_NODES_TOWER_POINT).State == POINT_DESTROYED &&
alterValleyBG->GetAVNodeInfo(BG_AV_NODES_ICEBLOOD_TOWER).State == POINT_DESTROYED;
int towersDestroyed = 0;
if (alterValleyBG->GetAVNodeInfo(BG_AV_NODES_FROSTWOLF_WTOWER).State == POINT_DESTROYED)
++towersDestroyed;
if (alterValleyBG->GetAVNodeInfo(BG_AV_NODES_FROSTWOLF_ETOWER).State == POINT_DESTROYED)
++towersDestroyed;
if (alterValleyBG->GetAVNodeInfo(BG_AV_NODES_TOWER_POINT).State == POINT_DESTROYED)
++towersDestroyed;
if (alterValleyBG->GetAVNodeInfo(BG_AV_NODES_ICEBLOOD_TOWER).State == POINT_DESTROYED)
++towersDestroyed;
// Now require only 2 to be destroyed
bool enemyTowersDown = (towersDestroyed >= 2);
// End Boss
if (enemyTowersDown && alterValleyBG->GetAVNodeInfo(BG_AV_NODES_FROSTWOLF_HUT).OwnerId != TEAM_HORDE &&
alterValleyBG->GetAVNodeInfo(BG_AV_NODES_FROSTWOLF_HUT).TotalOwnerId != TEAM_HORDE)
@@ -4300,8 +4316,22 @@ bool BGTactics::protectFC()
return false;
Unit* teamFC = AI_VALUE(Unit*, "team flag carrier");
if (teamFC && bot->IsWithinDistInMap(teamFC, 50.0f))
return Follow(teamFC);
if (!teamFC || teamFC == bot)
{
return false;
}
if (!bot->IsInCombat() && !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 = bot->GetMapId();
return MoveNear(mapId, fcX, fcY, fcZ, 5.0f, MovementPriority::MOVEMENT_NORMAL);
}
return false;
}

View File

@@ -29,6 +29,8 @@ void WarsongStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
new TriggerNode("low mana", NextAction::array(0, new NextAction("bg use buff", 30.0f), nullptr)));
triggers.push_back(new TriggerNode(
"enemy flagcarrier near", NextAction::array(0, new NextAction("attack enemy flag carrier", 80.0f), nullptr)));
triggers.push_back(new TriggerNode(
"team has flag", NextAction::array(0, new NextAction("bg protect fc", 75.0f), nullptr)));
triggers.push_back(new TriggerNode("player has flag",
NextAction::array(0, new NextAction("bg move to objective", 90.0f), nullptr)));
}