mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-02-21 10:30:01 +01:00
Compare commits
No commits in common. "8b9bcce3bcebe4e531792962887a5f0b1f654a7e" and "86390f90fd3a805d7d58443b9924deac6f8acb8a" have entirely different histories.
8b9bcce3bc
...
86390f90fd
@ -29,7 +29,6 @@
|
|||||||
#include "ScriptMgr.h"
|
#include "ScriptMgr.h"
|
||||||
#include "cs_playerbots.h"
|
#include "cs_playerbots.h"
|
||||||
#include "cmath"
|
#include "cmath"
|
||||||
#include "BattleGroundTactics.h"
|
|
||||||
|
|
||||||
class PlayerbotsDatabaseScript : public DatabaseScript
|
class PlayerbotsDatabaseScript : public DatabaseScript
|
||||||
{
|
{
|
||||||
@ -390,43 +389,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class PlayerBotsBGScript : public BGScript
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
PlayerBotsBGScript() : BGScript("PlayerBotsBGScript") {}
|
|
||||||
|
|
||||||
void OnBattlegroundStart(Battleground* bg) override
|
|
||||||
{
|
|
||||||
BGStrategyData data;
|
|
||||||
|
|
||||||
switch (bg->GetBgTypeID())
|
|
||||||
{
|
|
||||||
case BATTLEGROUND_WS:
|
|
||||||
data.allianceStrategy = urand(0, WS_STRATEGY_MAX - 1);
|
|
||||||
data.hordeStrategy = urand(0, WS_STRATEGY_MAX - 1);
|
|
||||||
break;
|
|
||||||
case BATTLEGROUND_AB:
|
|
||||||
data.allianceStrategy = urand(0, AB_STRATEGY_MAX - 1);
|
|
||||||
data.hordeStrategy = urand(0, AB_STRATEGY_MAX - 1);
|
|
||||||
break;
|
|
||||||
case BATTLEGROUND_AV:
|
|
||||||
data.allianceStrategy = urand(0, AV_STRATEGY_MAX - 1);
|
|
||||||
data.hordeStrategy = urand(0, AV_STRATEGY_MAX - 1);
|
|
||||||
break;
|
|
||||||
case BATTLEGROUND_EY:
|
|
||||||
data.allianceStrategy = urand(0, EY_STRATEGY_MAX - 1);
|
|
||||||
data.hordeStrategy = urand(0, EY_STRATEGY_MAX - 1);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
bgStrategies[bg->GetInstanceID()] = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnBattlegroundEnd(Battleground* bg, TeamId /*winnerTeam*/) override { bgStrategies.erase(bg->GetInstanceID()); }
|
|
||||||
};
|
|
||||||
|
|
||||||
void AddPlayerbotsScripts()
|
void AddPlayerbotsScripts()
|
||||||
{
|
{
|
||||||
new PlayerbotsDatabaseScript();
|
new PlayerbotsDatabaseScript();
|
||||||
@ -435,7 +397,6 @@ void AddPlayerbotsScripts()
|
|||||||
new PlayerbotsServerScript();
|
new PlayerbotsServerScript();
|
||||||
new PlayerbotsWorldScript();
|
new PlayerbotsWorldScript();
|
||||||
new PlayerbotsScript();
|
new PlayerbotsScript();
|
||||||
new PlayerBotsBGScript();
|
|
||||||
|
|
||||||
AddSC_playerbots_commandscript();
|
AddSC_playerbots_commandscript();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,7 +41,6 @@ enum StrategyType : uint32
|
|||||||
// };
|
// };
|
||||||
|
|
||||||
static float ACTION_IDLE = 0.0f;
|
static float ACTION_IDLE = 0.0f;
|
||||||
static float ACTION_BG = 1.0f;
|
|
||||||
static float ACTION_DEFAULT = 5.0f;
|
static float ACTION_DEFAULT = 5.0f;
|
||||||
static float ACTION_NORMAL = 10.0f;
|
static float ACTION_NORMAL = 10.0f;
|
||||||
static float ACTION_HIGH = 20.0f;
|
static float ACTION_HIGH = 20.0f;
|
||||||
|
|||||||
@ -193,7 +193,6 @@ public:
|
|||||||
// BG Tactics
|
// BG Tactics
|
||||||
creators["bg tactics"] = &ActionContext::bg_tactics;
|
creators["bg tactics"] = &ActionContext::bg_tactics;
|
||||||
creators["bg move to start"] = &ActionContext::bg_move_to_start;
|
creators["bg move to start"] = &ActionContext::bg_move_to_start;
|
||||||
creators["bg reset objective force"] = &ActionContext::bg_reset_objective_force;
|
|
||||||
creators["bg move to objective"] = &ActionContext::bg_move_to_objective;
|
creators["bg move to objective"] = &ActionContext::bg_move_to_objective;
|
||||||
creators["bg select objective"] = &ActionContext::bg_select_objective;
|
creators["bg select objective"] = &ActionContext::bg_select_objective;
|
||||||
creators["bg check objective"] = &ActionContext::bg_check_objective;
|
creators["bg check objective"] = &ActionContext::bg_check_objective;
|
||||||
@ -377,7 +376,6 @@ private:
|
|||||||
// BG Tactics
|
// BG Tactics
|
||||||
static Action* bg_tactics(PlayerbotAI* botAI) { return new BGTactics(botAI); }
|
static Action* bg_tactics(PlayerbotAI* botAI) { return new BGTactics(botAI); }
|
||||||
static Action* bg_move_to_start(PlayerbotAI* botAI) { return new BGTactics(botAI, "move to start"); }
|
static Action* bg_move_to_start(PlayerbotAI* botAI) { return new BGTactics(botAI, "move to start"); }
|
||||||
static Action* bg_reset_objective_force(PlayerbotAI* botAI) { return new BGTactics(botAI, "reset objective force"); }
|
|
||||||
static Action* bg_move_to_objective(PlayerbotAI* botAI) { return new BGTactics(botAI, "move to objective"); }
|
static Action* bg_move_to_objective(PlayerbotAI* botAI) { return new BGTactics(botAI, "move to objective"); }
|
||||||
static Action* bg_select_objective(PlayerbotAI* botAI) { return new BGTactics(botAI, "select objective"); }
|
static Action* bg_select_objective(PlayerbotAI* botAI) { return new BGTactics(botAI, "select objective"); }
|
||||||
static Action* bg_check_objective(PlayerbotAI* botAI) { return new BGTactics(botAI, "check objective"); }
|
static Action* bg_check_objective(PlayerbotAI* botAI) { return new BGTactics(botAI, "check objective"); }
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -6,7 +6,6 @@
|
|||||||
#ifndef _PLAYERBOT_BATTLEGROUNDTACTICSACTION_H
|
#ifndef _PLAYERBOT_BATTLEGROUNDTACTICSACTION_H
|
||||||
#define _PLAYERBOT_BATTLEGROUNDTACTICSACTION_H
|
#define _PLAYERBOT_BATTLEGROUNDTACTICSACTION_H
|
||||||
|
|
||||||
#include "BattlegroundAV.h"
|
|
||||||
#include "MovementActions.h"
|
#include "MovementActions.h"
|
||||||
|
|
||||||
class ChatHandler;
|
class ChatHandler;
|
||||||
@ -16,49 +15,8 @@ struct Position;
|
|||||||
|
|
||||||
#define SPELL_CAPTURE_BANNER 21651
|
#define SPELL_CAPTURE_BANNER 21651
|
||||||
|
|
||||||
enum WSBotStrategy : uint8
|
|
||||||
{
|
|
||||||
WS_STRATEGY_BALANCED = 0,
|
|
||||||
WS_STRATEGY_OFFENSIVE = 1,
|
|
||||||
WS_STRATEGY_DEFENSIVE = 2,
|
|
||||||
WS_STRATEGY_MAX = 3,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ABBotStrategy : uint8
|
|
||||||
{
|
|
||||||
AB_STRATEGY_BALANCED = 0,
|
|
||||||
AB_STRATEGY_OFFENSIVE = 1,
|
|
||||||
AB_STRATEGY_DEFENSIVE = 2,
|
|
||||||
AB_STRATEGY_MAX = 3,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum AVBotStrategy : uint8
|
|
||||||
{
|
|
||||||
AV_STRATEGY_BALANCED = 0,
|
|
||||||
AV_STRATEGY_OFFENSIVE = 1,
|
|
||||||
AV_STRATEGY_DEFENSIVE = 2,
|
|
||||||
AV_STRATEGY_MAX = 3,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum EYBotStrategy : uint8
|
|
||||||
{
|
|
||||||
EY_STRATEGY_BALANCED = 0,
|
|
||||||
EY_STRATEGY_FRONT_FOCUS = 1,
|
|
||||||
EY_STRATEGY_BACK_FOCUS = 2,
|
|
||||||
EY_STRATEGY_FLAG_FOCUS = 3,
|
|
||||||
EY_STRATEGY_MAX = 4
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef void (*BattleBotWaypointFunc)();
|
typedef void (*BattleBotWaypointFunc)();
|
||||||
|
|
||||||
struct BGStrategyData
|
|
||||||
{
|
|
||||||
uint8 allianceStrategy = 0;
|
|
||||||
uint8 hordeStrategy = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern std::unordered_map<uint32, BGStrategyData> bgStrategies;
|
|
||||||
|
|
||||||
struct BattleBotWaypoint
|
struct BattleBotWaypoint
|
||||||
{
|
{
|
||||||
BattleBotWaypoint(float x_, float y_, float z_, BattleBotWaypointFunc func) : x(x_), y(y_), z(z_), pFunc(func){};
|
BattleBotWaypoint(float x_, float y_, float z_, BattleBotWaypointFunc func) : x(x_), y(y_), z(z_), pFunc(func){};
|
||||||
@ -69,31 +27,6 @@ struct BattleBotWaypoint
|
|||||||
BattleBotWaypointFunc pFunc = nullptr;
|
BattleBotWaypointFunc pFunc = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct AVNodePositionData
|
|
||||||
{
|
|
||||||
Position pos;
|
|
||||||
float maxRadius;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Added to fix bot stuck at objectives
|
|
||||||
static std::unordered_map<uint8, AVNodePositionData> AVNodeMovementTargets = {
|
|
||||||
{BG_AV_NODES_FIRSTAID_STATION, {Position(640.364f, -36.535f, 45.625f), 15.0f}},
|
|
||||||
{BG_AV_NODES_STORMPIKE_GRAVE, {Position(665.598f, -292.976f, 30.291f), 15.0f}},
|
|
||||||
{BG_AV_NODES_STONEHEART_GRAVE, {Position(76.108f, -399.602f, 45.730f), 15.0f}},
|
|
||||||
{BG_AV_NODES_SNOWFALL_GRAVE, {Position(-201.298f, -119.661f, 78.291f), 15.0f}},
|
|
||||||
{BG_AV_NODES_ICEBLOOD_GRAVE, {Position(-617.858f, -400.654f, 59.692f), 15.0f}},
|
|
||||||
{BG_AV_NODES_FROSTWOLF_GRAVE, {Position(-1083.803f, -341.520f, 55.304f), 15.0f}},
|
|
||||||
{BG_AV_NODES_FROSTWOLF_HUT, {Position(-1405.678f, -309.108f, 89.377f, 0.392f), 10.0f}},
|
|
||||||
{BG_AV_NODES_DUNBALDAR_SOUTH, {Position(556.551f, -77.240f, 51.931f), 0.0f}},
|
|
||||||
{BG_AV_NODES_DUNBALDAR_NORTH, {Position(670.664f, -142.031f, 63.666f), 0.0f}},
|
|
||||||
{BG_AV_NODES_ICEWING_BUNKER, {Position(200.310f, -361.232f, 56.387f), 0.0f}},
|
|
||||||
{BG_AV_NODES_STONEHEART_BUNKER, {Position(-156.302f, -440.032f, 40.403f), 0.0f}},
|
|
||||||
{BG_AV_NODES_ICEBLOOD_TOWER, {Position(-569.702f, -265.362f, 75.009f), 0.0f}},
|
|
||||||
{BG_AV_NODES_TOWER_POINT, {Position(-767.439f, -360.200f, 90.895f), 0.0f}},
|
|
||||||
{BG_AV_NODES_FROSTWOLF_ETOWER, {Position(-1303.737f, -314.070f, 113.868f), 0.0f}},
|
|
||||||
{BG_AV_NODES_FROSTWOLF_WTOWER, {Position(-1300.648f, -267.356f, 114.151f), 0.0f}},
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef std::vector<BattleBotWaypoint> BattleBotPath;
|
typedef std::vector<BattleBotWaypoint> BattleBotPath;
|
||||||
|
|
||||||
extern std::vector<BattleBotPath*> const vPaths_WS;
|
extern std::vector<BattleBotPath*> const vPaths_WS;
|
||||||
@ -106,7 +39,6 @@ class BGTactics : public MovementAction
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static bool HandleConsoleCommand(ChatHandler* handler, char const* args);
|
static bool HandleConsoleCommand(ChatHandler* handler, char const* args);
|
||||||
uint8 static GetBotStrategyForTeam(Battleground* bg, TeamId teamId);
|
|
||||||
|
|
||||||
BGTactics(PlayerbotAI* botAI, std::string const name = "bg tactics") : MovementAction(botAI, name) {}
|
BGTactics(PlayerbotAI* botAI, std::string const name = "bg tactics") : MovementAction(botAI, name) {}
|
||||||
|
|
||||||
@ -116,13 +48,13 @@ private:
|
|||||||
static std::string const HandleConsoleCommandPrivate(WorldSession* session, char const* args);
|
static std::string const HandleConsoleCommandPrivate(WorldSession* session, char const* args);
|
||||||
bool moveToStart(bool force = false);
|
bool moveToStart(bool force = false);
|
||||||
bool selectObjective(bool reset = false);
|
bool selectObjective(bool reset = false);
|
||||||
bool moveToObjective(bool ignoreDist);
|
bool moveToObjective();
|
||||||
bool selectObjectiveWp(std::vector<BattleBotPath*> const& vPaths);
|
bool selectObjectiveWp(std::vector<BattleBotPath*> const& vPaths);
|
||||||
bool moveToObjectiveWp(BattleBotPath* const& currentPath, uint32 currentPoint, bool reverse = false);
|
bool moveToObjectiveWp(BattleBotPath* const& currentPath, uint32 currentPoint, bool reverse = false);
|
||||||
bool startNewPathBegin(std::vector<BattleBotPath*> const& vPaths);
|
bool startNewPathBegin(std::vector<BattleBotPath*> const& vPaths);
|
||||||
bool startNewPathFree(std::vector<BattleBotPath*> const& vPaths);
|
bool startNewPathFree(std::vector<BattleBotPath*> const& vPaths);
|
||||||
bool resetObjective();
|
bool resetObjective();
|
||||||
bool wsJumpDown();
|
bool wsgPaths();
|
||||||
bool eyJumpDown();
|
bool eyJumpDown();
|
||||||
bool atFlag(std::vector<BattleBotPath*> const& vPaths, std::vector<uint32> const& vFlagIds);
|
bool atFlag(std::vector<BattleBotPath*> const& vPaths, std::vector<uint32> const& vFlagIds);
|
||||||
bool flagTaken();
|
bool flagTaken();
|
||||||
|
|||||||
@ -4,8 +4,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "CheckMountStateAction.h"
|
#include "CheckMountStateAction.h"
|
||||||
#include "BattleGroundTactics.h"
|
|
||||||
#include "BattlegroundEY.h"
|
|
||||||
#include "BattlegroundWS.h"
|
#include "BattlegroundWS.h"
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "PlayerbotAI.h"
|
#include "PlayerbotAI.h"
|
||||||
@ -100,7 +98,7 @@ bool CheckMountStateAction::isUseful()
|
|||||||
if (bot->InBattleground())
|
if (bot->InBattleground())
|
||||||
{
|
{
|
||||||
// Do not use when carrying BG Flags
|
// Do not use when carrying BG Flags
|
||||||
if (bot->HasAura(BG_WS_SPELL_WARSONG_FLAG) || bot->HasAura(BG_WS_SPELL_SILVERWING_FLAG) || bot->HasAura(BG_EY_NETHERSTORM_FLAG_SPELL))
|
if (bot->HasAura(23333) || bot->HasAura(23335) || bot->HasAura(34976))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Only mount if BG starts in less than 30 sec
|
// Only mount if BG starts in less than 30 sec
|
||||||
|
|||||||
@ -25,7 +25,7 @@ bool AttackEnemyPlayerAction::isUseful()
|
|||||||
bool AttackEnemyFlagCarrierAction::isUseful()
|
bool AttackEnemyFlagCarrierAction::isUseful()
|
||||||
{
|
{
|
||||||
Unit* target = context->GetValue<Unit*>("enemy flag carrier")->Get();
|
Unit* target = context->GetValue<Unit*>("enemy flag carrier")->Get();
|
||||||
return target && sServerFacade->IsDistanceLessOrEqualThan(sServerFacade->GetDistance2d(bot, target), 100.0f) &&
|
return target && sServerFacade->IsDistanceLessOrEqualThan(sServerFacade->GetDistance2d(bot, target), 75.0f) &&
|
||||||
PlayerHasFlag::IsCapturingFlag(bot);
|
PlayerHasFlag::IsCapturingFlag(bot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -332,25 +332,7 @@ bool UseTrinketAction::UseTrinket(Item* item)
|
|||||||
if (item->GetTemplate()->Spells[i].SpellId > 0 && item->GetTemplate()->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_USE)
|
if (item->GetTemplate()->Spells[i].SpellId > 0 && item->GetTemplate()->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_USE)
|
||||||
{
|
{
|
||||||
spellId = item->GetTemplate()->Spells[i].SpellId;
|
spellId = item->GetTemplate()->Spells[i].SpellId;
|
||||||
const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(spellId);
|
uint32 spellProcFlag = sSpellMgr->GetSpellInfo(spellId)->ProcFlags;
|
||||||
|
|
||||||
if (!spellInfo || !spellInfo->IsPositive())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
bool applyAura = false;
|
|
||||||
for (int i = 0; i < MAX_SPELL_EFFECTS; i++)
|
|
||||||
{
|
|
||||||
const SpellEffectInfo& effectInfo = spellInfo->Effects[i];
|
|
||||||
if (effectInfo.Effect == SPELL_EFFECT_APPLY_AURA) {
|
|
||||||
applyAura = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!applyAura)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
uint32 spellProcFlag = spellInfo->ProcFlags;
|
|
||||||
|
|
||||||
// Handle items with procflag "if you kill a target that grants honor or experience"
|
// Handle items with procflag "if you kill a target that grants honor or experience"
|
||||||
// Bots will "learn" the trinket proc, so CanCastSpell() will be true
|
// Bots will "learn" the trinket proc, so CanCastSpell() will be true
|
||||||
@ -371,8 +353,17 @@ bool UseTrinketAction::UseTrinket(Item* item)
|
|||||||
WorldPacket packet(CMSG_USE_ITEM);
|
WorldPacket packet(CMSG_USE_ITEM);
|
||||||
packet << bagIndex << slot << cast_count << spellId << item_guid << glyphIndex << castFlags;
|
packet << bagIndex << slot << cast_count << spellId << item_guid << glyphIndex << castFlags;
|
||||||
|
|
||||||
targetFlag = TARGET_FLAG_NONE;
|
Unit* target = AI_VALUE(Unit*, "current target");
|
||||||
packet << targetFlag << bot->GetPackGUID();
|
if (target)
|
||||||
|
{
|
||||||
|
targetFlag = TARGET_FLAG_UNIT;
|
||||||
|
packet << targetFlag << target->GetGUID().WriteAsPacked();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
targetFlag = TARGET_FLAG_NONE;
|
||||||
|
packet << targetFlag << bot->GetPackGUID();
|
||||||
|
}
|
||||||
bot->GetSession()->HandleUseItemOpcode(packet);
|
bot->GetSession()->HandleUseItemOpcode(packet);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -98,10 +98,10 @@ bool InviteNearbyToGroupAction::Execute(Event event)
|
|||||||
|
|
||||||
if (group && group->isRaidGroup())
|
if (group && group->isRaidGroup())
|
||||||
bot->Say(BOT_TEXT2("join_raid", placeholders),
|
bot->Say(BOT_TEXT2("join_raid", placeholders),
|
||||||
(bot->GetTeamId() == TEAM_ALLIANCE ? LANG_COMMON : LANG_ORCISH));
|
(bot->GetTeamId() == ALLIANCE ? LANG_COMMON : LANG_ORCISH));
|
||||||
else
|
else
|
||||||
bot->Say(BOT_TEXT2("join_group", placeholders),
|
bot->Say(BOT_TEXT2("join_group", placeholders),
|
||||||
(bot->GetTeamId() == TEAM_ALLIANCE ? LANG_COMMON : LANG_ORCISH));
|
(bot->GetTeamId() == ALLIANCE ? LANG_COMMON : LANG_ORCISH));
|
||||||
}
|
}
|
||||||
|
|
||||||
return Invite(bot, player);
|
return Invite(bot, player);
|
||||||
|
|||||||
@ -63,7 +63,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Execute(Event event) override;
|
bool Execute(Event event) override;
|
||||||
bool isUseful() override { return bot->GetGuildId() && InviteNearbyToGroupAction::isUseful(); };
|
bool isUseful() { return bot->GetGuildId() && InviteNearbyToGroupAction::isUseful(); };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<Player*> getGuildMembers();
|
std::vector<Player*> getGuildMembers();
|
||||||
|
|||||||
@ -10,82 +10,106 @@
|
|||||||
void BGStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
void BGStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
||||||
{
|
{
|
||||||
triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("bg join", relevance), nullptr)));
|
triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("bg join", relevance), nullptr)));
|
||||||
triggers.push_back(new TriggerNode("bg invite active", NextAction::array(0, new NextAction("bg status check", relevance), nullptr)));
|
triggers.push_back(new TriggerNode("bg invite active",
|
||||||
triggers.push_back(new TriggerNode("timer", NextAction::array(0, new NextAction("bg strategy check", relevance), nullptr)));
|
NextAction::array(0, new NextAction("bg status check", relevance), nullptr)));
|
||||||
|
triggers.push_back(
|
||||||
|
new TriggerNode("timer", NextAction::array(0, new NextAction("bg strategy check", relevance), nullptr)));
|
||||||
}
|
}
|
||||||
|
|
||||||
BGStrategy::BGStrategy(PlayerbotAI* botAI) : PassTroughStrategy(botAI) {}
|
BGStrategy::BGStrategy(PlayerbotAI* botAI) : PassTroughStrategy(botAI) {}
|
||||||
|
|
||||||
|
void WarsongStrategy::InitTriggers(std::vector<TriggerNode*>& 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)));
|
||||||
|
triggers.push_back(
|
||||||
|
new TriggerNode("low health", NextAction::array(0, new NextAction("bg use buff", 30.0f), nullptr)));
|
||||||
|
triggers.push_back(
|
||||||
|
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)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void AlteracStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
||||||
|
{ /* placeholder */
|
||||||
|
}
|
||||||
|
|
||||||
|
void ArathiStrategy::InitTriggers(std::vector<TriggerNode*>& 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)));
|
||||||
|
triggers.push_back(
|
||||||
|
new TriggerNode("low health", NextAction::array(0, new NextAction("bg use buff", 30.0f), nullptr)));
|
||||||
|
triggers.push_back(
|
||||||
|
new TriggerNode("low mana", NextAction::array(0, new NextAction("bg use buff", 30.0f), nullptr)));
|
||||||
|
}
|
||||||
|
|
||||||
void BattlegroundStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
void BattlegroundStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
||||||
{
|
{
|
||||||
triggers.push_back(new TriggerNode("bg waiting", NextAction::array(0, new NextAction("bg move to start", ACTION_BG), nullptr)));
|
triggers.push_back(
|
||||||
triggers.push_back(new TriggerNode("bg active", NextAction::array(0, new NextAction("bg move to objective", ACTION_BG), nullptr)));
|
new TriggerNode("bg waiting", NextAction::array(0, new NextAction("bg move to start", 1.0f), nullptr)));
|
||||||
triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("bg check objective", ACTION_BG + 1), nullptr)));
|
triggers.push_back(
|
||||||
triggers.push_back(new TriggerNode("dead", NextAction::array(0, new NextAction("bg reset objective force", ACTION_EMERGENCY), nullptr)));
|
new TriggerNode("bg active", NextAction::array(0, new NextAction("bg move to objective", 1.0f), nullptr)));
|
||||||
|
triggers.push_back(
|
||||||
|
new TriggerNode("often", NextAction::array(0, new NextAction("bg check objective", 10.0f), nullptr)));
|
||||||
// triggers.push_back(new TriggerNode("enemy flagcarrier near", NextAction::array(0, new NextAction("attack enemy
|
// 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 flagcarrier near",
|
// flag carrier", 80.0f), nullptr))); triggers.push_back(new TriggerNode("team flagcarrier near",
|
||||||
// NextAction::array(0, new NextAction("bg protect fc", 40.0f), nullptr))); triggers.push_back(new
|
// NextAction::array(0, new NextAction("bg protect fc", 40.0f), nullptr))); triggers.push_back(new
|
||||||
// TriggerNode("player has flag", NextAction::array(0, new NextAction("bg move to objective", 90.0f), nullptr)));
|
// TriggerNode("player has flag", NextAction::array(0, new NextAction("bg move to objective", 90.0f), nullptr)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WarsongStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
|
||||||
{
|
|
||||||
triggers.push_back(new TriggerNode("bg active", NextAction::array(0, new NextAction("bg check flag", ACTION_EMERGENCY ), nullptr)));
|
|
||||||
triggers.push_back(new TriggerNode("enemy flagcarrier near", NextAction::array(0, new NextAction("attack enemy flag carrier", ACTION_RAID + 1.0f), nullptr)));
|
|
||||||
triggers.push_back(new TriggerNode("team flagcarrier near", NextAction::array(0, new NextAction("bg protect fc", ACTION_RAID), nullptr)));
|
|
||||||
triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("bg use buff", ACTION_BG), nullptr)));
|
|
||||||
triggers.push_back(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", ACTION_MOVE), nullptr)));
|
|
||||||
triggers.push_back(new TriggerNode("player has flag", NextAction::array(0, new NextAction("bg move to objective", ACTION_EMERGENCY), nullptr)));
|
|
||||||
triggers.push_back(new TriggerNode("timer bg", NextAction::array(0, new NextAction("bg reset objective force", ACTION_EMERGENCY), nullptr)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void AlteracStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
|
||||||
{
|
|
||||||
triggers.push_back(new TriggerNode("alliance no snowfall gy", NextAction::array(0, new NextAction("bg move to objective", ACTION_EMERGENCY), nullptr)));
|
|
||||||
triggers.push_back(new TriggerNode("timer bg", NextAction::array(0, new NextAction("bg reset objective force", ACTION_EMERGENCY), nullptr)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void ArathiStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
|
||||||
{
|
|
||||||
triggers.push_back(new TriggerNode("bg active", NextAction::array(0, new NextAction("bg check flag", ACTION_EMERGENCY), nullptr)));
|
|
||||||
triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("bg use buff", ACTION_BG), nullptr)));
|
|
||||||
triggers.push_back(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", ACTION_MOVE), nullptr)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void EyeStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
void EyeStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
||||||
{
|
{
|
||||||
triggers.push_back(new TriggerNode("bg active", NextAction::array(0, new NextAction("bg check flag", ACTION_EMERGENCY), nullptr)));
|
triggers.push_back(
|
||||||
triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("bg use buff", ACTION_BG), nullptr)));
|
new TriggerNode("bg active", NextAction::array(0, new NextAction("bg check flag", ACTION_MOVE + 7.0f), nullptr)));
|
||||||
triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("bg use buff", ACTION_MOVE), nullptr)));
|
triggers.push_back(new TriggerNode("often", 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", ACTION_MOVE), nullptr)));
|
triggers.push_back(
|
||||||
triggers.push_back(new TriggerNode("enemy flagcarrier near", NextAction::array(0, new NextAction("attack enemy flag carrier", ACTION_RAID), nullptr)));
|
new TriggerNode("low health", NextAction::array(0, new NextAction("bg use buff", ACTION_MOVE), nullptr)));
|
||||||
triggers.push_back(new TriggerNode("player has flag",NextAction::array(0, new NextAction("bg move to objective", ACTION_EMERGENCY), nullptr)));
|
triggers.push_back(
|
||||||
|
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", ACTION_MOVE + 8.0f), nullptr)));
|
||||||
|
triggers.push_back(new TriggerNode("player has flag",
|
||||||
|
NextAction::array(0, new NextAction("bg move to objective", ACTION_MOVE + 9.0f), nullptr)));
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Do Priorities
|
|
||||||
void IsleStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
void IsleStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
||||||
{
|
{
|
||||||
triggers.push_back(new TriggerNode("bg active", NextAction::array(0, new NextAction("bg check flag", ACTION_MOVE), nullptr)));
|
triggers.push_back(
|
||||||
triggers.push_back(new TriggerNode("timer", NextAction::array(0, new NextAction("enter vehicle", ACTION_MOVE + 8.0f), nullptr)));
|
new TriggerNode("bg active", NextAction::array(0, new NextAction("bg check flag", 70.0f), nullptr)));
|
||||||
triggers.push_back(new TriggerNode("random", NextAction::array(0, new NextAction("leave vehicle", ACTION_MOVE + 7.0f), nullptr)));
|
triggers.push_back(new TriggerNode("timer", NextAction::array(0, new NextAction("enter vehicle", 85.0f), nullptr)));
|
||||||
triggers.push_back(new TriggerNode("in vehicle", NextAction::array(0, new NextAction("hurl boulder", ACTION_MOVE + 9.0f), nullptr)));
|
triggers.push_back(
|
||||||
triggers.push_back(new TriggerNode("in vehicle", NextAction::array(0, new NextAction("fire cannon", ACTION_MOVE + 9.0f), nullptr)));
|
new TriggerNode("random", NextAction::array(0, new NextAction("leave vehicle", 80.0f), nullptr)));
|
||||||
triggers.push_back(new TriggerNode("in vehicle", NextAction::array(0, new NextAction("napalm", ACTION_MOVE + 9.0f), nullptr)));
|
triggers.push_back(
|
||||||
triggers.push_back(new TriggerNode("enemy is close", NextAction::array(0, new NextAction("steam blast", ACTION_MOVE + 9.0f), nullptr)));
|
new TriggerNode("in vehicle", NextAction::array(0, new NextAction("hurl boulder", 70.0f), nullptr)));
|
||||||
triggers.push_back(new TriggerNode("in vehicle", NextAction::array(0, new NextAction("ram", ACTION_MOVE + 9.0f), nullptr)));
|
triggers.push_back(
|
||||||
triggers.push_back(new TriggerNode("enemy is close", NextAction::array(0, new NextAction("ram", ACTION_MOVE + 9.1f), nullptr)));
|
new TriggerNode("in vehicle", NextAction::array(0, new NextAction("fire cannon", 70.0f), nullptr)));
|
||||||
triggers.push_back(new TriggerNode("enemy out of melee", NextAction::array(0, new NextAction("steam rush", ACTION_MOVE + 9.2f), nullptr)));
|
triggers.push_back(new TriggerNode("in vehicle", NextAction::array(0, new NextAction("napalm", 70.0f), nullptr)));
|
||||||
triggers.push_back(new TriggerNode("in vehicle", NextAction::array(0, new NextAction("incendiary rocket", ACTION_MOVE + 9.0f), nullptr)));
|
triggers.push_back(
|
||||||
triggers.push_back(new TriggerNode("in vehicle", NextAction::array(0, new NextAction("rocket blast", ACTION_MOVE + 9.0f), nullptr)));
|
new TriggerNode("enemy is close", NextAction::array(0, new NextAction("steam blast", 80.0f), nullptr)));
|
||||||
|
triggers.push_back(new TriggerNode("in vehicle", NextAction::array(0, new NextAction("ram", 70.0f), nullptr)));
|
||||||
|
triggers.push_back(new TriggerNode("enemy is close", NextAction::array(0, new NextAction("ram", 79.0f), nullptr)));
|
||||||
|
triggers.push_back(
|
||||||
|
new TriggerNode("enemy out of melee", NextAction::array(0, new NextAction("steam rush", 81.0f), nullptr)));
|
||||||
|
triggers.push_back(
|
||||||
|
new TriggerNode("in vehicle", NextAction::array(0, new NextAction("incendiary rocket", 70.0f), nullptr)));
|
||||||
|
triggers.push_back(
|
||||||
|
new TriggerNode("in vehicle", NextAction::array(0, new NextAction("rocket blast", 70.0f), nullptr)));
|
||||||
// this is bugged: it doesn't work, and stops glaive throw working (which is needed to take down gate)
|
// this is bugged: it doesn't work, and stops glaive throw working (which is needed to take down gate)
|
||||||
// triggers.push_back(new TriggerNode("in vehicle", NextAction::array(0, new NextAction("blade salvo", ACTION_MOVE + 9.0f), nullptr)));
|
// triggers.push_back(
|
||||||
triggers.push_back(new TriggerNode("in vehicle", NextAction::array(0, new NextAction("glaive throw", ACTION_MOVE + 9.0f), nullptr)));
|
// new TriggerNode("in vehicle", NextAction::array(0, new NextAction("blade salvo", 71.0f), nullptr)));
|
||||||
|
triggers.push_back(
|
||||||
|
new TriggerNode("in vehicle", NextAction::array(0, new NextAction("glaive throw", 70.0f), nullptr)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArenaStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
void ArenaStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
||||||
{
|
{
|
||||||
triggers.push_back(
|
triggers.push_back(
|
||||||
new TriggerNode("no possible targets", NextAction::array(0, new NextAction("arena tactics", ACTION_BG), nullptr)));
|
new TriggerNode("no possible targets", NextAction::array(0, new NextAction("arena tactics", 1.0f), nullptr)));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -482,19 +482,6 @@ bool TimerTrigger::IsActive()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TimerBGTrigger::IsActive()
|
|
||||||
{
|
|
||||||
time_t now = time(nullptr);
|
|
||||||
|
|
||||||
if (now - lastCheck >= 60)
|
|
||||||
{
|
|
||||||
lastCheck = now;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool HasNoAuraTrigger::IsActive() { return !botAI->HasAura(getName(), GetTarget()); }
|
bool HasNoAuraTrigger::IsActive() { return !botAI->HasAura(getName(), GetTarget()); }
|
||||||
|
|
||||||
bool TankAssistTrigger::IsActive()
|
bool TankAssistTrigger::IsActive()
|
||||||
|
|||||||
@ -655,17 +655,6 @@ private:
|
|||||||
time_t lastCheck;
|
time_t lastCheck;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TimerBGTrigger : public Trigger
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
TimerBGTrigger(PlayerbotAI* botAI) : Trigger(botAI, "timer bg"), lastCheck(0) {}
|
|
||||||
|
|
||||||
bool IsActive() override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
time_t lastCheck;
|
|
||||||
};
|
|
||||||
|
|
||||||
class TankAssistTrigger : public NoAttackersTrigger
|
class TankAssistTrigger : public NoAttackersTrigger
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -5,14 +5,11 @@
|
|||||||
|
|
||||||
#include "PvpTriggers.h"
|
#include "PvpTriggers.h"
|
||||||
|
|
||||||
#include "BattleGroundTactics.h"
|
|
||||||
#include "BattlegroundEY.h"
|
#include "BattlegroundEY.h"
|
||||||
#include "BattlegroundMgr.h"
|
#include "BattlegroundMgr.h"
|
||||||
#include "BattlegroundWS.h"
|
#include "BattlegroundWS.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
#include "BattlegroundAV.h"
|
|
||||||
#include "BattlegroundEY.h"
|
|
||||||
|
|
||||||
bool EnemyPlayerNear::IsActive() { return AI_VALUE(Unit*, "enemy player target"); }
|
bool EnemyPlayerNear::IsActive() { return AI_VALUE(Unit*, "enemy player target"); }
|
||||||
|
|
||||||
@ -164,26 +161,10 @@ bool PlayerHasFlag::IsCapturingFlag(Player* bot)
|
|||||||
|
|
||||||
if (bot->GetBattlegroundTypeId() == BATTLEGROUND_EY)
|
if (bot->GetBattlegroundTypeId() == BATTLEGROUND_EY)
|
||||||
{
|
{
|
||||||
|
// TODO we should probably add similiar logic as WSG to allow combat
|
||||||
|
// when bot has flag but no bases are available to take it to
|
||||||
BattlegroundEY* bg = (BattlegroundEY*)bot->GetBattleground();
|
BattlegroundEY* bg = (BattlegroundEY*)bot->GetBattleground();
|
||||||
|
return bot->GetGUID() == bg->GetFlagPickerGUID();
|
||||||
// Check if bot has the flag
|
|
||||||
if (bot->GetGUID() == bg->GetFlagPickerGUID())
|
|
||||||
{
|
|
||||||
// Count how many bases the bot's team owns
|
|
||||||
uint32 controlledBases = 0;
|
|
||||||
for (uint8 point = 0; point < EY_POINTS_MAX; ++point)
|
|
||||||
{
|
|
||||||
if (bg->GetCapturePointInfo(point)._ownerTeamId == bot->GetTeamId())
|
|
||||||
controlledBases++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If no bases are controlled, bot should go aggressive
|
|
||||||
if (controlledBases == 0)
|
|
||||||
return false; // bot has flag but no place to take it
|
|
||||||
|
|
||||||
// Otherwise, return false and stay defensive / move to base
|
|
||||||
return bot->GetGUID() == bg->GetFlagPickerGUID();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -194,30 +175,28 @@ bool PlayerHasFlag::IsCapturingFlag(Player* bot)
|
|||||||
|
|
||||||
bool TeamHasFlag::IsActive()
|
bool TeamHasFlag::IsActive()
|
||||||
{
|
{
|
||||||
if (!botAI->GetBot()->InBattleground())
|
if (botAI->GetBot()->InBattleground())
|
||||||
|
{
|
||||||
|
if (botAI->GetBot()->GetBattlegroundTypeId() == BattlegroundTypeId::BATTLEGROUND_WS)
|
||||||
|
{
|
||||||
|
BattlegroundWS* bg = (BattlegroundWS*)botAI->GetBot()->GetBattleground();
|
||||||
|
|
||||||
|
if (bot->GetGUID() == bg->GetFlagPickerGUID(TEAM_ALLIANCE) ||
|
||||||
|
bot->GetGUID() == bg->GetFlagPickerGUID(TEAM_HORDE))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bg->GetFlagState(bg->GetOtherTeamId(bot->GetTeamId())) == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (botAI->GetBot()->GetBattlegroundTypeId() != BattlegroundTypeId::BATTLEGROUND_WS)
|
return false;
|
||||||
return false;
|
|
||||||
|
|
||||||
BattlegroundWS* bg = (BattlegroundWS*)botAI->GetBot()->GetBattleground();
|
|
||||||
|
|
||||||
ObjectGuid botGuid = bot->GetGUID();
|
|
||||||
TeamId teamId = bot->GetTeamId();
|
|
||||||
TeamId enemyTeamId = bg->GetOtherTeamId(teamId);
|
|
||||||
|
|
||||||
// If the bot is carrying any flag, don't activate
|
|
||||||
if (botGuid == bg->GetFlagPickerGUID(TEAM_ALLIANCE) || botGuid == bg->GetFlagPickerGUID(TEAM_HORDE))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Check: Own team has enemy flag, enemy team does NOT have your flag
|
|
||||||
bool ownTeamHasFlag = bg->GetFlagState(enemyTeamId) == BG_WS_FLAG_STATE_ON_PLAYER;
|
|
||||||
bool enemyTeamHasFlag = bg->GetFlagState(teamId) == BG_WS_FLAG_STATE_ON_PLAYER;
|
|
||||||
|
|
||||||
return ownTeamHasFlag && !enemyTeamHasFlag;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool EnemyTeamHasFlag::IsActive()
|
bool EnemyTeamHasFlag::IsActive()
|
||||||
{
|
{
|
||||||
if (botAI->GetBot()->InBattleground())
|
if (botAI->GetBot()->InBattleground())
|
||||||
@ -247,42 +226,11 @@ bool EnemyTeamHasFlag::IsActive()
|
|||||||
bool EnemyFlagCarrierNear::IsActive()
|
bool EnemyFlagCarrierNear::IsActive()
|
||||||
{
|
{
|
||||||
Unit* carrier = AI_VALUE(Unit*, "enemy flag carrier");
|
Unit* carrier = AI_VALUE(Unit*, "enemy flag carrier");
|
||||||
|
return carrier && sServerFacade->IsDistanceLessOrEqualThan(sServerFacade->GetDistance2d(bot, carrier), 200.f);
|
||||||
if (!carrier || !sServerFacade->IsDistanceLessOrEqualThan(sServerFacade->GetDistance2d(bot, carrier), 100.f))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Check if there is another enemy player target closer than the FC
|
|
||||||
Unit* nearbyEnemy = AI_VALUE(Unit*, "enemy player target");
|
|
||||||
|
|
||||||
if (nearbyEnemy)
|
|
||||||
{
|
|
||||||
float distToFC = sServerFacade->GetDistance2d(bot, carrier);
|
|
||||||
float distToEnemy = sServerFacade->GetDistance2d(bot, nearbyEnemy);
|
|
||||||
|
|
||||||
// If the other enemy is significantly closer, don't pursue FC
|
|
||||||
if (distToEnemy + 15.0f < distToFC) // Add small buffer
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TeamFlagCarrierNear::IsActive()
|
bool TeamFlagCarrierNear::IsActive()
|
||||||
{
|
{
|
||||||
if (bot->GetBattlegroundTypeId() == BATTLEGROUND_WS)
|
|
||||||
{
|
|
||||||
BattlegroundWS* bg = dynamic_cast<BattlegroundWS*>(bot->GetBattleground());
|
|
||||||
if (bg)
|
|
||||||
{
|
|
||||||
bool bothFlagsNotAtBase =
|
|
||||||
bg->GetFlagState(TEAM_ALLIANCE) != BG_WS_FLAG_STATE_ON_BASE &&
|
|
||||||
bg->GetFlagState(TEAM_HORDE) != BG_WS_FLAG_STATE_ON_BASE;
|
|
||||||
|
|
||||||
if (bothFlagsNotAtBase)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Unit* carrier = AI_VALUE(Unit*, "team flag carrier");
|
Unit* carrier = AI_VALUE(Unit*, "team flag carrier");
|
||||||
return carrier && sServerFacade->IsDistanceLessOrEqualThan(sServerFacade->GetDistance2d(bot, carrier), 200.f);
|
return carrier && sServerFacade->IsDistanceLessOrEqualThan(sServerFacade->GetDistance2d(bot, carrier), 200.f);
|
||||||
}
|
}
|
||||||
@ -311,28 +259,3 @@ bool VehicleNearTrigger::IsActive()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool InVehicleTrigger::IsActive() { return botAI->IsInVehicle(); }
|
bool InVehicleTrigger::IsActive() { return botAI->IsInVehicle(); }
|
||||||
|
|
||||||
bool AllianceNoSnowfallGY::IsActive()
|
|
||||||
{
|
|
||||||
if (!bot || bot->GetTeamId() != TEAM_ALLIANCE)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
Battleground* bg = bot->GetBattleground();
|
|
||||||
if (bg && BGTactics::GetBotStrategyForTeam(bg, TEAM_ALLIANCE) != AV_STRATEGY_BALANCED)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
float botX = bot->GetPositionX();
|
|
||||||
if (botX <= -562.0f)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (bot->GetBattlegroundTypeId() != BATTLEGROUND_AV)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (BattlegroundAV* av = dynamic_cast<BattlegroundAV*>(bg))
|
|
||||||
{
|
|
||||||
const BG_AV_NodeInfo& snowfall = av->GetAVNodeInfo(BG_AV_NODES_SNOWFALL_GRAVE);
|
|
||||||
return snowfall.OwnerId != TEAM_ALLIANCE; // Active if the Snowfall Graveyard is NOT fully controlled by the Alliance
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -140,12 +140,4 @@ public:
|
|||||||
bool IsActive() override;
|
bool IsActive() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AllianceNoSnowfallGY : public Trigger
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
AllianceNoSnowfallGY(PlayerbotAI* botAI) : Trigger(botAI, "alliance no snowfall gy") {}
|
|
||||||
|
|
||||||
bool IsActive() override;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -34,7 +34,6 @@ public:
|
|||||||
creators["collision"] = &TriggerContext::collision;
|
creators["collision"] = &TriggerContext::collision;
|
||||||
|
|
||||||
creators["timer"] = &TriggerContext::Timer;
|
creators["timer"] = &TriggerContext::Timer;
|
||||||
creators["timer bg"] = &TriggerContext::TimerBG;
|
|
||||||
creators["random"] = &TriggerContext::Random;
|
creators["random"] = &TriggerContext::Random;
|
||||||
creators["seldom"] = &TriggerContext::seldom;
|
creators["seldom"] = &TriggerContext::seldom;
|
||||||
creators["often"] = &TriggerContext::often;
|
creators["often"] = &TriggerContext::often;
|
||||||
@ -178,7 +177,6 @@ public:
|
|||||||
creators["in Battleground"] = &TriggerContext::player_is_in_BATTLEGROUND;
|
creators["in Battleground"] = &TriggerContext::player_is_in_BATTLEGROUND;
|
||||||
creators["in Battleground without flag"] = &TriggerContext::player_is_in_BATTLEGROUND_no_flag;
|
creators["in Battleground without flag"] = &TriggerContext::player_is_in_BATTLEGROUND_no_flag;
|
||||||
creators["wants in bg"] = &TriggerContext::player_wants_in_bg;
|
creators["wants in bg"] = &TriggerContext::player_wants_in_bg;
|
||||||
creators["alliance no snowfall gy"] = &TriggerContext::alliance_no_snowfall_gy;
|
|
||||||
|
|
||||||
creators["mounted"] = &TriggerContext::mounted;
|
creators["mounted"] = &TriggerContext::mounted;
|
||||||
|
|
||||||
@ -309,7 +307,6 @@ private:
|
|||||||
static Trigger* NoAttackers(PlayerbotAI* botAI) { return new NoAttackersTrigger(botAI); }
|
static Trigger* NoAttackers(PlayerbotAI* botAI) { return new NoAttackersTrigger(botAI); }
|
||||||
static Trigger* TankAssist(PlayerbotAI* botAI) { return new TankAssistTrigger(botAI); }
|
static Trigger* TankAssist(PlayerbotAI* botAI) { return new TankAssistTrigger(botAI); }
|
||||||
static Trigger* Timer(PlayerbotAI* botAI) { return new TimerTrigger(botAI); }
|
static Trigger* Timer(PlayerbotAI* botAI) { return new TimerTrigger(botAI); }
|
||||||
static Trigger* TimerBG(PlayerbotAI* botAI) { return new TimerBGTrigger(botAI); }
|
|
||||||
static Trigger* NoTarget(PlayerbotAI* botAI) { return new NoTargetTrigger(botAI); }
|
static Trigger* NoTarget(PlayerbotAI* botAI) { return new NoTargetTrigger(botAI); }
|
||||||
static Trigger* TargetInSight(PlayerbotAI* botAI) { return new TargetInSightTrigger(botAI); }
|
static Trigger* TargetInSight(PlayerbotAI* botAI) { return new TargetInSightTrigger(botAI); }
|
||||||
static Trigger* not_dps_target_active(PlayerbotAI* botAI) { return new NotDpsTargetActiveTrigger(botAI); }
|
static Trigger* not_dps_target_active(PlayerbotAI* botAI) { return new NotDpsTargetActiveTrigger(botAI); }
|
||||||
@ -380,8 +377,10 @@ private:
|
|||||||
static Trigger* enemy_team_has_flag(PlayerbotAI* botAI) { return new EnemyTeamHasFlag(botAI); }
|
static Trigger* enemy_team_has_flag(PlayerbotAI* botAI) { return new EnemyTeamHasFlag(botAI); }
|
||||||
static Trigger* enemy_flagcarrier_near(PlayerbotAI* botAI) { return new EnemyFlagCarrierNear(botAI); }
|
static Trigger* enemy_flagcarrier_near(PlayerbotAI* botAI) { return new EnemyFlagCarrierNear(botAI); }
|
||||||
static Trigger* player_is_in_BATTLEGROUND(PlayerbotAI* botAI) { return new PlayerIsInBattleground(botAI); }
|
static Trigger* player_is_in_BATTLEGROUND(PlayerbotAI* botAI) { return new PlayerIsInBattleground(botAI); }
|
||||||
static Trigger* player_is_in_BATTLEGROUND_no_flag(PlayerbotAI* botAI) { return new PlayerIsInBattlegroundWithoutFlag(botAI); }
|
static Trigger* player_is_in_BATTLEGROUND_no_flag(PlayerbotAI* botAI)
|
||||||
static Trigger* alliance_no_snowfall_gy(PlayerbotAI* botAI) { return new AllianceNoSnowfallGY(botAI); }
|
{
|
||||||
|
return new PlayerIsInBattlegroundWithoutFlag(botAI);
|
||||||
|
}
|
||||||
static Trigger* mounted(PlayerbotAI* botAI) { return new IsMountedTrigger(botAI); }
|
static Trigger* mounted(PlayerbotAI* botAI) { return new IsMountedTrigger(botAI); }
|
||||||
static Trigger* at_dark_portal_outland(PlayerbotAI* botAI) { return new AtDarkPortalOutlandTrigger(botAI); }
|
static Trigger* at_dark_portal_outland(PlayerbotAI* botAI) { return new AtDarkPortalOutlandTrigger(botAI); }
|
||||||
static Trigger* at_dark_portal_azeroth(PlayerbotAI* botAI) { return new AtDarkPortalAzerothTrigger(botAI); }
|
static Trigger* at_dark_portal_azeroth(PlayerbotAI* botAI) { return new AtDarkPortalAzerothTrigger(botAI); }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user