Skip to content

Commit df72ff3

Browse files
committed
re add hiding spots in wsg
Make bot with flag try jump to destination, e.g. when hiding on the roof and flag was returned
1 parent 848dc94 commit df72ff3

File tree

2 files changed

+34
-41
lines changed

2 files changed

+34
-41
lines changed

playerbot/strategy/actions/BattleGroundTactics.cpp

Lines changed: 26 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ Position const WS_FLAG_POS_HORDE = { 915.958f, 1433.925f, 346.193f, 0.0f };
2121
Position const WS_FLAG_POS_ALLIANCE = { 1539.219f, 1481.747f, 352.458f, 0.0f };
2222
Position const WS_FLAG_HIDE_HORDE_1 = { 928.178f, 1458.432f, 346.889f, 4.8f };
2323
Position const WS_FLAG_HIDE_HORDE_2 = { 914.954f, 1439.540f, 346.415f, 4.7f };
24-
Position const WS_FLAG_HIDE_HORDE_3 = { 1163.820f, 1373.625f, 312.23f, 4.7f };
25-
Position const WS_FLAG_HIDE_HORDE_4 = { 924.0f, 1454.0f, 355.0f, 4.07f };
26-
Position const WS_FLAG_HIDE_HORDE_5 = { 963.0f, 1421.0f, 367.0f, 4.07f };
24+
Position const WS_FLAG_HIDE_HORDE_3 = { 924.0f, 1454.0f, 355.0f, 4.07f };
25+
Position const WS_FLAG_HIDE_HORDE_4 = { 963.0f, 1421.0f, 367.0f, 4.07f };
2726
Position const WS_FLAG_HIDE_ALLIANCE_1 = { 1529.249f, 1456.470f, 353.04f, 1.25f };
2827
Position const WS_FLAG_HIDE_ALLIANCE_2 = { 1540.286f, 1476.026f, 352.692f, 2.91f };
2928
Position const WS_FLAG_HIDE_ALLIANCE_3 = { 1495.807f, 1466.774f, 352.350f, 1.50f };
@@ -37,7 +36,7 @@ Position const WS_FLAG_ALLIANCE_FLOOR_JUMP_UPPER = { 1529.f, 1468.f, 362.f, 1.50
3736
Position const WS_FLAG_ALLIANCE_FLOOR_JUMP_LOWER = { 1531.f, 1475.f, 352.f, 1.50f };
3837
Position const WS_FLAG_HORDE_FLOOR_JUMP_UPPER = { 926.f, 1451.f, 355.f, 1.50f };
3938
Position const WS_FLAG_HORDE_FLOOR_JUMP_LOWER = { 925.f, 1444.f, 345.f, 1.50f };
40-
std::vector<Position> const WS_FLAG_HIDE_HORDE = { WS_FLAG_HIDE_HORDE_1 , WS_FLAG_HIDE_HORDE_2, WS_FLAG_HIDE_HORDE_3, WS_FLAG_HIDE_HORDE_4, WS_FLAG_HIDE_HORDE_5 };
39+
std::vector<Position> const WS_FLAG_HIDE_HORDE = { WS_FLAG_HIDE_HORDE_1 , WS_FLAG_HIDE_HORDE_2, WS_FLAG_HIDE_HORDE_3, WS_FLAG_HIDE_HORDE_4, WS_FLAG_HIDE_HORDE_4 };
4140
std::vector<Position> const WS_FLAG_HIDE_ALLIANCE = { WS_FLAG_HIDE_ALLIANCE_1 , WS_FLAG_HIDE_ALLIANCE_2, WS_FLAG_HIDE_ALLIANCE_3, WS_FLAG_HIDE_ALLIANCE_4, WS_FLAG_HIDE_ALLIANCE_5 };
4241
Position const AB_WAITING_POS_HORDE = { 702.884f, 703.045f, -16.115f, 0.77f };
4342
Position const AB_WAITING_POS_ALLIANCE = { 1286.054f, 1282.500f, -15.697f, 3.95f };
@@ -3015,31 +3014,28 @@ bool BGTactics::selectObjective(bool reset)
30153014
{
30163015
if (bot->GetTeam() == ALLIANCE)
30173016
{
3018-
//if (teamFlagTaken())
3019-
//{
3020-
// Position hidePos = WS_FLAG_HIDE_ALLIANCE[urand(0, 4)];
3021-
// pos.Set(hidePos.x, hidePos.y, hidePos.z, bot->GetMapId());
3022-
//}
3023-
//else
3024-
pos.Set(WS_FLAG_POS_ALLIANCE.x, WS_FLAG_POS_ALLIANCE.y, WS_FLAG_POS_ALLIANCE.z, bot->GetMapId());
3017+
if (teamFlagTaken())
3018+
{
3019+
Position hidePos = WS_FLAG_HIDE_ALLIANCE[urand(0, 4)];
3020+
pos.Set(hidePos.x, hidePos.y, hidePos.z, bot->GetMapId());
3021+
}
3022+
else
3023+
{
3024+
pos.Set(WS_FLAG_POS_ALLIANCE.x, WS_FLAG_POS_ALLIANCE.y, WS_FLAG_POS_ALLIANCE.z, bot->GetMapId());
3025+
}
30253026
}
30263027
else
30273028
{
3028-
//if (teamFlagTaken())
3029-
//{
3030-
// Position hidePos = WS_FLAG_HIDE_HORDE[urand(0, 4)];
3031-
// pos.Set(hidePos.x, hidePos.y, hidePos.z, bot->GetMapId());
3032-
//}
3033-
//else
3034-
pos.Set(WS_FLAG_POS_HORDE.x, WS_FLAG_POS_HORDE.y, WS_FLAG_POS_HORDE.z, bot->GetMapId());
3029+
if (teamFlagTaken())
3030+
{
3031+
Position hidePos = WS_FLAG_HIDE_HORDE[urand(0, 4)];
3032+
pos.Set(hidePos.x, hidePos.y, hidePos.z, bot->GetMapId());
3033+
}
3034+
else
3035+
{
3036+
pos.Set(WS_FLAG_POS_HORDE.x, WS_FLAG_POS_HORDE.y, WS_FLAG_POS_HORDE.z, bot->GetMapId());
3037+
}
30353038
}
3036-
3037-
//ostringstream out;
3038-
//if (teamFlagTaken())
3039-
// out << "Hiding with flag" << (bot->GetTeam() == ALLIANCE ? "in Alliance base" : "in Horde base");
3040-
//else
3041-
// out << "Taking " << (bot->GetTeam() == ALLIANCE ? "Horde flag to base" : "Alliance flag to base");
3042-
//bot->Say(out.str(), LANG_UNIVERSAL);
30433039
}
30443040
else
30453041
{
@@ -4206,21 +4202,11 @@ bool BGTactics::resetObjective()
42064202
ai::PositionMap& posMap = context->GetValue<ai::PositionMap&>("position")->Get();
42074203
ai::PositionEntry pos = context->GetValue<ai::PositionMap&>("position")->Get()["bg objective"];
42084204
// do not switch hiding spots - disabled for now until hiding spots reimplemented since it causes bots to stop moving
4209-
//if (teamFlagTaken() && (bot->HasAura(BG_WS_SPELL_WARSONG_FLAG) || bot->HasAura(BG_WS_SPELL_SILVERWING_FLAG)))
4210-
//{
4211-
// return false;
4212-
4213-
/*if (bot->GetTeam() == HORDE)
4214-
{
4215-
if (pos.x != WS_FLAG_POS_HORDE.x && pos.x != WS_FLAG_POS_ALLIANCE.x && pos.y != WS_FLAG_POS_HORDE.y && pos.y != WS_FLAG_POS_ALLIANCE.y)
4216-
return false;
4217-
}
4218-
else
4219-
{
4220-
if (pos.x != WS_FLAG_POS_HORDE.x && pos.x != WS_FLAG_POS_ALLIANCE.x && pos.y != WS_FLAG_POS_HORDE.y && pos.y != WS_FLAG_POS_ALLIANCE.y)
4221-
return false;
4222-
}*/
4223-
//}
4205+
if (teamFlagTaken() && (bot->HasAura(BG_WS_SPELL_WARSONG_FLAG) || bot->HasAura(BG_WS_SPELL_SILVERWING_FLAG)))
4206+
{
4207+
if (pos.x != WS_FLAG_POS_HORDE.x && pos.x != WS_FLAG_POS_ALLIANCE.x && pos.y != WS_FLAG_POS_HORDE.y && pos.y != WS_FLAG_POS_ALLIANCE.y)
4208+
return false;
4209+
}
42244210
pos.Reset();
42254211
posMap["bg objective"] = pos;
42264212

playerbot/strategy/generic/BattlegroundStrategy.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ void BattlegroundStrategy::InitNonCombatTriggers(std::list<TriggerNode*> &trigge
2121
"bg waiting",
2222
NextAction::array(0, new NextAction("bg move to start", 1.0f), NULL)));
2323

24+
triggers.push_back(new TriggerNode(
25+
"player has flag",
26+
NextAction::array(0, new NextAction("jump::position bg objective", 3.0f), NULL)));
27+
2428
triggers.push_back(new TriggerNode(
2529
"bg active",
2630
NextAction::array(0, new NextAction("check mount state", 2.0f), new NextAction("bg move to objective", 1.0f), NULL)));
@@ -74,7 +78,10 @@ void WarsongStrategy::InitNonCombatTriggers(std::list<TriggerNode*> &triggers)
7478

7579
triggers.push_back(new TriggerNode(
7680
"player has flag",
77-
NextAction::array(0, new NextAction("bg move to objective", 80.0f), NULL)));
81+
NextAction::array(0,
82+
new NextAction("jump::position bg objective", 80.5f),
83+
new NextAction("bg move to objective", 80.0f),
84+
NULL)));
7885

7986
triggers.push_back(new TriggerNode(
8087
"player has flag",

0 commit comments

Comments
 (0)