diff --git a/src/TravelMgr.cpp b/src/TravelMgr.cpp index 043e5ab5..ab705765 100644 --- a/src/TravelMgr.cpp +++ b/src/TravelMgr.cpp @@ -3409,13 +3409,14 @@ void TravelMgr::LoadQuestTravelTable() { Strategy* strat = con->GetStrategy(stratName); - if (strat->getDefaultActions()) - for (uint32 i = 0; i < NextAction::size(strat->getDefaultActions()); i++) - { - NextAction* nextAction = strat->getDefaultActions()[i]; + const std::vector defaultActions = strat->getDefaultActions(); + if (defaultActions.size() > 0) + { + for (NextAction nextAction : defaultActions) + { std::ostringstream aout; - aout << nextAction->getRelevance() << "," << nextAction->getName() + aout << nextAction.getRelevance() << "," << nextAction.getName() << ",,S:" << stratName; if (actions.find(aout.str().c_str()) != actions.end()) @@ -3427,27 +3428,24 @@ void TravelMgr::LoadQuestTravelTable() actions.insert_or_assign(aout.str().c_str(), classSpecLevel); } + } std::vector triggers; strat->InitTriggers(triggers); - for (auto& triggerNode : triggers) - { - // out << " TN:" << triggerNode->getName(); + for (TriggerNode*& triggerNode : triggers) + { if (Trigger* trigger = con->GetTrigger(triggerNode->getName())) { triggerNode->setTrigger(trigger); - NextAction** nextActions = triggerNode->getHandlers(); + std::vector nextActions = triggerNode->getHandlers(); - for (uint32 i = 0; i < NextAction::size(nextActions); i++) + // for (uint32_t i = 0; i < nextActions.size(); ++i) + for (NextAction nextAction : nextActions) { - NextAction* nextAction = nextActions[i]; - // out << " A:" << nextAction->getName() << "(" << - // nextAction->getRelevance() << ")"; - std::ostringstream aout; - aout << nextAction->getRelevance() << "," << nextAction->getName() + aout << nextAction.getRelevance() << "," << nextAction.getName() << "," << triggerNode->getName() << "," << stratName; if (actions.find(aout.str().c_str()) != actions.end()) diff --git a/src/strategy/Action.cpp b/src/strategy/Action.cpp index 08c0af98..464f9dcf 100644 --- a/src/strategy/Action.cpp +++ b/src/strategy/Action.cpp @@ -8,90 +8,6 @@ #include "Playerbots.h" #include "Timer.h" -uint32 NextAction::size(NextAction** actions) -{ - if (!actions) - return 0; - - uint32 size = 0; - for (size = 0; actions[size];) - ++size; - - return size; -} - -NextAction** NextAction::clone(NextAction** actions) -{ - if (!actions) - return nullptr; - - uint32 size = NextAction::size(actions); - - NextAction** res = new NextAction*[size + 1]; - for (uint32 i = 0; i < size; i++) - res[i] = new NextAction(*actions[i]); - - res[size] = nullptr; - - return res; -} - -NextAction** NextAction::merge(NextAction** left, NextAction** right) -{ - uint32 leftSize = NextAction::size(left); - uint32 rightSize = NextAction::size(right); - - NextAction** res = new NextAction*[leftSize + rightSize + 1]; - - for (uint32 i = 0; i < leftSize; i++) - res[i] = new NextAction(*left[i]); - - for (uint32 i = 0; i < rightSize; i++) - res[leftSize + i] = new NextAction(*right[i]); - - res[leftSize + rightSize] = nullptr; - - NextAction::destroy(left); - NextAction::destroy(right); - - return res; -} - -NextAction** NextAction::array(uint32 nil, ...) -{ - va_list vl; - va_start(vl, nil); - - uint32 size = 0; - NextAction* cur = nullptr; - do - { - cur = va_arg(vl, NextAction*); - ++size; - } while (cur); - - va_end(vl); - - NextAction** res = new NextAction*[size]; - va_start(vl, nil); - for (uint32 i = 0; i < size; i++) - res[i] = va_arg(vl, NextAction*); - va_end(vl); - - return res; -} - -void NextAction::destroy(NextAction** actions) -{ - if (!actions) - return; - - for (uint32 i = 0; actions[i]; i++) - delete actions[i]; - - delete[] actions; -} - Value* Action::GetTargetValue() { return context->GetValue(GetTargetName()); } Unit* Action::GetTarget() { return GetTargetValue()->Get(); } @@ -101,4 +17,4 @@ ActionBasket::ActionBasket(ActionNode* action, float relevance, bool skipPrerequ { } -bool ActionBasket::isExpired(uint32 msecs) { return getMSTime() - created >= msecs; } +bool ActionBasket::isExpired(uint32_t msecs) { return getMSTime() - created >= msecs; } diff --git a/src/strategy/Action.h b/src/strategy/Action.h index 5087a42b..2395c5ea 100644 --- a/src/strategy/Action.h +++ b/src/strategy/Action.h @@ -3,8 +3,7 @@ * and/or modify it under version 3 of the License, or (at your option), any later version. */ -#ifndef _PLAYERBOT_ACTION_H -#define _PLAYERBOT_ACTION_H +#pragma once #include "AiObject.h" #include "Common.h" @@ -24,15 +23,26 @@ public: std::string const getName() { return name; } float getRelevance() { return relevance; } - static uint32 size(NextAction** actions); - static NextAction** clone(NextAction** actions); - static NextAction** merge(NextAction** what, NextAction** with); - static NextAction** array(uint32 nil, ...); - static void destroy(NextAction** actions); + static std::vector merge(std::vector const& what, std::vector const& with) + { + std::vector result = {}; + + for (NextAction const& action : what) + { + result.push_back(action); + } + + for (NextAction const& action : with) + { + result.push_back(action); + } + + return result; + }; private: float relevance; - std::string const name; + std::string name; }; class Action : public AiNamedObject @@ -52,9 +62,9 @@ public: virtual bool Execute([[maybe_unused]] Event event) { return true; } virtual bool isPossible() { return true; } virtual bool isUseful() { return true; } - virtual NextAction** getPrerequisites() { return nullptr; } - virtual NextAction** getAlternatives() { return nullptr; } - virtual NextAction** getContinuers() { return nullptr; } + virtual std::vector getPrerequisites() { return {}; } + virtual std::vector getAlternatives() { return {}; } + virtual std::vector getContinuers() { return {}; } virtual ActionThreatType getThreatType() { return ActionThreatType::None; } void Update() {} void Reset() {} @@ -73,39 +83,44 @@ protected: class ActionNode { public: - ActionNode(std::string const name, NextAction** prerequisites = nullptr, NextAction** alternatives = nullptr, - NextAction** continuers = nullptr) - : name(name), action(nullptr), continuers(continuers), alternatives(alternatives), prerequisites(prerequisites) - { - } // reorder arguments - whipowill + ActionNode( + std::string name, + std::vector prerequisites = {}, + std::vector alternatives = {}, + std::vector continuers = {} + ) : + name(std::move(name)), + action(nullptr), + continuers(continuers), + alternatives(alternatives), + prerequisites(prerequisites) + {} - virtual ~ActionNode() - { - NextAction::destroy(prerequisites); - NextAction::destroy(alternatives); - NextAction::destroy(continuers); - } + virtual ~ActionNode() = default; Action* getAction() { return action; } void setAction(Action* action) { this->action = action; } - std::string const getName() { return name; } + const std::string getName() { return name; } - NextAction** getContinuers() { return NextAction::merge(NextAction::clone(continuers), action->getContinuers()); } - NextAction** getAlternatives() + std::vector getContinuers() { - return NextAction::merge(NextAction::clone(alternatives), action->getAlternatives()); + return NextAction::merge(this->continuers, action->getContinuers()); } - NextAction** getPrerequisites() + std::vector getAlternatives() { - return NextAction::merge(NextAction::clone(prerequisites), action->getPrerequisites()); + return NextAction::merge(this->alternatives, action->getAlternatives()); + } + std::vector getPrerequisites() + { + return NextAction::merge(this->prerequisites, action->getPrerequisites()); } private: - std::string const name; + const std::string name; Action* action; - NextAction** continuers; - NextAction** alternatives; - NextAction** prerequisites; + std::vector continuers; + std::vector alternatives; + std::vector prerequisites; }; class ActionBasket @@ -121,14 +136,12 @@ public: bool isSkipPrerequisites() { return skipPrerequisites; } void AmendRelevance(float k) { relevance *= k; } void setRelevance(float relevance) { this->relevance = relevance; } - bool isExpired(uint32 msecs); + bool isExpired(uint32_t msecs); private: ActionNode* action; float relevance; bool skipPrerequisites; Event event; - uint32 created; + uint32_t created; }; - -#endif diff --git a/src/strategy/AiObject.h b/src/strategy/AiObject.h index 4312313f..c161d4ed 100644 --- a/src/strategy/AiObject.h +++ b/src/strategy/AiObject.h @@ -42,9 +42,6 @@ protected: // TRIGGERS // -#define NEXT_TRIGGERS(name, relevance) \ - virtual NextAction* getNextAction() { return new NextAction(name, relevance); } - #define BEGIN_TRIGGER(clazz, super) \ class clazz : public super \ { \ @@ -78,14 +75,6 @@ protected: clazz(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, spell) {} \ } -#define BUFF_PARTY_TRIGGER_A(clazz, spell) \ - class clazz : public BuffOnPartyTrigger \ - { \ - public: \ - clazz(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, spell) {} \ - bool IsActive() override; \ - } - #define DEBUFF_TRIGGER(clazz, spell) \ class clazz : public DebuffTrigger \ { \ @@ -296,14 +285,6 @@ protected: clazz(PlayerbotAI* botAI) : CastHealingSpellAction(botAI, spell) {} \ } -#define HEAL_ACTION_U(clazz, spell, useful) \ - class clazz : public CastHealingSpellAction \ - { \ - public: \ - clazz(PlayerbotAI* botAI) : CastHealingSpellAction(botAI, spell) {} \ - bool isUseful() override { return useful; } \ - } - #define HEAL_PARTY_ACTION(clazz, spell, estAmount, manaEfficiency) \ class clazz : public HealPartyMemberAction \ { \ @@ -404,14 +385,6 @@ protected: clazz(PlayerbotAI* botAI) : CastReachTargetSpellAction(botAI, spell, range) {} \ } -#define REACH_ACTION_U(clazz, spell, range, useful) \ - class clazz : public CastReachTargetSpellAction \ - { \ - public: \ - clazz(PlayerbotAI* botAI) : CastReachTargetSpellAction(botAI, spell, range) {} \ - bool isUseful() override { return useful; } \ - } - #define ENEMY_HEALER_ACTION(clazz, spell) \ class clazz : public CastSpellOnEnemyHealerAction \ { \ @@ -440,10 +413,6 @@ protected: clazz(PlayerbotAI* botAI) : CastProtectSpellAction(botAI, spell) {} \ } -#define END_RANGED_SPELL_ACTION() \ - } \ - ; - #define BEGIN_SPELL_ACTION(clazz, name) \ class clazz : public CastSpellAction \ { \ @@ -472,42 +441,4 @@ protected: public: \ clazz(PlayerbotAI* botAI) : CastMeleeSpellAction(botAI, name) {} -#define END_RANGED_SPELL_ACTION() \ - } \ - ; - -#define BEGIN_BUFF_ON_PARTY_ACTION(clazz, name) \ - class clazz : public BuffOnPartyAction \ - { \ - public: \ - clazz(PlayerbotAI* botAI) : BuffOnPartyAction(botAI, name) {} - -// -// Action node -// - -// node_name , action, prerequisite -#define ACTION_NODE_P(name, spell, pre) \ - static ActionNode* name([[maybe_unused]] PlayerbotAI* botAI) \ - { \ - return new ActionNode(spell, /*P*/ NextAction::array(0, new NextAction(pre), nullptr), /*A*/ nullptr, \ - /*C*/ nullptr); \ - } - -// node_name , action, alternative -#define ACTION_NODE_A(name, spell, alt) \ - static ActionNode* name([[maybe_unused]] PlayerbotAI* botAI) \ - { \ - return new ActionNode(spell, /*P*/ nullptr, /*A*/ NextAction::array(0, new NextAction(alt), nullptr), \ - /*C*/ nullptr); \ - } - -// node_name , action, continuer -#define ACTION_NODE_C(name, spell, con) \ - static ActionNode* name([[maybe_unused]] PlayerbotAI* botAI) \ - { \ - return new ActionNode(spell, /*P*/ nullptr, /*A*/ nullptr, \ - /*C*/ NextAction::array(0, new NextAction(con), nullptr)); \ - } - #endif diff --git a/src/strategy/CustomStrategy.cpp b/src/strategy/CustomStrategy.cpp index a056aed5..d4dd3e51 100644 --- a/src/strategy/CustomStrategy.cpp +++ b/src/strategy/CustomStrategy.cpp @@ -6,36 +6,40 @@ #include "CustomStrategy.h" #include +#include #include "Playerbots.h" std::map CustomStrategy::actionLinesCache; -NextAction* toNextAction(std::string const action) +NextAction toNextAction(std::string const action) { std::vector tokens = split(action, '!'); - if (tokens.size() == 2 && !tokens[0].empty()) - return new NextAction(tokens[0], atof(tokens[1].c_str())); - else if (tokens.size() == 1 && !tokens[0].empty()) - return new NextAction(tokens[0], ACTION_NORMAL); + + if (tokens[0].empty()) + throw std::invalid_argument("Invalid action"); + + if (tokens.size() == 2) + return NextAction(tokens[0], atof(tokens[1].c_str())); + + if (tokens.size() == 1) + return NextAction(tokens[0], ACTION_NORMAL); LOG_ERROR("playerbots", "Invalid action {}", action.c_str()); - return nullptr; + + throw std::invalid_argument("Invalid action"); } -NextAction** toNextActionArray(std::string const actions) +std::vector toNextActionArray(const std::string actions) { - std::vector tokens = split(actions, ','); - NextAction** res = new NextAction*[tokens.size() + 1]; + const std::vector tokens = split(actions, ','); + std::vector res = {}; - uint32 index = 0; - for (std::vector::iterator i = tokens.begin(); i != tokens.end(); ++i) + for (const std::string token : tokens) { - if (NextAction* na = toNextAction(*i)) - res[index++] = na; + res.push_back(toNextAction(token)); } - res[index++] = nullptr; return res; } diff --git a/src/strategy/Engine.cpp b/src/strategy/Engine.cpp index 2e36e057..27adcd8b 100644 --- a/src/strategy/Engine.cpp +++ b/src/strategy/Engine.cpp @@ -258,48 +258,45 @@ ActionNode* Engine::CreateActionNode(std::string const name) return node; return new ActionNode(name, - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } -bool Engine::MultiplyAndPush(NextAction** actions, float forceRelevance, bool skipPrerequisites, Event event, - char const* pushType) +bool Engine::MultiplyAndPush( + std::vector actions, + float forceRelevance, + bool skipPrerequisites, + Event event, + char const* pushType +) { bool pushed = false; - if (actions) + + for (NextAction nextAction : actions) { - for (uint32 j = 0; actions[j]; j++) + ActionNode* action = this->CreateActionNode(nextAction.getName()); + + this->InitializeAction(action); + + float k = nextAction.getRelevance(); + + if (forceRelevance > 0.0f) { - if (NextAction* nextAction = actions[j]) - { - ActionNode* action = CreateActionNode(nextAction->getName()); - InitializeAction(action); - - float k = nextAction->getRelevance(); - if (forceRelevance > 0.0f) - { - k = forceRelevance; - } - - if (k > 0) - { - LogAction("PUSH:%s - %f (%s)", action->getName().c_str(), k, pushType); - queue.Push(new ActionBasket(action, k, skipPrerequisites, event)); - pushed = true; - } - else - { - delete action; - } - - delete nextAction; - } - else - break; + k = forceRelevance; } - delete[] actions; + if (k > 0) + { + this->LogAction("PUSH:%s - %f (%s)", action->getName().c_str(), k, pushType); + queue.Push(new ActionBasket(action, k, skipPrerequisites, event)); + pushed = true; + + continue; + } + + delete action; + } return pushed; @@ -530,10 +527,10 @@ std::vector Engine::GetStrategies() void Engine::PushAgain(ActionNode* actionNode, float relevance, Event event) { - NextAction** nextAction = new NextAction*[2]; - nextAction[0] = new NextAction(actionNode->getName(), relevance); - nextAction[1] = nullptr; + std::vector nextAction = { NextAction(actionNode->getName(), relevance) }; + MultiplyAndPush(nextAction, relevance, true, event, "again"); + delete actionNode; } @@ -563,6 +560,13 @@ bool Engine::ListenAndExecute(Action* action, Event event) { bool actionExecuted = false; + if (action == nullptr) + { + LOG_ERROR("playerbots", "Action is nullptr"); + + return actionExecuted; + } + if (actionExecutionListeners.Before(action, event)) { actionExecuted = actionExecutionListeners.AllowExecution(action, event) ? action->Execute(event) : true; diff --git a/src/strategy/Engine.h b/src/strategy/Engine.h index 6b98e04f..8a7c3418 100644 --- a/src/strategy/Engine.h +++ b/src/strategy/Engine.h @@ -90,7 +90,7 @@ public: bool testMode; private: - bool MultiplyAndPush(NextAction** actions, float forceRelevance, bool skipPrerequisites, Event event, + bool MultiplyAndPush(std::vector actions, float forceRelevance, bool skipPrerequisites, Event event, const char* pushType); void Reset(); void ProcessTriggers(bool minimal); diff --git a/src/strategy/Strategy.cpp b/src/strategy/Strategy.cpp index 753615c4..d6193e11 100644 --- a/src/strategy/Strategy.cpp +++ b/src/strategy/Strategy.cpp @@ -28,90 +28,112 @@ public: private: static ActionNode* melee([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("melee", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "melee", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* healthstone([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("healthstone", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("healing potion"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "healthstone", + /*P*/ {}, + /*A*/ { NextAction("healing potion") }, + /*C*/ {} + ); } static ActionNode* follow_master_random([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("be near", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("follow"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "be near", + /*P*/ {}, + /*A*/ { NextAction("follow") }, + /*C*/ {} + ); } static ActionNode* attack_anything([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("attack anything", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "attack anything", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* move_random([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("move random", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("stay line"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "move random", + /*P*/ {}, + /*A*/ { NextAction("stay line") }, + /*C*/ {} + ); } static ActionNode* move_to_loot([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("move to loot", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "move to loot", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* food([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("food", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "food", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* drink([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("drink", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "drink", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* mana_potion([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("mana potion", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "mana potion", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* healing_potion([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("healing potion", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("food"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "healing potion", + /*P*/ {}, + /*A*/ { NextAction("food") }, + /*C*/ {} + ); } static ActionNode* flee([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("flee", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "flee", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } }; diff --git a/src/strategy/Strategy.h b/src/strategy/Strategy.h index 333906fe..8f57bc07 100644 --- a/src/strategy/Strategy.h +++ b/src/strategy/Strategy.h @@ -60,7 +60,7 @@ public: Strategy(PlayerbotAI* botAI); virtual ~Strategy() {} - virtual NextAction** getDefaultActions() { return nullptr; } + virtual std::vector getDefaultActions() { return {}; } virtual void InitTriggers([[maybe_unused]] std::vector& triggers) {} virtual void InitMultipliers([[maybe_unused]] std::vector& multipliers) {} virtual std::string const getName() = 0; diff --git a/src/strategy/Trigger.h b/src/strategy/Trigger.h index 8b391730..d32845dc 100644 --- a/src/strategy/Trigger.h +++ b/src/strategy/Trigger.h @@ -3,8 +3,7 @@ * and/or modify it under version 3 of the License, or (at your option), any later version. */ -#ifndef _PLAYERBOT_TRIGGER_H -#define _PLAYERBOT_TRIGGER_H +#pragma once #include "Action.h" #include "Common.h" @@ -15,7 +14,11 @@ class Unit; class Trigger : public AiNamedObject { public: - Trigger(PlayerbotAI* botAI, std::string const name = "trigger", int32 checkInterval = 1); + Trigger( + PlayerbotAI* botAI, + const std::string name = "trigger", + int32_t checkInterval = 1 + ); virtual ~Trigger() {} @@ -23,7 +26,7 @@ public: virtual void ExternalEvent([[maybe_unused]] std::string const param, [[maybe_unused]] Player* owner = nullptr) {} virtual void ExternalEvent([[maybe_unused]] WorldPacket& packet, [[maybe_unused]] Player* owner = nullptr) {} virtual bool IsActive() { return false; } - virtual NextAction** getHandlers() { return nullptr; } + virtual std::vector getHandlers() { return {}; } void Update() {} virtual void Reset() {} virtual Unit* GetTarget(); @@ -33,32 +36,49 @@ public: bool needCheck(uint32 now); protected: - int32 checkInterval; - uint32 lastCheckTime; + int32_t checkInterval; + uint32_t lastCheckTime; }; class TriggerNode { public: - TriggerNode(std::string const name, NextAction** handlers = nullptr) - : trigger(nullptr), handlers(handlers), name(name) - { - } // reorder args - whipowill - - virtual ~TriggerNode() { NextAction::destroy(handlers); } + TriggerNode( + const std::string& name, + std::vector handlers = {} + ) : + trigger(nullptr), + handlers(std::move(handlers)), + name(name) + {} Trigger* getTrigger() { return trigger; } void setTrigger(Trigger* trigger) { this->trigger = trigger; } - std::string const getName() { return name; } + const std::string getName() { return name; } - NextAction** getHandlers() { return NextAction::merge(NextAction::clone(handlers), trigger->getHandlers()); } + std::vector getHandlers() + { + std::vector result = this->handlers; - float getFirstRelevance() { return handlers[0] ? handlers[0]->getRelevance() : -1; } + if (trigger != nullptr) + { + std::vector extra = trigger->getHandlers(); + result.insert(result.end(), extra.begin(), extra.end()); + } + + return result; + } + + float getFirstRelevance() + { + if (this->handlers.size() > 0) + return this->handlers[0].getRelevance(); + + return -1; + } private: Trigger* trigger; - NextAction** handlers; - std::string const name; + std::vector handlers; + const std::string name; }; - -#endif diff --git a/src/strategy/actions/ChooseRpgTargetAction.cpp b/src/strategy/actions/ChooseRpgTargetAction.cpp index 0d441e9b..a888aa14 100644 --- a/src/strategy/actions/ChooseRpgTargetAction.cpp +++ b/src/strategy/actions/ChooseRpgTargetAction.cpp @@ -78,20 +78,17 @@ float ChooseRpgTargetAction::getMaxRelevance(GuidPosition guidP) if (!trigger->IsActive()) continue; - NextAction** nextActions = triggerNode->getHandlers(); + std::vector nextActions = triggerNode->getHandlers(); bool isRpg = false; - for (int32 i = 0; i < NextAction::size(nextActions); i++) + for (NextAction nextAction : nextActions) { - NextAction* nextAction = nextActions[i]; - - Action* action = botAI->GetAiObjectContext()->GetAction(nextAction->getName()); + Action* action = botAI->GetAiObjectContext()->GetAction(nextAction.getName()); if (dynamic_cast(action)) isRpg = true; } - NextAction::destroy(nextActions); if (isRpg) { diff --git a/src/strategy/actions/GenericSpellActions.cpp b/src/strategy/actions/GenericSpellActions.cpp index b30975ad..af06a457 100644 --- a/src/strategy/actions/GenericSpellActions.cpp +++ b/src/strategy/actions/GenericSpellActions.cpp @@ -265,11 +265,6 @@ CastShootAction::CastShootAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "s } } -NextAction** CastSpellAction::getPrerequisites() -{ - return nullptr; -} - Value* CastDebuffSpellOnAttackerAction::GetTargetValue() { return context->GetValue("attacker without aura", spell); diff --git a/src/strategy/actions/GenericSpellActions.h b/src/strategy/actions/GenericSpellActions.h index e2435a57..b148b93f 100644 --- a/src/strategy/actions/GenericSpellActions.h +++ b/src/strategy/actions/GenericSpellActions.h @@ -27,7 +27,11 @@ public: bool isUseful() override; ActionThreatType getThreatType() override { return ActionThreatType::Single; } - NextAction** getPrerequisites() override; + std::vector getPrerequisites() override + { + return {}; + } + std::string const getSpell() { return spell; } protected: @@ -193,10 +197,12 @@ public: ResurrectPartyMemberAction(PlayerbotAI* botAI, std::string const spell) : CastSpellAction(botAI, spell) {} std::string const GetTargetName() override { return "party member to resurrect"; } - NextAction** getPrerequisites() override + std::vector getPrerequisites() override { - return NextAction::merge(NextAction::array(0, new NextAction("reach party member to resurrect"), NULL), - Action::getPrerequisites()); + return NextAction::merge( + { NextAction("reach party member to resurrect") }, + Action::getPrerequisites() + ); } }; diff --git a/src/strategy/actions/RpgAction.cpp b/src/strategy/actions/RpgAction.cpp index ae6a50fd..6002eaf6 100644 --- a/src/strategy/actions/RpgAction.cpp +++ b/src/strategy/actions/RpgAction.cpp @@ -68,17 +68,15 @@ bool RpgAction::SetNextRpgAction() triggerNode->setTrigger(trigger); - NextAction** nextActions = triggerNode->getHandlers(); + std::vector nextActions = triggerNode->getHandlers(); Trigger* trigger = triggerNode->getTrigger(); bool isChecked = false; - for (int32 i = 0; i < NextAction::size(nextActions); i++) + for (NextAction nextAction : nextActions) { - NextAction* nextAction = nextActions[i]; - - if (nextAction->getRelevance() > 5.0f) + if (nextAction.getRelevance() > 5.0f) continue; if (!isChecked && !trigger->IsActive()) @@ -86,14 +84,13 @@ bool RpgAction::SetNextRpgAction() isChecked = true; - Action* action = botAI->GetAiObjectContext()->GetAction(nextAction->getName()); + Action* action = botAI->GetAiObjectContext()->GetAction(nextAction.getName()); if (!dynamic_cast(action) || !action->isPossible() || !action->isUseful()) continue; actions.push_back(action); - relevances.push_back((nextAction->getRelevance() - 1) * 500); + relevances.push_back((nextAction.getRelevance() - 1) * 500); } - NextAction::destroy(nextActions); } } diff --git a/src/strategy/deathknight/BloodDKStrategy.cpp b/src/strategy/deathknight/BloodDKStrategy.cpp index 1f2793d9..344b3dc0 100644 --- a/src/strategy/deathknight/BloodDKStrategy.cpp +++ b/src/strategy/deathknight/BloodDKStrategy.cpp @@ -12,25 +12,10 @@ class BloodDKStrategyActionNodeFactory : public NamedObjectFactory public: BloodDKStrategyActionNodeFactory() { - // creators["melee"] = &melee; - // creators["blood strike"] = &blood_strike; creators["rune strike"] = &rune_strike; creators["heart strike"] = &heart_strike; creators["death strike"] = &death_strike; - // creators["death grip"] = &death_grip; - // creators["plague strike"] = &plague_strike; - // creators["pestilence"] = &pestilence; creators["icy touch"] = &icy_touch; - // creators["obliterate"] = &obliterate; - // creators["blood boil"] = &blood_boil; - // creators["mark of_blood"] = &mark_of_blood; - // creators["blood presence"] = &blood_presence; - // creators["rune tap"] = &rune_tap; - // creators["vampiric blood"] = &vampiric_blood; - // creators["death pact"] = &death_pact; - // creators["death rune_mastery"] = &death_rune_mastery; - // creators["hysteria"] = &hysteria; - // creators["dancing weapon"] = &dancing_weapon; creators["dark command"] = &dark_command; creators["taunt spell"] = &dark_command; } @@ -38,39 +23,61 @@ public: private: static ActionNode* rune_strike([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("rune strike", - /*P*/ NextAction::array(0, new NextAction("frost presence"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "rune strike", + { + NextAction("frost presence") + }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* icy_touch([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("icy touch", - /*P*/ NextAction::array(0, new NextAction("frost presence"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "icy touch", + { + NextAction("frost presence") + }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* heart_strike([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("heart strike", - /*P*/ NextAction::array(0, new NextAction("frost presence"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "heart strike", + { + NextAction("frost presence") + }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* death_strike([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("death strike", - /*P*/ NextAction::array(0, new NextAction("frost presence"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "death strike", + { + NextAction("frost presence") + }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* dark_command([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("dark command", - /*P*/ NextAction::array(0, new NextAction("frost presence"), NULL), - /*A*/ NextAction::array(0, new NextAction("death grip"), NULL), - /*C*/ NULL); + return new ActionNode( + "dark command", + { + NextAction("frost presence") + }, + /*A*/ { + NextAction("death grip") + }, + /*C*/ {} + ); } }; @@ -79,33 +86,80 @@ BloodDKStrategy::BloodDKStrategy(PlayerbotAI* botAI) : GenericDKStrategy(botAI) actionNodeFactories.Add(new BloodDKStrategyActionNodeFactory()); } -NextAction** BloodDKStrategy::getDefaultActions() +std::vector BloodDKStrategy::getDefaultActions() { - return NextAction::array( - 0, new NextAction("rune strike", ACTION_DEFAULT + 0.8f), new NextAction("icy touch", ACTION_DEFAULT + 0.7f), - new NextAction("heart strike", ACTION_DEFAULT + 0.6f), new NextAction("blood strike", ACTION_DEFAULT + 0.5f), - new NextAction("dancing rune weapon", ACTION_DEFAULT + 0.4f), - new NextAction("death coil", ACTION_DEFAULT + 0.3f), new NextAction("plague strike", ACTION_DEFAULT + 0.2f), - new NextAction("horn of winter", ACTION_DEFAULT + 0.1f), new NextAction("melee", ACTION_DEFAULT), NULL); + return { + NextAction("rune strike", ACTION_DEFAULT + 0.8f), + NextAction("icy touch", ACTION_DEFAULT + 0.7f), + NextAction("heart strike", ACTION_DEFAULT + 0.6f), + NextAction("blood strike", ACTION_DEFAULT + 0.5f), + NextAction("dancing rune weapon", ACTION_DEFAULT + 0.4f), + NextAction("death coil", ACTION_DEFAULT + 0.3f), + NextAction("plague strike", ACTION_DEFAULT + 0.2f), + NextAction("horn of winter", ACTION_DEFAULT + 0.1f), + NextAction("melee", ACTION_DEFAULT) + }; } void BloodDKStrategy::InitTriggers(std::vector& triggers) { GenericDKStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode( - "rune strike", NextAction::array(0, new NextAction("rune strike", ACTION_NORMAL + 3), nullptr))); triggers.push_back( - new TriggerNode("blood tap", NextAction::array(0, new NextAction("blood tap", ACTION_HIGH + 5), nullptr))); + new TriggerNode( + "rune strike", + { + NextAction("rune strike", ACTION_NORMAL + 3) + } + ) + ); triggers.push_back( - new TriggerNode("lose aggro", NextAction::array(0, new NextAction("dark command", ACTION_HIGH + 3), nullptr))); + new TriggerNode( + "blood tap", + { + NextAction("blood tap", ACTION_HIGH + 5) + } + ) + ); triggers.push_back( - new TriggerNode("low health", NextAction::array(0, new NextAction("army of the dead", ACTION_HIGH + 4), - new NextAction("death strike", ACTION_HIGH + 3), nullptr))); + new TriggerNode( + "lose aggro", + { + NextAction("dark command", ACTION_HIGH + 3) + } + ) + ); triggers.push_back( - new TriggerNode("critical health", NextAction::array(0, new NextAction("vampiric blood", ACTION_HIGH + 5), nullptr))); + new TriggerNode( + "low health", + { + NextAction("army of the dead", ACTION_HIGH + 4), + NextAction("death strike", ACTION_HIGH + 3) + } + ) + ); triggers.push_back( - new TriggerNode("icy touch", NextAction::array(0, new NextAction("icy touch", ACTION_HIGH + 2), nullptr))); - triggers.push_back(new TriggerNode( - "plague strike", NextAction::array(0, new NextAction("plague strike", ACTION_HIGH + 2), nullptr))); + new TriggerNode( + "critical health", + { + NextAction("vampiric blood", ACTION_HIGH + 5) + } + ) + ); + triggers.push_back( + new TriggerNode( + "icy touch", + { + NextAction("icy touch", ACTION_HIGH + 2) + } + ) + ); + triggers.push_back( + new TriggerNode( + "plague strike", + { + NextAction("plague strike", ACTION_HIGH + 2) + } + ) + ); } diff --git a/src/strategy/deathknight/BloodDKStrategy.h b/src/strategy/deathknight/BloodDKStrategy.h index e00101ad..590727c9 100644 --- a/src/strategy/deathknight/BloodDKStrategy.h +++ b/src/strategy/deathknight/BloodDKStrategy.h @@ -17,7 +17,7 @@ public: void InitTriggers(std::vector& triggers) override; std::string const getName() override { return "blood"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; uint32 GetType() const override { return STRATEGY_TYPE_TANK | STRATEGY_TYPE_MELEE; } }; diff --git a/src/strategy/deathknight/DKActions.cpp b/src/strategy/deathknight/DKActions.cpp index 2b5ce977..7788e481 100644 --- a/src/strategy/deathknight/DKActions.cpp +++ b/src/strategy/deathknight/DKActions.cpp @@ -11,39 +11,40 @@ #include "SpellInfo.h" #include "SpellMgr.h" -NextAction** CastDeathchillAction::getPrerequisites() +std::vector CastDeathchillAction::getPrerequisites() { - return NextAction::merge(NextAction::array(0, new NextAction("frost presence"), nullptr), + return NextAction::merge({ NextAction("frost presence") }, CastSpellAction::getPrerequisites()); } -NextAction** CastUnholyMeleeSpellAction::getPrerequisites() +std::vector CastUnholyMeleeSpellAction::getPrerequisites() { - return NextAction::merge(NextAction::array(0, new NextAction("unholy presence"), nullptr), + return NextAction::merge({ NextAction("unholy presence") }, CastMeleeSpellAction::getPrerequisites()); } -NextAction** CastFrostMeleeSpellAction::getPrerequisites() +std::vector CastFrostMeleeSpellAction::getPrerequisites() { - return NextAction::merge(NextAction::array(0, new NextAction("frost presence"), nullptr), + return NextAction::merge({ NextAction("frost presence") }, CastMeleeSpellAction::getPrerequisites()); } -NextAction** CastBloodMeleeSpellAction::getPrerequisites() +std::vector CastBloodMeleeSpellAction::getPrerequisites() { - return NextAction::merge(NextAction::array(0, new NextAction("blood presence"), nullptr), + return NextAction::merge({ NextAction("blood presence") }, CastMeleeSpellAction::getPrerequisites()); } bool CastRaiseDeadAction::Execute(Event event) { - bool result = CastBuffSpellAction::Execute(event); + const bool result = CastBuffSpellAction::Execute(event); + if (!result) - { return false; - } - uint32 spellId = AI_VALUE2(uint32, "spell id", spell); - // SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellId); + + const uint32_t spellId = AI_VALUE2(uint32_t, "spell id", spell); + bot->AddSpellCooldown(spellId, 0, 3 * 60 * 1000); + return true; } diff --git a/src/strategy/deathknight/DKActions.h b/src/strategy/deathknight/DKActions.h index a320a233..74e066cd 100644 --- a/src/strategy/deathknight/DKActions.h +++ b/src/strategy/deathknight/DKActions.h @@ -34,7 +34,7 @@ class CastDeathchillAction : public CastBuffSpellAction public: CastDeathchillAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "deathchill") {} - NextAction** getPrerequisites() override; + std::vector getPrerequisites() override; }; class CastDarkCommandAction : public CastSpellAction @@ -52,7 +52,7 @@ class CastUnholyMeleeSpellAction : public CastMeleeSpellAction public: CastUnholyMeleeSpellAction(PlayerbotAI* botAI, std::string const spell) : CastMeleeSpellAction(botAI, spell) {} - NextAction** getPrerequisites() override; + std::vector getPrerequisites() override; }; // Frost presence @@ -61,7 +61,7 @@ class CastFrostMeleeSpellAction : public CastMeleeSpellAction public: CastFrostMeleeSpellAction(PlayerbotAI* botAI, std::string const spell) : CastMeleeSpellAction(botAI, spell) {} - NextAction** getPrerequisites() override; + std::vector getPrerequisites() override; }; // Blood presence @@ -70,7 +70,7 @@ class CastBloodMeleeSpellAction : public CastMeleeSpellAction public: CastBloodMeleeSpellAction(PlayerbotAI* botAI, std::string const spell) : CastMeleeSpellAction(botAI, spell) {} - NextAction** getPrerequisites() override; + std::vector getPrerequisites() override; }; class CastRuneStrikeAction : public CastMeleeSpellAction @@ -79,10 +79,6 @@ public: CastRuneStrikeAction(PlayerbotAI* botAI) : CastMeleeSpellAction(botAI, "rune strike") {} }; -// debuff -// BEGIN_DEBUFF_ACTION(CastPestilenceAction, "pestilence") -// END_SPELL_ACTION() - class CastPestilenceAction : public CastSpellAction { public: @@ -90,20 +86,12 @@ public: ActionThreatType getThreatType() override { return ActionThreatType::None; } }; -// debuff -// BEGIN_DEBUFF_ACTION(CastHowlingBlastAction, "howling blast") -// END_SPELL_ACTION() - class CastHowlingBlastAction : public CastSpellAction { public: CastHowlingBlastAction(PlayerbotAI* ai) : CastSpellAction(ai, "howling blast") {} }; -// debuff it -// BEGIN_DEBUFF_ACTION(CastIcyTouchAction, "icy touch") -// END_SPELL_ACTION() - class CastIcyTouchAction : public CastSpellAction { public: @@ -126,8 +114,6 @@ class CastPlagueStrikeAction : public CastSpellAction public: CastPlagueStrikeAction(PlayerbotAI* ai) : CastSpellAction(ai, "plague strike") {} }; -// BEGIN_DEBUFF_ACTION(CastPlagueStrikeAction, "plague strike") -// END_SPELL_ACTION() class CastPlagueStrikeOnAttackerAction : public CastDebuffSpellOnMeleeAttackerAction { diff --git a/src/strategy/deathknight/FrostDKStrategy.cpp b/src/strategy/deathknight/FrostDKStrategy.cpp index f25fa682..d0b0ee20 100644 --- a/src/strategy/deathknight/FrostDKStrategy.cpp +++ b/src/strategy/deathknight/FrostDKStrategy.cpp @@ -16,66 +16,68 @@ public: creators["obliterate"] = &obliterate; creators["howling blast"] = &howling_blast; creators["frost strike"] = &frost_strike; - // creators["chains of ice"] = &chains_of_ice; creators["rune strike"] = &rune_strike; - // creators["icy clutch"] = &icy_clutch; - // creators["horn of winter"] = &horn_of_winter; - // creators["killing machine"] = &killing_machine; - // creators["frost presence"] = &frost_presence; - // creators["deathchill"] = &deathchill; - // creators["icebound fortitude"] = &icebound_fortitude; - // creators["mind freeze"] = &mind_freeze; - // creators["hungering cold"] = &hungering_cold; creators["unbreakable armor"] = &unbreakable_armor; - // creators["improved icy talons"] = &improved_icy_talons; } private: static ActionNode* icy_touch([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("icy touch", - /*P*/ NextAction::array(0, new NextAction("blood presence"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "icy touch", + /*P*/ { NextAction("blood presence") }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* obliterate([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("obliterate", - /*P*/ NextAction::array(0, new NextAction("blood presence"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "obliterate", + /*P*/ { NextAction("blood presence") }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* rune_strike([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("rune strike", - /*P*/ NextAction::array(0, new NextAction("blood presence"), nullptr), - /*A*/ NextAction::array(0, new NextAction("melee"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "rune strike", + /*P*/ { NextAction("blood presence") }, + /*A*/ { NextAction("melee") }, + /*C*/ {} + ); } static ActionNode* frost_strike([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("frost strike", - /*P*/ NextAction::array(0, new NextAction("blood presence"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "frost strike", + /*P*/ { NextAction("blood presence") }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* howling_blast([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("howling blast", - /*P*/ NextAction::array(0, new NextAction("blood presence"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "howling blast", + /*P*/ { NextAction("blood presence") }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* unbreakable_armor([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("unbreakable armor", - /*P*/ NextAction::array(0, new NextAction("blood tap"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "unbreakable armor", + /*P*/ { NextAction("blood tap") }, + /*A*/ {}, + /*C*/ {} + ); } }; @@ -84,41 +86,84 @@ FrostDKStrategy::FrostDKStrategy(PlayerbotAI* botAI) : GenericDKStrategy(botAI) actionNodeFactories.Add(new FrostDKStrategyActionNodeFactory()); } -NextAction** FrostDKStrategy::getDefaultActions() +std::vector FrostDKStrategy::getDefaultActions() { - return NextAction::array( - 0, new NextAction("obliterate", ACTION_DEFAULT + 0.7f), - new NextAction("frost strike", ACTION_DEFAULT + 0.4f), - new NextAction("empower rune weapon", ACTION_DEFAULT + 0.3f), - new NextAction("horn of winter", ACTION_DEFAULT + 0.1f), new NextAction("melee", ACTION_DEFAULT), NULL); + return { + NextAction("obliterate", ACTION_DEFAULT + 0.7f), + NextAction("frost strike", ACTION_DEFAULT + 0.4f), + NextAction("empower rune weapon", ACTION_DEFAULT + 0.3f), + NextAction("horn of winter", ACTION_DEFAULT + 0.1f), + NextAction("melee", ACTION_DEFAULT) + }; } void FrostDKStrategy::InitTriggers(std::vector& triggers) { GenericDKStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode( - "unbreakable armor", NextAction::array(0, new NextAction("unbreakable armor", ACTION_DEFAULT + 0.6f), nullptr))); - - triggers.push_back(new TriggerNode( - "freezing fog", NextAction::array(0, new NextAction("howling blast", ACTION_DEFAULT + 0.5f), nullptr))); - - triggers.push_back(new TriggerNode( - "high blood rune", NextAction::array(0, new NextAction("blood strike", ACTION_DEFAULT + 0.2f), nullptr))); - - triggers.push_back(new TriggerNode( - "army of the dead", NextAction::array(0, new NextAction("army of the dead", ACTION_HIGH + 6), nullptr))); + triggers.push_back( + new TriggerNode( + "unbreakable armor", + { + NextAction("unbreakable armor", ACTION_DEFAULT + 0.6f) + } + ) + ); triggers.push_back( - new TriggerNode("icy touch", NextAction::array(0, new NextAction("icy touch", ACTION_HIGH + 2), nullptr))); - triggers.push_back(new TriggerNode( - "plague strike", NextAction::array(0, new NextAction("plague strike", ACTION_HIGH + 2), nullptr))); - // triggers.push_back(new TriggerNode("empower rune weapon", NextAction::array(0, new NextAction("empower rune - // weapon", ACTION_NORMAL + 4), nullptr))); + new TriggerNode( + "freezing fog", + { + NextAction("howling blast", ACTION_DEFAULT + 0.5f) + } + ) + ); + + triggers.push_back( + new TriggerNode( + "high blood rune", + { + NextAction("blood strike", ACTION_DEFAULT + 0.2f) + } + ) + ); + + triggers.push_back( + new TriggerNode( + "army of the dead", + { + NextAction("army of the dead", ACTION_HIGH + 6) + } + ) + ); + + triggers.push_back( + new TriggerNode( + "icy touch", + { + NextAction("icy touch", ACTION_HIGH + 2) + } + ) + ); + triggers.push_back( + new TriggerNode( + "plague strike", + { + NextAction("plague strike", ACTION_HIGH + 2) + } + ) + ); + } void FrostDKAoeStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( - new TriggerNode("medium aoe", NextAction::array(0, new NextAction("howling blast", ACTION_HIGH + 4), nullptr))); + new TriggerNode( + "medium aoe", + { + NextAction("howling blast", ACTION_HIGH + 4) + } + ) + ); } diff --git a/src/strategy/deathknight/FrostDKStrategy.h b/src/strategy/deathknight/FrostDKStrategy.h index c305621a..94833919 100644 --- a/src/strategy/deathknight/FrostDKStrategy.h +++ b/src/strategy/deathknight/FrostDKStrategy.h @@ -17,7 +17,7 @@ public: void InitTriggers(std::vector& triggers) override; std::string const getName() override { return "frost"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; uint32 GetType() const override { return STRATEGY_TYPE_COMBAT | STRATEGY_TYPE_DPS | STRATEGY_TYPE_MELEE; } }; diff --git a/src/strategy/deathknight/GenericDKNonCombatStrategy.cpp b/src/strategy/deathknight/GenericDKNonCombatStrategy.cpp index 5c095d29..edead067 100644 --- a/src/strategy/deathknight/GenericDKNonCombatStrategy.cpp +++ b/src/strategy/deathknight/GenericDKNonCombatStrategy.cpp @@ -20,17 +20,17 @@ private: static ActionNode* bone_shield([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("bone shield", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* horn_of_winter([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("horn of winter", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } }; @@ -44,19 +44,18 @@ void GenericDKNonCombatStrategy::InitTriggers(std::vector& trigger NonCombatStrategy::InitTriggers(triggers); triggers.push_back( - new TriggerNode("no pet", NextAction::array(0, new NextAction("raise dead", ACTION_NORMAL + 1), nullptr))); + new TriggerNode("no pet", { NextAction("raise dead", ACTION_NORMAL + 1) })); triggers.push_back( - new TriggerNode("horn of winter", NextAction::array(0, new NextAction("horn of winter", 21.0f), nullptr))); + new TriggerNode("horn of winter", { NextAction("horn of winter", 21.0f) })); triggers.push_back( - new TriggerNode("bone shield", NextAction::array(0, new NextAction("bone shield", 21.0f), nullptr))); + new TriggerNode("bone shield", { NextAction("bone shield", 21.0f) })); triggers.push_back( - new TriggerNode("has pet", NextAction::array(0, new NextAction("toggle pet spell", 60.0f), NULL))); + new TriggerNode("has pet", { NextAction("toggle pet spell", 60.0f) })); triggers.push_back( - new TriggerNode("new pet", NextAction::array(0, new NextAction("set pet stance", 60.0f), NULL))); + new TriggerNode("new pet", { NextAction("set pet stance", 60.0f) })); } void DKBuffDpsStrategy::InitTriggers(std::vector& triggers) { - // triggers.push_back(new TriggerNode("improved icy talons", NextAction::array(0, new NextAction("improved icy - // talons", 19.0f), nullptr))); + } diff --git a/src/strategy/deathknight/GenericDKStrategy.cpp b/src/strategy/deathknight/GenericDKStrategy.cpp index 4d52cbc3..61ff8c74 100644 --- a/src/strategy/deathknight/GenericDKStrategy.cpp +++ b/src/strategy/deathknight/GenericDKStrategy.cpp @@ -54,105 +54,105 @@ private: static ActionNode* death_coil([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("death coil", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* death_grip([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("death grip", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("icy touch"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("icy touch") }, + /*C*/ {}); } static ActionNode* plague_strike([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("plague strike", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* icy_touch([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("icy touch", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* heart_strike([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("heart strike", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* pestilence([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("pestilence", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* horn_of_winter([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("horn of winter", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* bone_shield([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("bone shield", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* killing_machine([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("killing machine", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("improved icy talons"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("improved icy talons") }, + /*C*/ {}); } static ActionNode* corpse_explosion([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("corpse explosion", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* death_and_decay([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("death and decay", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* anti_magic_zone([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("anti magic zone", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("anti magic shell"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("anti magic shell") }, + /*C*/ {}); } static ActionNode* icebound_fortitude([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("icebound fortitude", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } }; @@ -165,36 +165,29 @@ void GenericDKStrategy::InitTriggers(std::vector& triggers) { MeleeCombatStrategy::InitTriggers(triggers); - // triggers.push_back(new TriggerNode("high aoe", NextAction::array(0, new NextAction("anti magic shell", - // ACTION_NORMAL + 3), nullptr))); triggers.push_back(new TriggerNode("death coil", NextAction::array(0, new - // NextAction("death coil", ACTION_NORMAL + 3), nullptr))); triggers.push_back(new TriggerNode("critical aoe heal", - // NextAction::array(0, new NextAction("anti magic zone", ACTION_EMERGENCY + 1), nullptr))); triggers.push_back( - new TriggerNode("no pet", NextAction::array(0, new NextAction("raise dead", ACTION_NORMAL + 5), nullptr))); + new TriggerNode("no pet", { NextAction("raise dead", ACTION_NORMAL + 5) })); triggers.push_back( - new TriggerNode("has pet", NextAction::array(0, new NextAction("toggle pet spell", 60.0f), nullptr))); + new TriggerNode("has pet", { NextAction("toggle pet spell", 60.0f) })); triggers.push_back( - new TriggerNode("new pet", NextAction::array(0, new NextAction("set pet stance", 60.0f), nullptr))); + new TriggerNode("new pet", { NextAction("set pet stance", 60.0f) })); triggers.push_back( - new TriggerNode("mind freeze", NextAction::array(0, new NextAction("mind freeze", ACTION_HIGH + 1), nullptr))); + new TriggerNode("mind freeze", { NextAction("mind freeze", ACTION_HIGH + 1) })); triggers.push_back( new TriggerNode("mind freeze on enemy healer", - NextAction::array(0, new NextAction("mind freeze on enemy healer", ACTION_HIGH + 1), nullptr))); + { NextAction("mind freeze on enemy healer", ACTION_HIGH + 1) })); triggers.push_back(new TriggerNode( - "horn of winter", NextAction::array(0, new NextAction("horn of winter", ACTION_NORMAL + 1), nullptr))); + "horn of winter", { NextAction("horn of winter", ACTION_NORMAL + 1) })); triggers.push_back(new TriggerNode("critical health", - NextAction::array(0, new NextAction("death pact", ACTION_HIGH + 5), nullptr))); + { NextAction("death pact", ACTION_HIGH + 5) })); triggers.push_back( - new TriggerNode("low health", NextAction::array(0, new NextAction("icebound fortitude", ACTION_HIGH + 5), - new NextAction("rune tap", ACTION_HIGH + 4), nullptr))); + new TriggerNode("low health", { NextAction("icebound fortitude", ACTION_HIGH + 5), + NextAction("rune tap", ACTION_HIGH + 4) })); triggers.push_back( - new TriggerNode("medium aoe", NextAction::array(0, new NextAction("death and decay", ACTION_HIGH + 9), - new NextAction("pestilence", ACTION_NORMAL + 4), - new NextAction("blood boil", ACTION_NORMAL + 3), nullptr))); - // triggers.push_back(new TriggerNode("light aoe", NextAction::array(0, - // new NextAction("pestilence", ACTION_NORMAL + 4), - // nullptr))); + new TriggerNode("medium aoe", { NextAction("death and decay", ACTION_HIGH + 9), + NextAction("pestilence", ACTION_NORMAL + 4), + NextAction("blood boil", ACTION_NORMAL + 3) })); triggers.push_back( - new TriggerNode("pestilence glyph", NextAction::array(0, new NextAction("pestilence", ACTION_HIGH + 9), NULL))); + new TriggerNode("pestilence glyph", { NextAction("pestilence", ACTION_HIGH + 9) })); } diff --git a/src/strategy/deathknight/UnholyDKStrategy.cpp b/src/strategy/deathknight/UnholyDKStrategy.cpp index 1740ec39..d94a94ec 100644 --- a/src/strategy/deathknight/UnholyDKStrategy.cpp +++ b/src/strategy/deathknight/UnholyDKStrategy.cpp @@ -1,4 +1,4 @@ -#/* +/* * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license, you may redistribute it and/or modify it under version 3 of the License, or (at your option), any later version. */ @@ -11,21 +11,8 @@ class UnholyDKStrategyActionNodeFactory : public NamedObjectFactory public: UnholyDKStrategyActionNodeFactory() { - // Unholy - // creators["bone shield"] = &bone_shield; - // creators["plague strike"] = &plague_strike; - // creators["death grip"] = &death_grip; - // creators["death coil"] = &death_coil; creators["death strike"] = &death_strike; - // creators["unholy blight"] = &unholy_blight; creators["scourge strike"] = &scourge_strike; - // creators["death and decay"] = &death_and_decay; - // creators["unholy pressence"] = &unholy_pressence; - // creators["raise dead"] = &raise_dead; - // creators["army of the dead"] = &army of the dead; - // creators["summon gargoyle"] = &army of the dead; - // creators["anti magic shell"] = &anti_magic_shell; - // creators["anti magic zone"] = &anti_magic_zone; creators["ghoul frenzy"] = &ghoul_frenzy; creators["corpse explosion"] = &corpse_explosion; creators["icy touch"] = &icy_touch; @@ -34,39 +21,49 @@ public: private: static ActionNode* death_strike([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("death strike", - /*P*/ NextAction::array(0, new NextAction("blood presence"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "death strike", + /*P*/ { NextAction("blood presence") }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* ghoul_frenzy([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("ghoul frenzy", - /*P*/ NextAction::array(0, new NextAction("blood presence"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "ghoul frenzy", + /*P*/ { NextAction("blood presence") }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* corpse_explosion([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("corpse explosion", - /*P*/ NextAction::array(0, new NextAction("blood presence"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "corpse explosion", + /*P*/ { NextAction("blood presence") }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* scourge_strike([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("scourge strike", - /*P*/ NextAction::array(0, new NextAction("blood presence"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "scourge strike", + /*P*/ { NextAction("blood presence") }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* icy_touch([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("icy touch", - /*P*/ NextAction::array(0, new NextAction("blood presence"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "icy touch", + /*P*/ { NextAction("blood presence") }, + /*A*/ {}, + /*C*/ {} + ); } }; @@ -75,69 +72,121 @@ UnholyDKStrategy::UnholyDKStrategy(PlayerbotAI* botAI) : GenericDKStrategy(botAI actionNodeFactories.Add(new UnholyDKStrategyActionNodeFactory()); } -NextAction** UnholyDKStrategy::getDefaultActions() +std::vector UnholyDKStrategy::getDefaultActions() { - return NextAction::array( - 0, new NextAction("death and decay", ACTION_HIGH + 5), - new NextAction("summon gargoyle", ACTION_DEFAULT + 0.4f), - // new NextAction("empower rune weapon", ACTION_DEFAULT + 0.3f), - new NextAction("horn of winter", ACTION_DEFAULT + 0.2f), - new NextAction("death coil", ACTION_DEFAULT + 0.1f), - new NextAction("melee", ACTION_DEFAULT), nullptr); + return { + NextAction("death and decay", ACTION_HIGH + 5), + NextAction("summon gargoyle", ACTION_DEFAULT + 0.4f), + NextAction("horn of winter", ACTION_DEFAULT + 0.2f), + NextAction("death coil", ACTION_DEFAULT + 0.1f), + NextAction("melee", ACTION_DEFAULT) + }; } void UnholyDKStrategy::InitTriggers(std::vector& triggers) { GenericDKStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode( - "death and decay cooldown", NextAction::array(0, - new NextAction("ghoul frenzy", ACTION_DEFAULT + 0.9f), - new NextAction("scourge strike", ACTION_DEFAULT + 0.8f), - new NextAction("icy touch", ACTION_DEFAULT + 0.7f), - new NextAction("blood strike", ACTION_DEFAULT + 0.6f), - new NextAction("plague strike", ACTION_DEFAULT + 0.5f), - nullptr))); - - triggers.push_back(new TriggerNode("dd cd and no desolation", - NextAction::array(0, new NextAction("blood strike", ACTION_DEFAULT + 0.75f), nullptr))); - - // triggers.push_back( - // new TriggerNode("icy touch", NextAction::array(0, new NextAction("icy touch", ACTION_HIGH + 2), nullptr))); - // triggers.push_back(new TriggerNode( - // "plague strike", NextAction::array(0, new NextAction("plague strike", ACTION_HIGH + 1), nullptr))); - - triggers.push_back(new TriggerNode( - "high frost rune", NextAction::array(0, - new NextAction("icy touch", ACTION_NORMAL + 3), nullptr))); - - triggers.push_back(new TriggerNode( - "high blood rune", NextAction::array(0, new NextAction("blood strike", ACTION_NORMAL + 2), nullptr))); - - triggers.push_back(new TriggerNode( - "high unholy rune", NextAction::array(0, - new NextAction("plague strike", ACTION_NORMAL + 1), nullptr))); triggers.push_back( - new TriggerNode("dd cd and plague strike 3s", NextAction::array(0, new NextAction("plague strike", ACTION_HIGH + 1), nullptr))); + new TriggerNode( + "death and decay cooldown", + { + NextAction("ghoul frenzy", ACTION_DEFAULT + 0.9f), + NextAction("scourge strike", ACTION_DEFAULT + 0.8f), + NextAction("icy touch", ACTION_DEFAULT + 0.7f), + NextAction("blood strike", ACTION_DEFAULT + 0.6f), + NextAction("plague strike", ACTION_DEFAULT + 0.5f), + } + ) + ); triggers.push_back( - new TriggerNode("dd cd and icy touch 3s", NextAction::array(0, new NextAction("icy touch", ACTION_HIGH + 2), nullptr))); - + new TriggerNode( + "dd cd and no desolation", + { + NextAction("blood strike", ACTION_DEFAULT + 0.75f) + } + ) + ); triggers.push_back( - new TriggerNode("no rune", NextAction::array(0, new NextAction("empower rune weapon", ACTION_HIGH + 1), nullptr))); - - // triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction(, ACTION_NORMAL + 2), nullptr))); - triggers.push_back(new TriggerNode( - "army of the dead", NextAction::array(0, new NextAction("army of the dead", ACTION_HIGH + 6), nullptr))); + new TriggerNode( + "high frost rune", + { + NextAction("icy touch", ACTION_NORMAL + 3) + } + ) + ); triggers.push_back( - new TriggerNode("bone shield", NextAction::array(0, new NextAction("bone shield", ACTION_HIGH + 3), nullptr))); + new TriggerNode( + "high blood rune", + { + NextAction("blood strike", ACTION_NORMAL + 2) + } + ) + ); + triggers.push_back( + new TriggerNode( + "high unholy rune", + { + NextAction("plague strike", ACTION_NORMAL + 1) + } + ) + ); + triggers.push_back( + new TriggerNode("dd cd and plague strike 3s", + { + NextAction("plague strike", ACTION_HIGH + 1) + } + ) + ); + triggers.push_back( + new TriggerNode("dd cd and icy touch 3s", + { + NextAction("icy touch", ACTION_HIGH + 2) + } + ) + ); + triggers.push_back( + new TriggerNode("no rune", + { + NextAction("empower rune weapon", ACTION_HIGH + 1) + } + ) + ); + triggers.push_back( + new TriggerNode( + "army of the dead", + { + NextAction("army of the dead", ACTION_HIGH + 6) + } + ) + ); + triggers.push_back( + new TriggerNode("bone shield", + { + NextAction("bone shield", ACTION_HIGH + 3) + } + ) + ); } void UnholyDKAoeStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode( - "loot available", NextAction::array(0, new NextAction("corpse explosion", ACTION_NORMAL + 1), nullptr))); - triggers.push_back(new TriggerNode( - "medium aoe", NextAction::array(0, new NextAction("death and decay", ACTION_NORMAL + 3), - new NextAction("corpse explosion", ACTION_NORMAL + 3), nullptr))); + triggers.push_back( + new TriggerNode( + "loot available", + { + NextAction("corpse explosion", ACTION_NORMAL + 1) + } + ) + ); + triggers.push_back( + new TriggerNode( + "medium aoe", + { + NextAction("death and decay", ACTION_NORMAL + 3), + NextAction("corpse explosion", ACTION_NORMAL + 3) + } + ) + ); } diff --git a/src/strategy/deathknight/UnholyDKStrategy.h b/src/strategy/deathknight/UnholyDKStrategy.h index 512ddb0d..65ee65d9 100644 --- a/src/strategy/deathknight/UnholyDKStrategy.h +++ b/src/strategy/deathknight/UnholyDKStrategy.h @@ -17,7 +17,7 @@ public: void InitTriggers(std::vector& triggers) override; std::string const getName() override { return "unholy"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; uint32 GetType() const override { return STRATEGY_TYPE_COMBAT | STRATEGY_TYPE_DPS | STRATEGY_TYPE_MELEE; } }; diff --git a/src/strategy/druid/BearTankDruidStrategy.cpp b/src/strategy/druid/BearTankDruidStrategy.cpp index 42bb81c4..4a60fbd3 100644 --- a/src/strategy/druid/BearTankDruidStrategy.cpp +++ b/src/strategy/druid/BearTankDruidStrategy.cpp @@ -30,107 +30,132 @@ public: private: static ActionNode* melee([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("melee", - /*P*/ NextAction::array(0, new NextAction("feral charge - bear"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "melee", + /*P*/ { NextAction("feral charge - bear") }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* feral_charge_bear([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("feral charge - bear", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("reach melee"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "feral charge - bear", + /*P*/ {}, + /*A*/ { NextAction("reach melee") }, + /*C*/ {} + ); } static ActionNode* swipe_bear([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("swipe (bear)", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "swipe (bear)", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* faerie_fire_feral([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("faerie fire (feral)", - /*P*/ NextAction::array(0, new NextAction("feral charge - bear"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "faerie fire (feral)", + /*P*/ { NextAction("feral charge - bear") }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* bear_form([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("bear form", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "bear form", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* dire_bear_form([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("dire bear form", - /*P*/ NextAction::array(0, new NextAction("caster form"), nullptr), - /*A*/ NextAction::array(0, new NextAction("bear form"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "dire bear form", + /*P*/ { NextAction("caster form") }, + /*A*/ { NextAction("bear form") }, + /*C*/ {} + ); } static ActionNode* mangle_bear([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("mangle (bear)", - /*P*/ nullptr, - // /*A*/ NextAction::array(0, new NextAction("lacerate"), nullptr), - nullptr, - /*C*/ nullptr); + return new ActionNode( + "mangle (bear)", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* maul([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("maul", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("melee"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "maul", + /*P*/ {}, + /*A*/ { NextAction("melee") }, + /*C*/ {} + ); } static ActionNode* bash([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("bash", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("melee"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "bash", + /*P*/ {}, + /*A*/ { NextAction("melee") }, + /*C*/ {} + ); } static ActionNode* swipe([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("swipe", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("melee"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "swipe", + /*P*/ {}, + /*A*/ { NextAction("melee") }, + /*C*/ {} + ); } static ActionNode* lacerate([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("lacerate", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("maul"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "lacerate", + /*P*/ {}, + /*A*/ { NextAction("maul") }, + /*C*/ {} + ); } static ActionNode* growl([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("growl", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "growl", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* demoralizing_roar([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("demoralizing roar", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "demoralizing roar", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } }; @@ -139,38 +164,93 @@ BearTankDruidStrategy::BearTankDruidStrategy(PlayerbotAI* botAI) : FeralDruidStr actionNodeFactories.Add(new BearTankDruidStrategyActionNodeFactory()); } -NextAction** BearTankDruidStrategy::getDefaultActions() +std::vector BearTankDruidStrategy::getDefaultActions() { - return NextAction::array( - 0, new NextAction("mangle (bear)", ACTION_DEFAULT + 0.5f), - new NextAction("faerie fire (feral)", ACTION_DEFAULT + 0.4f), new NextAction("lacerate", ACTION_DEFAULT + 0.3f), - new NextAction("maul", ACTION_DEFAULT + 0.2f), new NextAction("enrage", ACTION_DEFAULT + 0.1f), - new NextAction("melee", ACTION_DEFAULT), nullptr); + return { + NextAction("mangle (bear)", ACTION_DEFAULT + 0.5f), + NextAction("faerie fire (feral)", ACTION_DEFAULT + 0.4f), + NextAction("lacerate", ACTION_DEFAULT + 0.3f), + NextAction("maul", ACTION_DEFAULT + 0.2f), + NextAction("enrage", ACTION_DEFAULT + 0.1f), + NextAction("melee", ACTION_DEFAULT) + }; } void BearTankDruidStrategy::InitTriggers(std::vector& triggers) { FeralDruidStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode( - "enemy out of melee", NextAction::array(0, new NextAction("feral charge - bear", ACTION_NORMAL + 8), nullptr))); - // triggers.push_back(new TriggerNode("thorns", NextAction::array(0, new NextAction("thorns", ACTION_HIGH + 9), - // nullptr))); + triggers.push_back( - new TriggerNode("bear form", NextAction::array(0, new NextAction("dire bear form", ACTION_HIGH + 8), nullptr))); - triggers.push_back(new TriggerNode( - "low health", NextAction::array(0, new NextAction("frenzied regeneration", ACTION_HIGH + 7), nullptr))); - triggers.push_back(new TriggerNode( - "faerie fire (feral)", NextAction::array(0, new NextAction("faerie fire (feral)", ACTION_HIGH + 7), nullptr))); + new TriggerNode( + "enemy out of melee", + { + NextAction("feral charge - bear", ACTION_NORMAL + 8) + } + ) + ); triggers.push_back( - new TriggerNode("lose aggro", NextAction::array(0, new NextAction("growl", ACTION_HIGH + 8), nullptr))); + new TriggerNode( + "bear form", + { + NextAction("dire bear form", ACTION_HIGH + 8) + } + ) + ); triggers.push_back( - new TriggerNode("medium aoe", NextAction::array(0, new NextAction("demoralizing roar", ACTION_HIGH + 6), - new NextAction("swipe (bear)", ACTION_HIGH + 6), nullptr))); + new TriggerNode( + "low health", + { + NextAction("frenzied regeneration", ACTION_HIGH + 7) + } + ) + ); triggers.push_back( - new TriggerNode("light aoe", NextAction::array(0, new NextAction("swipe (bear)", ACTION_HIGH + 5), nullptr))); + new TriggerNode( + "faerie fire (feral)", + { + NextAction("faerie fire (feral)", ACTION_HIGH + 7) + } + ) + ); triggers.push_back( - new TriggerNode("bash", NextAction::array(0, new NextAction("bash", ACTION_INTERRUPT + 2), nullptr))); + new TriggerNode( + "lose aggro", + { + NextAction("growl", ACTION_HIGH + 8) + } + ) + ); triggers.push_back( - new TriggerNode("bash on enemy healer", - NextAction::array(0, new NextAction("bash on enemy healer", ACTION_INTERRUPT + 1), nullptr))); + new TriggerNode( + "medium aoe", + { + NextAction("demoralizing roar", ACTION_HIGH + 6), + NextAction("swipe (bear)", ACTION_HIGH + 6) + } + ) + ); + triggers.push_back( + new TriggerNode( + "light aoe", + { + NextAction("swipe (bear)", ACTION_HIGH + 5) + } + ) + ); + triggers.push_back( + new TriggerNode( + "bash", + { + NextAction("bash", ACTION_INTERRUPT + 2) + } + ) + ); + triggers.push_back( + new TriggerNode( + "bash on enemy healer", + { + NextAction("bash on enemy healer", ACTION_INTERRUPT + 1) + } + ) + ); } diff --git a/src/strategy/druid/BearTankDruidStrategy.h b/src/strategy/druid/BearTankDruidStrategy.h index 9b0595a1..2019bd0e 100644 --- a/src/strategy/druid/BearTankDruidStrategy.h +++ b/src/strategy/druid/BearTankDruidStrategy.h @@ -17,7 +17,7 @@ public: void InitTriggers(std::vector& triggers) override; std::string const getName() override { return "bear"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; uint32 GetType() const override { return STRATEGY_TYPE_TANK | STRATEGY_TYPE_MELEE; } }; diff --git a/src/strategy/druid/CasterDruidStrategy.cpp b/src/strategy/druid/CasterDruidStrategy.cpp index 657fedaa..a91f3b54 100644 --- a/src/strategy/druid/CasterDruidStrategy.cpp +++ b/src/strategy/druid/CasterDruidStrategy.cpp @@ -28,82 +28,102 @@ public: private: static ActionNode* faerie_fire([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("faerie fire", - /*P*/ NextAction::array(0, new NextAction("moonkin form"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "faerie fire", + /*P*/ { NextAction("moonkin form") }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* hibernate([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("hibernate", - /*P*/ NextAction::array(0, new NextAction("moonkin form"), nullptr), - /*A*/ NextAction::array(0, new NextAction("entangling roots"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "hibernate", + /*P*/ { NextAction("moonkin form") }, + /*A*/ { NextAction("entangling roots") }, + /*C*/ {} + ); } static ActionNode* entangling_roots([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("entangling roots", - /*P*/ NextAction::array(0, new NextAction("moonkin form"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "entangling roots", + /*P*/ { NextAction("moonkin form") }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* entangling_roots_on_cc([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("entangling roots on cc", - /*P*/ NextAction::array(0, new NextAction("moonkin form"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "entangling roots on cc", + /*P*/ { NextAction("moonkin form") }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* wrath([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("wrath", - /*P*/ NextAction::array(0, new NextAction("moonkin form"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "wrath", + /*P*/ { NextAction("moonkin form") }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* starfall([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("starfall", - /*P*/ NextAction::array(0, new NextAction("moonkin form"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "starfall", + /*P*/ { NextAction("moonkin form") }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* insect_swarm([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("insect swarm", - /*P*/ NextAction::array(0, new NextAction("moonkin form"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "insect swarm", + /*P*/ { NextAction("moonkin form") }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* moonfire([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("moonfire", - /*P*/ NextAction::array(0, new NextAction("moonkin form"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "moonfire", + /*P*/ { NextAction("moonkin form") }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* starfire([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("starfire", - /*P*/ NextAction::array(0, new NextAction("moonkin form"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "starfire", + /*P*/ { NextAction("moonkin form") }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* moonkin_form([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("moonkin form", - /*P*/ NextAction::array(0, new NextAction("caster form"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "moonkin form", + /*P*/ { NextAction("caster form") }, + /*A*/ {}, + /*C*/ {} + ); } }; @@ -113,55 +133,122 @@ CasterDruidStrategy::CasterDruidStrategy(PlayerbotAI* botAI) : GenericDruidStrat actionNodeFactories.Add(new ShapeshiftDruidStrategyActionNodeFactory()); } -NextAction** CasterDruidStrategy::getDefaultActions() +std::vector CasterDruidStrategy::getDefaultActions() { - return NextAction::array(0, - new NextAction("starfall", ACTION_HIGH + 1.0f), - new NextAction("force of nature", ACTION_DEFAULT + 1.0f), - new NextAction("wrath", ACTION_DEFAULT + 0.1f), - // new NextAction("starfire", ACTION_NORMAL), - nullptr); + return { + NextAction("starfall", ACTION_HIGH + 1.0f), + NextAction("force of nature", ACTION_DEFAULT + 1.0f), + NextAction("wrath", ACTION_DEFAULT + 0.1f), + }; } void CasterDruidStrategy::InitTriggers(std::vector& triggers) { GenericDruidStrategy::InitTriggers(triggers); - // triggers.push_back(new TriggerNode("enemy out of spell", NextAction::array(0, new NextAction("reach spell", - // ACTION_MOVE), nullptr))); - triggers.push_back(new TriggerNode("eclipse (lunar) cooldown", - NextAction::array(0, new NextAction("starfire", ACTION_DEFAULT + 0.2f), nullptr))); - triggers.push_back(new TriggerNode("eclipse (solar) cooldown", - NextAction::array(0, new NextAction("wrath", ACTION_DEFAULT + 0.2f), nullptr))); - - triggers.push_back(new TriggerNode( - "insect swarm", NextAction::array(0, new NextAction("insect swarm", ACTION_NORMAL + 5), nullptr))); triggers.push_back( - new TriggerNode("moonfire", NextAction::array(0, new NextAction("moonfire", ACTION_NORMAL + 4), nullptr))); + new TriggerNode( + "eclipse (lunar) cooldown", + { + NextAction("starfire", ACTION_DEFAULT + 0.2f) + } + ) + ); triggers.push_back( - new TriggerNode("eclipse (solar)", NextAction::array(0, new NextAction("wrath", ACTION_NORMAL + 6), nullptr))); - triggers.push_back(new TriggerNode("eclipse (lunar)", - NextAction::array(0, new NextAction("starfire", ACTION_NORMAL + 6), nullptr))); + new TriggerNode( + "eclipse (solar) cooldown", + { + NextAction("wrath", ACTION_DEFAULT + 0.2f) + } + ) + ); triggers.push_back( - new TriggerNode("medium mana", NextAction::array(0, new NextAction("innervate", ACTION_HIGH + 9), nullptr))); - - triggers.push_back(new TriggerNode("enemy too close for spell", - NextAction::array(0, new NextAction("flee", ACTION_MOVE + 9), nullptr))); + new TriggerNode( + "insect swarm", + { + NextAction("insect swarm", ACTION_NORMAL + 5) + } + ) + ); + triggers.push_back( + new TriggerNode( + "moonfire", + { + NextAction("moonfire", ACTION_NORMAL + 4) + } + ) + ); + triggers.push_back( + new TriggerNode( + "eclipse (solar)", + { + NextAction("wrath", ACTION_NORMAL + 6) + } + ) + ); + triggers.push_back( + new TriggerNode( + "eclipse (lunar)", + { + NextAction("starfire", ACTION_NORMAL + 6) + } + ) + ); + triggers.push_back( + new TriggerNode( + "medium mana", + { + NextAction("innervate", ACTION_HIGH + 9) + } + ) + ); + triggers.push_back( + new TriggerNode( + "enemy too close for spell", + { + NextAction("flee", ACTION_MOVE + 9) + } + ) + ); } void CasterDruidAoeStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( - new TriggerNode("hurricane channel check", NextAction::array(0, new NextAction("cancel channel", ACTION_HIGH + 2), nullptr))); + new TriggerNode( + "hurricane channel check", + { + NextAction("cancel channel", ACTION_HIGH + 2) + } + ) + ); triggers.push_back( - new TriggerNode("medium aoe", NextAction::array(0, new NextAction("hurricane", ACTION_HIGH + 1), nullptr))); - triggers.push_back(new TriggerNode( - "light aoe", NextAction::array(0, new NextAction("insect swarm on attacker", ACTION_NORMAL + 3), - new NextAction("moonfire on attacker", ACTION_NORMAL + 3), NULL))); + new TriggerNode( + "medium aoe", + { + NextAction("hurricane", ACTION_HIGH + 1) + } + ) + ); + triggers.push_back( + new TriggerNode( + "light aoe", + { + NextAction("insect swarm on attacker", ACTION_NORMAL + 3), + NextAction("moonfire on attacker", ACTION_NORMAL + 3) + } + ) + ); } void CasterDruidDebuffStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( - new TriggerNode("faerie fire", NextAction::array(0, new NextAction("faerie fire", ACTION_HIGH), nullptr))); + new TriggerNode( + "faerie fire", + { + NextAction("faerie fire", ACTION_HIGH) + } + ) + ); } diff --git a/src/strategy/druid/CasterDruidStrategy.h b/src/strategy/druid/CasterDruidStrategy.h index 0455b2f1..45bc78db 100644 --- a/src/strategy/druid/CasterDruidStrategy.h +++ b/src/strategy/druid/CasterDruidStrategy.h @@ -18,7 +18,7 @@ public: public: void InitTriggers(std::vector& triggers) override; std::string const getName() override { return "caster"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; uint32 GetType() const override { return STRATEGY_TYPE_COMBAT | STRATEGY_TYPE_DPS | STRATEGY_TYPE_RANGED; } }; diff --git a/src/strategy/druid/CatDpsDruidStrategy.cpp b/src/strategy/druid/CatDpsDruidStrategy.cpp index 641156f9..52ccee49 100644 --- a/src/strategy/druid/CatDpsDruidStrategy.cpp +++ b/src/strategy/druid/CatDpsDruidStrategy.cpp @@ -28,90 +28,112 @@ public: private: static ActionNode* faerie_fire_feral([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("faerie fire (feral)", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "faerie fire (feral)", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* melee([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("melee", - /*P*/ NextAction::array(0, new NextAction("feral charge - cat"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "melee", + /*P*/ { NextAction("feral charge - cat") }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* feral_charge_cat([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("feral charge - cat", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("reach melee"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "feral charge - cat", + /*P*/ {}, + /*A*/ { NextAction("reach melee") }, + /*C*/ {} + ); } static ActionNode* cat_form([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("cat form", - /*P*/ NextAction::array(0, new NextAction("caster form"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "cat form", + /*P*/ { NextAction("caster form") }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* claw([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("claw", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("melee"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "claw", + /*P*/ {}, + /*A*/ { NextAction("melee") }, + /*C*/ {} + ); } static ActionNode* mangle_cat([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("mangle (cat)", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "mangle (cat)", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* rake([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("rake", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "rake", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* ferocious_bite([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("ferocious bite", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("rip"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "ferocious bite", + /*P*/ {}, + /*A*/ { NextAction("rip") }, + /*C*/ {} + ); } static ActionNode* rip([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("rip", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "rip", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* pounce([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("pounce", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("ravage"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "pounce", + /*P*/ {}, + /*A*/ { NextAction("ravage") }, + /*C*/ {} + ); } static ActionNode* ravage([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("ravage", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("shred"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "ravage", + /*P*/ {}, + /*A*/ { NextAction("shred") }, + /*C*/ {} + ); } }; @@ -120,9 +142,11 @@ CatDpsDruidStrategy::CatDpsDruidStrategy(PlayerbotAI* botAI) : FeralDruidStrateg actionNodeFactories.Add(new CatDpsDruidStrategyActionNodeFactory()); } -NextAction** CatDpsDruidStrategy::getDefaultActions() +std::vector CatDpsDruidStrategy::getDefaultActions() { - return NextAction::array(0, new NextAction("tiger's fury", ACTION_DEFAULT + 0.1f), nullptr); + return { + NextAction("tiger's fury", ACTION_DEFAULT + 0.1f) + }; } void CatDpsDruidStrategy::InitTriggers(std::vector& triggers) @@ -130,50 +154,161 @@ void CatDpsDruidStrategy::InitTriggers(std::vector& triggers) FeralDruidStrategy::InitTriggers(triggers); // Default priority - triggers.push_back(new TriggerNode("almost full energy available", - NextAction::array(0, new NextAction("shred", ACTION_DEFAULT + 0.4f), nullptr))); - triggers.push_back(new TriggerNode("combo points not full", - NextAction::array(0, new NextAction("shred", ACTION_DEFAULT + 0.4f), nullptr))); - triggers.push_back(new TriggerNode("almost full energy available", - NextAction::array(0, new NextAction("mangle (cat)", ACTION_DEFAULT + 0.3f), nullptr))); - triggers.push_back(new TriggerNode("combo points not full and high energy", - NextAction::array(0, new NextAction("mangle (cat)", ACTION_DEFAULT + 0.3f), nullptr))); - triggers.push_back(new TriggerNode("almost full energy available", - NextAction::array(0, new NextAction("claw", ACTION_DEFAULT + 0.2f), nullptr))); - triggers.push_back(new TriggerNode("combo points not full and high energy", - NextAction::array(0, new NextAction("claw", ACTION_DEFAULT + 0.2f), nullptr))); triggers.push_back( - new TriggerNode("faerie fire (feral)", - NextAction::array(0, new NextAction("faerie fire (feral)", ACTION_DEFAULT + 0.0f), nullptr))); + new TriggerNode( + "almost full energy available", + { + NextAction("shred", ACTION_DEFAULT + 0.4f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "combo points not full", + { + NextAction("shred", ACTION_DEFAULT + 0.4f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "almost full energy available", + { + NextAction("mangle (cat)", ACTION_DEFAULT + 0.3f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "combo points not full and high energy", + { + NextAction("mangle (cat)", ACTION_DEFAULT + 0.3f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "almost full energy available", + { + NextAction("claw", ACTION_DEFAULT + 0.2f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "combo points not full and high energy", + { + NextAction("claw", ACTION_DEFAULT + 0.2f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "faerie fire (feral)", + { + NextAction("faerie fire (feral)", ACTION_DEFAULT + 0.0f) + } + ) + ); // Main spell triggers.push_back( - new TriggerNode("cat form", NextAction::array(0, new NextAction("cat form", ACTION_HIGH + 8), nullptr))); + new TriggerNode( + "cat form", { + NextAction("cat form", ACTION_HIGH + 8) + } + ) + ); triggers.push_back( - new TriggerNode("savage roar", NextAction::array(0, new NextAction("savage roar", ACTION_HIGH + 7), nullptr))); - triggers.push_back(new TriggerNode("combo points available", - NextAction::array(0, new NextAction("rip", ACTION_HIGH + 6), nullptr))); - triggers.push_back(new TriggerNode( - "ferocious bite time", NextAction::array(0, new NextAction("ferocious bite", ACTION_HIGH + 5), nullptr))); + new TriggerNode( + "savage roar", { + NextAction("savage roar", ACTION_HIGH + 7) + } + ) + ); triggers.push_back( - new TriggerNode("target with combo points almost dead", - NextAction::array(0, new NextAction("ferocious bite", ACTION_HIGH + 4), nullptr))); - triggers.push_back(new TriggerNode("mangle (cat)", - NextAction::array(0, new NextAction("mangle (cat)", ACTION_HIGH + 3), nullptr))); - triggers.push_back(new TriggerNode("rake", NextAction::array(0, new NextAction("rake", ACTION_HIGH + 2), nullptr))); + new TriggerNode( + "combo points available", + { + NextAction("rip", ACTION_HIGH + 6) + } + ) + ); triggers.push_back( - new TriggerNode("medium threat", NextAction::array(0, new NextAction("cower", ACTION_HIGH + 1), nullptr))); + new TriggerNode( + "ferocious bite time", + { + NextAction("ferocious bite", ACTION_HIGH + 5) + } + ) + ); + triggers.push_back( + new TriggerNode( + "target with combo points almost dead", + { + NextAction("ferocious bite", ACTION_HIGH + 4) + } + ) + ); + triggers.push_back( + new TriggerNode( + "mangle (cat)", + { + NextAction("mangle (cat)", ACTION_HIGH + 3) + } + ) + ); + triggers.push_back( + new TriggerNode( + "rake", + { + NextAction("rake", ACTION_HIGH + 2) + } + ) + ); + triggers.push_back( + new TriggerNode( + "medium threat", + { + NextAction("cower", ACTION_HIGH + 1) + } + ) + ); // AOE triggers.push_back( - new TriggerNode("medium aoe", NextAction::array(0, new NextAction("swipe (cat)", ACTION_HIGH + 3), nullptr))); - triggers.push_back(new TriggerNode( - "light aoe", NextAction::array(0, new NextAction("rake on attacker", ACTION_HIGH + 2), nullptr))); - // Reach target - triggers.push_back(new TriggerNode( - "enemy out of melee", NextAction::array(0, new NextAction("feral charge - cat", ACTION_HIGH + 9), nullptr))); + new TriggerNode( + "medium aoe", + { + NextAction("swipe (cat)", ACTION_HIGH + 3) + } + ) + ); triggers.push_back( - new TriggerNode("enemy out of melee", NextAction::array(0, new NextAction("dash", ACTION_HIGH + 8), nullptr))); + new TriggerNode( + "light aoe", + { + NextAction("rake on attacker", ACTION_HIGH + 2) + } + ) + ); + // Reach target + triggers.push_back( + new TriggerNode( + "enemy out of melee", + { + NextAction("feral charge - cat", ACTION_HIGH + 9) + } + ) + ); + triggers.push_back( + new TriggerNode( + "enemy out of melee", + { + NextAction("dash", ACTION_HIGH + 8) + } + ) + ); } void CatAoeDruidStrategy::InitTriggers(std::vector& triggers) {} diff --git a/src/strategy/druid/CatDpsDruidStrategy.h b/src/strategy/druid/CatDpsDruidStrategy.h index bfe2450b..312e94d0 100644 --- a/src/strategy/druid/CatDpsDruidStrategy.h +++ b/src/strategy/druid/CatDpsDruidStrategy.h @@ -18,7 +18,7 @@ public: public: void InitTriggers(std::vector& triggers) override; std::string const getName() override { return "cat"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; uint32 GetType() const override { return STRATEGY_TYPE_COMBAT | STRATEGY_TYPE_MELEE; } }; diff --git a/src/strategy/druid/DruidActions.cpp b/src/strategy/druid/DruidActions.cpp index 217db825..13336a67 100644 --- a/src/strategy/druid/DruidActions.cpp +++ b/src/strategy/druid/DruidActions.cpp @@ -11,15 +11,15 @@ #include "AoeValues.h" #include "TargetValue.h" -NextAction** CastAbolishPoisonAction::getAlternatives() +std::vector CastAbolishPoisonAction::getAlternatives() { - return NextAction::merge(NextAction::array(0, new NextAction("cure poison"), nullptr), + return NextAction::merge({ NextAction("cure poison") }, CastSpellAction::getPrerequisites()); } -NextAction** CastAbolishPoisonOnPartyAction::getAlternatives() +std::vector CastAbolishPoisonOnPartyAction::getAlternatives() { - return NextAction::merge(NextAction::array(0, new NextAction("cure poison on party"), nullptr), + return NextAction::merge({ NextAction("cure poison on party") }, CastSpellAction::getPrerequisites()); } @@ -60,15 +60,15 @@ bool CastStarfallAction::isUseful() return true; } -NextAction** CastReviveAction::getPrerequisites() +std::vector CastReviveAction::getPrerequisites() { - return NextAction::merge(NextAction::array(0, new NextAction("caster form"), nullptr), + return NextAction::merge({ NextAction("caster form") }, ResurrectPartyMemberAction::getPrerequisites()); } -NextAction** CastRebirthAction::getPrerequisites() +std::vector CastRebirthAction::getPrerequisites() { - return NextAction::merge(NextAction::array(0, new NextAction("caster form"), nullptr), + return NextAction::merge({ NextAction("caster form") }, ResurrectPartyMemberAction::getPrerequisites()); } diff --git a/src/strategy/druid/DruidActions.h b/src/strategy/druid/DruidActions.h index d0af6e5a..e3e17759 100644 --- a/src/strategy/druid/DruidActions.h +++ b/src/strategy/druid/DruidActions.h @@ -74,7 +74,7 @@ class CastReviveAction : public ResurrectPartyMemberAction public: CastReviveAction(PlayerbotAI* botAI) : ResurrectPartyMemberAction(botAI, "revive") {} - NextAction** getPrerequisites() override; + std::vector getPrerequisites() override; }; class CastRebirthAction : public ResurrectPartyMemberAction @@ -82,7 +82,7 @@ class CastRebirthAction : public ResurrectPartyMemberAction public: CastRebirthAction(PlayerbotAI* botAI) : ResurrectPartyMemberAction(botAI, "rebirth") {} - NextAction** getPrerequisites() override; + std::vector getPrerequisites() override; bool isUseful() override; }; @@ -223,7 +223,7 @@ class CastAbolishPoisonAction : public CastCureSpellAction { public: CastAbolishPoisonAction(PlayerbotAI* botAI) : CastCureSpellAction(botAI, "abolish poison") {} - NextAction** getAlternatives() override; + std::vector getAlternatives() override; }; class CastAbolishPoisonOnPartyAction : public CurePartyMemberAction @@ -233,7 +233,7 @@ public: { } - NextAction** getAlternatives() override; + std::vector getAlternatives() override; }; class CastBarkskinAction : public CastBuffSpellAction diff --git a/src/strategy/druid/DruidShapeshiftActions.cpp b/src/strategy/druid/DruidShapeshiftActions.cpp index 0c3aab7b..4f4a4e59 100644 --- a/src/strategy/druid/DruidShapeshiftActions.cpp +++ b/src/strategy/druid/DruidShapeshiftActions.cpp @@ -17,9 +17,9 @@ bool CastBearFormAction::isUseful() return CastBuffSpellAction::isUseful() && !botAI->HasAura("dire bear form", GetTarget()); } -NextAction** CastDireBearFormAction::getAlternatives() +std::vector CastDireBearFormAction::getAlternatives() { - return NextAction::merge(NextAction::array(0, new NextAction("bear form"), nullptr), + return NextAction::merge({ NextAction("bear form") }, CastSpellAction::getAlternatives()); } diff --git a/src/strategy/druid/DruidShapeshiftActions.h b/src/strategy/druid/DruidShapeshiftActions.h index 61a9a138..26e14c42 100644 --- a/src/strategy/druid/DruidShapeshiftActions.h +++ b/src/strategy/druid/DruidShapeshiftActions.h @@ -24,7 +24,7 @@ class CastDireBearFormAction : public CastBuffSpellAction public: CastDireBearFormAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "dire bear form") {} - NextAction** getAlternatives() override; + std::vector getAlternatives() override; }; class CastCatFormAction : public CastBuffSpellAction diff --git a/src/strategy/druid/FeralDruidStrategy.cpp b/src/strategy/druid/FeralDruidStrategy.cpp index e5e48325..894c05bf 100644 --- a/src/strategy/druid/FeralDruidStrategy.cpp +++ b/src/strategy/druid/FeralDruidStrategy.cpp @@ -26,65 +26,65 @@ private: static ActionNode* survival_instincts([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("survival instincts", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("barkskin"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("barkskin") }, + /*C*/ {}); } static ActionNode* thorns([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("thorns", - /*P*/ NextAction::array(0, new NextAction("caster form"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ { NextAction("caster form") }, + /*A*/ {}, + /*C*/ {}); } static ActionNode* omen_of_clarity([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("omen of clarity", - /*P*/ NextAction::array(0, new NextAction("caster form"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ { NextAction("caster form") }, + /*A*/ {}, + /*C*/ {}); } static ActionNode* cure_poison([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("cure poison", - /*P*/ NextAction::array(0, new NextAction("caster form"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ { NextAction("caster form") }, + /*A*/ {}, + /*C*/ {}); } static ActionNode* cure_poison_on_party([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("cure poison on party", - /*P*/ NextAction::array(0, new NextAction("caster form"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ { NextAction("caster form") }, + /*A*/ {}, + /*C*/ {}); } static ActionNode* abolish_poison([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("abolish poison", - /*P*/ NextAction::array(0, new NextAction("caster form"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ { NextAction("caster form") }, + /*A*/ {}, + /*C*/ {}); } static ActionNode* abolish_poison_on_party([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("abolish poison on party", - /*P*/ NextAction::array(0, new NextAction("caster form"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ { NextAction("caster form") }, + /*A*/ {}, + /*C*/ {}); } static ActionNode* prowl([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("prowl", - /*P*/ NextAction::array(0, new NextAction("cat form"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ { NextAction("cat form") }, + /*A*/ {}, + /*C*/ {}); } }; @@ -98,20 +98,16 @@ void FeralDruidStrategy::InitTriggers(std::vector& triggers) { GenericDruidStrategy::InitTriggers(triggers); - // triggers.push_back(new TriggerNode("not facing target", NextAction::array(0, new NextAction("set facing", - // ACTION_NORMAL + 7), nullptr))); triggers.push_back(new TriggerNode( - "enemy out of melee", NextAction::array(0, new NextAction("reach melee", ACTION_HIGH + 1), nullptr))); - // triggers.push_back(new TriggerNode("enemy too close for melee", NextAction::array(0, new NextAction("move out of - // enemy contact", ACTION_NORMAL + 8), nullptr))); + "enemy out of melee", { NextAction("reach melee", ACTION_HIGH + 1) })); triggers.push_back(new TriggerNode( - "critical health", NextAction::array(0, new NextAction("survival instincts", ACTION_EMERGENCY + 1), nullptr))); + "critical health", { NextAction("survival instincts", ACTION_EMERGENCY + 1) })); triggers.push_back(new TriggerNode( - "omen of clarity", NextAction::array(0, new NextAction("omen of clarity", ACTION_HIGH + 9), nullptr))); + "omen of clarity", { NextAction("omen of clarity", ACTION_HIGH + 9) })); triggers.push_back(new TriggerNode("player has flag", - NextAction::array(0, new NextAction("dash", ACTION_EMERGENCY + 2), nullptr))); + { NextAction("dash", ACTION_EMERGENCY + 2) })); triggers.push_back(new TriggerNode("enemy flagcarrier near", - NextAction::array(0, new NextAction("dash", ACTION_EMERGENCY + 2), nullptr))); + { NextAction("dash", ACTION_EMERGENCY + 2) })); triggers.push_back( - new TriggerNode("berserk", NextAction::array(0, new NextAction("berserk", ACTION_HIGH + 6), nullptr))); + new TriggerNode("berserk", { NextAction("berserk", ACTION_HIGH + 6) })); } diff --git a/src/strategy/druid/FeralDruidStrategy.h b/src/strategy/druid/FeralDruidStrategy.h index dd1e7d00..abf01c69 100644 --- a/src/strategy/druid/FeralDruidStrategy.h +++ b/src/strategy/druid/FeralDruidStrategy.h @@ -27,49 +27,49 @@ private: static ActionNode* regrowth([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("regrowth", - /*P*/ NextAction::array(0, new NextAction("caster form"), nullptr), - /*A*/ NextAction::array(0, new NextAction("healing touch"), nullptr), - /*C*/ NextAction::array(0, new NextAction("melee", 10.0f), nullptr)); + /*P*/ { NextAction("caster form") }, + /*A*/ { NextAction("healing touch") }, + /*C*/ { NextAction("melee", 10.0f) }); } static ActionNode* rejuvenation([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("rejuvenation", - /*P*/ NextAction::array(0, new NextAction("caster form"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ { NextAction("caster form") }, + /*A*/ {}, + /*C*/ {}); } static ActionNode* healing_touch([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("healing touch", - /*P*/ NextAction::array(0, new NextAction("caster form"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ { NextAction("caster form") }, + /*A*/ {}, + /*C*/ {}); } static ActionNode* regrowth_on_party([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("regrowth on party", - /*P*/ NextAction::array(0, new NextAction("caster form"), nullptr), - /*A*/ NextAction::array(0, new NextAction("healing touch on party"), nullptr), - /*C*/ NextAction::array(0, new NextAction("melee", 10.0f), nullptr)); + /*P*/ { NextAction("caster form") }, + /*A*/ { NextAction("healing touch on party") }, + /*C*/ { NextAction("melee", 10.0f) }); } static ActionNode* rejuvenation_on_party([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("rejuvenation on party", - /*P*/ NextAction::array(0, new NextAction("caster form"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ { NextAction("caster form") }, + /*A*/ {}, + /*C*/ {}); } static ActionNode* healing_touch_on_party([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("healing touch on party", - /*P*/ NextAction::array(0, new NextAction("caster form"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ { NextAction("caster form") }, + /*A*/ {}, + /*C*/ {}); } }; diff --git a/src/strategy/druid/GenericDruidNonCombatStrategy.cpp b/src/strategy/druid/GenericDruidNonCombatStrategy.cpp index 3b42160a..7d1a5f7c 100644 --- a/src/strategy/druid/GenericDruidNonCombatStrategy.cpp +++ b/src/strategy/druid/GenericDruidNonCombatStrategy.cpp @@ -29,76 +29,69 @@ private: static ActionNode* thorns([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("thorns", - /*P*/ NextAction::array(0, new NextAction("caster form"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ { NextAction("caster form") }, + /*A*/ {}, + /*C*/ {}); } static ActionNode* thorns_on_party([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("thorns on party", - /*P*/ NextAction::array(0, new NextAction("caster form"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ { NextAction("caster form") }, + /*A*/ {}, + /*C*/ {}); } static ActionNode* mark_of_the_wild([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("mark of the wild", - /*P*/ NextAction::array(0, new NextAction("caster form"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ { NextAction("caster form") }, + /*A*/ {}, + /*C*/ {}); } static ActionNode* mark_of_the_wild_on_party([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("mark of the wild on party", - /*P*/ NextAction::array(0, new NextAction("caster form"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ { NextAction("caster form") }, + /*A*/ {}, + /*C*/ {}); } static ActionNode* regrowth_on_party([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("regrowth on party", - /*P*/ NextAction::array(0, new NextAction("caster form"), nullptr), - /*A*/ NULL, - /*C*/ NULL); + /*P*/ { NextAction("caster form") }, + /*A*/ {}, + /*C*/ {}); } static ActionNode* rejuvenation_on_party([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("rejuvenation on party", - /*P*/ NextAction::array(0, new NextAction("caster form"), nullptr), - /*A*/ NULL, - /*C*/ NULL); + /*P*/ { NextAction("caster form") }, + /*A*/ {}, + /*C*/ {}); } static ActionNode* remove_curse_on_party([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("remove curse on party", - /*P*/ NextAction::array(0, new NextAction("caster form"), nullptr), - /*A*/ NULL, - /*C*/ NULL); + /*P*/ { NextAction("caster form") }, + /*A*/ {}, + /*C*/ {}); } static ActionNode* abolish_poison_on_party([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("abolish poison on party", - /*P*/ NextAction::array(0, new NextAction("caster form"), nullptr), - /*A*/ NULL, - /*C*/ NULL); + /*P*/ { NextAction("caster form") }, + /*A*/ {}, + /*C*/ {}); } static ActionNode* revive([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("revive", - /*P*/ NextAction::array(0, new NextAction("caster form"), nullptr), - /*A*/ NULL, - /*C*/ NULL); + /*P*/ { NextAction("caster form") }, + /*A*/ {}, + /*C*/ {}); } - // static ActionNode* innervate([[maybe_unused]] PlayerbotAI* botAI) - // { - // return new ActionNode ("innervate", - // /*P*/ nullptr, - // /*A*/ NextAction::array(0, new NextAction("drink"), nullptr), - // /*C*/ nullptr); - // } }; GenericDruidNonCombatStrategy::GenericDruidNonCombatStrategy(PlayerbotAI* botAI) : NonCombatStrategy(botAI) @@ -110,79 +103,73 @@ void GenericDruidNonCombatStrategy::InitTriggers(std::vector& trig { NonCombatStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("mark of the wild", NextAction::array(0, new NextAction("mark of the wild", 14.0f), nullptr))); - // triggers.push_back(new TriggerNode("thorns", NextAction::array(0, new NextAction("thorns", 12.0f), nullptr))); - // triggers.push_back(new TriggerNode("cure poison", NextAction::array(0, new NextAction("abolish poison", 21.0f), - // nullptr))); - triggers.push_back(new TriggerNode("party member cure poison", NextAction::array(0, new NextAction("abolish poison on party", 20.0f), nullptr))); - triggers.push_back(new TriggerNode("party member dead", NextAction::array(0, new NextAction("revive", ACTION_CRITICAL_HEAL + 10), nullptr))); - // triggers.push_back(new TriggerNode("low mana", NextAction::array(0, new NextAction("innervate", ACTION_EMERGENCY - // + 5), nullptr))); triggers.push_back(new TriggerNode("swimming", NextAction::array(0, new NextAction("aquatic - // form", 1.0f), nullptr))); + triggers.push_back(new TriggerNode("mark of the wild", { NextAction("mark of the wild", 14.0f) })); + triggers.push_back(new TriggerNode("party member cure poison", { NextAction("abolish poison on party", 20.0f) })); + triggers.push_back(new TriggerNode("party member dead", { NextAction("revive", ACTION_CRITICAL_HEAL + 10) })); - triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("apply oil", 1.0f), nullptr))); + triggers.push_back(new TriggerNode("often", { NextAction("apply oil", 1.0f) })); triggers.push_back( new TriggerNode("party member critical health", - NextAction::array(0, - new NextAction("wild growth on party", ACTION_MEDIUM_HEAL + 7), - new NextAction("regrowth on party", ACTION_MEDIUM_HEAL + 6), - new NextAction("rejuvenation on party", ACTION_MEDIUM_HEAL + 5), - nullptr))); + { + NextAction("wild growth on party", ACTION_MEDIUM_HEAL + 7), + NextAction("regrowth on party", ACTION_MEDIUM_HEAL + 6), + NextAction("rejuvenation on party", ACTION_MEDIUM_HEAL + 5), + })); triggers.push_back( new TriggerNode("party member low health", - NextAction::array(0, - new NextAction("wild growth on party", ACTION_MEDIUM_HEAL + 5), - new NextAction("regrowth on party", ACTION_MEDIUM_HEAL + 4), - new NextAction("rejuvenation on party", ACTION_MEDIUM_HEAL + 3), - nullptr))); + { + NextAction("wild growth on party", ACTION_MEDIUM_HEAL + 5), + NextAction("regrowth on party", ACTION_MEDIUM_HEAL + 4), + NextAction("rejuvenation on party", ACTION_MEDIUM_HEAL + 3), + })); triggers.push_back( new TriggerNode("party member medium health", - NextAction::array(0, new NextAction("wild growth on party", ACTION_MEDIUM_HEAL + 3), - new NextAction("regrowth on party", ACTION_MEDIUM_HEAL + 2), - new NextAction("rejuvenation on party", ACTION_MEDIUM_HEAL + 1), - nullptr))); + { NextAction("wild growth on party", ACTION_MEDIUM_HEAL + 3), + NextAction("regrowth on party", ACTION_MEDIUM_HEAL + 2), + NextAction("rejuvenation on party", ACTION_MEDIUM_HEAL + 1), + })); triggers.push_back( new TriggerNode("party member almost full health", - NextAction::array(0, new NextAction("wild growth on party", ACTION_LIGHT_HEAL + 3), new NextAction("rejuvenation on party", ACTION_LIGHT_HEAL + 2), NULL))); + { NextAction("wild growth on party", ACTION_LIGHT_HEAL + 3), NextAction("rejuvenation on party", ACTION_LIGHT_HEAL + 2) })); triggers.push_back( new TriggerNode("party member remove curse", - NextAction::array(0, new NextAction("remove curse on party", ACTION_DISPEL + 7), nullptr))); + { NextAction("remove curse on party", ACTION_DISPEL + 7) })); triggers.push_back( - new TriggerNode("new pet", NextAction::array(0, new NextAction("set pet stance", 60.0f), nullptr))); + new TriggerNode("new pet", { NextAction("set pet stance", 60.0f) })); - triggers.push_back(new TriggerNode("party member critical health", NextAction::array(0, - new NextAction("wild growth on party", ACTION_MEDIUM_HEAL + 7), - new NextAction("regrowth on party", ACTION_MEDIUM_HEAL + 6), - new NextAction("rejuvenation on party", ACTION_MEDIUM_HEAL + 5), - nullptr))); - triggers.push_back(new TriggerNode("party member low health", NextAction::array(0, - new NextAction("wild growth on party", ACTION_MEDIUM_HEAL + 5), - new NextAction("regrowth on party", ACTION_MEDIUM_HEAL + 4), - new NextAction("rejuvenation on party", ACTION_MEDIUM_HEAL + 3), - nullptr))); - triggers.push_back(new TriggerNode("party member medium health", NextAction::array(0, - new NextAction("wild growth on party", ACTION_MEDIUM_HEAL + 3), - new NextAction("regrowth on party", ACTION_MEDIUM_HEAL + 2), - new NextAction("rejuvenation on party", ACTION_MEDIUM_HEAL + 1), - nullptr))); - triggers.push_back(new TriggerNode("party member almost full health", NextAction::array(0, - new NextAction("wild growth on party", ACTION_LIGHT_HEAL + 3), - new NextAction("rejuvenation on party", ACTION_LIGHT_HEAL + 2), - nullptr))); - triggers.push_back(new TriggerNode("party member remove curse", NextAction::array(0, - new NextAction("remove curse on party", ACTION_DISPEL + 7), - nullptr))); + triggers.push_back(new TriggerNode("party member critical health", { + NextAction("wild growth on party", ACTION_MEDIUM_HEAL + 7), + NextAction("regrowth on party", ACTION_MEDIUM_HEAL + 6), + NextAction("rejuvenation on party", ACTION_MEDIUM_HEAL + 5), + })); + triggers.push_back(new TriggerNode("party member low health", { + NextAction("wild growth on party", ACTION_MEDIUM_HEAL + 5), + NextAction("regrowth on party", ACTION_MEDIUM_HEAL + 4), + NextAction("rejuvenation on party", ACTION_MEDIUM_HEAL + 3), + })); + triggers.push_back(new TriggerNode("party member medium health", { + NextAction("wild growth on party", ACTION_MEDIUM_HEAL + 3), + NextAction("regrowth on party", ACTION_MEDIUM_HEAL + 2), + NextAction("rejuvenation on party", ACTION_MEDIUM_HEAL + 1), + })); + triggers.push_back(new TriggerNode("party member almost full health", { + NextAction("wild growth on party", ACTION_LIGHT_HEAL + 3), + NextAction("rejuvenation on party", ACTION_LIGHT_HEAL + 2), + })); + triggers.push_back(new TriggerNode("party member remove curse", { + NextAction("remove curse on party", ACTION_DISPEL + 7), + })); int specTab = AiFactory::GetPlayerSpecTab(botAI->GetBot()); if (specTab == 0 || specTab == 2) // Balance or Restoration - triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("apply oil", 1.0f), nullptr))); + triggers.push_back(new TriggerNode("often", { NextAction("apply oil", 1.0f) })); if (specTab == 1) // Feral - triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("apply stone", 1.0f), nullptr))); + triggers.push_back(new TriggerNode("often", { NextAction("apply stone", 1.0f) })); } @@ -195,13 +182,13 @@ void GenericDruidBuffStrategy::InitTriggers(std::vector& triggers) { NonCombatStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("mark of the wild on party", NextAction::array(0, - new NextAction("mark of the wild on party", 13.0f), - nullptr))); - triggers.push_back(new TriggerNode("thorns on main tank", NextAction::array(0, - new NextAction("thorns on main tank", 11.0f), - nullptr))); - triggers.push_back(new TriggerNode("thorns", NextAction::array(0, - new NextAction("thorns", 10.0f), - nullptr))); + triggers.push_back(new TriggerNode("mark of the wild on party", { + NextAction("mark of the wild on party", 13.0f), + })); + triggers.push_back(new TriggerNode("thorns on main tank", { + NextAction("thorns on main tank", 11.0f), + })); + triggers.push_back(new TriggerNode("thorns", { + NextAction("thorns", 10.0f), + })); } diff --git a/src/strategy/druid/GenericDruidStrategy.cpp b/src/strategy/druid/GenericDruidStrategy.cpp index b1fec20e..d5ac8fce 100644 --- a/src/strategy/druid/GenericDruidStrategy.cpp +++ b/src/strategy/druid/GenericDruidStrategy.cpp @@ -27,73 +27,73 @@ private: static ActionNode* melee([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("melee", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* caster_form([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("caster form", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* cure_poison([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("cure poison", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* cure_poison_on_party([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("cure poison on party", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* abolish_poison([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("abolish poison", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* abolish_poison_on_party([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("abolish poison on party", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* rebirth([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("rebirth", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* entangling_roots_on_cc([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("entangling roots on cc", - /*P*/ NextAction::array(0, new NextAction("caster form"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ { NextAction("caster form") }, + /*A*/ {}, + /*C*/ {}); } static ActionNode* innervate([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("innervate", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("mana potion"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("mana potion") }, + /*C*/ {}); } }; @@ -107,70 +107,52 @@ void GenericDruidStrategy::InitTriggers(std::vector& triggers) CombatStrategy::InitTriggers(triggers); triggers.push_back( - new TriggerNode("low health", NextAction::array(0, new NextAction("barkskin", ACTION_HIGH + 7), nullptr))); + new TriggerNode("low health", { NextAction("barkskin", ACTION_HIGH + 7) })); - // triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("regrowth", - // ACTION_MEDIUM_HEAL + 2), nullptr))); triggers.push_back(new TriggerNode("party member low health", - // NextAction::array(0, new NextAction("regrowth on party", ACTION_MEDIUM_HEAL + 1), nullptr))); - // triggers.push_back(new TriggerNode("critical health", NextAction::array(0, new NextAction("regrowth", - // ACTION_CRITICAL_HEAL + 2), new NextAction("healing touch", ACTION_CRITICAL_HEAL + 2), nullptr))); - // triggers.push_back(new TriggerNode("party member critical health", NextAction::array(0, new NextAction("regrowth - // on party", ACTION_CRITICAL_HEAL + 1), new NextAction("healing touch on party", ACTION_CRITICAL_HEAL + 1), - // nullptr))); triggers.push_back(new TriggerNode("party member dead", NextAction::array(0, new - // NextAction("rebirth", ACTION_HIGH + 1), nullptr))); triggers.push_back(new TriggerNode("low mana", - // NextAction::array(0, new NextAction("innervate", ACTION_EMERGENCY + 5), nullptr))); triggers.push_back(new TriggerNode("combat party member dead", - NextAction::array(0, new NextAction("rebirth", ACTION_HIGH + 9), NULL))); + { NextAction("rebirth", ACTION_HIGH + 9) })); triggers.push_back(new TriggerNode("being attacked", - NextAction::array(0, new NextAction("nature's grasp", ACTION_HIGH + 1), nullptr))); - triggers.push_back(new TriggerNode("new pet", NextAction::array(0, new NextAction("set pet stance", 60.0f), nullptr))); + { NextAction("nature's grasp", ACTION_HIGH + 1) })); + triggers.push_back(new TriggerNode("new pet", { NextAction("set pet stance", 60.0f) })); } void DruidCureStrategy::InitTriggers(std::vector& triggers) { - // triggers.push_back(new TriggerNode("cure poison", NextAction::array(0, new NextAction("abolish poison", - // ACTION_DISPEL + 2), nullptr))); triggers.push_back( new TriggerNode("party member cure poison", - NextAction::array(0, new NextAction("abolish poison on party", ACTION_DISPEL + 1), nullptr))); + { NextAction("abolish poison on party", ACTION_DISPEL + 1) })); triggers.push_back( new TriggerNode("party member remove curse", - NextAction::array(0, new NextAction("remove curse on party", ACTION_DISPEL + 7), NULL))); + { NextAction("remove curse on party", ACTION_DISPEL + 7) })); } void DruidBoostStrategy::InitTriggers(std::vector& triggers) { triggers.push_back(new TriggerNode( - "nature's swiftness", NextAction::array(0, new NextAction("nature's swiftness", ACTION_HIGH + 9), nullptr))); + "nature's swiftness", { NextAction("nature's swiftness", ACTION_HIGH + 9) })); } void DruidCcStrategy::InitTriggers(std::vector& triggers) { triggers.push_back(new TriggerNode( - "entangling roots", NextAction::array(0, new NextAction("entangling roots on cc", ACTION_HIGH + 2), nullptr))); + "entangling roots", { NextAction("entangling roots on cc", ACTION_HIGH + 2) })); triggers.push_back(new TriggerNode( - "entangling roots kite", NextAction::array(0, new NextAction("entangling roots", ACTION_HIGH + 2), nullptr))); + "entangling roots kite", { NextAction("entangling roots", ACTION_HIGH + 2) })); triggers.push_back(new TriggerNode( - "hibernate", NextAction::array(0, new NextAction("hibernate on cc", ACTION_HIGH + 3), nullptr))); + "hibernate", { NextAction("hibernate on cc", ACTION_HIGH + 3) })); } void DruidHealerDpsStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( new TriggerNode("healer should attack", - NextAction::array(0, - new NextAction("cancel tree form", ACTION_DEFAULT + 0.3f), - new NextAction("moonfire", ACTION_DEFAULT + 0.2f), - new NextAction("wrath", ACTION_DEFAULT + 0.1f), - new NextAction("starfire", ACTION_DEFAULT), - nullptr))); + { + NextAction("cancel tree form", ACTION_DEFAULT + 0.3f), + NextAction("moonfire", ACTION_DEFAULT + 0.2f), + NextAction("wrath", ACTION_DEFAULT + 0.1f), + NextAction("starfire", ACTION_DEFAULT), +})); - // long cast time - // triggers.push_back( - // new TriggerNode("medium aoe and healer should attack", - // NextAction::array(0, - // new NextAction("hurricane", ACTION_DEFAULT + 0.7f), - // nullptr))); } diff --git a/src/strategy/druid/HealDruidStrategy.cpp b/src/strategy/druid/HealDruidStrategy.cpp index 7e052a34..5d2c4ce3 100644 --- a/src/strategy/druid/HealDruidStrategy.cpp +++ b/src/strategy/druid/HealDruidStrategy.cpp @@ -12,40 +12,16 @@ class HealDruidStrategyActionNodeFactory : public NamedObjectFactory public: HealDruidStrategyActionNodeFactory() { creators["nourish on party"] = &nourtish_on_party; - // creators["wild growth on party"] = &wild_growth_on_party; - // creators["rejuvenation on party"] = &rejuvenation_on_party; - // creators["regrowth on party"] = ®rowth_on_party; } private: static ActionNode* nourtish_on_party([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("nourish on party", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("healing touch on party"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("healing touch on party") }, + /*C*/ {}); } - // static ActionNode* wild_growth_on_party([[maybe_unused]] PlayerbotAI* botAI) - // { - // return new ActionNode("wild growth on party", - // /*P*/ NextAction::array(0, new NextAction("tree form"), nullptr), - // /*A*/ nullptr, - // /*C*/ nullptr); - // } - // static ActionNode* rejuvenation_on_party([[maybe_unused]] PlayerbotAI* botAI) - // { - // return new ActionNode("rejuvenation on party", - // /*P*/ NextAction::array(0, new NextAction("tree form"), nullptr), - // /*A*/ nullptr, - // /*C*/ nullptr); - // } - // static ActionNode* regrowth_on_party([[maybe_unused]] PlayerbotAI* botAI) - // { - // return new ActionNode("regrowth on party", - // /*P*/ NextAction::array(0, new NextAction("tree form"), nullptr), - // /*A*/ nullptr, - // /*C*/ nullptr); - // } }; HealDruidStrategy::HealDruidStrategy(PlayerbotAI* botAI) : GenericDruidStrategy(botAI) @@ -57,73 +33,69 @@ void HealDruidStrategy::InitTriggers(std::vector& triggers) { GenericDruidStrategy::InitTriggers(triggers); - // triggers.push_back( - // new TriggerNode("tree form", NextAction::array(0, new NextAction("tree form", ACTION_HIGH + 1), nullptr))); - triggers.push_back(new TriggerNode( "party member to heal out of spell range", - NextAction::array(0, new NextAction("reach party member to heal", ACTION_CRITICAL_HEAL + 9), nullptr))); + { NextAction("reach party member to heal", ACTION_CRITICAL_HEAL + 9) })); // CRITICAL triggers.push_back( new TriggerNode("party member critical health", - NextAction::array(0, - new NextAction("tree form", ACTION_CRITICAL_HEAL + 4.1f), - new NextAction("swiftmend on party", ACTION_CRITICAL_HEAL + 4), - new NextAction("regrowth on party", ACTION_CRITICAL_HEAL + 3), - new NextAction("wild growth on party", ACTION_CRITICAL_HEAL + 2), - new NextAction("nourish on party", ACTION_CRITICAL_HEAL + 1), - // new NextAction("healing touch on party", ACTION_CRITICAL_HEAL + 0), - nullptr))); + { + NextAction("tree form", ACTION_CRITICAL_HEAL + 4.1f), + NextAction("swiftmend on party", ACTION_CRITICAL_HEAL + 4), + NextAction("regrowth on party", ACTION_CRITICAL_HEAL + 3), + NextAction("wild growth on party", ACTION_CRITICAL_HEAL + 2), + NextAction("nourish on party", ACTION_CRITICAL_HEAL + 1), + })); triggers.push_back( new TriggerNode("party member critical health", - NextAction::array(0, new NextAction("nature's swiftness", ACTION_CRITICAL_HEAL + 4), nullptr))); + { NextAction("nature's swiftness", ACTION_CRITICAL_HEAL + 4) })); triggers.push_back(new TriggerNode( "group heal setting", - NextAction::array(0, - new NextAction("tree form", ACTION_MEDIUM_HEAL + 2.3f), - new NextAction("wild growth on party", ACTION_MEDIUM_HEAL + 2.2f), - new NextAction("rejuvenation on not full", ACTION_MEDIUM_HEAL + 2.1f), - nullptr))); + { + NextAction("tree form", ACTION_MEDIUM_HEAL + 2.3f), + NextAction("wild growth on party", ACTION_MEDIUM_HEAL + 2.2f), + NextAction("rejuvenation on not full", ACTION_MEDIUM_HEAL + 2.1f), + })); triggers.push_back( new TriggerNode("medium group heal setting", - NextAction::array(0, - new NextAction("tree form", ACTION_CRITICAL_HEAL + 0.6f), - new NextAction("tranquility", ACTION_CRITICAL_HEAL + 0.5f), nullptr))); + { + NextAction("tree form", ACTION_CRITICAL_HEAL + 0.6f), + NextAction("tranquility", ACTION_CRITICAL_HEAL + 0.5f) })); // LOW triggers.push_back( new TriggerNode("party member low health", - NextAction::array(0, new NextAction("tree form", ACTION_MEDIUM_HEAL + 1.5f), - new NextAction("wild growth on party", ACTION_MEDIUM_HEAL + 1.4f), - new NextAction("regrowth on party", ACTION_MEDIUM_HEAL + 1.3f), - new NextAction("swiftmend on party", ACTION_MEDIUM_HEAL + 1.2), - new NextAction("nourish on party", ACTION_MEDIUM_HEAL + 1.1f), - nullptr))); + { NextAction("tree form", ACTION_MEDIUM_HEAL + 1.5f), + NextAction("wild growth on party", ACTION_MEDIUM_HEAL + 1.4f), + NextAction("regrowth on party", ACTION_MEDIUM_HEAL + 1.3f), + NextAction("swiftmend on party", ACTION_MEDIUM_HEAL + 1.2), + NextAction("nourish on party", ACTION_MEDIUM_HEAL + 1.1f), + })); // MEDIUM triggers.push_back( new TriggerNode("party member medium health", - NextAction::array(0, - new NextAction("tree form", ACTION_MEDIUM_HEAL + 0.5f), - new NextAction("wild growth on party", ACTION_MEDIUM_HEAL + 0.4f), - new NextAction("rejuvenation on party", ACTION_MEDIUM_HEAL + 0.3f), - new NextAction("regrowth on party", ACTION_MEDIUM_HEAL + 0.2f), - new NextAction("nourish on party", ACTION_MEDIUM_HEAL + 0.1f), nullptr))); + { + NextAction("tree form", ACTION_MEDIUM_HEAL + 0.5f), + NextAction("wild growth on party", ACTION_MEDIUM_HEAL + 0.4f), + NextAction("rejuvenation on party", ACTION_MEDIUM_HEAL + 0.3f), + NextAction("regrowth on party", ACTION_MEDIUM_HEAL + 0.2f), + NextAction("nourish on party", ACTION_MEDIUM_HEAL + 0.1f) })); // almost full triggers.push_back( new TriggerNode("party member almost full health", - NextAction::array(0, new NextAction("wild growth on party", ACTION_LIGHT_HEAL + 0.3f), - new NextAction("rejuvenation on party", ACTION_LIGHT_HEAL + 0.2f), - new NextAction("regrowth on party", ACTION_LIGHT_HEAL + 0.1f), nullptr))); + { NextAction("wild growth on party", ACTION_LIGHT_HEAL + 0.3f), + NextAction("rejuvenation on party", ACTION_LIGHT_HEAL + 0.2f), + NextAction("regrowth on party", ACTION_LIGHT_HEAL + 0.1f) })); triggers.push_back( - new TriggerNode("medium mana", NextAction::array(0, new NextAction("innervate", ACTION_HIGH + 5), nullptr))); + new TriggerNode("medium mana", { NextAction("innervate", ACTION_HIGH + 5) })); triggers.push_back(new TriggerNode("enemy too close for spell", - NextAction::array(0, new NextAction("flee", ACTION_MOVE + 9), nullptr))); + { NextAction("flee", ACTION_MOVE + 9) })); } diff --git a/src/strategy/druid/MeleeDruidStrategy.cpp b/src/strategy/druid/MeleeDruidStrategy.cpp index f474a978..5dc0f85d 100644 --- a/src/strategy/druid/MeleeDruidStrategy.cpp +++ b/src/strategy/druid/MeleeDruidStrategy.cpp @@ -9,16 +9,24 @@ MeleeDruidStrategy::MeleeDruidStrategy(PlayerbotAI* botAI) : CombatStrategy(botAI) {} -NextAction** MeleeDruidStrategy::getDefaultActions() +std::vector MeleeDruidStrategy::getDefaultActions() { - return NextAction::array(0, new NextAction("faerie fire", ACTION_DEFAULT + 0.1f), - new NextAction("melee", ACTION_DEFAULT), nullptr); + return { + NextAction("faerie fire", ACTION_DEFAULT + 0.1f), + NextAction("melee", ACTION_DEFAULT) + }; } void MeleeDruidStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode( - "omen of clarity", NextAction::array(0, new NextAction("omen of clarity", ACTION_HIGH + 9), nullptr))); + triggers.push_back( + new TriggerNode( + "omen of clarity", + { + NextAction("omen of clarity", ACTION_HIGH + 9) + } + ) + ); CombatStrategy::InitTriggers(triggers); } diff --git a/src/strategy/druid/MeleeDruidStrategy.h b/src/strategy/druid/MeleeDruidStrategy.h index 95317360..67bbbbfe 100644 --- a/src/strategy/druid/MeleeDruidStrategy.h +++ b/src/strategy/druid/MeleeDruidStrategy.h @@ -15,7 +15,7 @@ public: void InitTriggers(std::vector& triggers) override; std::string const getName() override { return "melee"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; }; #endif diff --git a/src/strategy/druid/OffhealDruidCatStrategy.cpp b/src/strategy/druid/OffhealDruidCatStrategy.cpp index 70590709..c472ce8d 100644 --- a/src/strategy/druid/OffhealDruidCatStrategy.cpp +++ b/src/strategy/druid/OffhealDruidCatStrategy.cpp @@ -29,90 +29,112 @@ public: private: static ActionNode* cat_form([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("cat form", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "cat form", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* mangle_cat([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("mangle (cat)", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "mangle (cat)", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* shred([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("shred", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("claw"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "shred", + /*P*/ {}, + /*A*/ { NextAction("claw") }, + /*C*/ {} + ); } static ActionNode* rake([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("rake", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "rake", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* rip([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("rip", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "rip", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* ferocious_bite([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("ferocious bite", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("rip"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "ferocious bite", + /*P*/ {}, + /*A*/ { NextAction("rip") }, + /*C*/ {} + ); } static ActionNode* savage_roar([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("savage roar", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "savage roar", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* faerie_fire_feral([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("faerie fire (feral)", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "faerie fire (feral)", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* healing_touch_on_party([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("healing touch on party", - /*P*/ NextAction::array(0, new NextAction("caster form"), nullptr), - /*A*/ nullptr, - /*C*/ NextAction::array(0, new NextAction("cat form"), nullptr)); + return new ActionNode( + "healing touch on party", + /*P*/ { NextAction("caster form") }, + /*A*/ {}, + /*C*/ { NextAction("cat form") } + ); } static ActionNode* regrowth_on_party([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("regrowth on party", - /*P*/ NextAction::array(0, new NextAction("caster form"), nullptr), - /*A*/ nullptr, - /*C*/ NextAction::array(0, new NextAction("cat form"), nullptr)); + return new ActionNode( + "regrowth on party", + /*P*/ { NextAction("caster form") }, + /*A*/ {}, + /*C*/ { NextAction("cat form") } + ); } static ActionNode* rejuvenation_on_party([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("rejuvenation on party", - /*P*/ NextAction::array(0, new NextAction("caster form"), nullptr), - /*A*/ nullptr, - /*C*/ NextAction::array(0, new NextAction("cat form"), nullptr)); + return new ActionNode( + "rejuvenation on party", + /*P*/ { NextAction("caster form") }, + /*A*/ {}, + /*C*/ { NextAction("cat form") } + ); } }; @@ -121,12 +143,15 @@ OffhealDruidCatStrategy::OffhealDruidCatStrategy(PlayerbotAI* botAI) : FeralDrui actionNodeFactories.Add(new OffhealDruidCatStrategyActionNodeFactory()); } -NextAction** OffhealDruidCatStrategy::getDefaultActions() +std::vector OffhealDruidCatStrategy::getDefaultActions() { - return NextAction::array(0, new NextAction("mangle (cat)", ACTION_DEFAULT + 0.5f), - new NextAction("shred", ACTION_DEFAULT + 0.4f), - new NextAction("rake", ACTION_DEFAULT + 0.3f), new NextAction("melee", ACTION_DEFAULT), - new NextAction("cat form", ACTION_DEFAULT - 0.1f), nullptr); + return { + NextAction("mangle (cat)", ACTION_DEFAULT + 0.5f), + NextAction("shred", ACTION_DEFAULT + 0.4f), + NextAction("rake", ACTION_DEFAULT + 0.3f), + NextAction("melee", ACTION_DEFAULT), + NextAction("cat form", ACTION_DEFAULT - 0.1f) + }; } void OffhealDruidCatStrategy::InitTriggers(std::vector& triggers) @@ -134,46 +159,149 @@ void OffhealDruidCatStrategy::InitTriggers(std::vector& triggers) FeralDruidStrategy::InitTriggers(triggers); triggers.push_back( - new TriggerNode("cat form", NextAction::array(0, new NextAction("cat form", ACTION_HIGH + 8), nullptr))); + new TriggerNode( + "cat form", + { + NextAction("cat form", ACTION_HIGH + 8) + } + ) + ); triggers.push_back( - new TriggerNode("savage roar", NextAction::array(0, new NextAction("savage roar", ACTION_HIGH + 7), nullptr))); - triggers.push_back(new TriggerNode("combo points available", - NextAction::array(0, new NextAction("rip", ACTION_HIGH + 6), nullptr))); - triggers.push_back(new TriggerNode( - "ferocious bite time", NextAction::array(0, new NextAction("ferocious bite", ACTION_HIGH + 5), nullptr))); + new TriggerNode( + "savage roar", + { + NextAction("savage roar", ACTION_HIGH + 7) + } + ) + ); triggers.push_back( - new TriggerNode("target with combo points almost dead", - NextAction::array(0, new NextAction("ferocious bite", ACTION_HIGH + 4), nullptr))); - triggers.push_back(new TriggerNode("mangle (cat)", - NextAction::array(0, new NextAction("mangle (cat)", ACTION_HIGH + 3), nullptr))); - triggers.push_back(new TriggerNode("rake", NextAction::array(0, new NextAction("rake", ACTION_HIGH + 2), nullptr))); - triggers.push_back(new TriggerNode("almost full energy available", - NextAction::array(0, new NextAction("shred", ACTION_DEFAULT + 0.4f), nullptr))); - triggers.push_back(new TriggerNode("combo points not full", - NextAction::array(0, new NextAction("shred", ACTION_DEFAULT + 0.4f), nullptr))); - triggers.push_back(new TriggerNode( - "faerie fire (feral)", NextAction::array(0, new NextAction("faerie fire (feral)", ACTION_NORMAL), nullptr))); - triggers.push_back(new TriggerNode("enemy out of melee", - NextAction::array(0, new NextAction("feral charge - cat", ACTION_HIGH + 9), - new NextAction("dash", ACTION_HIGH + 8), nullptr))); + new TriggerNode( + "combo points available", + { + NextAction("rip", ACTION_HIGH + 6) + } + ) + ); triggers.push_back( - new TriggerNode("medium aoe", NextAction::array(0, new NextAction("swipe (cat)", ACTION_HIGH + 3), nullptr))); - triggers.push_back(new TriggerNode( - "low energy", NextAction::array(0, new NextAction("tiger's fury", ACTION_NORMAL + 1), nullptr))); - - triggers.push_back(new TriggerNode( - "party member critical health", - NextAction::array(0, new NextAction("regrowth on party", ACTION_CRITICAL_HEAL + 6), - new NextAction("healing touch on party", ACTION_CRITICAL_HEAL + 5), nullptr))); - triggers.push_back(new TriggerNode( - "party member low health", - NextAction::array(0, new NextAction("healing touch on party", ACTION_MEDIUM_HEAL + 5), nullptr))); + new TriggerNode( + "ferocious bite time", + { + NextAction("ferocious bite", ACTION_HIGH + 5) + } + ) + ); triggers.push_back( - new TriggerNode("party member medium health", - NextAction::array(0, new NextAction("rejuvenation on party", ACTION_LIGHT_HEAL + 8), nullptr))); - triggers.push_back(new TriggerNode( - "party member to heal out of spell range", - NextAction::array(0, new NextAction("reach party member to heal", ACTION_EMERGENCY + 3), nullptr))); + new TriggerNode( + "target with combo points almost dead", + { + NextAction("ferocious bite", ACTION_HIGH + 4) + } + ) + ); triggers.push_back( - new TriggerNode("low mana", NextAction::array(0, new NextAction("innervate", ACTION_HIGH + 4), nullptr))); + new TriggerNode( + "mangle (cat)", + { + NextAction("mangle (cat)", ACTION_HIGH + 3) + } + ) + ); + triggers.push_back( + new TriggerNode( + "rake", + { + NextAction("rake", ACTION_HIGH + 2) + } + ) + ); + triggers.push_back( + new TriggerNode( + "almost full energy available", + { + NextAction("shred", ACTION_DEFAULT + 0.4f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "combo points not full", + { + NextAction("shred", ACTION_DEFAULT + 0.4f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "faerie fire (feral)", + { + NextAction("faerie fire (feral)", ACTION_NORMAL) + } + ) + ); + triggers.push_back( + new TriggerNode( + "enemy out of melee", + { + NextAction("feral charge - cat", ACTION_HIGH + 9), + NextAction("dash", ACTION_HIGH + 8) + } + ) + ); + triggers.push_back( + new TriggerNode( + "medium aoe", + { + NextAction("swipe (cat)", ACTION_HIGH + 3) + } + ) + ); + triggers.push_back( + new TriggerNode( + "low energy", + { + NextAction("tiger's fury", ACTION_NORMAL + 1) + } + ) + ); + triggers.push_back( + new TriggerNode( + "party member critical health", + { + NextAction("regrowth on party", ACTION_CRITICAL_HEAL + 6), + NextAction("healing touch on party", ACTION_CRITICAL_HEAL + 5) + } + ) + ); + triggers.push_back( + new TriggerNode( + "party member low health", + { + NextAction("healing touch on party", ACTION_MEDIUM_HEAL + 5) + } + ) + ); + triggers.push_back( + new TriggerNode( + "party member medium health", + { + NextAction("rejuvenation on party", ACTION_LIGHT_HEAL + 8) + } + ) + ); + triggers.push_back( + new TriggerNode( + "party member to heal out of spell range", + { + NextAction("reach party member to heal", ACTION_EMERGENCY + 3) + } + ) + ); + triggers.push_back( + new TriggerNode( + "low mana", + { + NextAction("innervate", ACTION_HIGH + 4) + } + ) + ); } diff --git a/src/strategy/druid/OffhealDruidCatStrategy.h b/src/strategy/druid/OffhealDruidCatStrategy.h index c90775d5..736de37c 100644 --- a/src/strategy/druid/OffhealDruidCatStrategy.h +++ b/src/strategy/druid/OffhealDruidCatStrategy.h @@ -17,7 +17,7 @@ void InitTriggers(std::vector& triggers) override; std::string const getName() override { return "offheal"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; uint32 GetType() const override { return STRATEGY_TYPE_COMBAT | STRATEGY_TYPE_DPS | STRATEGY_TYPE_HEAL | STRATEGY_TYPE_MELEE; diff --git a/src/strategy/dungeons/wotlk/azjolnerub/AzjolNerubStrategy.cpp b/src/strategy/dungeons/wotlk/azjolnerub/AzjolNerubStrategy.cpp index 1a30e98c..dbbb8f5b 100644 --- a/src/strategy/dungeons/wotlk/azjolnerub/AzjolNerubStrategy.cpp +++ b/src/strategy/dungeons/wotlk/azjolnerub/AzjolNerubStrategy.cpp @@ -7,9 +7,9 @@ void WotlkDungeonANStrategy::InitTriggers(std::vector &triggers) // TODO: Add CC trigger while web wraps are casting? // TODO: Bring healer closer than ranged dps to avoid fixates? triggers.push_back(new TriggerNode("krik'thir web wrap", - NextAction::array(0, new NextAction("attack web wrap", ACTION_RAID + 5), nullptr))); + { NextAction("attack web wrap", ACTION_RAID + 5) })); triggers.push_back(new TriggerNode("krik'thir watchers", - NextAction::array(0, new NextAction("krik'thir priority", ACTION_RAID + 4), nullptr))); + { NextAction("krik'thir priority", ACTION_RAID + 4) })); // Hadronox // The core AC triggers are very buggy with this boss, but default strat seems to play correctly @@ -19,9 +19,9 @@ void WotlkDungeonANStrategy::InitTriggers(std::vector &triggers) // and cast time is instant so no way to check currently casting location. // May need to hook boss AI.. might be able to just heal through it for now. // triggers.push_back(new TriggerNode("anub'arak impale", - // NextAction::array(0, new NextAction("TODO", ACTION_MOVE + 5), nullptr))); + // { NextAction("TODO", ACTION_MOVE + 5) })); triggers.push_back(new TriggerNode("anub'arak pound", - NextAction::array(0, new NextAction("dodge pound", ACTION_MOVE + 5), nullptr))); + { NextAction("dodge pound", ACTION_MOVE + 5) })); } void WotlkDungeonANStrategy::InitMultipliers(std::vector &multipliers) diff --git a/src/strategy/dungeons/wotlk/cullingofstratholme/CullingOfStratholmeStrategy.cpp b/src/strategy/dungeons/wotlk/cullingofstratholme/CullingOfStratholmeStrategy.cpp index e9011ee7..90765bde 100644 --- a/src/strategy/dungeons/wotlk/cullingofstratholme/CullingOfStratholmeStrategy.cpp +++ b/src/strategy/dungeons/wotlk/cullingofstratholme/CullingOfStratholmeStrategy.cpp @@ -8,12 +8,12 @@ void WotlkDungeonCoSStrategy::InitTriggers(std::vector &triggers) // Salramm the Fleshcrafter triggers.push_back(new TriggerNode("explode ghoul", - NextAction::array(0, new NextAction("explode ghoul spread", ACTION_MOVE + 5), nullptr))); + { NextAction("explode ghoul spread", ACTION_MOVE + 5) })); // Chrono-Lord Epoch // Not sure if this actually works, I think I've seen him charge melee characters..? triggers.push_back(new TriggerNode("epoch ranged", - NextAction::array(0, new NextAction("epoch stack", ACTION_MOVE + 5), nullptr))); + { NextAction("epoch stack", ACTION_MOVE + 5) })); // Mal'Ganis diff --git a/src/strategy/dungeons/wotlk/draktharonkeep/DrakTharonKeepStrategy.cpp b/src/strategy/dungeons/wotlk/draktharonkeep/DrakTharonKeepStrategy.cpp index a32d5231..791a0ea7 100644 --- a/src/strategy/dungeons/wotlk/draktharonkeep/DrakTharonKeepStrategy.cpp +++ b/src/strategy/dungeons/wotlk/draktharonkeep/DrakTharonKeepStrategy.cpp @@ -5,32 +5,32 @@ void WotlkDungeonDTKStrategy::InitTriggers(std::vector &triggers) { // Trollgore triggers.push_back(new TriggerNode("corpse explode", - NextAction::array(0, new NextAction("corpse explode spread", ACTION_MOVE + 5), nullptr))); + { NextAction("corpse explode spread", ACTION_MOVE + 5) })); // Novos the Summoner // TODO: Can be improved - it's a pretty easy fight but complex to program, revisit if needed triggers.push_back(new TriggerNode("arcane field", - NextAction::array(0, new NextAction("avoid arcane field", ACTION_MOVE + 5), nullptr))); + { NextAction("avoid arcane field", ACTION_MOVE + 5) })); triggers.push_back(new TriggerNode("arcane field", - NextAction::array(0, new NextAction("novos positioning", ACTION_MOVE + 4), nullptr))); + { NextAction("novos positioning", ACTION_MOVE + 4) })); triggers.push_back(new TriggerNode("arcane field", - NextAction::array(0, new NextAction("novos target priority", ACTION_NORMAL + 1), nullptr))); + { NextAction("novos target priority", ACTION_NORMAL + 1) })); // King Dred // TODO: Fear ward / tremor totem, or general anti-fear strat development //The Prophet Tharon'ja triggers.push_back(new TriggerNode("gift of tharon'ja", - NextAction::array(0, new NextAction("touch of life", ACTION_NORMAL + 5), nullptr))); + { NextAction("touch of life", ACTION_NORMAL + 5) })); triggers.push_back(new TriggerNode("gift of tharon'ja", - NextAction::array(0, new NextAction("bone armor", ACTION_NORMAL + 4), nullptr))); + { NextAction("bone armor", ACTION_NORMAL + 4) })); // Run ranged chars (who would normally stand at range) into melee, to dps in skeleton form triggers.push_back(new TriggerNode("tharon'ja out of melee", - NextAction::array(0, new NextAction("reach melee", ACTION_NORMAL + 3), nullptr))); + { NextAction("reach melee", ACTION_NORMAL + 3) })); triggers.push_back(new TriggerNode("gift of tharon'ja", - NextAction::array(0, new NextAction("taunt", ACTION_NORMAL + 2), nullptr))); + { NextAction("taunt", ACTION_NORMAL + 2) })); triggers.push_back(new TriggerNode("gift of tharon'ja", - NextAction::array(0, new NextAction("slaying strike", ACTION_NORMAL + 2), nullptr))); + { NextAction("slaying strike", ACTION_NORMAL + 2) })); } void WotlkDungeonDTKStrategy::InitMultipliers(std::vector &multipliers) diff --git a/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsStrategy.cpp b/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsStrategy.cpp index b70b518e..9ff32198 100644 --- a/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsStrategy.cpp +++ b/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsStrategy.cpp @@ -4,17 +4,16 @@ void WotlkDungeonFoSStrategy::InitTriggers(std::vector& triggers) { triggers.push_back(new TriggerNode("move from bronjahm", - NextAction::array(0, new NextAction("move from bronjahm", ACTION_MOVE + 5), nullptr))); + { NextAction("move from bronjahm", ACTION_MOVE + 5) })); triggers.push_back(new TriggerNode("switch to soul fragment", - NextAction::array(0, new NextAction("attack corrupted soul fragment", ACTION_RAID + 2), nullptr))); + { NextAction("attack corrupted soul fragment", ACTION_RAID + 2) })); triggers.push_back(new TriggerNode("bronjahm position", - NextAction::array(0, new NextAction("bronjahm group position", ACTION_RAID + 1), nullptr))); + { NextAction("bronjahm group position", ACTION_RAID + 1) })); triggers.push_back(new TriggerNode("devourer of souls", - NextAction::array(0, new NextAction("devourer of souls", ACTION_RAID + 1), nullptr))); + { NextAction("devourer of souls", ACTION_RAID + 1) })); } void WotlkDungeonFoSStrategy::InitMultipliers(std::vector& multipliers) { multipliers.push_back(new BronjahmMultiplier(botAI)); - //multipliers.push_back(new AttackFragmentMultiplier(botAI)); } diff --git a/src/strategy/dungeons/wotlk/gundrak/GundrakStrategy.cpp b/src/strategy/dungeons/wotlk/gundrak/GundrakStrategy.cpp index 8c5612dc..c8244e2c 100644 --- a/src/strategy/dungeons/wotlk/gundrak/GundrakStrategy.cpp +++ b/src/strategy/dungeons/wotlk/gundrak/GundrakStrategy.cpp @@ -11,13 +11,13 @@ void WotlkDungeonGDStrategy::InitTriggers(std::vector &triggers) // TODO: Might need to add target priority for heroic on the snakes or to burn down boss. // Will re-test in heroic, decent dps groups should be able to blast him down with no funky strats. triggers.push_back(new TriggerNode("poison nova", - NextAction::array(0, new NextAction("avoid poison nova", ACTION_RAID + 5), nullptr))); + { NextAction("avoid poison nova", ACTION_RAID + 5) })); triggers.push_back(new TriggerNode("snake wrap", - NextAction::array(0, new NextAction("attack snake wrap", ACTION_RAID + 4), nullptr))); + { NextAction("attack snake wrap", ACTION_RAID + 4) })); // Gal'darah triggers.push_back(new TriggerNode("whirling slash", - NextAction::array(0, new NextAction("avoid whirling slash", ACTION_RAID + 5), nullptr))); + { NextAction("avoid whirling slash", ACTION_RAID + 5) })); // Eck the Ferocious (Heroic only) } diff --git a/src/strategy/dungeons/wotlk/hallsoflightning/HallsOfLightningStrategy.cpp b/src/strategy/dungeons/wotlk/hallsoflightning/HallsOfLightningStrategy.cpp index 42d30d96..1266fb0b 100644 --- a/src/strategy/dungeons/wotlk/hallsoflightning/HallsOfLightningStrategy.cpp +++ b/src/strategy/dungeons/wotlk/hallsoflightning/HallsOfLightningStrategy.cpp @@ -5,30 +5,30 @@ void WotlkDungeonHoLStrategy::InitTriggers(std::vector &triggers) { // General Bjarngrim triggers.push_back(new TriggerNode("stormforged lieutenant", - NextAction::array(0, new NextAction("bjarngrim target", ACTION_RAID + 5), nullptr))); + { NextAction("bjarngrim target", ACTION_RAID + 5) })); triggers.push_back(new TriggerNode("whirlwind", - NextAction::array(0, new NextAction("avoid whirlwind", ACTION_RAID + 4), nullptr))); + { NextAction("avoid whirlwind", ACTION_RAID + 4) })); // Volkhan triggers.push_back(new TriggerNode("volkhan", - NextAction::array(0, new NextAction("volkhan target", ACTION_RAID + 5), nullptr))); + { NextAction("volkhan target", ACTION_RAID + 5) })); // Ionar triggers.push_back(new TriggerNode("ionar disperse", - NextAction::array(0, new NextAction("disperse position", ACTION_MOVE + 5), nullptr))); + { NextAction("disperse position", ACTION_MOVE + 5) })); triggers.push_back(new TriggerNode("ionar tank aggro", - NextAction::array(0, new NextAction("ionar tank position", ACTION_MOVE + 4), nullptr))); + { NextAction("ionar tank position", ACTION_MOVE + 4) })); triggers.push_back(new TriggerNode("static overload", - NextAction::array(0, new NextAction("static overload spread", ACTION_MOVE + 3), nullptr))); + { NextAction("static overload spread", ACTION_MOVE + 3) })); // TODO: Targeted player can dodge the ball, but a single player soaking it isn't too bad to heal triggers.push_back(new TriggerNode("ball lightning", - NextAction::array(0, new NextAction("ball lightning spread", ACTION_MOVE + 2), nullptr))); + { NextAction("ball lightning spread", ACTION_MOVE + 2) })); // Loken triggers.push_back(new TriggerNode("lightning nova", - NextAction::array(0, new NextAction("avoid lightning nova", ACTION_MOVE + 5), nullptr))); + { NextAction("avoid lightning nova", ACTION_MOVE + 5) })); triggers.push_back(new TriggerNode("loken ranged", - NextAction::array(0, new NextAction("loken stack", ACTION_MOVE + 4), nullptr))); + { NextAction("loken stack", ACTION_MOVE + 4) })); } void WotlkDungeonHoLStrategy::InitMultipliers(std::vector &multipliers) diff --git a/src/strategy/dungeons/wotlk/hallsofstone/HallsOfStoneStrategy.cpp b/src/strategy/dungeons/wotlk/hallsofstone/HallsOfStoneStrategy.cpp index b13d4d63..47006a9e 100644 --- a/src/strategy/dungeons/wotlk/hallsofstone/HallsOfStoneStrategy.cpp +++ b/src/strategy/dungeons/wotlk/hallsofstone/HallsOfStoneStrategy.cpp @@ -9,7 +9,7 @@ void WotlkDungeonHoSStrategy::InitTriggers(std::vector &triggers) // Krystallus // TODO: I think bots need to dismiss pets on this, or they nuke players they are standing close to triggers.push_back(new TriggerNode("ground slam", - NextAction::array(0, new NextAction("shatter spread", ACTION_RAID + 5), nullptr))); + { NextAction("shatter spread", ACTION_RAID + 5) })); // Tribunal of Ages // Seems fine, maybe add focus targeting strat if needed on heroic. @@ -19,7 +19,7 @@ void WotlkDungeonHoSStrategy::InitTriggers(std::vector &triggers) // Sjonnir The Ironshaper // Possibly tank in place in the middle of the room, assign a dps to adds? triggers.push_back(new TriggerNode("lightning ring", - NextAction::array(0, new NextAction("avoid lightning ring", ACTION_RAID + 5), nullptr))); + { NextAction("avoid lightning ring", ACTION_RAID + 5) })); } void WotlkDungeonHoSStrategy::InitMultipliers(std::vector &multipliers) diff --git a/src/strategy/dungeons/wotlk/nexus/NexusStrategy.cpp b/src/strategy/dungeons/wotlk/nexus/NexusStrategy.cpp index 22a85f50..e633ba98 100644 --- a/src/strategy/dungeons/wotlk/nexus/NexusStrategy.cpp +++ b/src/strategy/dungeons/wotlk/nexus/NexusStrategy.cpp @@ -7,39 +7,39 @@ void WotlkDungeonNexStrategy::InitTriggers(std::vector &triggers) // or // Alliance Commander (Horde N)/Commander Stoutbeard (Horde H) triggers.push_back(new TriggerNode("faction commander whirlwind", - NextAction::array(0, new NextAction("move from whirlwind", ACTION_MOVE + 5), nullptr))); + { NextAction("move from whirlwind", ACTION_MOVE + 5) })); // TODO: Handle fear? (tremor totems, fear ward etc.) // Grand Magus Telestra triggers.push_back(new TriggerNode("telestra firebomb", - NextAction::array(0, new NextAction("firebomb spread", ACTION_MOVE + 5), nullptr))); + { NextAction("firebomb spread", ACTION_MOVE + 5) })); triggers.push_back(new TriggerNode("telestra split phase", - NextAction::array(0, new NextAction("telestra split target", ACTION_RAID + 1), nullptr))); + { NextAction("telestra split target", ACTION_RAID + 1) })); // TODO: Add priority interrupt on the frost split's Blizzard casts // Anomalus triggers.push_back(new TriggerNode("chaotic rift", - NextAction::array(0, new NextAction("chaotic rift target", ACTION_RAID + 1), nullptr))); + { NextAction("chaotic rift target", ACTION_RAID + 1) })); // Ormorok the Tree-Shaper // Tank trigger to stack inside boss. Can also add return action to prevent boss repositioning // if it becomes too much of a problem. He usually dies before he's up against a wall though triggers.push_back(new TriggerNode("ormorok spikes", - NextAction::array(0, new NextAction("dodge spikes", ACTION_MOVE + 5), nullptr))); + { NextAction("dodge spikes", ACTION_MOVE + 5) })); // Non-tank trigger to stack. Avoiding the spikes at range is.. harder than it seems. // TODO: This turns hunters into melee marshmallows, have not come up with a better solution yet triggers.push_back(new TriggerNode("ormorok stack", - NextAction::array(0, new NextAction("dodge spikes", ACTION_MOVE + 5), nullptr))); + { NextAction("dodge spikes", ACTION_MOVE + 5) })); // TODO: Add handling for spell reflect... best to spam low level/weak spells but don't want // to hardcode spells per class, might be difficult to dynamically generate this. // Will revisit if I find my altbots killing themselves in heroic, just heal through it for now // Keristrasza triggers.push_back(new TriggerNode("intense cold", - NextAction::array(0, new NextAction("intense cold jump", ACTION_MOVE + 5), nullptr))); + { NextAction("intense cold jump", ACTION_MOVE + 5) })); // Flank dragon positioning triggers.push_back(new TriggerNode("keristrasza positioning", - NextAction::array(0, new NextAction("rear flank", ACTION_MOVE + 4), nullptr))); + { NextAction("rear flank", ACTION_MOVE + 4) })); // TODO: Add frost resist aura for paladins? } diff --git a/src/strategy/dungeons/wotlk/oculus/OculusStrategy.cpp b/src/strategy/dungeons/wotlk/oculus/OculusStrategy.cpp index 3e98dfa6..4c558469 100644 --- a/src/strategy/dungeons/wotlk/oculus/OculusStrategy.cpp +++ b/src/strategy/dungeons/wotlk/oculus/OculusStrategy.cpp @@ -6,28 +6,28 @@ void WotlkDungeonOccStrategy::InitTriggers(std::vector &triggers) // Drakos the Interrogator // TODO: May need work, TBA. triggers.push_back(new TriggerNode("unstable sphere", - NextAction::array(0, new NextAction("avoid unstable sphere", ACTION_MOVE + 5), nullptr))); + { NextAction("avoid unstable sphere", ACTION_MOVE + 5) })); // DRAKES triggers.push_back(new TriggerNode("drake mount", - NextAction::array(0, new NextAction("mount drake", ACTION_RAID + 5), nullptr))); + { NextAction("mount drake", ACTION_RAID + 5) })); triggers.push_back(new TriggerNode("drake dismount", - NextAction::array(0, new NextAction("dismount drake", ACTION_RAID + 5), nullptr))); + { NextAction("dismount drake", ACTION_RAID + 5) })); triggers.push_back(new TriggerNode("group flying", - NextAction::array(0, new NextAction("occ fly drake", ACTION_NORMAL + 1), nullptr))); + { NextAction("occ fly drake", ACTION_NORMAL + 1) })); triggers.push_back(new TriggerNode("drake combat", - NextAction::array(0, new NextAction("occ drake attack", ACTION_NORMAL + 5), nullptr))); + { NextAction("occ drake attack", ACTION_NORMAL + 5) })); // Varos Cloudstrider // Seems to be no way to identify the marked cores, may need to hook boss AI.. // triggers.push_back(new TriggerNode("varos cloudstrider", - // NextAction::array(0, new NextAction("avoid energize cores", ACTION_RAID + 5), nullptr))); + // { NextAction("avoid energize cores", ACTION_RAID + 5) })); // Mage-Lord Urom triggers.push_back(new TriggerNode("arcane explosion", - NextAction::array(0, new NextAction("avoid arcane explosion", ACTION_MOVE + 5), nullptr))); + { NextAction("avoid arcane explosion", ACTION_MOVE + 5) })); triggers.push_back(new TriggerNode("time bomb", - NextAction::array(0, new NextAction("time bomb spread", ACTION_MOVE + 4), nullptr))); + { NextAction("time bomb spread", ACTION_MOVE + 4) })); // Ley-Guardian Eregos } diff --git a/src/strategy/dungeons/wotlk/oldkingdom/OldKingdomStrategy.cpp b/src/strategy/dungeons/wotlk/oldkingdom/OldKingdomStrategy.cpp index 50a38412..484ea6ac 100644 --- a/src/strategy/dungeons/wotlk/oldkingdom/OldKingdomStrategy.cpp +++ b/src/strategy/dungeons/wotlk/oldkingdom/OldKingdomStrategy.cpp @@ -5,7 +5,7 @@ void WotlkDungeonOKStrategy::InitTriggers(std::vector &triggers) { // Elder Nadox triggers.push_back(new TriggerNode("nadox guardian", - NextAction::array(0, new NextAction("attack nadox guardian", ACTION_RAID + 5), nullptr))); + { NextAction("attack nadox guardian", ACTION_RAID + 5) })); // Prince Taldaram // Flame Orb spawns in melee, doesn't have a clear direction until it starts moving. @@ -14,13 +14,13 @@ void WotlkDungeonOKStrategy::InitTriggers(std::vector &triggers) // Jedoga Shadowseeker triggers.push_back(new TriggerNode("jedoga volunteer", - NextAction::array(0, new NextAction("attack jedoga volunteer", ACTION_RAID + 5), nullptr))); + { NextAction("attack jedoga volunteer", ACTION_RAID + 5) })); // Herald Volazj // Trash mobs before him have a big telegraphed shadow crash spell, // this can be avoided and is intended to be dodged triggers.push_back(new TriggerNode("shadow crash", - NextAction::array(0, new NextAction("avoid shadow crash", ACTION_MOVE + 5), nullptr))); + { NextAction("avoid shadow crash", ACTION_MOVE + 5) })); // Volazj is not implemented properly in AC, insanity phase does nothing. // Amanitar (Heroic Only) diff --git a/src/strategy/dungeons/wotlk/pitofsaron/PitOfSaronStrategy.cpp b/src/strategy/dungeons/wotlk/pitofsaron/PitOfSaronStrategy.cpp index 2539457b..641af0a6 100644 --- a/src/strategy/dungeons/wotlk/pitofsaron/PitOfSaronStrategy.cpp +++ b/src/strategy/dungeons/wotlk/pitofsaron/PitOfSaronStrategy.cpp @@ -4,14 +4,13 @@ void WotlkDungeonPoSStrategy::InitTriggers(std::vector& triggers) { triggers.push_back(new TriggerNode("ick and krick", - NextAction::array(0, new NextAction("ick and krick", ACTION_RAID + 5), nullptr))); + { NextAction("ick and krick", ACTION_RAID + 5) })); triggers.push_back(new TriggerNode("tyrannus", - NextAction::array(0, new NextAction("tyrannus", ACTION_RAID + 5), nullptr))); + { NextAction("tyrannus", ACTION_RAID + 5) })); } void WotlkDungeonPoSStrategy::InitMultipliers(std::vector& multipliers) { multipliers.push_back(new IckAndKrickMultiplier(botAI)); - //multipliers.push_back(new AttackFragmentMultiplier(botAI)); } diff --git a/src/strategy/dungeons/wotlk/trialofthechampion/TrialOfTheChampionStrategy.cpp b/src/strategy/dungeons/wotlk/trialofthechampion/TrialOfTheChampionStrategy.cpp index e1f97000..bbccca71 100644 --- a/src/strategy/dungeons/wotlk/trialofthechampion/TrialOfTheChampionStrategy.cpp +++ b/src/strategy/dungeons/wotlk/trialofthechampion/TrialOfTheChampionStrategy.cpp @@ -4,19 +4,18 @@ void WotlkDungeonToCStrategy::InitTriggers(std::vector &triggers) { triggers.push_back(new TriggerNode("toc lance", - NextAction::array(0, new NextAction("toc lance", ACTION_RAID + 5), nullptr))); + { NextAction("toc lance", ACTION_RAID + 5) })); triggers.push_back(new TriggerNode("toc ue lance", - NextAction::array(0, new NextAction("toc ue lance", ACTION_RAID + 2), nullptr))); + { NextAction("toc ue lance", ACTION_RAID + 2) })); triggers.push_back(new TriggerNode("toc mount near", - NextAction::array(0, new NextAction("toc mount", ACTION_RAID + 4), nullptr))); + { NextAction("toc mount", ACTION_RAID + 4) })); triggers.push_back(new TriggerNode("toc mounted", - NextAction::array(0, new NextAction("toc mounted", ACTION_RAID + 6), nullptr))); + { NextAction("toc mounted", ACTION_RAID + 6) })); triggers.push_back(new TriggerNode("toc eadric", - NextAction::array(0, new NextAction("toc eadric", ACTION_RAID + 3), nullptr))); + { NextAction("toc eadric", ACTION_RAID + 3) })); } void WotlkDungeonToCStrategy::InitMultipliers(std::vector &multipliers) { - //multipliers.push_back(new toc...); if needed in the future } diff --git a/src/strategy/dungeons/wotlk/utgardekeep/UtgardeKeepStrategy.cpp b/src/strategy/dungeons/wotlk/utgardekeep/UtgardeKeepStrategy.cpp index ee7d102a..562cb8ec 100644 --- a/src/strategy/dungeons/wotlk/utgardekeep/UtgardeKeepStrategy.cpp +++ b/src/strategy/dungeons/wotlk/utgardekeep/UtgardeKeepStrategy.cpp @@ -5,32 +5,32 @@ void WotlkDungeonUKStrategy::InitTriggers(std::vector &triggers) { // Prince Keleseth triggers.push_back(new TriggerNode("keleseth frost tomb", - NextAction::array(0, new NextAction("attack frost tomb", ACTION_RAID + 1), nullptr))); + { NextAction("attack frost tomb", ACTION_RAID + 1) })); // Skarvald the Constructor & Dalronn the Controller triggers.push_back(new TriggerNode("dalronn priority", - NextAction::array(0, new NextAction("attack dalronn", ACTION_RAID + 1), nullptr))); + { NextAction("attack dalronn", ACTION_RAID + 1) })); // Ingvar the Plunderer // Doesn't work yet, this action doesn't get processed until the existing cast finishes // triggers.push_back(new TriggerNode("ingvar staggering roar", - // NextAction::array(0, new NextAction("ingvar stop casting", ACTION_RAID + 1), nullptr))); + // { NextAction("ingvar stop casting", ACTION_RAID + 1) })); // No easy way to check LoS here, the pillars do not seem to count as gameobjects. // Not implemented for now, unsure if this is needed as a good group can probably burst through the boss // and just eat the debuff. // triggers.push_back(new TriggerNode("ingvar dreadful roar", - // NextAction::array(0, new NextAction("ingvar hide los", ACTION_RAID + 1), nullptr))); + // { NextAction("ingvar hide los", ACTION_RAID + 1) })); triggers.push_back(new TriggerNode("ingvar smash tank", - NextAction::array(0, new NextAction("ingvar dodge smash", ACTION_MOVE + 5), nullptr))); + { NextAction("ingvar dodge smash", ACTION_MOVE + 5) })); triggers.push_back(new TriggerNode("ingvar smash tank return", - NextAction::array(0, new NextAction("ingvar smash return", ACTION_MOVE + 5), nullptr))); + { NextAction("ingvar smash return", ACTION_MOVE + 5) })); // Buggy... if not behind target, ai can get stuck running towards and away from target. // I think for ranged chars, a custom action should be added that doesn't attempt to run into melee. // This is a bandaid for now, needs to be improved. triggers.push_back(new TriggerNode("not behind ingvar", - NextAction::array(0, new NextAction("set behind", ACTION_MOVE + 1), nullptr))); + { NextAction("set behind", ACTION_MOVE + 1) })); } diff --git a/src/strategy/dungeons/wotlk/utgardepinnacle/UtgardePinnacleStrategy.cpp b/src/strategy/dungeons/wotlk/utgardepinnacle/UtgardePinnacleStrategy.cpp index bcc4399c..fe104f34 100644 --- a/src/strategy/dungeons/wotlk/utgardepinnacle/UtgardePinnacleStrategy.cpp +++ b/src/strategy/dungeons/wotlk/utgardepinnacle/UtgardePinnacleStrategy.cpp @@ -10,14 +10,14 @@ void WotlkDungeonUPStrategy::InitTriggers(std::vector &triggers) // Skadi the Ruthless // TODO: Harpoons launchable via GameObject. For now players should do them triggers.push_back(new TriggerNode("freezing cloud", - NextAction::array(0, new NextAction("avoid freezing cloud", ACTION_RAID + 5), nullptr))); + { NextAction("avoid freezing cloud", ACTION_RAID + 5) })); triggers.push_back(new TriggerNode("skadi whirlwind", - NextAction::array(0, new NextAction("avoid skadi whirlwind", ACTION_RAID + 4), nullptr))); + { NextAction("avoid skadi whirlwind", ACTION_RAID + 4) })); // King Ymiron // May need to avoid orb.. unclear if the generic avoid AoE does this well triggers.push_back(new TriggerNode("ymiron bane", - NextAction::array(0, new NextAction("stop attack", ACTION_RAID + 5), nullptr))); + { NextAction("stop attack", ACTION_RAID + 5) })); } void WotlkDungeonUPStrategy::InitMultipliers(std::vector &multipliers) diff --git a/src/strategy/dungeons/wotlk/violethold/VioletHoldStrategy.cpp b/src/strategy/dungeons/wotlk/violethold/VioletHoldStrategy.cpp index 5b610300..ffc00e30 100644 --- a/src/strategy/dungeons/wotlk/violethold/VioletHoldStrategy.cpp +++ b/src/strategy/dungeons/wotlk/violethold/VioletHoldStrategy.cpp @@ -6,14 +6,14 @@ void WotlkDungeonVHStrategy::InitTriggers(std::vector &triggers) // Erekem // This boss has many purgable buffs, purging/dispels could be merged into generic strats though triggers.push_back(new TriggerNode("erekem target", - NextAction::array(0, new NextAction("attack erekem", ACTION_RAID + 1), nullptr))); + { NextAction("attack erekem", ACTION_RAID + 1) })); // Moragg // TODO: This guy has Optic Link which may require moving, add if needed // Ichoron triggers.push_back(new TriggerNode("ichoron target", - NextAction::array(0, new NextAction("attack ichor globule", ACTION_RAID + 1), nullptr))); + { NextAction("attack ichor globule", ACTION_RAID + 1) })); // Xevozz // TODO: Revisit in heroics, waypoints back and forth on stairs. Need to test with double beacon spawn @@ -23,13 +23,13 @@ void WotlkDungeonVHStrategy::InitTriggers(std::vector &triggers) // Zuramat the Obliterator triggers.push_back(new TriggerNode("shroud of darkness", - NextAction::array(0, new NextAction("stop attack", ACTION_HIGH + 5), nullptr))); + { NextAction("stop attack", ACTION_HIGH + 5) })); triggers.push_back(new TriggerNode("void shift", - NextAction::array(0, new NextAction("attack void sentry", ACTION_RAID + 1), nullptr))); + { NextAction("attack void sentry", ACTION_RAID + 1) })); // Cyanigosa triggers.push_back(new TriggerNode("cyanigosa positioning", - NextAction::array(0, new NextAction("rear flank", ACTION_MOVE + 5), nullptr))); + { NextAction("rear flank", ACTION_MOVE + 5) })); } void WotlkDungeonVHStrategy::InitMultipliers(std::vector &multipliers) diff --git a/src/strategy/generic/AttackEnemyPlayersStrategy.cpp b/src/strategy/generic/AttackEnemyPlayersStrategy.cpp index 1c3b843e..a4326997 100644 --- a/src/strategy/generic/AttackEnemyPlayersStrategy.cpp +++ b/src/strategy/generic/AttackEnemyPlayersStrategy.cpp @@ -10,5 +10,5 @@ void AttackEnemyPlayersStrategy::InitTriggers(std::vector& triggers) { triggers.push_back(new TriggerNode("enemy player near", - NextAction::array(0, new NextAction("attack enemy player", 55.0f), nullptr))); + { NextAction("attack enemy player", 55.0f) })); } diff --git a/src/strategy/generic/BattlegroundStrategy.cpp b/src/strategy/generic/BattlegroundStrategy.cpp index 444acf06..41c726cc 100644 --- a/src/strategy/generic/BattlegroundStrategy.cpp +++ b/src/strategy/generic/BattlegroundStrategy.cpp @@ -9,83 +9,79 @@ void BGStrategy::InitTriggers(std::vector& triggers) { - 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("timer", NextAction::array(0, new NextAction("bg strategy check", relevance), nullptr))); + triggers.push_back(new TriggerNode("often", { NextAction("bg join", relevance)})); + triggers.push_back(new TriggerNode("bg invite active", { NextAction("bg status check", relevance)})); + triggers.push_back(new TriggerNode("timer", { NextAction("bg strategy check", relevance)})); } BGStrategy::BGStrategy(PlayerbotAI* botAI) : PassTroughStrategy(botAI) {} void BattlegroundStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("bg waiting", NextAction::array(0, new NextAction("bg move to start", ACTION_BG), nullptr))); - triggers.push_back(new TriggerNode("bg active", NextAction::array(0, new NextAction("bg move to objective", ACTION_BG), nullptr))); - triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("bg check objective", ACTION_BG + 1), nullptr))); - triggers.push_back(new TriggerNode("dead", NextAction::array(0, new NextAction("bg reset objective force", ACTION_EMERGENCY), 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 flagcarrier near", - // 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))); + triggers.push_back(new TriggerNode("bg waiting", { NextAction("bg move to start", ACTION_BG)})); + triggers.push_back(new TriggerNode("bg active", { NextAction("bg move to objective", ACTION_BG)})); + triggers.push_back(new TriggerNode("often", { NextAction("bg check objective", ACTION_BG + 1)})); + triggers.push_back(new TriggerNode("dead", { NextAction("bg reset objective force", ACTION_EMERGENCY)})); } void WarsongStrategy::InitTriggers(std::vector& 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))); + triggers.push_back(new TriggerNode("bg active", { NextAction("bg check flag", ACTION_EMERGENCY )})); + triggers.push_back(new TriggerNode("enemy flagcarrier near", { NextAction("attack enemy flag carrier", ACTION_RAID + 1.0f)})); + triggers.push_back(new TriggerNode("team flagcarrier near", { NextAction("bg protect fc", ACTION_RAID)})); + triggers.push_back(new TriggerNode("often", { NextAction("bg use buff", ACTION_BG)})); + triggers.push_back(new TriggerNode("low health", { NextAction("bg use buff", ACTION_MOVE)})); + triggers.push_back(new TriggerNode("low mana", { NextAction("bg use buff", ACTION_MOVE)})); + triggers.push_back(new TriggerNode("player has flag", { NextAction("bg move to objective", ACTION_EMERGENCY)})); + triggers.push_back(new TriggerNode("timer bg", { NextAction("bg reset objective force", ACTION_EMERGENCY)})); } void AlteracStrategy::InitTriggers(std::vector& 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))); + triggers.push_back(new TriggerNode("alliance no snowfall gy", { NextAction("bg move to objective", ACTION_EMERGENCY)})); + triggers.push_back(new TriggerNode("timer bg", { NextAction("bg reset objective force", ACTION_EMERGENCY)})); } void ArathiStrategy::InitTriggers(std::vector& 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))); + triggers.push_back(new TriggerNode("bg active", { NextAction("bg check flag", ACTION_EMERGENCY)})); + triggers.push_back(new TriggerNode("often", { NextAction("bg use buff", ACTION_BG)})); + triggers.push_back(new TriggerNode("low health", { NextAction("bg use buff", ACTION_MOVE)})); + triggers.push_back(new TriggerNode("low mana", { NextAction("bg use buff", ACTION_MOVE)})); } void EyeStrategy::InitTriggers(std::vector& 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))); - triggers.push_back(new TriggerNode("enemy flagcarrier near", NextAction::array(0, new NextAction("attack enemy flag carrier", ACTION_RAID), 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("bg active", { NextAction("bg check flag", ACTION_EMERGENCY)})); + triggers.push_back(new TriggerNode("often", { NextAction("bg use buff", ACTION_BG)})); + triggers.push_back(new TriggerNode("low health", { NextAction("bg use buff", ACTION_MOVE)})); + triggers.push_back(new TriggerNode("low mana", { NextAction("bg use buff", ACTION_MOVE)})); + triggers.push_back(new TriggerNode("enemy flagcarrier near", { NextAction("attack enemy flag carrier", ACTION_RAID)})); + triggers.push_back(new TriggerNode("player has flag",{ NextAction("bg move to objective", ACTION_EMERGENCY)})); } //TODO: Do Priorities void IsleStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("bg active", NextAction::array(0, new NextAction("bg check flag", ACTION_MOVE), nullptr))); - triggers.push_back(new TriggerNode("timer", NextAction::array(0, new NextAction("enter vehicle", ACTION_MOVE + 8.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("in vehicle", NextAction::array(0, new NextAction("hurl boulder", ACTION_MOVE + 9.0f), nullptr))); - triggers.push_back(new TriggerNode("in vehicle", NextAction::array(0, new NextAction("fire cannon", ACTION_MOVE + 9.0f), nullptr))); - triggers.push_back(new TriggerNode("in vehicle", NextAction::array(0, new NextAction("napalm", ACTION_MOVE + 9.0f), nullptr))); - triggers.push_back(new TriggerNode("enemy is close", NextAction::array(0, new NextAction("steam blast", ACTION_MOVE + 9.0f), nullptr))); - triggers.push_back(new TriggerNode("in vehicle", NextAction::array(0, new NextAction("ram", ACTION_MOVE + 9.0f), nullptr))); - triggers.push_back(new TriggerNode("enemy is close", NextAction::array(0, new NextAction("ram", ACTION_MOVE + 9.1f), 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("incendiary rocket", ACTION_MOVE + 9.0f), nullptr))); - triggers.push_back(new TriggerNode("in vehicle", NextAction::array(0, new NextAction("rocket blast", ACTION_MOVE + 9.0f), nullptr))); + triggers.push_back(new TriggerNode("bg active", { NextAction("bg check flag", ACTION_MOVE)})); + triggers.push_back(new TriggerNode("timer", { NextAction("enter vehicle", ACTION_MOVE + 8.0f)})); + triggers.push_back(new TriggerNode("random", { NextAction("leave vehicle", ACTION_MOVE + 7.0f)})); + triggers.push_back(new TriggerNode("in vehicle", { NextAction("hurl boulder", ACTION_MOVE + 9.0f)})); + triggers.push_back(new TriggerNode("in vehicle", { NextAction("fire cannon", ACTION_MOVE + 9.0f)})); + triggers.push_back(new TriggerNode("in vehicle", { NextAction("napalm", ACTION_MOVE + 9.0f)})); + triggers.push_back(new TriggerNode("enemy is close", { NextAction("steam blast", ACTION_MOVE + 9.0f)})); + triggers.push_back(new TriggerNode("in vehicle", { NextAction("ram", ACTION_MOVE + 9.0f)})); + triggers.push_back(new TriggerNode("enemy is close", { NextAction("ram", ACTION_MOVE + 9.1f)})); + triggers.push_back(new TriggerNode("enemy out of melee", { NextAction("steam rush", ACTION_MOVE + 9.2f)})); + triggers.push_back(new TriggerNode("in vehicle", { NextAction("incendiary rocket", ACTION_MOVE + 9.0f)})); + triggers.push_back(new TriggerNode("in vehicle", { NextAction("rocket blast", ACTION_MOVE + 9.0f)})); // 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(new TriggerNode("in vehicle", NextAction::array(0, new NextAction("glaive throw", ACTION_MOVE + 9.0f), nullptr))); + // triggers.push_back(new TriggerNode("in vehicle", { NextAction("blade salvo", ACTION_MOVE + 9.0f)})); + triggers.push_back(new TriggerNode("in vehicle", { NextAction("glaive throw", ACTION_MOVE + 9.0f)})); } void ArenaStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( - new TriggerNode("no possible targets", NextAction::array(0, new NextAction("arena tactics", ACTION_BG), nullptr))); + new TriggerNode("no possible targets", { NextAction("arena tactics", ACTION_BG)})); } diff --git a/src/strategy/generic/ChatCommandHandlerStrategy.cpp b/src/strategy/generic/ChatCommandHandlerStrategy.cpp index 6cb59cda..0a81686a 100644 --- a/src/strategy/generic/ChatCommandHandlerStrategy.cpp +++ b/src/strategy/generic/ChatCommandHandlerStrategy.cpp @@ -16,9 +16,9 @@ private: static ActionNode* tank_attack_chat_shortcut(PlayerbotAI* botAI) { return new ActionNode("tank attack chat shortcut", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ NextAction::array(0, new NextAction("attack my target", 100.0f), nullptr)); + /*P*/ {}, + /*A*/ {}, + /*C*/ { NextAction("attack my target", 100.0f) }); } }; @@ -26,86 +26,86 @@ void ChatCommandHandlerStrategy::InitTriggers(std::vector& trigger { PassTroughStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("rep", NextAction::array(0, new NextAction("reputation", relevance), nullptr))); - triggers.push_back(new TriggerNode("q", NextAction::array(0, new NextAction("query quest", relevance), - new NextAction("query item usage", relevance), nullptr))); - triggers.push_back(new TriggerNode("add all loot", NextAction::array(0, new NextAction("add all loot", relevance), - new NextAction("loot", relevance), nullptr))); - triggers.push_back(new TriggerNode("u", NextAction::array(0, new NextAction("use", relevance), nullptr))); - triggers.push_back(new TriggerNode("c", NextAction::array(0, new NextAction("item count", relevance), nullptr))); + triggers.push_back(new TriggerNode("rep", { NextAction("reputation", relevance) })); + triggers.push_back(new TriggerNode("q", { NextAction("query quest", relevance), + NextAction("query item usage", relevance) })); + triggers.push_back(new TriggerNode("add all loot", { NextAction("add all loot", relevance), + NextAction("loot", relevance) })); + triggers.push_back(new TriggerNode("u", { NextAction("use", relevance) })); + triggers.push_back(new TriggerNode("c", { NextAction("item count", relevance) })); triggers.push_back( - new TriggerNode("items", NextAction::array(0, new NextAction("item count", relevance), nullptr))); - triggers.push_back(new TriggerNode("inv", NextAction::array(0, new NextAction("item count", relevance), nullptr))); - triggers.push_back(new TriggerNode("e", NextAction::array(0, new NextAction("equip", relevance), nullptr))); - triggers.push_back(new TriggerNode("ue", NextAction::array(0, new NextAction("unequip", relevance), nullptr))); - triggers.push_back(new TriggerNode("t", NextAction::array(0, new NextAction("trade", relevance), nullptr))); - triggers.push_back(new TriggerNode("nt", NextAction::array(0, new NextAction("trade", relevance), nullptr))); - triggers.push_back(new TriggerNode("s", NextAction::array(0, new NextAction("sell", relevance), nullptr))); - triggers.push_back(new TriggerNode("b", NextAction::array(0, new NextAction("buy", relevance), nullptr))); - triggers.push_back(new TriggerNode("r", NextAction::array(0, new NextAction("reward", relevance), nullptr))); + new TriggerNode("items", { NextAction("item count", relevance) })); + triggers.push_back(new TriggerNode("inv", { NextAction("item count", relevance) })); + triggers.push_back(new TriggerNode("e", { NextAction("equip", relevance) })); + triggers.push_back(new TriggerNode("ue", { NextAction("unequip", relevance) })); + triggers.push_back(new TriggerNode("t", { NextAction("trade", relevance) })); + triggers.push_back(new TriggerNode("nt", { NextAction("trade", relevance) })); + triggers.push_back(new TriggerNode("s", { NextAction("sell", relevance) })); + triggers.push_back(new TriggerNode("b", { NextAction("buy", relevance) })); + triggers.push_back(new TriggerNode("r", { NextAction("reward", relevance) })); triggers.push_back( - new TriggerNode("attack", NextAction::array(0, new NextAction("attack my target", relevance), nullptr))); + new TriggerNode("attack", { NextAction("attack my target", relevance) })); triggers.push_back( - new TriggerNode("accept", NextAction::array(0, new NextAction("accept quest", relevance), nullptr))); + new TriggerNode("accept", { NextAction("accept quest", relevance) })); triggers.push_back( - new TriggerNode("follow", NextAction::array(0, new NextAction("follow chat shortcut", relevance), nullptr))); + new TriggerNode("follow", { NextAction("follow chat shortcut", relevance) })); triggers.push_back( - new TriggerNode("stay", NextAction::array(0, new NextAction("stay chat shortcut", relevance), nullptr))); + new TriggerNode("stay", { NextAction("stay chat shortcut", relevance) })); triggers.push_back( - new TriggerNode("move from group", NextAction::array(0, new NextAction("move from group chat shortcut", relevance), nullptr))); + new TriggerNode("move from group", { NextAction("move from group chat shortcut", relevance) })); triggers.push_back( - new TriggerNode("flee", NextAction::array(0, new NextAction("flee chat shortcut", relevance), nullptr))); + new TriggerNode("flee", { NextAction("flee chat shortcut", relevance) })); triggers.push_back(new TriggerNode( - "tank attack", NextAction::array(0, new NextAction("tank attack chat shortcut", relevance), nullptr))); + "tank attack", { NextAction("tank attack chat shortcut", relevance) })); triggers.push_back( - new TriggerNode("grind", NextAction::array(0, new NextAction("grind chat shortcut", relevance), nullptr))); + new TriggerNode("grind", { NextAction("grind chat shortcut", relevance) })); triggers.push_back( - new TriggerNode("talk", NextAction::array(0, new NextAction("gossip hello", relevance), - new NextAction("talk to quest giver", relevance), nullptr))); + new TriggerNode("talk", { NextAction("gossip hello", relevance), + NextAction("talk to quest giver", relevance) })); triggers.push_back( - new TriggerNode("enter vehicle", NextAction::array(0, new NextAction("enter vehicle", relevance), nullptr))); + new TriggerNode("enter vehicle", { NextAction("enter vehicle", relevance) })); triggers.push_back( - new TriggerNode("leave vehicle", NextAction::array(0, new NextAction("leave vehicle", relevance), nullptr))); + new TriggerNode("leave vehicle", { NextAction("leave vehicle", relevance) })); triggers.push_back( - new TriggerNode("cast", NextAction::array(0, new NextAction("cast custom spell", relevance), nullptr))); + new TriggerNode("cast", { NextAction("cast custom spell", relevance) })); triggers.push_back( - new TriggerNode("castnc", NextAction::array(0, new NextAction("cast custom nc spell", relevance), nullptr))); + new TriggerNode("castnc", { NextAction("cast custom nc spell", relevance) })); triggers.push_back( - new TriggerNode("revive", NextAction::array(0, new NextAction("spirit healer", relevance), nullptr))); + new TriggerNode("revive", { NextAction("spirit healer", relevance) })); triggers.push_back( - new TriggerNode("runaway", NextAction::array(0, new NextAction("runaway chat shortcut", relevance), nullptr))); + new TriggerNode("runaway", { NextAction("runaway chat shortcut", relevance) })); triggers.push_back( - new TriggerNode("warning", NextAction::array(0, new NextAction("runaway chat shortcut", relevance), nullptr))); + new TriggerNode("warning", { NextAction("runaway chat shortcut", relevance) })); triggers.push_back( - new TriggerNode("max dps", NextAction::array(0, new NextAction("max dps chat shortcut", relevance), nullptr))); + new TriggerNode("max dps", { NextAction("max dps chat shortcut", relevance) })); triggers.push_back( - new TriggerNode("attackers", NextAction::array(0, new NextAction("tell attackers", relevance), nullptr))); + new TriggerNode("attackers", { NextAction("tell attackers", relevance) })); triggers.push_back( - new TriggerNode("target", NextAction::array(0, new NextAction("tell target", relevance), nullptr))); + new TriggerNode("target", { NextAction("tell target", relevance) })); triggers.push_back( - new TriggerNode("ready", NextAction::array(0, new NextAction("ready check", relevance), nullptr))); + new TriggerNode("ready", { NextAction("ready check", relevance) })); triggers.push_back( - new TriggerNode("bwl", NextAction::array(0, new NextAction("bwl chat shortcut", relevance), NULL))); + new TriggerNode("bwl", { NextAction("bwl chat shortcut", relevance) })); triggers.push_back( - new TriggerNode("dps", NextAction::array(0, new NextAction("tell estimated dps", relevance), NULL))); + new TriggerNode("dps", { NextAction("tell estimated dps", relevance) })); triggers.push_back( - new TriggerNode("disperse", NextAction::array(0, new NextAction("disperse set", relevance), NULL))); + new TriggerNode("disperse", { NextAction("disperse set", relevance) })); triggers.push_back( - new TriggerNode("open items", NextAction::array(0, new NextAction("open items", relevance), nullptr))); + new TriggerNode("open items", { NextAction("open items", relevance) })); triggers.push_back( - new TriggerNode("qi", NextAction::array(0, new NextAction("query item usage", relevance), nullptr))); + new TriggerNode("qi", { NextAction("query item usage", relevance) })); triggers.push_back( - new TriggerNode("unlock items", NextAction::array(0, new NextAction("unlock items", relevance), nullptr))); + new TriggerNode("unlock items", { NextAction("unlock items", relevance) })); triggers.push_back( - new TriggerNode("unlock traded item", NextAction::array(0, new NextAction("unlock traded item", relevance), nullptr))); + new TriggerNode("unlock traded item", { NextAction("unlock traded item", relevance) })); triggers.push_back( - new TriggerNode("wipe", NextAction::array(0, new NextAction("wipe", relevance), nullptr))); - triggers.push_back(new TriggerNode("tame", NextAction::array(0, new NextAction("tame", relevance), nullptr))); - triggers.push_back(new TriggerNode("glyphs", NextAction::array(0, new NextAction("glyphs", relevance), nullptr))); // Added for custom Glyphs - triggers.push_back(new TriggerNode("glyph equip", NextAction::array(0, new NextAction("glyph equip", relevance), nullptr))); // Added for custom Glyphs - triggers.push_back(new TriggerNode("pet", NextAction::array(0, new NextAction("pet", relevance), nullptr))); - triggers.push_back(new TriggerNode("pet attack", NextAction::array(0, new NextAction("pet attack", relevance), nullptr))); - triggers.push_back(new TriggerNode("roll", NextAction::array(0, new NextAction("roll", relevance), nullptr))); + new TriggerNode("wipe", { NextAction("wipe", relevance) })); + triggers.push_back(new TriggerNode("tame", { NextAction("tame", relevance) })); + triggers.push_back(new TriggerNode("glyphs", { NextAction("glyphs", relevance) })); // Added for custom Glyphs + triggers.push_back(new TriggerNode("glyph equip", { NextAction("glyph equip", relevance) })); // Added for custom Glyphs + triggers.push_back(new TriggerNode("pet", { NextAction("pet", relevance) })); + triggers.push_back(new TriggerNode("pet attack", { NextAction("pet attack", relevance) })); + triggers.push_back(new TriggerNode("roll", { NextAction("roll", relevance) })); } ChatCommandHandlerStrategy::ChatCommandHandlerStrategy(PlayerbotAI* botAI) : PassTroughStrategy(botAI) diff --git a/src/strategy/generic/CombatStrategy.cpp b/src/strategy/generic/CombatStrategy.cpp index e194eb88..75700e9a 100644 --- a/src/strategy/generic/CombatStrategy.cpp +++ b/src/strategy/generic/CombatStrategy.cpp @@ -10,70 +10,59 @@ void CombatStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("enemy out of spell", - NextAction::array(0, new NextAction("reach spell", ACTION_HIGH), nullptr))); + triggers.push_back( + new TriggerNode( + "enemy out of spell", + { + NextAction("reach spell", ACTION_HIGH) + } + ) + ); // drop target relevance 99 (lower than Worldpacket triggers) triggers.push_back( - new TriggerNode("invalid target", NextAction::array(0, new NextAction("drop target", 99), nullptr))); + new TriggerNode( + "invalid target", + { + NextAction("drop target", 99) + } + ) + ); triggers.push_back( - new TriggerNode("mounted", NextAction::array(0, new NextAction("check mount state", 54), nullptr))); - // triggers.push_back(new TriggerNode("out of react range", NextAction::array(0, new NextAction("flee to master", - // 55), nullptr))); - triggers.push_back(new TriggerNode("combat stuck", NextAction::array(0, new NextAction("reset", 1.0f), nullptr))); - triggers.push_back(new TriggerNode("not facing target", - NextAction::array(0, new NextAction("set facing", ACTION_MOVE + 7), nullptr))); - // triggers.push_back(new TriggerNode("pet attack", NextAction::array(0, new NextAction("pet attack", 40.0f), nullptr))); + new TriggerNode( + "mounted", + { + NextAction("check mount state", 54) + } + ) + ); + triggers.push_back( + new TriggerNode( + "combat stuck", + { + NextAction("reset", 1.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "not facing target", + { + NextAction("set facing", ACTION_MOVE + 7) + } + ) + ); // The pet-attack trigger is commented out because it was forcing the bot's pet to attack, overriding stay and follow commands. // Pets will automatically attack the bot's enemy if they are in "defensive" or "aggressive" // stance, or if the master issues an attack command. - // triggers.push_back(new TriggerNode("combat long stuck", NextAction::array(0, new NextAction("hearthstone", 0.9f), - // new NextAction("repop", 0.8f), nullptr))); } AvoidAoeStrategy::AvoidAoeStrategy(PlayerbotAI* botAI) : Strategy(botAI) {} -// class AvoidAoeStrategyMultiplier : public Multiplier -// { -// public: -// AvoidAoeStrategyMultiplier(PlayerbotAI* botAI) : Multiplier(botAI, "run away on area debuff") {} - -// public: -// virtual float GetValue(Action* action); - -// private: -// }; - -// float AvoidAoeStrategyMultiplier::GetValue(Action* action) -// { -// if (!action) -// return 1.0f; - -// std::string name = action->getName(); -// if (name == "follow" || name == "co" || name == "nc" || name == "drop target") -// return 1.0f; - -// uint32 spellId = AI_VALUE2(uint32, "spell id", name); -// const SpellInfo* const pSpellInfo = sSpellMgr->GetSpellInfo(spellId); -// if (!pSpellInfo) return 1.0f; - -// if (spellId && pSpellInfo->Targets & TARGET_FLAG_DEST_LOCATION) -// return 1.0f; -// else if (spellId && pSpellInfo->Targets & TARGET_FLAG_SOURCE_LOCATION) -// return 1.0f; - -// uint32 castTime = pSpellInfo->CalcCastTime(bot); - -// if (AI_VALUE2(bool, "has area debuff", "self target") && spellId && castTime > 0) -// { -// return 0.0f; -// } - -// return 1.0f; -// } - -NextAction** AvoidAoeStrategy::getDefaultActions() +std::vector AvoidAoeStrategy::getDefaultActions() { - return NextAction::array(0, new NextAction("avoid aoe", ACTION_EMERGENCY), nullptr); + return { + NextAction("avoid aoe", ACTION_EMERGENCY) + }; } void AvoidAoeStrategy::InitTriggers(std::vector& triggers) @@ -82,21 +71,24 @@ void AvoidAoeStrategy::InitTriggers(std::vector& triggers) void AvoidAoeStrategy::InitMultipliers(std::vector& multipliers) { - // multipliers.push_back(new AvoidAoeStrategyMultiplier(botAI)); } TankFaceStrategy::TankFaceStrategy(PlayerbotAI* botAI) : Strategy(botAI) {} -NextAction** TankFaceStrategy::getDefaultActions() +std::vector TankFaceStrategy::getDefaultActions() { - return NextAction::array(0, new NextAction("tank face", ACTION_MOVE), nullptr); + return { + NextAction("tank face", ACTION_MOVE) + }; } void TankFaceStrategy::InitTriggers(std::vector& triggers) { } -NextAction** CombatFormationStrategy::getDefaultActions() +std::vector CombatFormationStrategy::getDefaultActions() { - return NextAction::array(0, new NextAction("combat formation move", ACTION_NORMAL), nullptr); + return { + NextAction("combat formation move", ACTION_NORMAL) + }; } diff --git a/src/strategy/generic/CombatStrategy.h b/src/strategy/generic/CombatStrategy.h index 3f3019f2..3296d8bc 100644 --- a/src/strategy/generic/CombatStrategy.h +++ b/src/strategy/generic/CombatStrategy.h @@ -24,7 +24,7 @@ class AvoidAoeStrategy : public Strategy public: explicit AvoidAoeStrategy(PlayerbotAI* ai); const std::string getName() override { return "avoid aoe"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; void InitMultipliers(std::vector& multipliers) override; void InitTriggers(std::vector& triggers) override; }; @@ -34,7 +34,7 @@ class TankFaceStrategy : public Strategy public: explicit TankFaceStrategy(PlayerbotAI* ai); const std::string getName() override { return "tank face"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; void InitTriggers(std::vector& triggers) override; }; @@ -43,7 +43,7 @@ class CombatFormationStrategy : public Strategy public: CombatFormationStrategy(PlayerbotAI* ai) : Strategy(ai) {} const std::string getName() override { return "formation"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; }; #endif diff --git a/src/strategy/generic/DeadStrategy.cpp b/src/strategy/generic/DeadStrategy.cpp index 764813cf..61399fa1 100644 --- a/src/strategy/generic/DeadStrategy.cpp +++ b/src/strategy/generic/DeadStrategy.cpp @@ -12,21 +12,21 @@ void DeadStrategy::InitTriggers(std::vector& triggers) PassTroughStrategy::InitTriggers(triggers); triggers.push_back( - new TriggerNode("often", NextAction::array(0, new NextAction("auto release", relevance), nullptr))); + new TriggerNode("often", { NextAction("auto release", relevance) })); triggers.push_back( - new TriggerNode("bg active", NextAction::array(0, new NextAction("auto release", relevance), nullptr))); + new TriggerNode("bg active", { NextAction("auto release", relevance) })); triggers.push_back( - new TriggerNode("dead", NextAction::array(0, new NextAction("find corpse", relevance), nullptr))); + new TriggerNode("dead", { NextAction("find corpse", relevance) })); triggers.push_back(new TriggerNode( - "corpse near", NextAction::array(0, new NextAction("revive from corpse", relevance - 1.0f), nullptr))); + "corpse near", { NextAction("revive from corpse", relevance - 1.0f) })); triggers.push_back(new TriggerNode("resurrect request", - NextAction::array(0, new NextAction("accept resurrect", relevance), nullptr))); + { NextAction("accept resurrect", relevance) })); triggers.push_back( - new TriggerNode("falling far", NextAction::array(0, new NextAction("repop", relevance + 1.f), nullptr))); + new TriggerNode("falling far", { NextAction("repop", relevance + 1.f) })); triggers.push_back( - new TriggerNode("location stuck", NextAction::array(0, new NextAction("repop", relevance + 1), nullptr))); + new TriggerNode("location stuck", { NextAction("repop", relevance + 1) })); triggers.push_back(new TriggerNode( - "can self resurrect", NextAction::array(0, new NextAction("self resurrect", relevance + 2.0f), nullptr))); + "can self resurrect", { NextAction("self resurrect", relevance + 2.0f) })); } DeadStrategy::DeadStrategy(PlayerbotAI* botAI) : PassTroughStrategy(botAI) {} diff --git a/src/strategy/generic/DpsAssistStrategy.cpp b/src/strategy/generic/DpsAssistStrategy.cpp index 19976233..8ead279b 100644 --- a/src/strategy/generic/DpsAssistStrategy.cpp +++ b/src/strategy/generic/DpsAssistStrategy.cpp @@ -10,11 +10,11 @@ void DpsAssistStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( - new TriggerNode("not dps target active", NextAction::array(0, new NextAction("dps assist", 50.0f), nullptr))); + new TriggerNode("not dps target active", { NextAction("dps assist", 50.0f) })); } void DpsAoeStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( - new TriggerNode("not dps aoe target active", NextAction::array(0, new NextAction("dps aoe", 50.0f), nullptr))); + new TriggerNode("not dps aoe target active", { NextAction("dps aoe", 50.0f) })); } diff --git a/src/strategy/generic/DuelStrategy.cpp b/src/strategy/generic/DuelStrategy.cpp index 5a571e0f..4c08397e 100644 --- a/src/strategy/generic/DuelStrategy.cpp +++ b/src/strategy/generic/DuelStrategy.cpp @@ -12,9 +12,9 @@ void DuelStrategy::InitTriggers(std::vector& triggers) PassTroughStrategy::InitTriggers(triggers); triggers.push_back( - new TriggerNode("duel requested", NextAction::array(0, new NextAction("accept duel", relevance), nullptr))); + new TriggerNode("duel requested", { NextAction("accept duel", relevance) })); triggers.push_back( - new TriggerNode("no attackers", NextAction::array(0, new NextAction("attack duel opponent", 70.0f), nullptr))); + new TriggerNode("no attackers", { NextAction("attack duel opponent", 70.0f) })); } DuelStrategy::DuelStrategy(PlayerbotAI* botAI) : PassTroughStrategy(botAI) {} diff --git a/src/strategy/generic/EmoteStrategy.cpp b/src/strategy/generic/EmoteStrategy.cpp index 8e38a4b7..9419e0c3 100644 --- a/src/strategy/generic/EmoteStrategy.cpp +++ b/src/strategy/generic/EmoteStrategy.cpp @@ -11,25 +11,25 @@ void EmoteStrategy::InitTriggers(std::vector& triggers) { if (sPlayerbotAIConfig->randomBotEmote) { - triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("talk", 1.0f), nullptr))); - triggers.push_back(new TriggerNode("seldom", NextAction::array(0, new NextAction("emote", 1.0f), nullptr))); + triggers.push_back(new TriggerNode("often", { NextAction("talk", 1.0f) })); + triggers.push_back(new TriggerNode("seldom", { NextAction("emote", 1.0f) })); triggers.push_back( - new TriggerNode("receive text emote", NextAction::array(0, new NextAction("emote", 10.0f), nullptr))); + new TriggerNode("receive text emote", { NextAction("emote", 10.0f) })); triggers.push_back( - new TriggerNode("receive emote", NextAction::array(0, new NextAction("emote", 10.0f), nullptr))); + new TriggerNode("receive emote", { NextAction("emote", 10.0f) })); } if (sPlayerbotAIConfig->randomBotTalk) { triggers.push_back(new TriggerNode( "often", - NextAction::array(0, new NextAction("suggest what to do", 10.0f), new NextAction("suggest dungeon", 3.0f), - new NextAction("suggest trade", 3.0f), nullptr))); + { NextAction("suggest what to do", 10.0f), NextAction("suggest dungeon", 3.0f), + NextAction("suggest trade", 3.0f) })); } if (sPlayerbotAIConfig->enableGreet) triggers.push_back( - new TriggerNode("new player nearby", NextAction::array(0, new NextAction("greet", 1.0f), nullptr))); + new TriggerNode("new player nearby", { NextAction("greet", 1.0f) })); - triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("rpg mount anim", 1.0f), nullptr))); + triggers.push_back(new TriggerNode("often", { NextAction("rpg mount anim", 1.0f) })); } diff --git a/src/strategy/generic/FleeStrategy.cpp b/src/strategy/generic/FleeStrategy.cpp index a2eeb9ba..66373830 100644 --- a/src/strategy/generic/FleeStrategy.cpp +++ b/src/strategy/generic/FleeStrategy.cpp @@ -10,15 +10,15 @@ void FleeStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( - new TriggerNode("panic", NextAction::array(0, new NextAction("flee", ACTION_EMERGENCY + 9), nullptr))); + new TriggerNode("panic", { NextAction("flee", ACTION_EMERGENCY + 9) })); triggers.push_back( - new TriggerNode("outnumbered", NextAction::array(0, new NextAction("flee", ACTION_EMERGENCY + 9), nullptr))); + new TriggerNode("outnumbered", { NextAction("flee", ACTION_EMERGENCY + 9) })); triggers.push_back( - new TriggerNode("critical health", NextAction::array(0, new NextAction("flee", ACTION_MEDIUM_HEAL), nullptr))); + new TriggerNode("critical health", { NextAction("flee", ACTION_MEDIUM_HEAL) })); } void FleeFromAddsStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( - new TriggerNode("has nearest adds", NextAction::array(0, new NextAction("runaway", 50.0f), nullptr))); + new TriggerNode("has nearest adds", { NextAction("runaway", 50.0f) })); } diff --git a/src/strategy/generic/FollowMasterStrategy.cpp b/src/strategy/generic/FollowMasterStrategy.cpp index 771bcffb..0308b113 100644 --- a/src/strategy/generic/FollowMasterStrategy.cpp +++ b/src/strategy/generic/FollowMasterStrategy.cpp @@ -7,13 +7,13 @@ #include "Playerbots.h" -NextAction** FollowMasterStrategy::getDefaultActions() +std::vector FollowMasterStrategy::getDefaultActions() { - return NextAction::array(0, new NextAction("follow", 1.0f), nullptr); + return { + NextAction("follow", 1.0f) + }; } void FollowMasterStrategy::InitTriggers(std::vector& triggers) { - // triggers.push_back(new TriggerNode("out of react range", NextAction::array(0, new NextAction("flee to master", - // ACTION_HIGH), nullptr))); } diff --git a/src/strategy/generic/FollowMasterStrategy.h b/src/strategy/generic/FollowMasterStrategy.h index d751741e..9d7e3431 100644 --- a/src/strategy/generic/FollowMasterStrategy.h +++ b/src/strategy/generic/FollowMasterStrategy.h @@ -16,7 +16,7 @@ public: FollowMasterStrategy(PlayerbotAI* botAI) : NonCombatStrategy(botAI) {} std::string const getName() override { return "follow"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; void InitTriggers(std::vector& triggers) override; }; diff --git a/src/strategy/generic/GrindingStrategy.cpp b/src/strategy/generic/GrindingStrategy.cpp index 62237fa4..2db8cd87 100644 --- a/src/strategy/generic/GrindingStrategy.cpp +++ b/src/strategy/generic/GrindingStrategy.cpp @@ -7,22 +7,35 @@ #include "Playerbots.h" -NextAction** GrindingStrategy::getDefaultActions() +std::vector GrindingStrategy::getDefaultActions() { - return NextAction::array(0, - new NextAction("drink", 4.2f), - new NextAction("food", 4.1f), - nullptr); + return { + NextAction("drink", 4.2f), + NextAction("food", 4.1f), + }; } void GrindingStrategy::InitTriggers(std::vector& triggers) { // reduce lower than loot triggers.push_back( - new TriggerNode("no target", NextAction::array(0, new NextAction("attack anything", 4.0f), nullptr))); + new TriggerNode( + "no target", + { + NextAction("attack anything", 4.0f) + } + ) + ); } void MoveRandomStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("move random", 1.5f), NULL))); -} \ No newline at end of file + triggers.push_back( + new TriggerNode( + "often", + { + NextAction("move random", 1.5f) + } + ) + ); +} diff --git a/src/strategy/generic/GrindingStrategy.h b/src/strategy/generic/GrindingStrategy.h index 5ce9c4f7..e093c7a5 100644 --- a/src/strategy/generic/GrindingStrategy.h +++ b/src/strategy/generic/GrindingStrategy.h @@ -17,7 +17,7 @@ public: std::string const getName() override { return "grind"; } uint32 GetType() const override { return STRATEGY_TYPE_DPS; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; void InitTriggers(std::vector& triggers) override; }; diff --git a/src/strategy/generic/GroupStrategy.cpp b/src/strategy/generic/GroupStrategy.cpp index 9cfba6e2..1b81faa9 100644 --- a/src/strategy/generic/GroupStrategy.cpp +++ b/src/strategy/generic/GroupStrategy.cpp @@ -9,8 +9,8 @@ void GroupStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("invite nearby", 4.0f), nullptr))); - triggers.push_back(new TriggerNode("random", NextAction::array(0, new NextAction("invite guild", 4.0f), nullptr))); - triggers.push_back(new TriggerNode("random", NextAction::array(0, new NextAction("leave far away", 4.0f), nullptr))); - triggers.push_back(new TriggerNode("seldom", NextAction::array(0, new NextAction("reset instances", 1.0f), nullptr))); + triggers.push_back(new TriggerNode("often", { NextAction("invite nearby", 4.0f) })); + triggers.push_back(new TriggerNode("random", { NextAction("invite guild", 4.0f) })); + triggers.push_back(new TriggerNode("random", { NextAction("leave far away", 4.0f) })); + triggers.push_back(new TriggerNode("seldom", { NextAction("reset instances", 1.0f) })); } diff --git a/src/strategy/generic/GuardStrategy.cpp b/src/strategy/generic/GuardStrategy.cpp index 68ce2d00..9a396ac5 100644 --- a/src/strategy/generic/GuardStrategy.cpp +++ b/src/strategy/generic/GuardStrategy.cpp @@ -7,6 +7,11 @@ #include "Playerbots.h" -NextAction** GuardStrategy::getDefaultActions() { return NextAction::array(0, new NextAction("guard", 4.0f), nullptr); } +std::vector GuardStrategy::getDefaultActions() +{ + return { + NextAction("guard", 4.0f) + }; +} void GuardStrategy::InitTriggers(std::vector& triggers) {} diff --git a/src/strategy/generic/GuardStrategy.h b/src/strategy/generic/GuardStrategy.h index c6902ced..98c6b2a6 100644 --- a/src/strategy/generic/GuardStrategy.h +++ b/src/strategy/generic/GuardStrategy.h @@ -16,7 +16,7 @@ public: GuardStrategy(PlayerbotAI* botAI) : NonCombatStrategy(botAI) {} std::string const getName() override { return "guard"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; void InitTriggers(std::vector& triggers) override; }; diff --git a/src/strategy/generic/GuildStrategy.cpp b/src/strategy/generic/GuildStrategy.cpp index 3a5df2f1..d2594504 100644 --- a/src/strategy/generic/GuildStrategy.cpp +++ b/src/strategy/generic/GuildStrategy.cpp @@ -10,13 +10,13 @@ void GuildStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( - new TriggerNode("often", NextAction::array(0, new NextAction("offer petition nearby", 4.0f), nullptr))); + new TriggerNode("often", { NextAction("offer petition nearby", 4.0f) })); triggers.push_back( - new TriggerNode("often", NextAction::array(0, new NextAction("guild manage nearby", 4.0f), nullptr))); + new TriggerNode("often", { NextAction("guild manage nearby", 4.0f) })); triggers.push_back( - new TriggerNode("petition signed", NextAction::array(0, new NextAction("turn in petition", 10.0f), nullptr))); + new TriggerNode("petition signed", { NextAction("turn in petition", 10.0f) })); triggers.push_back( - new TriggerNode("buy tabard", NextAction::array(0, new NextAction("buy tabard", 10.0f), nullptr))); + new TriggerNode("buy tabard", { NextAction("buy tabard", 10.0f) })); triggers.push_back( - new TriggerNode("leave large guild", NextAction::array(0, new NextAction("guild leave", 4.0f), nullptr))); + new TriggerNode("leave large guild", { NextAction("guild leave", 4.0f) })); } diff --git a/src/strategy/generic/KiteStrategy.cpp b/src/strategy/generic/KiteStrategy.cpp index 011650df..2d496446 100644 --- a/src/strategy/generic/KiteStrategy.cpp +++ b/src/strategy/generic/KiteStrategy.cpp @@ -11,5 +11,5 @@ KiteStrategy::KiteStrategy(PlayerbotAI* botAI) : Strategy(botAI) {} void KiteStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("has aggro", NextAction::array(0, new NextAction("runaway", 51.0f), nullptr))); + triggers.push_back(new TriggerNode("has aggro", { NextAction("runaway", 51.0f) })); } diff --git a/src/strategy/generic/LfgStrategy.cpp b/src/strategy/generic/LfgStrategy.cpp index 1607d8e5..b6057881 100644 --- a/src/strategy/generic/LfgStrategy.cpp +++ b/src/strategy/generic/LfgStrategy.cpp @@ -9,11 +9,11 @@ void LfgStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("random", NextAction::array(0, new NextAction("lfg join", relevance), nullptr))); + triggers.push_back(new TriggerNode("random", { NextAction("lfg join", relevance) })); triggers.push_back( - new TriggerNode("seldom", NextAction::array(0, new NextAction("lfg leave", relevance), nullptr))); + new TriggerNode("seldom", { NextAction("lfg leave", relevance) })); triggers.push_back(new TriggerNode( - "unknown dungeon", NextAction::array(0, new NextAction("give leader in dungeon", relevance), nullptr))); + "unknown dungeon", { NextAction("give leader in dungeon", relevance) })); } LfgStrategy::LfgStrategy(PlayerbotAI* botAI) : PassTroughStrategy(botAI) {} diff --git a/src/strategy/generic/LootNonCombatStrategy.cpp b/src/strategy/generic/LootNonCombatStrategy.cpp index caf901b8..5ecbb695 100644 --- a/src/strategy/generic/LootNonCombatStrategy.cpp +++ b/src/strategy/generic/LootNonCombatStrategy.cpp @@ -9,29 +9,29 @@ void LootNonCombatStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("loot available", NextAction::array(0, new NextAction("loot", 6.0f), nullptr))); + triggers.push_back(new TriggerNode("loot available", { NextAction("loot", 6.0f) })); triggers.push_back( - new TriggerNode("far from loot target", NextAction::array(0, new NextAction("move to loot", 7.0f), nullptr))); - triggers.push_back(new TriggerNode("can loot", NextAction::array(0, new NextAction("open loot", 8.0f), nullptr))); - triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("add all loot", 5.0f), nullptr))); + new TriggerNode("far from loot target", { NextAction("move to loot", 7.0f) })); + triggers.push_back(new TriggerNode("can loot", { NextAction("open loot", 8.0f) })); + triggers.push_back(new TriggerNode("often", { NextAction("add all loot", 5.0f) })); } void GatherStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( - new TriggerNode("timer", NextAction::array(0, new NextAction("add gathering loot", 5.0f), nullptr))); + new TriggerNode("timer", { NextAction("add gathering loot", 5.0f) })); } void RevealStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( - new TriggerNode("often", NextAction::array(0, new NextAction("reveal gathering item", 50.0f), nullptr))); + new TriggerNode("often", { NextAction("reveal gathering item", 50.0f) })); } void UseBobberStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( - new TriggerNode("can use fishing bobber", NextAction::array(0, new NextAction("use fishing bobber", 20.0f), nullptr))); + new TriggerNode("can use fishing bobber", { NextAction("use fishing bobber", 20.0f) })); triggers.push_back( - new TriggerNode("random", NextAction::array(0, new NextAction("remove bobber strategy", 20.0f), nullptr))); + new TriggerNode("random", { NextAction("remove bobber strategy", 20.0f) })); } diff --git a/src/strategy/generic/MaintenanceStrategy.cpp b/src/strategy/generic/MaintenanceStrategy.cpp index 3e35f5bf..855555ed 100644 --- a/src/strategy/generic/MaintenanceStrategy.cpp +++ b/src/strategy/generic/MaintenanceStrategy.cpp @@ -7,17 +7,72 @@ #include "Playerbots.h" -NextAction** MaintenanceStrategy::getDefaultActions() { return nullptr; } +std::vector MaintenanceStrategy::getDefaultActions() { return {}; } void MaintenanceStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("random", NextAction::array(0, new NextAction("clean quest log", 6.0f), nullptr))); - triggers.push_back(new TriggerNode("random", NextAction::array(0, new NextAction("use random recipe", 1.0f), nullptr))); - triggers.push_back(new TriggerNode("random", NextAction::array(0, new NextAction("disenchant random item", 1.0f), nullptr))); - triggers.push_back(new TriggerNode("random", NextAction::array(0, new NextAction("enchant random item", 1.0f), nullptr))); - triggers.push_back(new TriggerNode("random", NextAction::array(0, new NextAction("smart destroy item", 1.0f), nullptr))); - triggers.push_back(new TriggerNode("move stuck", NextAction::array(0, new NextAction("reset", 1.0f), nullptr))); - // triggers.push_back(new TriggerNode("move long stuck", NextAction::array(0, new NextAction("hearthstone", 0.9f), new NextAction("repop", 0.8f), nullptr))); - triggers.push_back(new TriggerNode("random", NextAction::array(0, new NextAction("use random quest item", 0.9f), nullptr))); - triggers.push_back(new TriggerNode("random", NextAction::array(0, new NextAction("auto share quest", 0.9f), nullptr))); + triggers.push_back( + new TriggerNode( + "random", + { + NextAction("clean quest log", 6.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "random", + { + NextAction("use random recipe", 1.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "random", + { + NextAction("disenchant random item", 1.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "random", + { + NextAction("enchant random item", 1.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "random", + { + NextAction("smart destroy item", 1.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "move stuck", + { + NextAction("reset", 1.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "random", + { + NextAction("use random quest item", 0.9f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "random", + { + NextAction("auto share quest", 0.9f) + } + ) + ); } diff --git a/src/strategy/generic/MaintenanceStrategy.h b/src/strategy/generic/MaintenanceStrategy.h index 5a7025be..44bfadd0 100644 --- a/src/strategy/generic/MaintenanceStrategy.h +++ b/src/strategy/generic/MaintenanceStrategy.h @@ -17,7 +17,7 @@ public: std::string const getName() override { return "maintenance"; } uint32 GetType() const override { return STRATEGY_TYPE_NONCOMBAT; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; void InitTriggers(std::vector& triggers) override; }; diff --git a/src/strategy/generic/MarkRtiStrategy.cpp b/src/strategy/generic/MarkRtiStrategy.cpp index bf5fb8de..8d49c9a8 100644 --- a/src/strategy/generic/MarkRtiStrategy.cpp +++ b/src/strategy/generic/MarkRtiStrategy.cpp @@ -10,5 +10,5 @@ void MarkRtiStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( - new TriggerNode("no rti target", NextAction::array(0, new NextAction("mark rti", ACTION_NORMAL), nullptr))); + new TriggerNode("no rti target", { NextAction("mark rti", ACTION_NORMAL) })); } diff --git a/src/strategy/generic/MeleeCombatStrategy.cpp b/src/strategy/generic/MeleeCombatStrategy.cpp index de3ba39a..bc2d1891 100644 --- a/src/strategy/generic/MeleeCombatStrategy.cpp +++ b/src/strategy/generic/MeleeCombatStrategy.cpp @@ -11,12 +11,8 @@ void MeleeCombatStrategy::InitTriggers(std::vector& triggers) { CombatStrategy::InitTriggers(triggers); - // triggers.push_back(new TriggerNode("not facing target", NextAction::array(0, new NextAction("set facing", - // ACTION_MOVE + 7), nullptr))); triggers.push_back(new TriggerNode( - "enemy out of melee", NextAction::array(0, new NextAction("reach melee", ACTION_HIGH + 1), nullptr))); - // triggers.push_back(new TriggerNode("enemy too close for melee", NextAction::array(0, new NextAction("move out of - // enemy contact", ACTION_NORMAL + 8), nullptr))); + "enemy out of melee", { NextAction("reach melee", ACTION_HIGH + 1) })); } void SetBehindCombatStrategy::InitTriggers(std::vector& triggers) @@ -24,5 +20,5 @@ void SetBehindCombatStrategy::InitTriggers(std::vector& triggers) CombatStrategy::InitTriggers(triggers); triggers.push_back(new TriggerNode("not behind target", - NextAction::array(0, new NextAction("set behind", ACTION_MOVE + 7), nullptr))); + { NextAction("set behind", ACTION_MOVE + 7) })); } diff --git a/src/strategy/generic/MoveFromGroupStrategy.cpp b/src/strategy/generic/MoveFromGroupStrategy.cpp index 3ceccce2..247abc88 100644 --- a/src/strategy/generic/MoveFromGroupStrategy.cpp +++ b/src/strategy/generic/MoveFromGroupStrategy.cpp @@ -7,9 +7,11 @@ #include "PassiveMultiplier.h" #include "Playerbots.h" -NextAction** MoveFromGroupStrategy::getDefaultActions() +std::vector MoveFromGroupStrategy::getDefaultActions() { - return NextAction::array(0, new NextAction("move from group", 1.0f), nullptr); + return { + NextAction("move from group", 1.0f) + }; } void MoveFromGroupStrategy::InitMultipliers(std::vector& multipliers) diff --git a/src/strategy/generic/MoveFromGroupStrategy.h b/src/strategy/generic/MoveFromGroupStrategy.h index 3fb17f37..53aa1c99 100644 --- a/src/strategy/generic/MoveFromGroupStrategy.h +++ b/src/strategy/generic/MoveFromGroupStrategy.h @@ -16,7 +16,7 @@ public: MoveFromGroupStrategy(PlayerbotAI* botAI) : Strategy(botAI) {} std::string const getName() override { return "move from group"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; void InitMultipliers(std::vector& multipliers) override; }; diff --git a/src/strategy/generic/NonCombatStrategy.cpp b/src/strategy/generic/NonCombatStrategy.cpp index 09a24c67..6b8f76ac 100644 --- a/src/strategy/generic/NonCombatStrategy.cpp +++ b/src/strategy/generic/NonCombatStrategy.cpp @@ -9,41 +9,57 @@ void NonCombatStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("random", NextAction::array(0, new NextAction("clean quest log", 1.0f), nullptr))); - triggers.push_back(new TriggerNode("timer", NextAction::array(0, new NextAction("check mount state", 1.0f), - // new NextAction("check values", 1.0f), - nullptr))); - // triggers.push_back(new TriggerNode("near dark portal", NextAction::array(0, new NextAction("move to dark portal", 1.0f), nullptr))); - // triggers.push_back(new TriggerNode("at dark portal azeroth", NextAction::array(0, new NextAction("use dark portal azeroth", 1.0f), nullptr))); - // triggers.push_back(new TriggerNode("at dark portal outland", NextAction::array(0, new NextAction("move from dark portal", 1.0f), nullptr))); - // triggers.push_back(new TriggerNode("vehicle near", NextAction::array(0, new NextAction("enter vehicle", 10.0f), nullptr))); + triggers.push_back(new TriggerNode("random", { NextAction("clean quest log", 1.0f) })); + triggers.push_back(new TriggerNode("timer", { NextAction("check mount state", 1.0f) })); } void CollisionStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( - new TriggerNode("collision", NextAction::array(0, new NextAction("move out of collision", 2.0f), nullptr))); + new TriggerNode("collision", { NextAction("move out of collision", 2.0f) })); } void MountStrategy::InitTriggers(std::vector& triggers) { - /*triggers.push_back(new TriggerNode("no possible targets", NextAction::array(0, new NextAction("mount", 1.0f), - nullptr))); triggers.push_back(new TriggerNode("no rpg target", NextAction::array(0, new NextAction("mount", 1.0f), - nullptr)));*/ - /*triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("mount", 4.0f), nullptr)));*/ } void WorldBuffStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("need world buff", NextAction::array(0, new NextAction("world buff", 1.0f), nullptr))); + triggers.push_back( + new TriggerNode( + "need world buff", + { + NextAction("world buff", 1.0f) + } + ) + ); } void MasterFishingStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("very often", NextAction::array(0, new NextAction("move near water" , 10.0f), nullptr))); - - triggers.push_back(new TriggerNode("very often", NextAction::array(0, new NextAction("go fishing" , 10.0f), nullptr))); - - triggers.push_back(new TriggerNode("random", NextAction::array(0, new NextAction("end master fishing", 12.0f), - new NextAction("equip upgrades", 6.0f), nullptr))); + triggers.push_back( + new TriggerNode( + "very often", + { + NextAction("move near water" , 10.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "very often", + { + NextAction("go fishing" , 10.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "random", + { + NextAction("end master fishing", 12.0f), + NextAction("equip upgrades", 6.0f) + } + ) + ); } diff --git a/src/strategy/generic/PassTroughStrategy.cpp b/src/strategy/generic/PassTroughStrategy.cpp index e9365bad..228106df 100644 --- a/src/strategy/generic/PassTroughStrategy.cpp +++ b/src/strategy/generic/PassTroughStrategy.cpp @@ -11,5 +11,5 @@ void PassTroughStrategy::InitTriggers(std::vector& triggers) { for (std::vector::iterator i = supported.begin(); i != supported.end(); i++) triggers.push_back( - new TriggerNode(i->c_str(), NextAction::array(0, new NextAction(i->c_str(), relevance), nullptr))); + new TriggerNode(i->c_str(), { NextAction(i->c_str(), relevance) })); } diff --git a/src/strategy/generic/PullStrategy.cpp b/src/strategy/generic/PullStrategy.cpp index 70111ef8..d0c7c9ea 100644 --- a/src/strategy/generic/PullStrategy.cpp +++ b/src/strategy/generic/PullStrategy.cpp @@ -31,10 +31,13 @@ float MagePullMultiplier::GetValue(Action* action) return PassiveMultiplier::GetValue(action); } -NextAction** PullStrategy::getDefaultActions() +std::vector PullStrategy::getDefaultActions() { - return NextAction::array(0, new NextAction(action, 105.0f), new NextAction("follow", 104.0f), - new NextAction("end pull", 103.0f), nullptr); + return { + NextAction(action, 105.0f), + NextAction("follow", 104.0f), + NextAction("end pull", 103.0f), + }; } void PullStrategy::InitTriggers(std::vector& triggers) { CombatStrategy::InitTriggers(triggers); } @@ -50,5 +53,11 @@ void PossibleAddsStrategy::InitTriggers(std::vector& triggers) Strategy::InitTriggers(triggers); triggers.push_back( - new TriggerNode("possible adds", NextAction::array(0, new NextAction("flee with pet", 60), nullptr))); + new TriggerNode( + "possible adds", + { + NextAction("flee with pet", 60) + } + ) + ); } diff --git a/src/strategy/generic/PullStrategy.h b/src/strategy/generic/PullStrategy.h index 354760df..bdd7332f 100644 --- a/src/strategy/generic/PullStrategy.h +++ b/src/strategy/generic/PullStrategy.h @@ -18,7 +18,7 @@ public: void InitTriggers(std::vector& triggers) override; void InitMultipliers(std::vector& multipliers) override; std::string const getName() override { return "pull"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; private: std::string const action; diff --git a/src/strategy/generic/QuestStrategies.cpp b/src/strategy/generic/QuestStrategies.cpp index bdc1e9b7..adcc4b22 100644 --- a/src/strategy/generic/QuestStrategies.cpp +++ b/src/strategy/generic/QuestStrategies.cpp @@ -14,7 +14,7 @@ void QuestStrategy::InitTriggers(std::vector& triggers) PassTroughStrategy::InitTriggers(triggers); triggers.push_back( - new TriggerNode("quest share", NextAction::array(0, new NextAction("accept quest share", relevance), nullptr))); + new TriggerNode("quest share", { NextAction("accept quest share", relevance) })); } void DefaultQuestStrategy::InitTriggers(std::vector& triggers) @@ -22,11 +22,11 @@ void DefaultQuestStrategy::InitTriggers(std::vector& triggers) QuestStrategy::InitTriggers(triggers); triggers.push_back(new TriggerNode( - "use game object", NextAction::array(0, new NextAction("talk to quest giver", relevance), nullptr))); + "use game object", { NextAction("talk to quest giver", relevance) })); triggers.push_back(new TriggerNode( - "gossip hello", NextAction::array(0, new NextAction("talk to quest giver", relevance), nullptr))); + "gossip hello", { NextAction("talk to quest giver", relevance) })); triggers.push_back(new TriggerNode( - "complete quest", NextAction::array(0, new NextAction("talk to quest giver", relevance), nullptr))); + "complete quest", { NextAction("talk to quest giver", relevance) })); } DefaultQuestStrategy::DefaultQuestStrategy(PlayerbotAI* botAI) : QuestStrategy(botAI) {} @@ -36,14 +36,14 @@ void AcceptAllQuestsStrategy::InitTriggers(std::vector& triggers) QuestStrategy::InitTriggers(triggers); triggers.push_back( - new TriggerNode("use game object", NextAction::array(0, new NextAction("talk to quest giver", relevance), - new NextAction("accept all quests", relevance), nullptr))); + new TriggerNode("use game object", { NextAction("talk to quest giver", relevance), + NextAction("accept all quests", relevance) })); triggers.push_back( - new TriggerNode("gossip hello", NextAction::array(0, new NextAction("talk to quest giver", relevance), - new NextAction("accept all quests", relevance), nullptr))); + new TriggerNode("gossip hello", { NextAction("talk to quest giver", relevance), + NextAction("accept all quests", relevance) })); triggers.push_back( - new TriggerNode("complete quest", NextAction::array(0, new NextAction("talk to quest giver", relevance), - new NextAction("accept all quests", relevance), nullptr))); + new TriggerNode("complete quest", { NextAction("talk to quest giver", relevance), + NextAction("accept all quests", relevance) })); } AcceptAllQuestsStrategy::AcceptAllQuestsStrategy(PlayerbotAI* botAI) : QuestStrategy(botAI) {} diff --git a/src/strategy/generic/RacialsStrategy.cpp b/src/strategy/generic/RacialsStrategy.cpp index 53f40ef8..f4f270b1 100644 --- a/src/strategy/generic/RacialsStrategy.cpp +++ b/src/strategy/generic/RacialsStrategy.cpp @@ -16,26 +16,25 @@ private: static ActionNode* lifeblood(PlayerbotAI* botAI) { return new ActionNode("lifeblood", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("gift of the naaru"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("gift of the naaru") }, + /*C*/ {}); } }; void RacialsStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( - new TriggerNode("low health", NextAction::array(0, new NextAction("lifeblood", ACTION_NORMAL + 5), nullptr))); + new TriggerNode("low health", { NextAction("lifeblood", ACTION_NORMAL + 5) })); triggers.push_back( - new TriggerNode("medium aoe", NextAction::array(0, new NextAction("war stomp", ACTION_NORMAL + 5), nullptr))); + new TriggerNode("medium aoe", { NextAction("war stomp", ACTION_NORMAL + 5) })); triggers.push_back(new TriggerNode( - "low mana", NextAction::array(0, new NextAction("arcane torrent", ACTION_NORMAL + 5), nullptr))); + "low mana", { NextAction("arcane torrent", ACTION_NORMAL + 5) })); triggers.push_back(new TriggerNode( - "generic boost", NextAction::array(0, new NextAction("blood fury", ACTION_NORMAL + 5), - new NextAction("berserking", ACTION_NORMAL + 5), - new NextAction("use trinket", ACTION_NORMAL + 4), - nullptr))); + "generic boost", { NextAction("blood fury", ACTION_NORMAL + 5), + NextAction("berserking", ACTION_NORMAL + 5), + NextAction("use trinket", ACTION_NORMAL + 4) })); } diff --git a/src/strategy/generic/RangedCombatStrategy.cpp b/src/strategy/generic/RangedCombatStrategy.cpp index ec0f3fb3..73f26423 100644 --- a/src/strategy/generic/RangedCombatStrategy.cpp +++ b/src/strategy/generic/RangedCombatStrategy.cpp @@ -12,7 +12,5 @@ void RangedCombatStrategy::InitTriggers(std::vector& triggers) CombatStrategy::InitTriggers(triggers); triggers.push_back(new TriggerNode("enemy too close for spell", - NextAction::array(0, new NextAction("flee", ACTION_MOVE + 4), nullptr))); - // triggers.push_back(new TriggerNode("not facing target", NextAction::array(0, new NextAction("set facing", - // ACTION_MOVE + 7), nullptr))); + { NextAction("flee", ACTION_MOVE + 4) })); } diff --git a/src/strategy/generic/ReturnStrategy.cpp b/src/strategy/generic/ReturnStrategy.cpp index 27fc7670..2c88e64f 100644 --- a/src/strategy/generic/ReturnStrategy.cpp +++ b/src/strategy/generic/ReturnStrategy.cpp @@ -9,6 +9,6 @@ void ReturnStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("return", NextAction::array(0, new NextAction("set return position", 1.5f), - new NextAction("return", 1.0f), nullptr))); + triggers.push_back(new TriggerNode("return", { NextAction("set return position", 1.5f), + NextAction("return", 1.0f), })); } diff --git a/src/strategy/generic/RpgStrategy.cpp b/src/strategy/generic/RpgStrategy.cpp index 13173fd2..2c0b3544 100644 --- a/src/strategy/generic/RpgStrategy.cpp +++ b/src/strategy/generic/RpgStrategy.cpp @@ -24,51 +24,145 @@ float RpgActionMultiplier::GetValue(Action* action) RpgStrategy::RpgStrategy(PlayerbotAI* botAI) : Strategy(botAI) {} -NextAction** RpgStrategy::getDefaultActions() { return NextAction::array(0, new NextAction("rpg", 1.0f), nullptr); } +std::vector RpgStrategy::getDefaultActions() +{ + return { + NextAction("rpg", 1.0f) + }; +} void RpgStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( - new TriggerNode("no rpg target", NextAction::array(0, new NextAction("choose rpg target", 5.0f), nullptr))); - triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("move random", 1.10f), NULL))); - triggers.push_back(new TriggerNode("far from rpg target", - NextAction::array(0, new NextAction("move to rpg target", 5.0f), nullptr))); + new TriggerNode( + "no rpg target", + { + NextAction("choose rpg target", 5.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "often", + { + NextAction("move random", 1.10f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "far from rpg target", + { + NextAction("move to rpg target", 5.0f) + } + ) + ); // Sub actions - triggers.push_back(new TriggerNode("rpg", NextAction::array(0, new NextAction("rpg stay", 1.101f), nullptr))); - triggers.push_back(new TriggerNode("rpg", NextAction::array(0, new NextAction("rpg work", 1.101f), nullptr))); - triggers.push_back(new TriggerNode("rpg", NextAction::array(0, new NextAction("rpg emote", 1.101f), nullptr))); triggers.push_back( - new TriggerNode("has rpg target", NextAction::array(0, new NextAction("rpg cancel", 1.101f), nullptr))); - // triggers.push_back(new TriggerNode("rpg taxi", NextAction::array(0, new NextAction("rpg taxi", 1.005f), - // nullptr))); + new TriggerNode( + "rpg", + { + NextAction("rpg stay", 1.101f) + } + ) + ); triggers.push_back( - new TriggerNode("rpg discover", NextAction::array(0, new NextAction("rpg discover", 1.210f), nullptr))); + new TriggerNode( + "rpg", + { + NextAction("rpg work", 1.101f) + } + ) + ); triggers.push_back( - new TriggerNode("rpg start quest", NextAction::array(0, new NextAction("rpg start quest", 1.180f), nullptr))); + new TriggerNode( + "rpg", + { + NextAction("rpg emote", 1.101f) + } + ) + ); triggers.push_back( - new TriggerNode("rpg end quest", NextAction::array(0, new NextAction("rpg end quest", 1.190f), nullptr))); - triggers.push_back(new TriggerNode("rpg buy", NextAction::array(0, new NextAction("rpg buy", 1.130f), nullptr))); - // triggers.push_back(new TriggerNode("rpg sell", NextAction::array(0, new NextAction("rpg sell", 1.100f), - // nullptr))); + new TriggerNode( + "has rpg target", + { + NextAction("rpg cancel", 1.101f) + } + ) + ); triggers.push_back( - new TriggerNode("rpg repair", NextAction::array(0, new NextAction("rpg repair", 1.195f), nullptr))); - // triggers.push_back(new TriggerNode("rpg train", NextAction::array(0, new NextAction("rpg train", 1.080f), - // nullptr))); - triggers.push_back(new TriggerNode("rpg heal", NextAction::array(0, new NextAction("rpg heal", 1.125f), nullptr))); + new TriggerNode( + "rpg discover", + { + NextAction("rpg discover", 1.210f) + } + ) + ); triggers.push_back( - new TriggerNode("rpg home bind", NextAction::array(0, new NextAction("rpg home bind", 1.160f), nullptr))); - // triggers.push_back(new TriggerNode("rpg queue bg", NextAction::array(0, new NextAction("rpg queue bg", 1.085f), - // nullptr))); + new TriggerNode( + "rpg start quest", + { + NextAction("rpg start quest", 1.180f) + } + ) + ); triggers.push_back( - new TriggerNode("rpg buy petition", NextAction::array(0, new NextAction("rpg buy petition", 1.140f), nullptr))); - triggers.push_back(new TriggerNode("rpg use", NextAction::array(0, new NextAction("rpg use", 1.102f), nullptr))); - // triggers.push_back(new TriggerNode("rpg spell", NextAction::array(0, new NextAction("rpg spell", 1.001f), - // nullptr))); triggers.push_back(new TriggerNode("rpg craft", NextAction::array(0, new NextAction("rpg - // craft", 1.001f), nullptr))); - // triggers.push_back(new TriggerNode("rpg trade useful", NextAction::array(0, new NextAction("rpg trade - // useful", 1.030f), nullptr))); triggers.push_back(new TriggerNode("rpg duel", NextAction::array(0, new - // NextAction("rpg duel", 1.010f), nullptr))); + new TriggerNode( + "rpg end quest", + { + NextAction("rpg end quest", 1.190f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "rpg buy", + { + NextAction("rpg buy", 1.130f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "rpg repair", + { + NextAction("rpg repair", 1.195f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "rpg heal", + { + NextAction("rpg heal", 1.125f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "rpg home bind", + { + NextAction("rpg home bind", 1.160f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "rpg buy petition", + { + NextAction("rpg buy petition", 1.140f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "rpg use", + { + NextAction("rpg use", 1.102f) + } + ) + ); } void RpgStrategy::InitMultipliers(std::vector& multipliers) diff --git a/src/strategy/generic/RpgStrategy.h b/src/strategy/generic/RpgStrategy.h index f81a5bdf..cb1db704 100644 --- a/src/strategy/generic/RpgStrategy.h +++ b/src/strategy/generic/RpgStrategy.h @@ -24,7 +24,7 @@ public: RpgStrategy(PlayerbotAI* botAI); std::string const getName() override { return "rpg"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; void InitTriggers(std::vector& triggers) override; void InitMultipliers(std::vector& multipliers) override; }; diff --git a/src/strategy/generic/RunawayStrategy.cpp b/src/strategy/generic/RunawayStrategy.cpp index ae9cf129..28868a48 100644 --- a/src/strategy/generic/RunawayStrategy.cpp +++ b/src/strategy/generic/RunawayStrategy.cpp @@ -10,5 +10,5 @@ void RunawayStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( - new TriggerNode("enemy too close for spell", NextAction::array(0, new NextAction("runaway", 50.0f), nullptr))); + new TriggerNode("enemy too close for spell", { NextAction("runaway", 50.0f) })); } diff --git a/src/strategy/generic/SayStrategy.cpp b/src/strategy/generic/SayStrategy.cpp index fe9e5f54..71a72b79 100644 --- a/src/strategy/generic/SayStrategy.cpp +++ b/src/strategy/generic/SayStrategy.cpp @@ -10,11 +10,11 @@ void SayStrategy::InitTriggers(std::vector& triggers) { triggers.push_back(new TriggerNode("critical health", - NextAction::array(0, new NextAction("say::critical health", 99.0f), nullptr))); + { NextAction("say::critical health", 99.0f) })); triggers.push_back( - new TriggerNode("low health", NextAction::array(0, new NextAction("say::low health", 99.0f), nullptr))); + new TriggerNode("low health", { NextAction("say::low health", 99.0f) })); triggers.push_back( - new TriggerNode("low mana", NextAction::array(0, new NextAction("say::low mana", 99.0f), nullptr))); - triggers.push_back(new TriggerNode("tank aoe", NextAction::array(0, new NextAction("say::taunt", 99.0f), nullptr))); - triggers.push_back(new TriggerNode("medium aoe", NextAction::array(0, new NextAction("say::aoe", 99.0f), nullptr))); + new TriggerNode("low mana", { NextAction("say::low mana", 99.0f) })); + triggers.push_back(new TriggerNode("tank aoe", { NextAction("say::taunt", 99.0f) })); + triggers.push_back(new TriggerNode("medium aoe", { NextAction("say::aoe", 99.0f) })); } diff --git a/src/strategy/generic/StayStrategy.cpp b/src/strategy/generic/StayStrategy.cpp index 2237cc99..a59f9461 100644 --- a/src/strategy/generic/StayStrategy.cpp +++ b/src/strategy/generic/StayStrategy.cpp @@ -9,14 +9,31 @@ void StayStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode( - "return to stay position", - NextAction::array(0, new NextAction("return to stay position", ACTION_MOVE), nullptr))); + triggers.push_back( + new TriggerNode( + "return to stay position", + { + NextAction("return to stay position", ACTION_MOVE) + } + ) + ); } -NextAction** StayStrategy::getDefaultActions() { return NextAction::array(0, new NextAction("stay", 1.0f), nullptr); } +std::vector StayStrategy::getDefaultActions() +{ + return { + NextAction("stay", 1.0f) + }; +} void SitStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("sit", NextAction::array(0, new NextAction("sit", 1.5f), nullptr))); + triggers.push_back( + new TriggerNode( + "sit", + { + NextAction("sit", 1.5f) + } + ) + ); } diff --git a/src/strategy/generic/StayStrategy.h b/src/strategy/generic/StayStrategy.h index 90285516..0ee1c7d1 100644 --- a/src/strategy/generic/StayStrategy.h +++ b/src/strategy/generic/StayStrategy.h @@ -17,7 +17,7 @@ public: std::string const getName() override { return "stay"; } void InitTriggers(std::vector& triggers) override; - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; }; class SitStrategy : public NonCombatStrategy diff --git a/src/strategy/generic/TankAssistStrategy.cpp b/src/strategy/generic/TankAssistStrategy.cpp index 60106d43..4d4aae1a 100644 --- a/src/strategy/generic/TankAssistStrategy.cpp +++ b/src/strategy/generic/TankAssistStrategy.cpp @@ -10,5 +10,5 @@ void TankAssistStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( - new TriggerNode("tank assist", NextAction::array(0, new NextAction("tank assist", 50.0f), nullptr))); + new TriggerNode("tank assist", { NextAction("tank assist", 50.0f) })); } diff --git a/src/strategy/generic/TellTargetStrategy.cpp b/src/strategy/generic/TellTargetStrategy.cpp index 4410dcbf..c4c387f4 100644 --- a/src/strategy/generic/TellTargetStrategy.cpp +++ b/src/strategy/generic/TellTargetStrategy.cpp @@ -10,5 +10,5 @@ void TellTargetStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( - new TriggerNode("target changed", NextAction::array(0, new NextAction("tell target", 51.0f), nullptr))); + new TriggerNode("target changed", { NextAction("tell target", 51.0f) })); } diff --git a/src/strategy/generic/TravelStrategy.cpp b/src/strategy/generic/TravelStrategy.cpp index 2f335a46..3b5c77ff 100644 --- a/src/strategy/generic/TravelStrategy.cpp +++ b/src/strategy/generic/TravelStrategy.cpp @@ -9,15 +9,29 @@ TravelStrategy::TravelStrategy(PlayerbotAI* botAI) : Strategy(botAI) {} -NextAction** TravelStrategy::getDefaultActions() +std::vector TravelStrategy::getDefaultActions() { - return NextAction::array(0, new NextAction("travel", 1.0f), nullptr); + return { + NextAction("travel", 1.0f) + }; } void TravelStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("no travel target", - NextAction::array(0, new NextAction("choose travel target", 6.f), nullptr))); - triggers.push_back(new TriggerNode("far from travel target", - NextAction::array(0, new NextAction("move to travel target", 1), nullptr))); + triggers.push_back( + new TriggerNode( + "no travel target", + { + NextAction("choose travel target", 6.f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "far from travel target", + { + NextAction("move to travel target", 1) + } + ) + ); } diff --git a/src/strategy/generic/TravelStrategy.h b/src/strategy/generic/TravelStrategy.h index bc5afc0d..c0b0bd2d 100644 --- a/src/strategy/generic/TravelStrategy.h +++ b/src/strategy/generic/TravelStrategy.h @@ -17,7 +17,7 @@ public: std::string const getName() override { return "travel"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; void InitTriggers(std::vector& triggers) override; }; diff --git a/src/strategy/generic/UseFoodStrategy.cpp b/src/strategy/generic/UseFoodStrategy.cpp index f945dad7..939d655f 100644 --- a/src/strategy/generic/UseFoodStrategy.cpp +++ b/src/strategy/generic/UseFoodStrategy.cpp @@ -13,12 +13,12 @@ void UseFoodStrategy::InitTriggers(std::vector& triggers) Strategy::InitTriggers(triggers); if (botAI->HasCheat(BotCheatMask::food)) { - triggers.push_back(new TriggerNode("medium health", NextAction::array(0, new NextAction("food", 3.0f), nullptr))); - triggers.push_back(new TriggerNode("high mana", NextAction::array(0, new NextAction("drink", 3.0f), nullptr))); + triggers.push_back(new TriggerNode("medium health", { NextAction("food", 3.0f) })); + triggers.push_back(new TriggerNode("high mana", { NextAction("drink", 3.0f) })); } else { - triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("food", 3.0f), nullptr))); - triggers.push_back(new TriggerNode("low mana", NextAction::array(0, new NextAction("drink", 3.0f), nullptr))); + triggers.push_back(new TriggerNode("low health", { NextAction("food", 3.0f) })); + triggers.push_back(new TriggerNode("low mana", { NextAction("drink", 3.0f) })); } } diff --git a/src/strategy/generic/UsePotionsStrategy.cpp b/src/strategy/generic/UsePotionsStrategy.cpp index dc4bc9ad..b0e00492 100644 --- a/src/strategy/generic/UsePotionsStrategy.cpp +++ b/src/strategy/generic/UsePotionsStrategy.cpp @@ -16,9 +16,9 @@ private: static ActionNode* healthstone(PlayerbotAI* botAI) { return new ActionNode("healthstone", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("healing potion"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("healing potion") }, + /*C*/ {}); } }; @@ -32,7 +32,7 @@ void UsePotionsStrategy::InitTriggers(std::vector& triggers) Strategy::InitTriggers(triggers); triggers.push_back(new TriggerNode( - "critical health", NextAction::array(0, new NextAction("healthstone", ACTION_MEDIUM_HEAL + 1), nullptr))); + "critical health", { NextAction("healthstone", ACTION_MEDIUM_HEAL + 1) })); triggers.push_back( - new TriggerNode("low mana", NextAction::array(0, new NextAction("mana potion", ACTION_EMERGENCY), nullptr))); + new TriggerNode("low mana", { NextAction("mana potion", ACTION_EMERGENCY) })); } diff --git a/src/strategy/generic/WorldPacketHandlerStrategy.cpp b/src/strategy/generic/WorldPacketHandlerStrategy.cpp index e09408c2..cb37d271 100644 --- a/src/strategy/generic/WorldPacketHandlerStrategy.cpp +++ b/src/strategy/generic/WorldPacketHandlerStrategy.cpp @@ -10,65 +10,64 @@ void WorldPacketHandlerStrategy::InitTriggers(std::vector& trigger PassTroughStrategy::InitTriggers(triggers); triggers.push_back( - new TriggerNode("group invite", NextAction::array(0, new NextAction("accept invitation", relevance), nullptr))); + new TriggerNode("group invite", { NextAction("accept invitation", relevance) })); triggers.push_back( - new TriggerNode("uninvite", NextAction::array(0, new NextAction("uninvite", relevance), nullptr))); + new TriggerNode("uninvite", { NextAction("uninvite", relevance) })); triggers.push_back( - new TriggerNode("uninvite guid", NextAction::array(0, new NextAction("uninvite", relevance), nullptr))); + new TriggerNode("uninvite guid", { NextAction("uninvite", relevance) })); triggers.push_back( - new TriggerNode("group set leader", NextAction::array(0, /*new NextAction("leader", relevance),*/ nullptr))); + new TriggerNode("group set leader", { /*NextAction("leader", relevance),*/ })); triggers.push_back(new TriggerNode( - "not enough money", NextAction::array(0, new NextAction("tell not enough money", relevance), nullptr))); + "not enough money", { NextAction("tell not enough money", relevance) })); triggers.push_back( new TriggerNode("not enough reputation", - NextAction::array(0, new NextAction("tell not enough reputation", relevance), nullptr))); + { NextAction("tell not enough reputation", relevance) })); triggers.push_back( - new TriggerNode("cannot equip", NextAction::array(0, new NextAction("tell cannot equip", relevance), nullptr))); + new TriggerNode("cannot equip", { NextAction("tell cannot equip", relevance) })); triggers.push_back( - new TriggerNode("use game object", NextAction::array(0, new NextAction("add loot", relevance), - new NextAction("use meeting stone", relevance), nullptr))); + new TriggerNode("use game object", { NextAction("add loot", relevance), + NextAction("use meeting stone", relevance) })); triggers.push_back( - new TriggerNode("gossip hello", NextAction::array(0, new NextAction("trainer", relevance), nullptr))); - triggers.push_back(new TriggerNode("activate taxi", NextAction::array(0, new NextAction("remember taxi", relevance), - new NextAction("taxi", relevance), nullptr))); - triggers.push_back(new TriggerNode("taxi done", NextAction::array(0, new NextAction("taxi", relevance), nullptr))); - triggers.push_back(new TriggerNode("trade status", NextAction::array(0, new NextAction("accept trade", relevance), new NextAction("equip upgrades", relevance), nullptr))); - triggers.push_back(new TriggerNode("trade status extended", NextAction::array(0, new NextAction("trade status extended", relevance), nullptr))); - triggers.push_back(new TriggerNode("area trigger", NextAction::array(0, new NextAction("reach area trigger", relevance), nullptr))); - triggers.push_back(new TriggerNode("within area trigger", NextAction::array(0, new NextAction("area trigger", relevance), nullptr))); - triggers.push_back(new TriggerNode("loot response", NextAction::array(0, new NextAction("store loot", relevance), nullptr))); - triggers.push_back(new TriggerNode("item push result", NextAction::array(0, new NextAction("unlock items", relevance), - new NextAction("open items", relevance), - new NextAction("query item usage", relevance), - new NextAction("equip upgrades", relevance), nullptr))); - triggers.push_back(new TriggerNode("item push result", NextAction::array(0, new NextAction("quest item push result", relevance), nullptr))); - triggers.push_back(new TriggerNode("ready check finished", NextAction::array(0, new NextAction("finish ready check", relevance), nullptr))); - // triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("security check", relevance), new NextAction("check mail", relevance), nullptr))); - triggers.push_back(new TriggerNode("guild invite", NextAction::array(0, new NextAction("guild accept", relevance), nullptr))); - triggers.push_back(new TriggerNode("petition offer", NextAction::array(0, new NextAction("petition sign", relevance), nullptr))); - triggers.push_back(new TriggerNode("lfg proposal", NextAction::array(0, new NextAction("lfg accept", relevance), nullptr))); - triggers.push_back(new TriggerNode("lfg proposal active", NextAction::array(0, new NextAction("lfg accept", relevance), nullptr))); - triggers.push_back(new TriggerNode("arena team invite", NextAction::array(0, new NextAction("arena team accept", relevance), nullptr))); - //triggers.push_back(new TriggerNode("no non bot players around", NextAction::array(0, new NextAction("delay", relevance), nullptr))); - triggers.push_back(new TriggerNode("bg status", NextAction::array(0, new NextAction("bg status", relevance), nullptr))); - triggers.push_back(new TriggerNode("xpgain", NextAction::array(0, new NextAction("xp gain", relevance), nullptr))); + new TriggerNode("gossip hello", { NextAction("trainer", relevance) })); + triggers.push_back(new TriggerNode("activate taxi", { NextAction("remember taxi", relevance), + NextAction("taxi", relevance) })); + triggers.push_back(new TriggerNode("taxi done", { NextAction("taxi", relevance) })); + triggers.push_back(new TriggerNode("trade status", { NextAction("accept trade", relevance), NextAction("equip upgrades", relevance) })); + triggers.push_back(new TriggerNode("trade status extended", { NextAction("trade status extended", relevance) })); + triggers.push_back(new TriggerNode("area trigger", { NextAction("reach area trigger", relevance) })); + triggers.push_back(new TriggerNode("within area trigger", { NextAction("area trigger", relevance) })); + triggers.push_back(new TriggerNode("loot response", { NextAction("store loot", relevance) })); + triggers.push_back(new TriggerNode("item push result", { NextAction("unlock items", relevance), + NextAction("open items", relevance), + NextAction("query item usage", relevance), + NextAction("equip upgrades", relevance) })); + triggers.push_back(new TriggerNode("item push result", { NextAction("quest item push result", relevance) })); + triggers.push_back(new TriggerNode("ready check finished", { NextAction("finish ready check", relevance) })); + // triggers.push_back(new TriggerNode("often", { NextAction("security check", relevance), NextAction("check mail", relevance) })); + triggers.push_back(new TriggerNode("guild invite", { NextAction("guild accept", relevance) })); + triggers.push_back(new TriggerNode("petition offer", { NextAction("petition sign", relevance) })); + triggers.push_back(new TriggerNode("lfg proposal", { NextAction("lfg accept", relevance) })); + triggers.push_back(new TriggerNode("lfg proposal active", { NextAction("lfg accept", relevance) })); + triggers.push_back(new TriggerNode("arena team invite", { NextAction("arena team accept", relevance) })); + //triggers.push_back(new TriggerNode("no non bot players around", { NextAction("delay", relevance) })); + triggers.push_back(new TriggerNode("bg status", { NextAction("bg status", relevance) })); + triggers.push_back(new TriggerNode("xpgain", { NextAction("xp gain", relevance) })); triggers.push_back( - new TriggerNode("levelup", NextAction::array(0, new NextAction("auto maintenance on levelup", relevance + 3), nullptr))); - // triggers.push_back(new TriggerNode("group destroyed", NextAction::array(0, new NextAction("reset botAI", - // relevance), nullptr))); - triggers.push_back(new TriggerNode("group list", NextAction::array(0, new NextAction("reset botAI", relevance), nullptr))); - triggers.push_back(new TriggerNode("see spell", NextAction::array(0, new NextAction("see spell", relevance), nullptr))); - - triggers.push_back(new TriggerNode("release spirit", NextAction::array(0, new NextAction("release", relevance), nullptr))); - triggers.push_back(new TriggerNode("revive from corpse", NextAction::array(0, new NextAction("revive from corpse", relevance), nullptr))); - triggers.push_back(new TriggerNode("master loot roll", NextAction::array(0, new NextAction("master loot roll", relevance), nullptr))); + new TriggerNode("levelup", { NextAction("auto maintenance on levelup", relevance + 3) })); + // triggers.push_back(new TriggerNode("group destroyed", { NextAction("reset botAI", + // relevance) })); + triggers.push_back(new TriggerNode("group list", { NextAction("reset botAI", relevance) })); + triggers.push_back(new TriggerNode("see spell", { NextAction("see spell", relevance) })); + triggers.push_back(new TriggerNode("release spirit", { NextAction("release", relevance) })); + triggers.push_back(new TriggerNode("revive from corpse", { NextAction("revive from corpse", relevance) })); + triggers.push_back(new TriggerNode("master loot roll", { NextAction("master loot roll", relevance) })); // quest ? - //triggers.push_back(new TriggerNode("quest confirm", NextAction::array(0, new NextAction("quest confirm", relevance), nullptr))); - triggers.push_back(new TriggerNode("questgiver quest details", NextAction::array(0, new NextAction("turn in query quest", relevance), nullptr))); + //triggers.push_back(new TriggerNode("quest confirm", { NextAction("quest confirm", relevance) })); + triggers.push_back(new TriggerNode("questgiver quest details", { NextAction("turn in query quest", relevance) })); // loot roll - triggers.push_back(new TriggerNode("very often", NextAction::array(0, new NextAction("loot roll", relevance), nullptr))); + triggers.push_back(new TriggerNode("very often", { NextAction("loot roll", relevance) })); } WorldPacketHandlerStrategy::WorldPacketHandlerStrategy(PlayerbotAI* botAI) : PassTroughStrategy(botAI) @@ -96,5 +95,5 @@ WorldPacketHandlerStrategy::WorldPacketHandlerStrategy(PlayerbotAI* botAI) : Pas void ReadyCheckStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( - new TriggerNode("timer", NextAction::array(0, new NextAction("ready check", relevance), nullptr))); + new TriggerNode("timer", { NextAction("ready check", relevance) })); } diff --git a/src/strategy/hunter/BeastMasteryHunterStrategy.cpp b/src/strategy/hunter/BeastMasteryHunterStrategy.cpp index 0b691357..a2c302d3 100644 --- a/src/strategy/hunter/BeastMasteryHunterStrategy.cpp +++ b/src/strategy/hunter/BeastMasteryHunterStrategy.cpp @@ -25,16 +25,16 @@ public: } private: - static ActionNode* auto_shot(PlayerbotAI*) { return new ActionNode("auto shot", nullptr, nullptr, nullptr); } - static ActionNode* kill_command(PlayerbotAI*) { return new ActionNode("kill command", nullptr, nullptr, nullptr); } - static ActionNode* kill_shot(PlayerbotAI*) { return new ActionNode("kill shot", nullptr, nullptr, nullptr); } - static ActionNode* viper_sting(PlayerbotAI*) { return new ActionNode("viper sting", nullptr, nullptr, nullptr); } - static ActionNode* serpent_sting(PlayerbotAI*) { return new ActionNode("serpent sting", nullptr, nullptr, nullptr); } - static ActionNode* aimed_shot(PlayerbotAI*) { return new ActionNode("aimed shot", nullptr, nullptr, nullptr); } - static ActionNode* arcane_shot(PlayerbotAI*) { return new ActionNode("arcane shot", nullptr, nullptr, nullptr); } - static ActionNode* steady_shot(PlayerbotAI*) { return new ActionNode("steady shot", nullptr, nullptr, nullptr); } - static ActionNode* multi_shot(PlayerbotAI*) { return new ActionNode("multi shot", nullptr, nullptr, nullptr); } - static ActionNode* volley(PlayerbotAI*) { return new ActionNode("volley", nullptr, nullptr, nullptr); } + static ActionNode* auto_shot(PlayerbotAI*) { return new ActionNode("auto shot", {}, {}, {}); } + static ActionNode* kill_command(PlayerbotAI*) { return new ActionNode("kill command", {}, {}, {}); } + static ActionNode* kill_shot(PlayerbotAI*) { return new ActionNode("kill shot", {}, {}, {}); } + static ActionNode* viper_sting(PlayerbotAI*) { return new ActionNode("viper sting", {}, {}, {}); } + static ActionNode* serpent_sting(PlayerbotAI*) { return new ActionNode("serpent sting", {}, {}, {}); } + static ActionNode* aimed_shot(PlayerbotAI*) { return new ActionNode("aimed shot", {}, {}, {}); } + static ActionNode* arcane_shot(PlayerbotAI*) { return new ActionNode("arcane shot", {}, {}, {}); } + static ActionNode* steady_shot(PlayerbotAI*) { return new ActionNode("steady shot", {}, {}, {}); } + static ActionNode* multi_shot(PlayerbotAI*) { return new ActionNode("multi shot", {}, {}, {}); } + static ActionNode* volley(PlayerbotAI*) { return new ActionNode("volley", {}, {}, {}); } }; // ===== Single Target Strategy ===== @@ -44,26 +44,70 @@ BeastMasteryHunterStrategy::BeastMasteryHunterStrategy(PlayerbotAI* botAI) : Gen } // ===== Default Actions ===== -NextAction** BeastMasteryHunterStrategy::getDefaultActions() +std::vector BeastMasteryHunterStrategy::getDefaultActions() { - return NextAction::array(0, new NextAction("bestial wrath", 19.0f), - new NextAction("kill command", 5.7f), - new NextAction("kill shot", 5.6f), - new NextAction("serpent sting", 5.5f), - new NextAction("aimed shot", 5.4f), - new NextAction("arcane shot", 5.3f), - new NextAction("steady shot", 5.2f), - new NextAction("auto shot", 5.1f), nullptr); + return { + NextAction("bestial wrath", 19.0f), + NextAction("kill command", 5.7f), + NextAction("kill shot", 5.6f), + NextAction("serpent sting", 5.5f), + NextAction("aimed shot", 5.4f), + NextAction("arcane shot", 5.3f), + NextAction("steady shot", 5.2f), + NextAction("auto shot", 5.1f) + }; } // ===== Trigger Initialization === void BeastMasteryHunterStrategy::InitTriggers(std::vector& triggers) { GenericHunterStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("intimidation", NextAction::array(0, new NextAction("intimidation", 40.0f), nullptr))); - triggers.push_back(new TriggerNode("kill command", NextAction::array(0, new NextAction("kill command", 18.5f), nullptr))); - triggers.push_back(new TriggerNode("target critical health", NextAction::array(0, new NextAction("kill shot", 18.0f), nullptr))); - triggers.push_back(new TriggerNode("low mana", NextAction::array(0, new NextAction("viper sting", 17.5f), nullptr))); - triggers.push_back(new TriggerNode("no stings", NextAction::array(0, new NextAction("serpent sting", 17.0f), nullptr))); - triggers.push_back(new TriggerNode("serpent sting on attacker", NextAction::array(0, new NextAction("serpent sting on attacker", 16.5f), nullptr))); + triggers.push_back( + new TriggerNode( + "intimidation", + { + NextAction("intimidation", 40.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "kill command", + { + NextAction("kill command", 18.5f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "target critical health", + { + NextAction("kill shot", 18.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "low mana", + { + NextAction("viper sting", 17.5f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "no stings", + { + NextAction("serpent sting", 17.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "serpent sting on attacker", + { + NextAction("serpent sting on attacker", 16.5f) + } + ) + ); } diff --git a/src/strategy/hunter/BeastMasteryHunterStrategy.h b/src/strategy/hunter/BeastMasteryHunterStrategy.h index 561ba024..5235aa86 100644 --- a/src/strategy/hunter/BeastMasteryHunterStrategy.h +++ b/src/strategy/hunter/BeastMasteryHunterStrategy.h @@ -18,7 +18,7 @@ public: void InitTriggers(std::vector& triggers) override; std::string const getName() override { return "bm"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; }; #endif diff --git a/src/strategy/hunter/GenericHunterNonCombatStrategy.cpp b/src/strategy/hunter/GenericHunterNonCombatStrategy.cpp index e7581873..151feadf 100644 --- a/src/strategy/hunter/GenericHunterNonCombatStrategy.cpp +++ b/src/strategy/hunter/GenericHunterNonCombatStrategy.cpp @@ -21,17 +21,17 @@ private: static ActionNode* rapid_fire([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("rapid fire", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("readiness"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("readiness")}, + /*C*/ {}); } static ActionNode* aspect_of_the_pack([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("aspect of the pack", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("aspect of the cheetah"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("aspect of the cheetah")}, + /*C*/ {}); } }; @@ -44,25 +44,22 @@ void GenericHunterNonCombatStrategy::InitTriggers(std::vector& tri { NonCombatStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("trueshot aura", NextAction::array(0, new NextAction("trueshot aura", 2.0f), nullptr))); - triggers.push_back(new TriggerNode("often", NextAction::array(0, - new NextAction("apply stone", 1.0f), - new NextAction("apply oil", 1.0f), - nullptr))); - triggers.push_back(new TriggerNode("low ammo", NextAction::array(0, new NextAction("say::low ammo", ACTION_NORMAL), nullptr))); - triggers.push_back(new TriggerNode("no track", NextAction::array(0, new NextAction("track humanoids", ACTION_NORMAL), nullptr))); - triggers.push_back(new TriggerNode("no ammo", NextAction::array(0, new NextAction("equip upgrades", ACTION_HIGH + 1), nullptr))); - // triggers.push_back(new TriggerNode("no ammo", NextAction::array(0, new NextAction("switch to melee", - // ACTION_NORMAL + 1), new NextAction("say::no ammo", ACTION_NORMAL), nullptr))); triggers.push_back(new - // TriggerNode("has ammo", NextAction::array(0, new NextAction("switch to ranged", ACTION_NORMAL), nullptr))); + triggers.push_back(new TriggerNode("trueshot aura", { NextAction("trueshot aura", 2.0f)})); + triggers.push_back(new TriggerNode("often", { + NextAction("apply stone", 1.0f), + NextAction("apply oil", 1.0f), + })); + triggers.push_back(new TriggerNode("low ammo", { NextAction("say::low ammo", ACTION_NORMAL)})); + triggers.push_back(new TriggerNode("no track", { NextAction("track humanoids", ACTION_NORMAL)})); + triggers.push_back(new TriggerNode("no ammo", { NextAction("equip upgrades", ACTION_HIGH + 1)})); } void HunterPetStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("no pet", NextAction::array(0, new NextAction("call pet", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("has pet", NextAction::array(0, new NextAction("toggle pet spell", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("new pet", NextAction::array(0, new NextAction("set pet stance", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("pet not happy", NextAction::array(0, new NextAction("feed pet", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("hunters pet medium health", NextAction::array(0, new NextAction("mend pet", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("hunters pet dead", NextAction::array(0, new NextAction("revive pet", 60.0f), nullptr))); + triggers.push_back(new TriggerNode("no pet", { NextAction("call pet", 60.0f)})); + triggers.push_back(new TriggerNode("has pet", { NextAction("toggle pet spell", 60.0f)})); + triggers.push_back(new TriggerNode("new pet", { NextAction("set pet stance", 60.0f)})); + triggers.push_back(new TriggerNode("pet not happy", { NextAction("feed pet", 60.0f)})); + triggers.push_back(new TriggerNode("hunters pet medium health", { NextAction("mend pet", 60.0f)})); + triggers.push_back(new TriggerNode("hunters pet dead", { NextAction("revive pet", 60.0f)})); } diff --git a/src/strategy/hunter/GenericHunterStrategy.cpp b/src/strategy/hunter/GenericHunterStrategy.cpp index dab37261..04afc6f7 100644 --- a/src/strategy/hunter/GenericHunterStrategy.cpp +++ b/src/strategy/hunter/GenericHunterStrategy.cpp @@ -28,66 +28,66 @@ private: static ActionNode* rapid_fire([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("rapid fire", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("readiness"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("readiness") }, + /*C*/ {}); } static ActionNode* aspect_of_the_pack([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("aspect of the pack", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("aspect of the cheetah"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("aspect of the cheetah") }, + /*C*/ {}); } static ActionNode* aspect_of_the_dragonhawk([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("aspect of the dragonhawk", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("aspect of the hawk"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("aspect of the hawk") }, + /*C*/ {}); } static ActionNode* feign_death([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("feign death", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* wing_clip([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("wing clip", - /*P*/ nullptr, - // /*A*/ NextAction::array(0, new NextAction("mongoose bite"), nullptr), - nullptr, - /*C*/ nullptr); + /*P*/ {}, + // /*A*/ { NextAction("mongoose bite") }, + {}, + /*C*/ {}); } static ActionNode* mongoose_bite([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("mongoose bite", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("raptor strike"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("raptor strike") }, + /*C*/ {}); } static ActionNode* raptor_strike([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("raptor strike", - /*P*/ NextAction::array(0, new NextAction("melee"), nullptr), - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ { NextAction("melee") }, + /*A*/ {}, + /*C*/ {}); } static ActionNode* explosive_trap([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("explosive trap", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("immolation trap"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("immolation trap") }, + /*C*/ {}); } }; @@ -101,34 +101,34 @@ void GenericHunterStrategy::InitTriggers(std::vector& triggers) CombatStrategy::InitTriggers(triggers); // Mark/Ammo/Mana Triggers - triggers.push_back(new TriggerNode("no ammo", NextAction::array(0, new NextAction("equip upgrades", 30.0f), nullptr))); - triggers.push_back(new TriggerNode("hunter's mark", NextAction::array(0, new NextAction("hunter's mark", 29.5f), nullptr))); - triggers.push_back(new TriggerNode("rapid fire", NextAction::array(0, new NextAction("rapid fire", 29.0f), nullptr))); - triggers.push_back(new TriggerNode("aspect of the viper", NextAction::array(0, new NextAction("aspect of the viper", 28.0f), NULL))); - triggers.push_back(new TriggerNode("aspect of the hawk", NextAction::array(0, new NextAction("aspect of the dragonhawk", 27.5f), nullptr))); + triggers.push_back(new TriggerNode("no ammo", { NextAction("equip upgrades", 30.0f) })); + triggers.push_back(new TriggerNode("hunter's mark", { NextAction("hunter's mark", 29.5f) })); + triggers.push_back(new TriggerNode("rapid fire", { NextAction("rapid fire", 29.0f) })); + triggers.push_back(new TriggerNode("aspect of the viper", { NextAction("aspect of the viper", 28.0f) })); + triggers.push_back(new TriggerNode("aspect of the hawk", { NextAction("aspect of the dragonhawk", 27.5f) })); // Aggro/Threat/Defensive Triggers - triggers.push_back(new TriggerNode("has aggro", NextAction::array(0, new NextAction("concussive shot", 20.0f), nullptr))); - triggers.push_back(new TriggerNode("low tank threat", NextAction::array(0, new NextAction("misdirection on main tank", 27.0f), NULL))); - triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("deterrence", 35.0f), nullptr))); - triggers.push_back(new TriggerNode("concussive shot on snare target", NextAction::array(0, new NextAction("concussive shot", 20.0f), nullptr))); - triggers.push_back(new TriggerNode("medium threat", NextAction::array(0, new NextAction("feign death", 35.0f), nullptr))); - triggers.push_back(new TriggerNode("hunters pet medium health", NextAction::array(0, new NextAction("mend pet", 22.0f), nullptr))); - triggers.push_back(new TriggerNode("hunters pet low health", NextAction::array(0, new NextAction("mend pet", 21.0f), nullptr))); + triggers.push_back(new TriggerNode("has aggro", { NextAction("concussive shot", 20.0f) })); + triggers.push_back(new TriggerNode("low tank threat", { NextAction("misdirection on main tank", 27.0f) })); + triggers.push_back(new TriggerNode("low health", { NextAction("deterrence", 35.0f) })); + triggers.push_back(new TriggerNode("concussive shot on snare target", { NextAction("concussive shot", 20.0f) })); + triggers.push_back(new TriggerNode("medium threat", { NextAction("feign death", 35.0f) })); + triggers.push_back(new TriggerNode("hunters pet medium health", { NextAction("mend pet", 22.0f) })); + triggers.push_back(new TriggerNode("hunters pet low health", { NextAction("mend pet", 21.0f) })); // Dispel Triggers - triggers.push_back(new TriggerNode("tranquilizing shot enrage", NextAction::array(0, new NextAction("tranquilizing shot", 61.0f), NULL))); - triggers.push_back(new TriggerNode("tranquilizing shot magic", NextAction::array(0, new NextAction("tranquilizing shot", 61.0f), NULL))); + triggers.push_back(new TriggerNode("tranquilizing shot enrage", { NextAction("tranquilizing shot", 61.0f) })); + triggers.push_back(new TriggerNode("tranquilizing shot magic", { NextAction("tranquilizing shot", 61.0f) })); // Ranged-based Triggers - triggers.push_back(new TriggerNode("enemy within melee", NextAction::array(0, - new NextAction("explosive trap", 37.0f), - new NextAction("mongoose bite", 22.0f), - new NextAction("wing clip", 21.0f), nullptr))); + triggers.push_back(new TriggerNode("enemy within melee", { + NextAction("explosive trap", 37.0f), + NextAction("mongoose bite", 22.0f), + NextAction("wing clip", 21.0f) })); - triggers.push_back(new TriggerNode("enemy too close for auto shot", NextAction::array(0, - new NextAction("disengage", 35.0f), - new NextAction("flee", 34.0f), nullptr))); + triggers.push_back(new TriggerNode("enemy too close for auto shot", { + NextAction("disengage", 35.0f), + NextAction("flee", 34.0f) })); } // ===== AoE Strategy, 2/3+ enemies ===== @@ -136,9 +136,9 @@ AoEHunterStrategy::AoEHunterStrategy(PlayerbotAI* botAI) : CombatStrategy(botAI) void AoEHunterStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("volley channel check", NextAction::array(0, new NextAction("cancel channel", 23.0f), nullptr))); - triggers.push_back(new TriggerNode("medium aoe", NextAction::array(0, new NextAction("volley", 22.0f), nullptr))); - triggers.push_back(new TriggerNode("light aoe", NextAction::array(0, new NextAction("multi-shot", 21.0f), nullptr))); + triggers.push_back(new TriggerNode("volley channel check", { NextAction("cancel channel", 23.0f) })); + triggers.push_back(new TriggerNode("medium aoe", { NextAction("volley", 22.0f) })); + triggers.push_back(new TriggerNode("light aoe", { NextAction("multi-shot", 21.0f) })); } void HunterBoostStrategy::InitTriggers(std::vector& triggers) @@ -147,11 +147,11 @@ void HunterBoostStrategy::InitTriggers(std::vector& triggers) void HunterCcStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("scare beast", NextAction::array(0, new NextAction("scare beast on cc", 23.0f), nullptr))); - triggers.push_back(new TriggerNode("freezing trap", NextAction::array(0, new NextAction("freezing trap on cc", 23.0f), nullptr))); + triggers.push_back(new TriggerNode("scare beast", { NextAction("scare beast on cc", 23.0f) })); + triggers.push_back(new TriggerNode("freezing trap", { NextAction("freezing trap on cc", 23.0f) })); } void HunterTrapWeaveStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("immolation trap no cd", NextAction::array(0, new NextAction("reach melee", 23.0f), nullptr))); + triggers.push_back(new TriggerNode("immolation trap no cd", { NextAction("reach melee", 23.0f) })); } diff --git a/src/strategy/hunter/HunterActions.cpp b/src/strategy/hunter/HunterActions.cpp index 379cf0d5..a1588f85 100644 --- a/src/strategy/hunter/HunterActions.cpp +++ b/src/strategy/hunter/HunterActions.cpp @@ -103,9 +103,7 @@ bool CastScareBeastCcAction::Execute(Event event) { return botAI->CastSpell("sca bool CastWingClipAction::isUseful() { return CastSpellAction::isUseful() && !botAI->HasAura(spell, GetTarget()); } -NextAction** CastWingClipAction::getPrerequisites() { return nullptr; } - -// bool CastRaptorStrikeAction::isUseful() -// { -// return CastMeleeSpellAction::isUseful() && botAI->HasStrategy("close", BOT_STATE_COMBAT); -// } +std::vector CastWingClipAction::getPrerequisites() +{ + return {}; +} diff --git a/src/strategy/hunter/HunterActions.h b/src/strategy/hunter/HunterActions.h index 6deaabaf..8e211352 100644 --- a/src/strategy/hunter/HunterActions.h +++ b/src/strategy/hunter/HunterActions.h @@ -418,7 +418,7 @@ public: CastWingClipAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "wing clip") {} bool isUseful() override; - NextAction** getPrerequisites() override; + std::vector getPrerequisites() override; }; class CastRaptorStrikeAction : public CastSpellAction diff --git a/src/strategy/hunter/HunterBuffStrategies.cpp b/src/strategy/hunter/HunterBuffStrategies.cpp index 94e7e7dc..3601d771 100644 --- a/src/strategy/hunter/HunterBuffStrategies.cpp +++ b/src/strategy/hunter/HunterBuffStrategies.cpp @@ -16,9 +16,9 @@ private: static ActionNode* aspect_of_the_hawk([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("aspect of the hawk", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("aspect of the monkey"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("aspect of the monkey") }, + /*C*/ {}); } }; @@ -30,24 +30,24 @@ HunterBuffDpsStrategy::HunterBuffDpsStrategy(PlayerbotAI* botAI) : NonCombatStra void HunterBuffDpsStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( - new TriggerNode("aspect of the hawk", NextAction::array(0, new NextAction("aspect of the dragonhawk", 20.1f), - new NextAction("aspect of the hawk", 20.0f), nullptr))); + new TriggerNode("aspect of the hawk", { NextAction("aspect of the dragonhawk", 20.1f), + NextAction("aspect of the hawk", 20.0f) })); } void HunterNatureResistanceStrategy::InitTriggers(std::vector& triggers) { triggers.push_back(new TriggerNode("aspect of the wild", - NextAction::array(0, new NextAction("aspect of the wild", 20.0f), nullptr))); + { NextAction("aspect of the wild", 20.0f) })); } void HunterBuffSpeedStrategy::InitTriggers(std::vector& triggers) { triggers.push_back(new TriggerNode("aspect of the pack", - NextAction::array(0, new NextAction("aspect of the pack", 20.0f), nullptr))); + { NextAction("aspect of the pack", 20.0f) })); } void HunterBuffManaStrategy::InitTriggers(std::vector& triggers) { triggers.push_back(new TriggerNode("aspect of the viper", - NextAction::array(0, new NextAction("aspect of the viper", 20.0f), nullptr))); + { NextAction("aspect of the viper", 20.0f) })); } diff --git a/src/strategy/hunter/MarksmanshipHunterStrategy.cpp b/src/strategy/hunter/MarksmanshipHunterStrategy.cpp index 665de727..e4e8a9a4 100644 --- a/src/strategy/hunter/MarksmanshipHunterStrategy.cpp +++ b/src/strategy/hunter/MarksmanshipHunterStrategy.cpp @@ -27,18 +27,18 @@ public: } private: - static ActionNode* auto_shot(PlayerbotAI*) { return new ActionNode("auto shot", nullptr, nullptr, nullptr); } - static ActionNode* silencing_shot(PlayerbotAI*) { return new ActionNode("silencing shot", nullptr, nullptr, nullptr); } - static ActionNode* kill_command(PlayerbotAI*) { return new ActionNode("kill command", nullptr, nullptr, nullptr); } - static ActionNode* kill_shot(PlayerbotAI*) { return new ActionNode("kill shot", nullptr, nullptr, nullptr); } - static ActionNode* viper_sting(PlayerbotAI*) { return new ActionNode("viper sting", nullptr, nullptr, nullptr); } - static ActionNode* serpent_sting(PlayerbotAI*) { return new ActionNode("serpent sting", nullptr, nullptr, nullptr); } - static ActionNode* chimera_shot(PlayerbotAI*) { return new ActionNode("chimera shot", nullptr, nullptr, nullptr); } - static ActionNode* aimed_shot(PlayerbotAI*) { return new ActionNode("aimed shot", nullptr, nullptr, nullptr); } - static ActionNode* arcane_shot(PlayerbotAI*) { return new ActionNode("arcane shot", nullptr, nullptr, nullptr); } - static ActionNode* steady_shot(PlayerbotAI*) { return new ActionNode("steady shot", nullptr, nullptr, nullptr); } - static ActionNode* multi_shot(PlayerbotAI*) { return new ActionNode("multi shot", nullptr, nullptr, nullptr); } - static ActionNode* volley(PlayerbotAI*) { return new ActionNode("volley", nullptr, nullptr, nullptr); } + static ActionNode* auto_shot(PlayerbotAI*) { return new ActionNode("auto shot", {}, {}, {}); } + static ActionNode* silencing_shot(PlayerbotAI*) { return new ActionNode("silencing shot", {}, {}, {}); } + static ActionNode* kill_command(PlayerbotAI*) { return new ActionNode("kill command", {}, {}, {}); } + static ActionNode* kill_shot(PlayerbotAI*) { return new ActionNode("kill shot", {}, {}, {}); } + static ActionNode* viper_sting(PlayerbotAI*) { return new ActionNode("viper sting", {}, {}, {}); } + static ActionNode* serpent_sting(PlayerbotAI*) { return new ActionNode("serpent sting", {}, {}, {}); } + static ActionNode* chimera_shot(PlayerbotAI*) { return new ActionNode("chimera shot", {}, {}, {}); } + static ActionNode* aimed_shot(PlayerbotAI*) { return new ActionNode("aimed shot", {}, {}, {}); } + static ActionNode* arcane_shot(PlayerbotAI*) { return new ActionNode("arcane shot", {}, {}, {}); } + static ActionNode* steady_shot(PlayerbotAI*) { return new ActionNode("steady shot", {}, {}, {}); } + static ActionNode* multi_shot(PlayerbotAI*) { return new ActionNode("multi shot", {}, {}, {}); } + static ActionNode* volley(PlayerbotAI*) { return new ActionNode("volley", {}, {}, {}); } }; // ===== Single Target Strategy ===== @@ -48,27 +48,71 @@ MarksmanshipHunterStrategy::MarksmanshipHunterStrategy(PlayerbotAI* botAI) : Gen } // ===== Default Actions ===== -NextAction** MarksmanshipHunterStrategy::getDefaultActions() +std::vector MarksmanshipHunterStrategy::getDefaultActions() { - return NextAction::array(0, - new NextAction("kill command", 5.8f), - new NextAction("kill shot", 5.7f), - new NextAction("serpent sting", 5.6f), - new NextAction("chimera shot", 5.5f), - new NextAction("aimed shot", 5.4f), - new NextAction("arcane shot", 5.3f), - new NextAction("steady shot", 5.2f), - new NextAction("auto shot", 5.1f), nullptr); + return { + NextAction("kill command", 5.8f), + NextAction("kill shot", 5.7f), + NextAction("serpent sting", 5.6f), + NextAction("chimera shot", 5.5f), + NextAction("aimed shot", 5.4f), + NextAction("arcane shot", 5.3f), + NextAction("steady shot", 5.2f), + NextAction("auto shot", 5.1f) + }; } // ===== Trigger Initialization === void MarksmanshipHunterStrategy::InitTriggers(std::vector& triggers) { GenericHunterStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("silencing shot", NextAction::array(0, new NextAction("silencing shot", 40.0f), nullptr))); - triggers.push_back(new TriggerNode("kill command", NextAction::array(0, new NextAction("kill command", 18.5f), nullptr))); - triggers.push_back(new TriggerNode("target critical health", NextAction::array(0, new NextAction("kill shot", 18.0f), nullptr))); - triggers.push_back(new TriggerNode("low mana", NextAction::array(0, new NextAction("viper sting", 17.5f), nullptr))); - triggers.push_back(new TriggerNode("no stings", NextAction::array(0, new NextAction("serpent sting", 17.0f), nullptr))); - triggers.push_back(new TriggerNode("serpent sting on attacker", NextAction::array(0, new NextAction("serpent sting on attacker", 16.5f), nullptr))); + + triggers.push_back( + new TriggerNode( + "silencing shot", + { + NextAction("silencing shot", 40.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "kill command", + { + NextAction("kill command", 18.5f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "target critical health", + { + NextAction("kill shot", 18.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "low mana", + { + NextAction("viper sting", 17.5f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "no stings", + { + NextAction("serpent sting", 17.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "serpent sting on attacker", + { + NextAction("serpent sting on attacker", 16.5f) + } + ) + ); } diff --git a/src/strategy/hunter/MarksmanshipHunterStrategy.h b/src/strategy/hunter/MarksmanshipHunterStrategy.h index e08de85c..800d40a8 100644 --- a/src/strategy/hunter/MarksmanshipHunterStrategy.h +++ b/src/strategy/hunter/MarksmanshipHunterStrategy.h @@ -18,7 +18,7 @@ public: void InitTriggers(std::vector& triggers) override; std::string const getName() override { return "mm"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; }; #endif diff --git a/src/strategy/hunter/SurvivalHunterStrategy.cpp b/src/strategy/hunter/SurvivalHunterStrategy.cpp index 78908354..796891a9 100644 --- a/src/strategy/hunter/SurvivalHunterStrategy.cpp +++ b/src/strategy/hunter/SurvivalHunterStrategy.cpp @@ -27,18 +27,18 @@ public: } private: - static ActionNode* auto_shot(PlayerbotAI*) { return new ActionNode("auto shot", nullptr, nullptr, nullptr); } - static ActionNode* kill_command(PlayerbotAI*) { return new ActionNode("kill command", nullptr, nullptr, nullptr); } - static ActionNode* kill_shot(PlayerbotAI*) { return new ActionNode("kill shot", nullptr, nullptr, nullptr); } - static ActionNode* explosive_shot(PlayerbotAI*) { return new ActionNode("explosive shot", nullptr, nullptr, nullptr); } - static ActionNode* black_arrow(PlayerbotAI*) { return new ActionNode("black arrow", nullptr, nullptr, nullptr); } - static ActionNode* viper_sting(PlayerbotAI*) { return new ActionNode("viper sting", nullptr, nullptr, nullptr); } - static ActionNode* serpent_sting(PlayerbotAI*) { return new ActionNode("serpent sting", nullptr, nullptr, nullptr); } - static ActionNode* aimed_shot(PlayerbotAI*) { return new ActionNode("aimed shot", nullptr, nullptr, nullptr); } - static ActionNode* arcane_shot(PlayerbotAI*) { return new ActionNode("arcane shot", nullptr, nullptr, nullptr); } - static ActionNode* steady_shot(PlayerbotAI*) { return new ActionNode("steady shot", nullptr, nullptr, nullptr); } - static ActionNode* multi_shot(PlayerbotAI*) { return new ActionNode("multi shot", nullptr, nullptr, nullptr); } - static ActionNode* volley(PlayerbotAI*) { return new ActionNode("volley", nullptr, nullptr, nullptr); } + static ActionNode* auto_shot(PlayerbotAI*) { return new ActionNode("auto shot", {}, {}, {}); } + static ActionNode* kill_command(PlayerbotAI*) { return new ActionNode("kill command", {}, {}, {}); } + static ActionNode* kill_shot(PlayerbotAI*) { return new ActionNode("kill shot", {}, {}, {}); } + static ActionNode* explosive_shot(PlayerbotAI*) { return new ActionNode("explosive shot", {}, {}, {}); } + static ActionNode* black_arrow(PlayerbotAI*) { return new ActionNode("black arrow", {}, {}, {}); } + static ActionNode* viper_sting(PlayerbotAI*) { return new ActionNode("viper sting", {}, {}, {}); } + static ActionNode* serpent_sting(PlayerbotAI*) { return new ActionNode("serpent sting", {}, {}, {}); } + static ActionNode* aimed_shot(PlayerbotAI*) { return new ActionNode("aimed shot", {}, {}, {}); } + static ActionNode* arcane_shot(PlayerbotAI*) { return new ActionNode("arcane shot", {}, {}, {}); } + static ActionNode* steady_shot(PlayerbotAI*) { return new ActionNode("steady shot", {}, {}, {}); } + static ActionNode* multi_shot(PlayerbotAI*) { return new ActionNode("multi shot", {}, {}, {}); } + static ActionNode* volley(PlayerbotAI*) { return new ActionNode("volley", {}, {}, {}); } }; // ===== Single Target Strategy ===== @@ -48,18 +48,19 @@ SurvivalHunterStrategy::SurvivalHunterStrategy(PlayerbotAI* botAI) : GenericHunt } // ===== Default Actions ===== -NextAction** SurvivalHunterStrategy::getDefaultActions() +std::vector SurvivalHunterStrategy::getDefaultActions() { - return NextAction::array(0, - new NextAction("kill command", 5.9f), - new NextAction("kill shot", 5.8f), - new NextAction("explosive shot", 5.7f), - new NextAction("black arrow", 5.6f), - new NextAction("serpent sting", 5.5f), - new NextAction("aimed shot", 5.4f), - new NextAction("arcane shot", 5.3f), - new NextAction("steady shot", 5.2f), - new NextAction("auto shot", 5.1f), nullptr); + return { + NextAction("kill command", 5.9f), + NextAction("kill shot", 5.8f), + NextAction("explosive shot", 5.7f), + NextAction("black arrow", 5.6f), + NextAction("serpent sting", 5.5f), + NextAction("aimed shot", 5.4f), + NextAction("arcane shot", 5.3f), + NextAction("steady shot", 5.2f), + NextAction("auto shot", 5.1f) + }; } // ===== Trigger Initialization === @@ -67,16 +68,92 @@ void SurvivalHunterStrategy::InitTriggers(std::vector& triggers) { GenericHunterStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("lock and load", NextAction::array(0, new NextAction("explosive shot rank 4", 28.0f), nullptr))); - triggers.push_back(new TriggerNode("lock and load", NextAction::array(0, new NextAction("explosive shot rank 3", 27.5f), nullptr))); - triggers.push_back(new TriggerNode("lock and load", NextAction::array(0, new NextAction("explosive shot rank 2", 27.0f), nullptr))); - triggers.push_back(new TriggerNode("lock and load", NextAction::array(0, new NextAction("explosive shot rank 1", 26.5f), nullptr))); - - triggers.push_back(new TriggerNode("kill command", NextAction::array(0, new NextAction("kill command", 18.5f), nullptr))); - triggers.push_back(new TriggerNode("target critical health", NextAction::array(0, new NextAction("kill shot", 18.0f), nullptr))); - triggers.push_back(new TriggerNode("explosive shot", NextAction::array(0, new NextAction("explosive shot", 17.5f), nullptr))); - triggers.push_back(new TriggerNode("black arrow", NextAction::array(0, new NextAction("black arrow", 16.5f), nullptr))); - triggers.push_back(new TriggerNode("low mana", NextAction::array(0, new NextAction("viper sting", 16.0f), nullptr))); - triggers.push_back(new TriggerNode("no stings", NextAction::array(0, new NextAction("serpent sting", 15.5f), nullptr))); - triggers.push_back(new TriggerNode("serpent sting on attacker", NextAction::array(0, new NextAction("serpent sting on attacker", 15.0f), nullptr))); + triggers.push_back( + new TriggerNode( + "lock and load", + { + NextAction("explosive shot rank 4", 28.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "lock and load", + { + NextAction("explosive shot rank 3", 27.5f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "lock and load", + { + NextAction("explosive shot rank 2", 27.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "lock and load", + { + NextAction("explosive shot rank 1", 26.5f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "kill command", + { + NextAction("kill command", 18.5f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "target critical health", + { + NextAction("kill shot", 18.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "explosive shot", + { + NextAction("explosive shot", 17.5f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "black arrow", + { + NextAction("black arrow", 16.5f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "low mana", + { + NextAction("viper sting", 16.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "no stings", + { + NextAction("serpent sting", 15.5f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "serpent sting on attacker", + { + NextAction("serpent sting on attacker", 15.0f) + } + ) + ); } diff --git a/src/strategy/hunter/SurvivalHunterStrategy.h b/src/strategy/hunter/SurvivalHunterStrategy.h index 573a3e8f..2e2b52f1 100644 --- a/src/strategy/hunter/SurvivalHunterStrategy.h +++ b/src/strategy/hunter/SurvivalHunterStrategy.h @@ -18,7 +18,7 @@ public: void InitTriggers(std::vector& triggers) override; std::string const getName() override { return "surv"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; }; #endif diff --git a/src/strategy/mage/ArcaneMageStrategy.cpp b/src/strategy/mage/ArcaneMageStrategy.cpp index b3cf8a63..4707231d 100644 --- a/src/strategy/mage/ArcaneMageStrategy.cpp +++ b/src/strategy/mage/ArcaneMageStrategy.cpp @@ -22,13 +22,13 @@ public: } private: - static ActionNode* arcane_blast(PlayerbotAI*) { return new ActionNode("arcane blast", nullptr, nullptr, nullptr); } - static ActionNode* arcane_barrage(PlayerbotAI*) { return new ActionNode("arcane barrage", nullptr, nullptr, nullptr); } - static ActionNode* arcane_missiles(PlayerbotAI*) { return new ActionNode("arcane missiles", nullptr, nullptr, nullptr); } - static ActionNode* fire_blast(PlayerbotAI*) { return new ActionNode("fire blast", nullptr, nullptr, nullptr); } - static ActionNode* frostbolt(PlayerbotAI*) { return new ActionNode("frostbolt", nullptr, nullptr, nullptr); } - static ActionNode* arcane_power(PlayerbotAI*) { return new ActionNode("arcane power", nullptr, nullptr, nullptr); } - static ActionNode* icy_veins(PlayerbotAI*) { return new ActionNode("icy veins", nullptr, nullptr, nullptr); } + static ActionNode* arcane_blast(PlayerbotAI*) { return new ActionNode("arcane blast", {}, {}, {}); } + static ActionNode* arcane_barrage(PlayerbotAI*) { return new ActionNode("arcane barrage", {}, {}, {}); } + static ActionNode* arcane_missiles(PlayerbotAI*) { return new ActionNode("arcane missiles", {}, {}, {}); } + static ActionNode* fire_blast(PlayerbotAI*) { return new ActionNode("fire blast", {}, {}, {}); } + static ActionNode* frostbolt(PlayerbotAI*) { return new ActionNode("frostbolt", {}, {}, {}); } + static ActionNode* arcane_power(PlayerbotAI*) { return new ActionNode("arcane power", {}, {}, {}); } + static ActionNode* icy_veins(PlayerbotAI*) { return new ActionNode("icy veins", {}, {}, {}); } }; // ===== Single Target Strategy ===== @@ -38,14 +38,16 @@ ArcaneMageStrategy::ArcaneMageStrategy(PlayerbotAI* botAI) : GenericMageStrategy } // ===== Default Actions ===== -NextAction** ArcaneMageStrategy::getDefaultActions() +std::vector ArcaneMageStrategy::getDefaultActions() { - return NextAction::array(0, new NextAction("arcane blast", 5.6f), - new NextAction("arcane missiles", 5.5f), - new NextAction("arcane barrage", 5.4f), // cast while moving - new NextAction("fire blast", 5.3f), // cast while moving if arcane barrage isn't available/learned - new NextAction("frostbolt", 5.2f), // for arcane immune targets - new NextAction("shoot", 5.1f), nullptr); + return { + NextAction("arcane blast", 5.6f), + NextAction("arcane missiles", 5.5f), + NextAction("arcane barrage", 5.4f), // cast while moving + NextAction("fire blast", 5.3f), // cast while moving if arcane barrage isn't available/learned + NextAction("frostbolt", 5.2f), // for arcane immune targets + NextAction("shoot", 5.1f) + }; } // ===== Trigger Initialization === @@ -54,5 +56,12 @@ void ArcaneMageStrategy::InitTriggers(std::vector& triggers) GenericMageStrategy::InitTriggers(triggers); // Proc Trigger - triggers.push_back(new TriggerNode("arcane blast 4 stacks and missile barrage", NextAction::array(0, new NextAction("arcane missiles", 15.0f), nullptr))); + triggers.push_back( + new TriggerNode( + "arcane blast 4 stacks and missile barrage", + { + NextAction("arcane missiles", 15.0f) + } + ) + ); } diff --git a/src/strategy/mage/ArcaneMageStrategy.h b/src/strategy/mage/ArcaneMageStrategy.h index c32f966f..e654a655 100644 --- a/src/strategy/mage/ArcaneMageStrategy.h +++ b/src/strategy/mage/ArcaneMageStrategy.h @@ -17,7 +17,7 @@ public: void InitTriggers(std::vector& triggers) override; std::string const getName() override { return "arcane"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; }; #endif diff --git a/src/strategy/mage/FireMageStrategy.cpp b/src/strategy/mage/FireMageStrategy.cpp index 95cc6955..4914c72d 100644 --- a/src/strategy/mage/FireMageStrategy.cpp +++ b/src/strategy/mage/FireMageStrategy.cpp @@ -23,13 +23,13 @@ public: } private: - static ActionNode* fireball(PlayerbotAI*) { return new ActionNode("fireball", nullptr, nullptr, nullptr); } - static ActionNode* frostbolt(PlayerbotAI*) { return new ActionNode("frostbolt", nullptr, nullptr, nullptr); } - static ActionNode* fire_blast(PlayerbotAI*) { return new ActionNode("fire blast", nullptr, nullptr, nullptr); } - static ActionNode* pyroblast(PlayerbotAI*) { return new ActionNode("pyroblast", nullptr, nullptr, nullptr); } - static ActionNode* scorch(PlayerbotAI*) { return new ActionNode("scorch", nullptr, nullptr, nullptr); } - static ActionNode* living_bomb(PlayerbotAI*) { return new ActionNode("living bomb", nullptr, nullptr, nullptr); } - static ActionNode* combustion(PlayerbotAI*) { return new ActionNode("combustion", nullptr, nullptr, nullptr); } + static ActionNode* fireball(PlayerbotAI*) { return new ActionNode("fireball", {}, {}, {}); } + static ActionNode* frostbolt(PlayerbotAI*) { return new ActionNode("frostbolt", {}, {}, {}); } + static ActionNode* fire_blast(PlayerbotAI*) { return new ActionNode("fire blast", {}, {}, {}); } + static ActionNode* pyroblast(PlayerbotAI*) { return new ActionNode("pyroblast", {}, {}, {}); } + static ActionNode* scorch(PlayerbotAI*) { return new ActionNode("scorch", {}, {}, {}); } + static ActionNode* living_bomb(PlayerbotAI*) { return new ActionNode("living bomb", {}, {}, {}); } + static ActionNode* combustion(PlayerbotAI*) { return new ActionNode("combustion", {}, {}, {}); } }; // ===== Single Target Strategy ===== @@ -39,12 +39,14 @@ FireMageStrategy::FireMageStrategy(PlayerbotAI* botAI) : GenericMageStrategy(bot } // ===== Default Actions ===== -NextAction** FireMageStrategy::getDefaultActions() +std::vector FireMageStrategy::getDefaultActions() { - return NextAction::array(0, new NextAction("fireball", 5.3f), - new NextAction("frostbolt", 5.2f), // fire immune target - new NextAction("fire blast", 5.1f), // cast during movement - new NextAction("shoot", 5.0f), nullptr); + return { + NextAction("fireball", 5.3f), + NextAction("frostbolt", 5.2f), // fire immune target + NextAction("fire blast", 5.1f), // cast during movement + NextAction("shoot", 5.0f) + }; } // ===== Trigger Initialization ===== @@ -53,11 +55,32 @@ void FireMageStrategy::InitTriggers(std::vector& triggers) GenericMageStrategy::InitTriggers(triggers); // Debuff Triggers - triggers.push_back(new TriggerNode("improved scorch", NextAction::array(0, new NextAction("scorch", 19.0f), nullptr))); - triggers.push_back(new TriggerNode("living bomb", NextAction::array(0, new NextAction("living bomb", 18.5f), nullptr))); + triggers.push_back( + new TriggerNode( + "improved scorch", + { + NextAction("scorch", 19.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "living bomb", + { + NextAction("living bomb", 18.5f) + } + ) + ); // Proc Trigger - triggers.push_back(new TriggerNode("hot streak", NextAction::array(0, new NextAction("pyroblast", 25.0f), nullptr))); + triggers.push_back( + new TriggerNode( + "hot streak", + { + NextAction("pyroblast", 25.0f) + } + ) + ); } // Combat strategy to run to melee for Dragon's Breath and Blast Wave @@ -68,7 +91,12 @@ FirestarterStrategy::FirestarterStrategy(PlayerbotAI* botAI) : CombatStrategy(bo void FirestarterStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode( - "blast wave off cd and medium aoe", - NextAction::array(0, new NextAction("reach melee", 25.5f), nullptr))); + triggers.push_back( + new TriggerNode( + "blast wave off cd and medium aoe", + { + NextAction("reach melee", 25.5f) + } + ) + ); } diff --git a/src/strategy/mage/FireMageStrategy.h b/src/strategy/mage/FireMageStrategy.h index 5a5e1fa0..03d50641 100644 --- a/src/strategy/mage/FireMageStrategy.h +++ b/src/strategy/mage/FireMageStrategy.h @@ -17,7 +17,7 @@ public: void InitTriggers(std::vector& triggers) override; std::string const getName() override { return "fire"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; }; class FirestarterStrategy : public CombatStrategy diff --git a/src/strategy/mage/FrostFireMageStrategy.cpp b/src/strategy/mage/FrostFireMageStrategy.cpp index 0d6e1fec..4448a434 100644 --- a/src/strategy/mage/FrostFireMageStrategy.cpp +++ b/src/strategy/mage/FrostFireMageStrategy.cpp @@ -22,13 +22,13 @@ public: } private: - static ActionNode* frostfire_bolt(PlayerbotAI*) { return new ActionNode("frostfire bolt", nullptr, nullptr, nullptr); } - static ActionNode* fire_blast(PlayerbotAI*) { return new ActionNode("fire blast", nullptr, nullptr, nullptr); } - static ActionNode* pyroblast(PlayerbotAI*) { return new ActionNode("pyroblast", nullptr, nullptr, nullptr); } - static ActionNode* combustion(PlayerbotAI*) { return new ActionNode("combustion", nullptr, nullptr, nullptr); } - static ActionNode* icy_veins(PlayerbotAI*) { return new ActionNode("icy veins", nullptr, nullptr, nullptr); } - static ActionNode* scorch(PlayerbotAI*) { return new ActionNode("scorch", nullptr, nullptr, nullptr); } - static ActionNode* living_bomb(PlayerbotAI*) { return new ActionNode("living bomb", nullptr, nullptr, nullptr); } + static ActionNode* frostfire_bolt(PlayerbotAI*) { return new ActionNode("frostfire bolt", {}, {}, {}); } + static ActionNode* fire_blast(PlayerbotAI*) { return new ActionNode("fire blast", {}, {}, {}); } + static ActionNode* pyroblast(PlayerbotAI*) { return new ActionNode("pyroblast", {}, {}, {}); } + static ActionNode* combustion(PlayerbotAI*) { return new ActionNode("combustion", {}, {}, {}); } + static ActionNode* icy_veins(PlayerbotAI*) { return new ActionNode("icy veins", {}, {}, {}); } + static ActionNode* scorch(PlayerbotAI*) { return new ActionNode("scorch", {}, {}, {}); } + static ActionNode* living_bomb(PlayerbotAI*) { return new ActionNode("living bomb", {}, {}, {}); } }; // ===== Single Target Strategy ===== @@ -38,11 +38,13 @@ FrostFireMageStrategy::FrostFireMageStrategy(PlayerbotAI* botAI) : GenericMageSt } // ===== Default Actions ===== -NextAction** FrostFireMageStrategy::getDefaultActions() +std::vector FrostFireMageStrategy::getDefaultActions() { - return NextAction::array(0, new NextAction("frostfire bolt", 5.2f), - new NextAction("fire blast", 5.1f), // cast during movement - new NextAction("shoot", 5.0f), nullptr); + return { + NextAction("frostfire bolt", 5.2f), + NextAction("fire blast", 5.1f), // cast during movement + NextAction("shoot", 5.0f) + }; } // ===== Trigger Initialization ===== @@ -51,9 +53,30 @@ void FrostFireMageStrategy::InitTriggers(std::vector& triggers) GenericMageStrategy::InitTriggers(triggers); // Debuff Triggers - triggers.push_back(new TriggerNode("improved scorch", NextAction::array(0, new NextAction("scorch", 19.0f), nullptr))); - triggers.push_back(new TriggerNode("living bomb", NextAction::array(0, new NextAction("living bomb", 18.5f), nullptr))); + triggers.push_back( + new TriggerNode( + "improved scorch", + { + NextAction("scorch", 19.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "living bomb", + { + NextAction("living bomb", 18.5f) + } + ) + ); // Proc Trigger - triggers.push_back(new TriggerNode("hot streak", NextAction::array(0, new NextAction("pyroblast", 25.0f), nullptr))); + triggers.push_back( + new TriggerNode( + "hot streak", + { + NextAction("pyroblast", 25.0f) + } + ) + ); } diff --git a/src/strategy/mage/FrostFireMageStrategy.h b/src/strategy/mage/FrostFireMageStrategy.h index 8d3a3963..00bbf03a 100644 --- a/src/strategy/mage/FrostFireMageStrategy.h +++ b/src/strategy/mage/FrostFireMageStrategy.h @@ -17,7 +17,7 @@ public: void InitTriggers(std::vector& triggers) override; std::string const getName() override { return "frostfire"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; }; #endif diff --git a/src/strategy/mage/FrostMageStrategy.cpp b/src/strategy/mage/FrostMageStrategy.cpp index 369fc1c8..34ed81db 100644 --- a/src/strategy/mage/FrostMageStrategy.cpp +++ b/src/strategy/mage/FrostMageStrategy.cpp @@ -26,16 +26,16 @@ public: } private: - static ActionNode* cold_snap(PlayerbotAI*) { return new ActionNode("cold snap", nullptr, nullptr, nullptr); } - static ActionNode* ice_barrier(PlayerbotAI*) { return new ActionNode("ice barrier", nullptr, nullptr, nullptr); } - static ActionNode* summon_water_elemental(PlayerbotAI*) { return new ActionNode("summon water elemental", nullptr, nullptr, nullptr); } - static ActionNode* deep_freeze(PlayerbotAI*) { return new ActionNode("deep freeze", nullptr, nullptr, nullptr); } - static ActionNode* icy_veins(PlayerbotAI*) { return new ActionNode("icy veins", nullptr, nullptr, nullptr); } - static ActionNode* frostbolt(PlayerbotAI*) { return new ActionNode("frostbolt", nullptr, nullptr, nullptr); } - static ActionNode* ice_lance(PlayerbotAI*) { return new ActionNode("ice lance", nullptr, nullptr, nullptr); } - static ActionNode* fire_blast(PlayerbotAI*) { return new ActionNode("fire blast", nullptr, nullptr, nullptr); } - static ActionNode* fireball(PlayerbotAI*) { return new ActionNode("fireball", nullptr, nullptr, nullptr); } - static ActionNode* frostfire_bolt(PlayerbotAI*) { return new ActionNode("frostfire bolt", nullptr, nullptr, nullptr); } + static ActionNode* cold_snap(PlayerbotAI*) { return new ActionNode("cold snap", {}, {}, {}); } + static ActionNode* ice_barrier(PlayerbotAI*) { return new ActionNode("ice barrier", {}, {}, {}); } + static ActionNode* summon_water_elemental(PlayerbotAI*) { return new ActionNode("summon water elemental", {}, {}, {}); } + static ActionNode* deep_freeze(PlayerbotAI*) { return new ActionNode("deep freeze", {}, {}, {}); } + static ActionNode* icy_veins(PlayerbotAI*) { return new ActionNode("icy veins", {}, {}, {}); } + static ActionNode* frostbolt(PlayerbotAI*) { return new ActionNode("frostbolt", {}, {}, {}); } + static ActionNode* ice_lance(PlayerbotAI*) { return new ActionNode("ice lance", {}, {}, {}); } + static ActionNode* fire_blast(PlayerbotAI*) { return new ActionNode("fire blast", {}, {}, {}); } + static ActionNode* fireball(PlayerbotAI*) { return new ActionNode("fireball", {}, {}, {}); } + static ActionNode* frostfire_bolt(PlayerbotAI*) { return new ActionNode("frostfire bolt", {}, {}, {}); } }; // ===== Single Target Strategy ===== @@ -45,13 +45,15 @@ FrostMageStrategy::FrostMageStrategy(PlayerbotAI* botAI) : GenericMageStrategy(b } // ===== Default Actions ===== -NextAction** FrostMageStrategy::getDefaultActions() +std::vector FrostMageStrategy::getDefaultActions() { - return NextAction::array(0, new NextAction("frostbolt", 5.4f), - new NextAction("ice lance", 5.3f), // cast during movement - new NextAction("fire blast", 5.2f), // cast during movement if ice lance is not learned - new NextAction("shoot", 5.1f), - new NextAction("fireball", 5.0f), nullptr); + return { + NextAction("frostbolt", 5.4f), + NextAction("ice lance", 5.3f), // cast during movement + NextAction("fire blast", 5.2f), // cast during movement if ice lance is not learned + NextAction("shoot", 5.1f), + NextAction("fireball", 5.0f) + }; } // ===== Trigger Initialization === @@ -60,24 +62,81 @@ void FrostMageStrategy::InitTriggers(std::vector& triggers) GenericMageStrategy::InitTriggers(triggers); // Pet/Defensive triggers - triggers.push_back(new TriggerNode("no pet", NextAction::array(0, new NextAction("summon water elemental", 30.0f), nullptr))); - triggers.push_back(new TriggerNode("has pet", NextAction::array(0, new NextAction("toggle pet spell", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("new pet", NextAction::array(0, new NextAction("set pet stance", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("medium health", NextAction::array(0, new NextAction("ice barrier", 29.0f), nullptr))); - triggers.push_back(new TriggerNode("being attacked", NextAction::array(0, new NextAction("ice barrier", 29.0f), nullptr))); + triggers.push_back( + new TriggerNode( + "no pet", + { + NextAction("summon water elemental", 30.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "has pet", + { + NextAction("toggle pet spell", 60.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "new pet", + { + NextAction("set pet stance", 60.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "medium health", + { + NextAction("ice barrier", 29.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "being attacked", + { + NextAction("ice barrier", 29.0f) + } + ) + ); // Proc/Freeze triggers - triggers.push_back(new TriggerNode("brain freeze", NextAction::array(0, new NextAction("frostfire bolt", 19.5f), nullptr))); - triggers.push_back(new TriggerNode("fingers of frost", NextAction::array(0, - new NextAction("deep freeze", 19.0f), - new NextAction("frostbolt", 18.0f), nullptr))); - - triggers.push_back(new TriggerNode("frostbite on target", NextAction::array(0, - new NextAction("deep freeze", 19.0f), - new NextAction("frostbolt", 18.0f), nullptr))); - - triggers.push_back(new TriggerNode("frost nova on target", NextAction::array(0, - new NextAction("deep freeze", 19.0f), - new NextAction("frostbolt", 18.0f), nullptr))); - + triggers.push_back( + new TriggerNode( + "brain freeze", + { + NextAction("frostfire bolt", 19.5f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "fingers of frost", + { + NextAction("deep freeze", 19.0f), + NextAction("frostbolt", 18.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "frostbite on target", + { + NextAction("deep freeze", 19.0f), + NextAction("frostbolt", 18.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "frost nova on target", + { + NextAction("deep freeze", 19.0f), + NextAction("frostbolt", 18.0f) + } + ) + ); } diff --git a/src/strategy/mage/FrostMageStrategy.h b/src/strategy/mage/FrostMageStrategy.h index d0b3b372..9b027fed 100644 --- a/src/strategy/mage/FrostMageStrategy.h +++ b/src/strategy/mage/FrostMageStrategy.h @@ -17,7 +17,7 @@ public: void InitTriggers(std::vector& triggers) override; std::string const getName() override { return "frost"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; }; #endif diff --git a/src/strategy/mage/GenericMageNonCombatStrategy.cpp b/src/strategy/mage/GenericMageNonCombatStrategy.cpp index d83c0f5f..eab98ea5 100644 --- a/src/strategy/mage/GenericMageNonCombatStrategy.cpp +++ b/src/strategy/mage/GenericMageNonCombatStrategy.cpp @@ -21,25 +21,25 @@ private: static ActionNode* molten_armor([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("molten armor", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("mage armor"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("mage armor") }, + /*C*/ {}); } static ActionNode* mage_armor([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("mage armor", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("ice armor"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("ice armor") }, + /*C*/ {}); } static ActionNode* ice_armor([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("ice armor", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("frost armor"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("frost armor") }, + /*C*/ {}); } }; @@ -52,23 +52,23 @@ void GenericMageNonCombatStrategy::InitTriggers(std::vector& trigg { NonCombatStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("arcane intellect", NextAction::array(0, new NextAction("arcane intellect", 21.0f), nullptr))); - triggers.push_back(new TriggerNode("no focus magic", NextAction::array(0, new NextAction("focus magic on party", 19.0f), nullptr))); - triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("apply oil", 1.0f), nullptr))); - triggers.push_back(new TriggerNode("no mana gem", NextAction::array(0, new NextAction("conjure mana gem", 20.0f), nullptr))); + triggers.push_back(new TriggerNode("arcane intellect", { NextAction("arcane intellect", 21.0f) })); + triggers.push_back(new TriggerNode("no focus magic", { NextAction("focus magic on party", 19.0f) })); + triggers.push_back(new TriggerNode("often", { NextAction("apply oil", 1.0f) })); + triggers.push_back(new TriggerNode("no mana gem", { NextAction("conjure mana gem", 20.0f) })); } void MageBuffManaStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("mage armor", NextAction::array(0, new NextAction("mage armor", 19.0f), nullptr))); + triggers.push_back(new TriggerNode("mage armor", { NextAction("mage armor", 19.0f) })); } void MageBuffDpsStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("mage armor", NextAction::array(0, new NextAction("molten armor", 19.0f), nullptr))); + triggers.push_back(new TriggerNode("mage armor", { NextAction("molten armor", 19.0f) })); } void MageBuffStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("arcane intellect on party", NextAction::array(0, new NextAction("arcane intellect on party", 20.0f), nullptr))); + triggers.push_back(new TriggerNode("arcane intellect on party", { NextAction("arcane intellect on party", 20.0f) })); } diff --git a/src/strategy/mage/GenericMageStrategy.cpp b/src/strategy/mage/GenericMageStrategy.cpp index f8d5667f..75a63efa 100644 --- a/src/strategy/mage/GenericMageStrategy.cpp +++ b/src/strategy/mage/GenericMageStrategy.cpp @@ -34,120 +34,120 @@ private: static ActionNode* frostbolt([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("frostbolt", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("shoot"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("shoot") }, + /*C*/ {}); } static ActionNode* frostfire_bolt([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("frostfire bolt", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("fireball"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("fireball") }, + /*C*/ {}); } static ActionNode* ice_lance([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("ice lance", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* fire_blast([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("fire blast", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* scorch([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("scorch", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("shoot"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("shoot") }, + /*C*/ {}); } static ActionNode* frost_nova([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("frost nova", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* cone_of_cold([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("cone of cold", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* icy_veins([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("icy veins", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* combustion([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("combustion", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* evocation([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("evocation", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("mana potion"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("mana potion") }, + /*C*/ {}); } static ActionNode* dragons_breath([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("dragon's breath", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* blast_wave([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("blast wave", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* remove_curse([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("remove curse", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("remove lesser curse"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("remove lesser curse") }, + /*C*/ {}); } static ActionNode* remove_curse_on_party([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("remove curse on party", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("remove lesser curse on party"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("remove lesser curse on party") }, + /*C*/ {}); } static ActionNode* fireball([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("fireball", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("shoot"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("shoot") }, + /*C*/ {}); } }; @@ -161,44 +161,44 @@ void GenericMageStrategy::InitTriggers(std::vector& triggers) RangedCombatStrategy::InitTriggers(triggers); // Threat Triggers - triggers.push_back(new TriggerNode("high threat", NextAction::array(0, new NextAction("mirror image", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("medium threat", NextAction::array(0, new NextAction("invisibility", 30.0f), nullptr))); + triggers.push_back(new TriggerNode("high threat", { NextAction("mirror image", 60.0f) })); + triggers.push_back(new TriggerNode("medium threat", { NextAction("invisibility", 30.0f) })); // Defensive Triggers - triggers.push_back(new TriggerNode("critical health", NextAction::array(0, new NextAction("ice block", 90.0f), nullptr))); - triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("mana shield", 85.0f), nullptr))); - triggers.push_back(new TriggerNode("fire ward", NextAction::array(0, new NextAction("fire ward", 90.0f), nullptr))); - triggers.push_back(new TriggerNode("frost ward", NextAction::array(0, new NextAction("frost ward", 90.0f), nullptr))); - triggers.push_back(new TriggerNode("enemy is close and no firestarter strategy", NextAction::array(0, new NextAction("frost nova", 50.0f), nullptr))); - triggers.push_back(new TriggerNode("enemy too close for spell and no firestarter strategy", NextAction::array(0, new NextAction("blink back", 35.0f), nullptr))); + triggers.push_back(new TriggerNode("critical health", { NextAction("ice block", 90.0f) })); + triggers.push_back(new TriggerNode("low health", { NextAction("mana shield", 85.0f) })); + triggers.push_back(new TriggerNode("fire ward", { NextAction("fire ward", 90.0f) })); + triggers.push_back(new TriggerNode("frost ward", { NextAction("frost ward", 90.0f) })); + triggers.push_back(new TriggerNode("enemy is close and no firestarter strategy", { NextAction("frost nova", 50.0f) })); + triggers.push_back(new TriggerNode("enemy too close for spell and no firestarter strategy", { NextAction("blink back", 35.0f) })); // Mana Threshold Triggers Player* bot = botAI->GetBot(); if (bot->HasSpell(42985)) // Mana Sapphire - triggers.push_back(new TriggerNode("high mana", NextAction::array(0, new NextAction("use mana sapphire", 90.0f), nullptr))); + triggers.push_back(new TriggerNode("high mana", { NextAction("use mana sapphire", 90.0f) })); else if (bot->HasSpell(27101)) // Mana Emerald - triggers.push_back(new TriggerNode("high mana", NextAction::array(0, new NextAction("use mana emerald", 90.0f), nullptr))); + triggers.push_back(new TriggerNode("high mana", { NextAction("use mana emerald", 90.0f) })); else if (bot->HasSpell(10054)) // Mana Ruby - triggers.push_back(new TriggerNode("high mana", NextAction::array(0, new NextAction("use mana ruby", 90.0f), nullptr))); + triggers.push_back(new TriggerNode("high mana", { NextAction("use mana ruby", 90.0f) })); else if (bot->HasSpell(10053)) // Mana Citrine - triggers.push_back(new TriggerNode("high mana", NextAction::array(0, new NextAction("use mana citrine", 90.0f), nullptr))); + triggers.push_back(new TriggerNode("high mana", { NextAction("use mana citrine", 90.0f) })); else if (bot->HasSpell(3552)) // Mana Jade - triggers.push_back(new TriggerNode("high mana", NextAction::array(0, new NextAction("use mana jade", 90.0f), nullptr))); + triggers.push_back(new TriggerNode("high mana", { NextAction("use mana jade", 90.0f) })); else if (bot->HasSpell(759)) // Mana Agate - triggers.push_back(new TriggerNode("high mana", NextAction::array(0, new NextAction("use mana agate", 90.0f), nullptr))); + triggers.push_back(new TriggerNode("high mana", { NextAction("use mana agate", 90.0f) })); - triggers.push_back(new TriggerNode("medium mana", NextAction::array(0, new NextAction("mana potion", 90.0f), nullptr))); - triggers.push_back(new TriggerNode("low mana", NextAction::array(0, new NextAction("evocation", 90.0f), nullptr))); + triggers.push_back(new TriggerNode("medium mana", { NextAction("mana potion", 90.0f) })); + triggers.push_back(new TriggerNode("low mana", { NextAction("evocation", 90.0f) })); // Counterspell / Spellsteal Triggers - triggers.push_back(new TriggerNode("spellsteal", NextAction::array(0, new NextAction("spellsteal", 40.0f), nullptr))); - triggers.push_back(new TriggerNode("counterspell on enemy healer", NextAction::array(0, new NextAction("counterspell on enemy healer", 40.0f), nullptr))); + triggers.push_back(new TriggerNode("spellsteal", { NextAction("spellsteal", 40.0f) })); + triggers.push_back(new TriggerNode("counterspell on enemy healer", { NextAction("counterspell on enemy healer", 40.0f) })); } void MageCureStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("remove curse", NextAction::array(0, new NextAction("remove curse", 41.0f), nullptr))); - triggers.push_back(new TriggerNode("remove curse on party", NextAction::array(0, new NextAction("remove curse on party", 40.0f), nullptr))); + triggers.push_back(new TriggerNode("remove curse", { NextAction("remove curse", 41.0f) })); + triggers.push_back(new TriggerNode("remove curse on party", { NextAction("remove curse on party", 40.0f) })); } void MageBoostStrategy::InitTriggers(std::vector& triggers) @@ -208,71 +208,71 @@ void MageBoostStrategy::InitTriggers(std::vector& triggers) if (tab == 0) // Arcane { - triggers.push_back(new TriggerNode("arcane power", NextAction::array(0, new NextAction("arcane power", 29.0f), nullptr))); - triggers.push_back(new TriggerNode("icy veins", NextAction::array(0, new NextAction("icy veins", 28.5f), nullptr))); - triggers.push_back(new TriggerNode("mirror image", NextAction::array(0, new NextAction("mirror image", 28.0f), nullptr))); + triggers.push_back(new TriggerNode("arcane power", { NextAction("arcane power", 29.0f) })); + triggers.push_back(new TriggerNode("icy veins", { NextAction("icy veins", 28.5f) })); + triggers.push_back(new TriggerNode("mirror image", { NextAction("mirror image", 28.0f) })); } else if (tab == 1) { if (bot->HasSpell(44614) /*Frostfire Bolt*/ && bot->HasAura(15047) /*Ice Shards*/) { // Frostfire - triggers.push_back(new TriggerNode("combustion", NextAction::array(0, new NextAction("combustion", 18.0f), nullptr))); - triggers.push_back(new TriggerNode("icy veins", NextAction::array(0, new NextAction("icy veins", 17.5f), nullptr))); - triggers.push_back(new TriggerNode("mirror image", NextAction::array(0, new NextAction("mirror image", 17.0f), nullptr))); + triggers.push_back(new TriggerNode("combustion", { NextAction("combustion", 18.0f) })); + triggers.push_back(new TriggerNode("icy veins", { NextAction("icy veins", 17.5f) })); + triggers.push_back(new TriggerNode("mirror image", { NextAction("mirror image", 17.0f) })); } else { // Fire - triggers.push_back(new TriggerNode("combustion", NextAction::array(0, new NextAction("combustion", 18.0f), nullptr))); - triggers.push_back(new TriggerNode("mirror image", NextAction::array(0, new NextAction("mirror image", 17.5f), nullptr))); + triggers.push_back(new TriggerNode("combustion", { NextAction("combustion", 18.0f) })); + triggers.push_back(new TriggerNode("mirror image", { NextAction("mirror image", 17.5f) })); } } else if (tab == 2) // Frost { - triggers.push_back(new TriggerNode("cold snap", NextAction::array(0, new NextAction("cold snap", 28.0f), nullptr))); - triggers.push_back(new TriggerNode("icy veins", NextAction::array(0, new NextAction("icy veins", 27.5f), nullptr))); - triggers.push_back(new TriggerNode("mirror image", NextAction::array(0, new NextAction("mirror image", 26.0f), nullptr))); + triggers.push_back(new TriggerNode("cold snap", { NextAction("cold snap", 28.0f) })); + triggers.push_back(new TriggerNode("icy veins", { NextAction("icy veins", 27.5f) })); + triggers.push_back(new TriggerNode("mirror image", { NextAction("mirror image", 26.0f) })); } } void MageCcStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("polymorph", NextAction::array(0, new NextAction("polymorph", 30.0f), nullptr))); + triggers.push_back(new TriggerNode("polymorph", { NextAction("polymorph", 30.0f) })); } void MageAoeStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("blizzard channel check", NextAction::array(0, new NextAction("cancel channel", 26.0f), nullptr))); + triggers.push_back(new TriggerNode("blizzard channel check", { NextAction("cancel channel", 26.0f) })); Player* bot = botAI->GetBot(); int tab = AiFactory::GetPlayerSpecTab(bot); if (tab == 0) // Arcane { - triggers.push_back(new TriggerNode("flamestrike active and medium aoe", NextAction::array(0, new NextAction("blizzard", 24.0f), nullptr))); - triggers.push_back(new TriggerNode("medium aoe", NextAction::array(0, - new NextAction("flamestrike", 23.0f), - new NextAction("blizzard", 22.0f), nullptr))); - triggers.push_back(new TriggerNode("light aoe", NextAction::array(0, new NextAction("arcane explosion", 21.0f), nullptr))); + triggers.push_back(new TriggerNode("flamestrike active and medium aoe", { NextAction("blizzard", 24.0f) })); + triggers.push_back(new TriggerNode("medium aoe", { + NextAction("flamestrike", 23.0f), + NextAction("blizzard", 22.0f) })); + triggers.push_back(new TriggerNode("light aoe", { NextAction("arcane explosion", 21.0f) })); } else if (tab == 1) // Fire and Frostfire { triggers.push_back( - new TriggerNode("medium aoe", NextAction::array(0, - new NextAction("dragon's breath", 39.0f), - new NextAction("blast wave", 38.0f), - new NextAction("flamestrike", 23.0f), - new NextAction("blizzard", 22.0f), nullptr))); + new TriggerNode("medium aoe", { + NextAction("dragon's breath", 39.0f), + NextAction("blast wave", 38.0f), + NextAction("flamestrike", 23.0f), + NextAction("blizzard", 22.0f) })); - triggers.push_back(new TriggerNode("flamestrike active and medium aoe", NextAction::array(0, new NextAction("blizzard", 24.0f), nullptr))); - triggers.push_back(new TriggerNode("firestarter", NextAction::array(0, new NextAction("flamestrike", 40.0f), nullptr))); - triggers.push_back(new TriggerNode("living bomb on attackers", NextAction::array(0, new NextAction("living bomb on attackers", 21.0f), nullptr))); + triggers.push_back(new TriggerNode("flamestrike active and medium aoe", { NextAction("blizzard", 24.0f) })); + triggers.push_back(new TriggerNode("firestarter", { NextAction("flamestrike", 40.0f) })); + triggers.push_back(new TriggerNode("living bomb on attackers", { NextAction("living bomb on attackers", 21.0f) })); } else if (tab == 2) // Frost { - triggers.push_back(new TriggerNode("flamestrike active and medium aoe", NextAction::array(0, new NextAction("blizzard", 24.0f), nullptr))); - triggers.push_back(new TriggerNode("medium aoe", NextAction::array(0, - new NextAction("flamestrike", 23.0f), - new NextAction("blizzard", 22.0f), nullptr))); - triggers.push_back(new TriggerNode("light aoe", NextAction::array(0, new NextAction("cone of cold", 21.0f), nullptr))); + triggers.push_back(new TriggerNode("flamestrike active and medium aoe", { NextAction("blizzard", 24.0f) })); + triggers.push_back(new TriggerNode("medium aoe", { + NextAction("flamestrike", 23.0f), + NextAction("blizzard", 22.0f) })); + triggers.push_back(new TriggerNode("light aoe", { NextAction("cone of cold", 21.0f) })); } } diff --git a/src/strategy/paladin/DpsPaladinStrategy.cpp b/src/strategy/paladin/DpsPaladinStrategy.cpp index 209e0200..185fb72d 100644 --- a/src/strategy/paladin/DpsPaladinStrategy.cpp +++ b/src/strategy/paladin/DpsPaladinStrategy.cpp @@ -29,50 +29,113 @@ public: private: static ActionNode* seal_of_corruption([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("seal of corruption", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("seal of vengeance"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "seal of corruption", + /*P*/ {}, + /*A*/ { NextAction("seal of vengeance") }, + /*C*/ {} + ); } static ActionNode* seal_of_vengeance([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("seal of vengeance", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("seal of command"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "seal of vengeance", + /*P*/ {}, + /*A*/ { NextAction("seal of command") }, + /*C*/ {} + ); } static ActionNode* seal_of_command([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("seal of command", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("seal of righteousness"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "seal of command", + /*P*/ {}, + /*A*/ { NextAction("seal of righteousness") }, + /*C*/ {} + ); } static ActionNode* blessing_of_might([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("blessing of might", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("blessing of kings"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "blessing of might", + /*P*/ {}, + /*A*/ { NextAction("blessing of kings") }, + /*C*/ {} + ); } static ActionNode* crusader_strike([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("crusader strike", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "crusader strike", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } - ACTION_NODE_A(repentance, "repentance", "hammer of justice"); - ACTION_NODE_A(repentance_on_enemy_healer, "repentance on enemy healer", "hammer of justice on enemy healer"); - ACTION_NODE_A(repentance_on_snare_target, "repentance on snare target", "hammer of justice on snare target"); - ACTION_NODE_A(sanctity_aura, "sanctity aura", "retribution aura"); - ACTION_NODE_A(retribution_aura, "retribution aura", "devotion aura"); - ACTION_NODE_A(repentance_or_shield, "repentance", "divine shield"); + static ActionNode* repentance([[maybe_unused]] PlayerbotAI* botAI) + { + return new ActionNode( + "repentance", + /*P*/ {}, + /*A*/ { NextAction("hammer of justice") }, + /*C*/ {} + ); + } + + static ActionNode* repentance_on_enemy_healer([[maybe_unused]] PlayerbotAI* botAI) + { + return new ActionNode( + "repentance on enemy healer", + /*P*/ {}, + /*A*/ { NextAction("hammer of justice on enemy healer") }, + /*C*/ {} + ); + } + + static ActionNode* repentance_on_snare_target([[maybe_unused]] PlayerbotAI* botAI) + { + return new ActionNode( + "repentance on snare target", + /*P*/ {}, + /*A*/ { NextAction("hammer of justice on snare target") }, + /*C*/ {} + ); + } + + static ActionNode* sanctity_aura([[maybe_unused]] PlayerbotAI* botAI) + { + return new ActionNode( + "sanctity aura", + /*P*/ {}, + /*A*/ { NextAction("retribution aura") }, + /*C*/ {} + ); + } + + static ActionNode* retribution_aura([[maybe_unused]] PlayerbotAI* botAI) + { + return new ActionNode( + "retribution aura", + /*P*/ {}, + /*A*/ { NextAction("devotion aura") }, + /*C*/ {} + ); + } + + static ActionNode* repentance_or_shield([[maybe_unused]] PlayerbotAI* botAI) + { + return new ActionNode( + "repentance", + /*P*/ {}, + /*A*/ { NextAction("divine shield") }, + /*C*/ {} + ); + } }; DpsPaladinStrategy::DpsPaladinStrategy(PlayerbotAI* botAI) : GenericPaladinStrategy(botAI) @@ -80,56 +143,70 @@ DpsPaladinStrategy::DpsPaladinStrategy(PlayerbotAI* botAI) : GenericPaladinStrat actionNodeFactories.Add(new DpsPaladinStrategyActionNodeFactory()); } -NextAction** DpsPaladinStrategy::getDefaultActions() +std::vector DpsPaladinStrategy::getDefaultActions() { - return NextAction::array(0, - new NextAction("hammer of wrath", ACTION_DEFAULT + 0.6f), - new NextAction("judgement of wisdom", ACTION_DEFAULT + 0.5f), - new NextAction("crusader strike", ACTION_DEFAULT + 0.4f), - new NextAction("divine storm", ACTION_DEFAULT + 0.3f), - new NextAction("consecration", ACTION_DEFAULT + 0.1f), - new NextAction("melee", ACTION_DEFAULT), nullptr); + return { + NextAction("hammer of wrath", ACTION_DEFAULT + 0.6f), + NextAction("judgement of wisdom", ACTION_DEFAULT + 0.5f), + NextAction("crusader strike", ACTION_DEFAULT + 0.4f), + NextAction("divine storm", ACTION_DEFAULT + 0.3f), + NextAction("consecration", ACTION_DEFAULT + 0.1f), + NextAction("melee", ACTION_DEFAULT) + }; } void DpsPaladinStrategy::InitTriggers(std::vector& triggers) { GenericPaladinStrategy::InitTriggers(triggers); - // triggers.push_back(new TriggerNode( - // "enough mana", NextAction::array(0, new NextAction("consecration", ACTION_DEFAULT + 0.2f), nullptr))); triggers.push_back( - new TriggerNode("art of war", NextAction::array(0, new NextAction("exorcism", ACTION_DEFAULT + 0.2f), nullptr))); + new TriggerNode( + "art of war", + { + NextAction("exorcism", ACTION_DEFAULT + 0.2f) + } + ) + ); triggers.push_back( - new TriggerNode("seal", NextAction::array(0, new NextAction("seal of corruption", ACTION_HIGH), NULL))); - // triggers.push_back(new TriggerNode("seal", NextAction::array(0, new NextAction("seal of command", 90.0f), - // nullptr))); + new TriggerNode( + "seal", + { + NextAction("seal of corruption", ACTION_HIGH) + } + ) + ); triggers.push_back( - new TriggerNode("low mana", NextAction::array(0, new NextAction("seal of wisdom", ACTION_HIGH + 5), nullptr))); + new TriggerNode( + "low mana", + { + NextAction("seal of wisdom", ACTION_HIGH + 5) + } + ) + ); - triggers.push_back(new TriggerNode( - "avenging wrath", NextAction::array(0, new NextAction("avenging wrath", ACTION_HIGH + 2), nullptr))); - // triggers.push_back(new TriggerNode("sanctity aura", NextAction::array(0, new NextAction("sanctity aura", 90.0f), - // nullptr))); triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("repentance or - // shield", ACTION_CRITICAL_HEAL + 3), new NextAction("holy light", ACTION_CRITICAL_HEAL + 2), nullptr))); - // triggers.push_back(new TriggerNode("judgement of wisdom", NextAction::array(0, new NextAction("judgement of - // wisdom", ACTION_NORMAL + 10), nullptr))); triggers.push_back(new TriggerNode("judgement", NextAction::array(0, - // new NextAction("judgement", ACTION_HIGH + 10), nullptr))); triggers.push_back(new TriggerNode("enemy is close", - // NextAction::array(0, new NextAction("consecration", ACTION_INTERRUPT), nullptr))); triggers.push_back(new - // TriggerNode("repentance on enemy healer", NextAction::array(0, new NextAction("repentance on enemy healer", - // ACTION_INTERRUPT + 2), nullptr))); triggers.push_back(new TriggerNode("repentance on snare target", - // NextAction::array(0, new NextAction("repentance on snare target", ACTION_INTERRUPT + 2), nullptr))); - // triggers.push_back(new TriggerNode("repentance", NextAction::array(0, new NextAction("repentance", - // ACTION_INTERRUPT + 2), nullptr))); - triggers.push_back(new TriggerNode( - "medium aoe", NextAction::array(0, - new NextAction("divine storm", ACTION_HIGH + 4), - new NextAction("consecration", ACTION_HIGH + 3), nullptr))); - // triggers.push_back(new TriggerNode("target critical health", - // NextAction::array(0, new NextAction("hammer of wrath", ACTION_HIGH), nullptr))); - // triggers.push_back(new TriggerNode( - // "not facing target", - // NextAction::array(0, new NextAction("set facing", ACTION_NORMAL + 7), NULL))); - - triggers.push_back(new TriggerNode("enemy out of melee", - NextAction::array(0, new NextAction("reach melee", ACTION_HIGH + 1), NULL))); + triggers.push_back( + new TriggerNode( + "avenging wrath", + { + NextAction("avenging wrath", ACTION_HIGH + 2) + } + ) + ); + triggers.push_back( + new TriggerNode( + "medium aoe", + { + NextAction("divine storm", ACTION_HIGH + 4), + NextAction("consecration", ACTION_HIGH + 3) + } + ) + ); + triggers.push_back( + new TriggerNode( + "enemy out of melee", + { + NextAction("reach melee", ACTION_HIGH + 1) + } + ) + ); } diff --git a/src/strategy/paladin/DpsPaladinStrategy.h b/src/strategy/paladin/DpsPaladinStrategy.h index 144ad3d5..9611946a 100644 --- a/src/strategy/paladin/DpsPaladinStrategy.h +++ b/src/strategy/paladin/DpsPaladinStrategy.h @@ -17,7 +17,7 @@ public: void InitTriggers(std::vector& triggers) override; std::string const getName() override { return "dps"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; uint32 GetType() const override { return STRATEGY_TYPE_COMBAT | STRATEGY_TYPE_DPS | STRATEGY_TYPE_MELEE; } }; diff --git a/src/strategy/paladin/GenericPaladinNonCombatStrategy.cpp b/src/strategy/paladin/GenericPaladinNonCombatStrategy.cpp index a1630ea2..7f9919e0 100644 --- a/src/strategy/paladin/GenericPaladinNonCombatStrategy.cpp +++ b/src/strategy/paladin/GenericPaladinNonCombatStrategy.cpp @@ -18,15 +18,15 @@ void GenericPaladinNonCombatStrategy::InitTriggers(std::vector& tr { NonCombatStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("party member dead", NextAction::array(0, new NextAction("redemption", ACTION_CRITICAL_HEAL + 10), nullptr))); - triggers.push_back(new TriggerNode("party member almost full health", NextAction::array(0, new NextAction("flash of light on party", 25.0f), nullptr))); - triggers.push_back(new TriggerNode("party member medium health", NextAction::array(0, new NextAction("flash of light on party", 26.0f), nullptr))); - triggers.push_back(new TriggerNode("party member low health", NextAction::array(0, new NextAction("holy light on party", 27.0f), nullptr))); - triggers.push_back(new TriggerNode("party member critical health", NextAction::array(0, new NextAction("holy light on party", 28.0f), nullptr))); + triggers.push_back(new TriggerNode("party member dead", { NextAction("redemption", ACTION_CRITICAL_HEAL + 10) })); + triggers.push_back(new TriggerNode("party member almost full health", { NextAction("flash of light on party", 25.0f) })); + triggers.push_back(new TriggerNode("party member medium health", { NextAction("flash of light on party", 26.0f) })); + triggers.push_back(new TriggerNode("party member low health", { NextAction("holy light on party", 27.0f) })); + triggers.push_back(new TriggerNode("party member critical health", { NextAction("holy light on party", 28.0f) })); int specTab = AiFactory::GetPlayerSpecTab(botAI->GetBot()); if (specTab == 0 || specTab == 1) // Holy or Protection - triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("apply oil", 1.0f), nullptr))); + triggers.push_back(new TriggerNode("often", { NextAction("apply oil", 1.0f) })); if (specTab == 2) // Retribution - triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("apply stone", 1.0f), nullptr))); + triggers.push_back(new TriggerNode("often", { NextAction("apply stone", 1.0f) })); } diff --git a/src/strategy/paladin/GenericPaladinStrategy.cpp b/src/strategy/paladin/GenericPaladinStrategy.cpp index aec2c4f8..62d7dfb1 100644 --- a/src/strategy/paladin/GenericPaladinStrategy.cpp +++ b/src/strategy/paladin/GenericPaladinStrategy.cpp @@ -17,71 +17,71 @@ void GenericPaladinStrategy::InitTriggers(std::vector& triggers) { CombatStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("critical health", NextAction::array(0, new NextAction("divine shield", - ACTION_HIGH + 5), nullptr))); + triggers.push_back(new TriggerNode("critical health", { NextAction("divine shield", + ACTION_HIGH + 5) })); triggers.push_back( new TriggerNode("hammer of justice interrupt", - NextAction::array(0, new NextAction("hammer of justice", ACTION_INTERRUPT), nullptr))); + { NextAction("hammer of justice", ACTION_INTERRUPT) })); triggers.push_back(new TriggerNode( "hammer of justice on enemy healer", - NextAction::array(0, new NextAction("hammer of justice on enemy healer", ACTION_INTERRUPT), nullptr))); + { NextAction("hammer of justice on enemy healer", ACTION_INTERRUPT) })); triggers.push_back(new TriggerNode( "hammer of justice on snare target", - NextAction::array(0, new NextAction("hammer of justice on snare target", ACTION_INTERRUPT), nullptr))); + { NextAction("hammer of justice on snare target", ACTION_INTERRUPT) })); triggers.push_back(new TriggerNode( - "critical health", NextAction::array(0, new NextAction("lay on hands", ACTION_EMERGENCY), nullptr))); + "critical health", { NextAction("lay on hands", ACTION_EMERGENCY) })); triggers.push_back( new TriggerNode("party member critical health", - NextAction::array(0, new NextAction("lay on hands on party", ACTION_EMERGENCY + 1), nullptr))); + { NextAction("lay on hands on party", ACTION_EMERGENCY + 1) })); triggers.push_back(new TriggerNode( "protect party member", - NextAction::array(0, new NextAction("blessing of protection on party", ACTION_EMERGENCY + 2), nullptr))); + { NextAction("blessing of protection on party", ACTION_EMERGENCY + 2) })); triggers.push_back( - new TriggerNode("high mana", NextAction::array(0, new NextAction("divine plea", ACTION_HIGH), NULL))); + new TriggerNode("high mana", { NextAction("divine plea", ACTION_HIGH) })); } void PaladinCureStrategy::InitTriggers(std::vector& triggers) { triggers.push_back(new TriggerNode( - "cleanse cure disease", NextAction::array(0, new NextAction("cleanse disease", ACTION_DISPEL + 2), nullptr))); + "cleanse cure disease", { NextAction("cleanse disease", ACTION_DISPEL + 2) })); triggers.push_back( new TriggerNode("cleanse party member cure disease", - NextAction::array(0, new NextAction("cleanse disease on party", ACTION_DISPEL + 1), nullptr))); + { NextAction("cleanse disease on party", ACTION_DISPEL + 1) })); triggers.push_back(new TriggerNode( - "cleanse cure poison", NextAction::array(0, new NextAction("cleanse poison", ACTION_DISPEL + 2), nullptr))); + "cleanse cure poison", { NextAction("cleanse poison", ACTION_DISPEL + 2) })); triggers.push_back( new TriggerNode("cleanse party member cure poison", - NextAction::array(0, new NextAction("cleanse poison on party", ACTION_DISPEL + 1), nullptr))); + { NextAction("cleanse poison on party", ACTION_DISPEL + 1) })); triggers.push_back(new TriggerNode( - "cleanse cure magic", NextAction::array(0, new NextAction("cleanse magic", ACTION_DISPEL + 2), nullptr))); + "cleanse cure magic", { NextAction("cleanse magic", ACTION_DISPEL + 2) })); triggers.push_back( new TriggerNode("cleanse party member cure magic", - NextAction::array(0, new NextAction("cleanse magic on party", ACTION_DISPEL + 1), nullptr))); + { NextAction("cleanse magic on party", ACTION_DISPEL + 1) })); } void PaladinBoostStrategy::InitTriggers(std::vector& triggers) { - // triggers.push_back(new TriggerNode("divine favor", NextAction::array(0, new NextAction("divine favor", - // ACTION_HIGH + 1), nullptr))); + // triggers.push_back(new TriggerNode("divine favor", { NextAction("divine favor", + // ACTION_HIGH + 1) })); } void PaladinCcStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( - new TriggerNode("turn undead", NextAction::array(0, new NextAction("turn undead", ACTION_HIGH + 1), nullptr))); + new TriggerNode("turn undead", { NextAction("turn undead", ACTION_HIGH + 1) })); } void PaladinHealerDpsStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( new TriggerNode("healer should attack", - NextAction::array(0, - new NextAction("hammer of wrath", ACTION_DEFAULT + 0.6f), - new NextAction("holy shock", ACTION_DEFAULT + 0.5f), - new NextAction("shield of righteousness", ACTION_DEFAULT + 0.4f), - new NextAction("judgement of light", ACTION_DEFAULT + 0.3f), - new NextAction("consecration", ACTION_DEFAULT + 0.2f), - new NextAction("exorcism", ACTION_DEFAULT+ 0.1f), - nullptr))); + { + NextAction("hammer of wrath", ACTION_DEFAULT + 0.6f), + NextAction("holy shock", ACTION_DEFAULT + 0.5f), + NextAction("shield of righteousness", ACTION_DEFAULT + 0.4f), + NextAction("judgement of light", ACTION_DEFAULT + 0.3f), + NextAction("consecration", ACTION_DEFAULT + 0.2f), + NextAction("exorcism", ACTION_DEFAULT+ 0.1f), + })); } diff --git a/src/strategy/paladin/GenericPaladinStrategyActionNodeFactory.h b/src/strategy/paladin/GenericPaladinStrategyActionNodeFactory.h index 93812ce6..f1d0d342 100644 --- a/src/strategy/paladin/GenericPaladinStrategyActionNodeFactory.h +++ b/src/strategy/paladin/GenericPaladinStrategyActionNodeFactory.h @@ -52,206 +52,206 @@ private: static ActionNode* blessing_of_sanctuary(PlayerbotAI* /* ai */) { return new ActionNode("blessing of sanctuary", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* blessing_of_kings(PlayerbotAI* /* ai */) { return new ActionNode("blessing of kings", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* blessing_of_wisdom(PlayerbotAI* /* ai */) { return new ActionNode("blessing of wisdom", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* blessing_of_kings_on_party(PlayerbotAI* /* ai */) { return new ActionNode("blessing of kings on party", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* blessing_of_wisdom_on_party(PlayerbotAI* /* ai */) { return new ActionNode("blessing of wisdom on party", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* blessing_of_sanctuary_on_party(PlayerbotAI* /* ai */) { return new ActionNode("blessing of sanctuary on party", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* retribution_aura(PlayerbotAI* /* ai */) { return new ActionNode("retribution aura", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("devotion aura"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("devotion aura") }, + /*C*/ {}); } static ActionNode* lay_on_hands(PlayerbotAI* /* ai */) { return new ActionNode("lay on hands", - /*P*/ nullptr, - /*A*/ nullptr, // NextAction::array(0, new NextAction("divine shield"), new + /*P*/ {}, + /*A*/ {}, // { NextAction("divine shield"), new // NextAction("flash of light"), NULL), - /*C*/ nullptr); + /*C*/ {}); } static ActionNode* lay_on_hands_on_party(PlayerbotAI* /* ai */) { return new ActionNode("lay on hands on party", - /*P*/ nullptr, - /*A*/ nullptr, // NextAction::array(0, new NextAction("flash of light"), NULL), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, // { NextAction("flash of light"), NULL), + /*C*/ {}); } // static ActionNode* seal_of_light(PlayerbotAI* /* ai */) // { // return new ActionNode ("seal of light", // /*P*/ NULL, - // /*A*/ NextAction::array(0, new NextAction("seal of justice"), NULL), + // /*A*/ { NextAction("seal of justice"), NULL), // /*C*/ NULL); // } static ActionNode* cleanse_poison(PlayerbotAI* /* ai */) { return new ActionNode("cleanse poison", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("purify poison"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("purify poison") }, + /*C*/ {}); } static ActionNode* cleanse_magic(PlayerbotAI* /* ai */) { return new ActionNode("cleanse magic", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* cleanse_disease(PlayerbotAI* /* ai */) { return new ActionNode("cleanse disease", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("purify disease"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("purify disease") }, + /*C*/ {}); } static ActionNode* cleanse_poison_on_party(PlayerbotAI* /* ai */) { return new ActionNode("cleanse poison on party", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("purify poison on party"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("purify poison on party") }, + /*C*/ {}); } static ActionNode* cleanse_disease_on_party(PlayerbotAI* /* ai */) { return new ActionNode("cleanse disease on party", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("purify disease on party"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("purify disease on party") }, + /*C*/ {}); } static ActionNode* seal_of_wisdom(PlayerbotAI* /* ai */) { return new ActionNode ("seal of wisdom", - /*P*/ NULL, - /*A*/ NextAction::array(0, new NextAction("seal of righteousness"), NULL), - /*C*/ NULL); + /*P*/ {}, + /*A*/ { NextAction("seal of righteousness") }, + /*C*/ {}); } static ActionNode* seal_of_justice(PlayerbotAI* /* ai */) { return new ActionNode("seal of justice", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("seal of righteousness"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("seal of righteousness") }, + /*C*/ {}); } static ActionNode* hand_of_reckoning(PlayerbotAI* /* ai */) { return new ActionNode("hand of reckoning", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("righteous defense"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("righteous defense") }, + /*C*/ {}); } static ActionNode* righteous_defense(PlayerbotAI* /* ai */) { return new ActionNode("righteous defense", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("avenger's shield"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("avenger's shield") }, + /*C*/ {}); } static ActionNode* avengers_shield(PlayerbotAI* /* ai */) { return new ActionNode("avenger's shield", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("judgement of wisdom"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("judgement of wisdom") }, + /*C*/ {}); } static ActionNode* divine_sacrifice(PlayerbotAI* /* ai */) { return new ActionNode("divine sacrifice", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ NextAction::array(0, new NextAction("cancel divine sacrifice"), nullptr)); + /*P*/ {}, + /*A*/ {}, + /*C*/ { NextAction("cancel divine sacrifice") }); } static ActionNode* judgement_of_wisdom(PlayerbotAI* /* ai */) { return new ActionNode("judgement of wisdom", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("judgement of light"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("judgement of light") }, + /*C*/ {}); } static ActionNode* judgement(PlayerbotAI* /* ai */) { return new ActionNode("judgement", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* divine_shield(PlayerbotAI* /* ai */) { return new ActionNode("divine shield", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("divine protection"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("divine protection") }, + /*C*/ {}); } static ActionNode* flash_of_light(PlayerbotAI* /* ai */) { return new ActionNode("flash of light", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("holy light"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("holy light") }, + /*C*/ {}); } static ActionNode* flash_of_light_on_party(PlayerbotAI* /* ai */) { return new ActionNode("flash of light on party", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("holy light on party"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("holy light on party") }, + /*C*/ {}); } static ActionNode* holy_wrath(PlayerbotAI* /* ai */) { return new ActionNode("holy wrath", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* hammer_of_wrath(PlayerbotAI* /* ai */) { return new ActionNode("hammer of wrath", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ {}, + /*A*/ {}, + /*C*/ {}); } static ActionNode* seal_of_command(PlayerbotAI* /* ai */) { return new ActionNode("seal of command", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("seal of righteousness"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("seal of righteousness") }, + /*C*/ {}); } }; diff --git a/src/strategy/paladin/HealPaladinStrategy.cpp b/src/strategy/paladin/HealPaladinStrategy.cpp index 3b368d03..5eb1a3ac 100644 --- a/src/strategy/paladin/HealPaladinStrategy.cpp +++ b/src/strategy/paladin/HealPaladinStrategy.cpp @@ -10,14 +10,6 @@ class HealPaladinStrategyActionNodeFactory : public NamedObjectFactory { -public: - // HealPaladinStrategyActionNodeFactory() - // { - // creators["concentration aura"] = &concentration_aura; - // } - -private: - // ACTION_NODE_A(concentration_aura, "concentration aura", "devotion aura"); }; HealPaladinStrategy::HealPaladinStrategy(PlayerbotAI* botAI) : GenericPaladinStrategy(botAI) @@ -25,59 +17,108 @@ HealPaladinStrategy::HealPaladinStrategy(PlayerbotAI* botAI) : GenericPaladinStr actionNodeFactories.Add(new HealPaladinStrategyActionNodeFactory()); } -NextAction** HealPaladinStrategy::getDefaultActions() +std::vector HealPaladinStrategy::getDefaultActions() { - return NextAction::array(0, new NextAction("judgement of light", ACTION_DEFAULT), nullptr); + return { NextAction("judgement of light", ACTION_DEFAULT) }; } void HealPaladinStrategy::InitTriggers(std::vector& triggers) { GenericPaladinStrategy::InitTriggers(triggers); - // triggers.push_back(new TriggerNode("concentration aura", NextAction::array(0, new NextAction("concentration - // aura", ACTION_NORMAL), nullptr))); triggers.push_back( - new TriggerNode("seal", NextAction::array(0, new NextAction("seal of wisdom", ACTION_HIGH), nullptr))); - triggers.push_back(new TriggerNode( - "medium mana", NextAction::array(0, new NextAction("divine illumination", ACTION_HIGH + 2), nullptr))); + new TriggerNode( + "seal", + { + NextAction("seal of wisdom", ACTION_HIGH) + } + ) + ); triggers.push_back( - new TriggerNode("low mana", NextAction::array(0, new NextAction("divine favor", ACTION_HIGH + 1), nullptr))); - // triggers.push_back(new TriggerNode("blessing", NextAction::array(0, new NextAction("blessing of sanctuary", - // ACTION_HIGH + 9), nullptr))); - triggers.push_back(new TriggerNode( - "party member to heal out of spell range", - NextAction::array(0, new NextAction("reach party member to heal", ACTION_EMERGENCY + 3), nullptr))); + new TriggerNode( + "medium mana", + { + NextAction("divine illumination", ACTION_HIGH + 2) + } + ) + ); + triggers.push_back( + new TriggerNode( + "low mana", + { + NextAction("divine favor", ACTION_HIGH + 1) + } + ) + ); + triggers.push_back( + new TriggerNode( + "party member to heal out of spell range", + { + NextAction("reach party member to heal", ACTION_EMERGENCY + 3) + } + ) + ); + triggers.push_back( + new TriggerNode( + "medium group heal setting", + { + NextAction("divine sacrifice", ACTION_CRITICAL_HEAL + 5), + NextAction("avenging wrath", ACTION_HIGH + 4), + } + ) + ); + triggers.push_back( + new TriggerNode( + "party member critical health", + { + NextAction("holy shock on party", ACTION_CRITICAL_HEAL + 6), + NextAction("divine sacrifice", ACTION_CRITICAL_HEAL + 5), + NextAction("holy light on party", ACTION_CRITICAL_HEAL + 4) + } + ) + ); + triggers.push_back( + new TriggerNode( + "party member low health", + { + NextAction("holy light on party", ACTION_MEDIUM_HEAL + 5) + } + ) + ); + triggers.push_back( + new TriggerNode( + "party member medium health", + { + NextAction("holy light on party", ACTION_LIGHT_HEAL + 9), + NextAction("flash of light on party", ACTION_LIGHT_HEAL + 8) + } + ) + ); triggers.push_back( - new TriggerNode("medium group heal setting", - NextAction::array(0, new NextAction("divine sacrifice", ACTION_CRITICAL_HEAL + 5), - new NextAction("avenging wrath", ACTION_HIGH + 4), - nullptr))); - - triggers.push_back( - new TriggerNode("party member critical health", - NextAction::array(0, new NextAction("holy shock on party", ACTION_CRITICAL_HEAL + 6), - new NextAction("divine sacrifice", ACTION_CRITICAL_HEAL + 5), - new NextAction("holy light on party", ACTION_CRITICAL_HEAL + 4), nullptr))); - - triggers.push_back( - new TriggerNode("party member low health", - NextAction::array(0, new NextAction("holy light on party", ACTION_MEDIUM_HEAL + 5), nullptr))); - - triggers.push_back( - new TriggerNode("party member medium health", - NextAction::array(0, new NextAction("holy light on party", ACTION_LIGHT_HEAL + 9), - new NextAction("flash of light on party", ACTION_LIGHT_HEAL + 8), nullptr))); - - triggers.push_back(new TriggerNode( + new TriggerNode( "party member almost full health", - NextAction::array(0, new NextAction("flash of light on party", ACTION_LIGHT_HEAL + 3), nullptr))); + { + NextAction("flash of light on party", ACTION_LIGHT_HEAL + 3) + } + ) +); - triggers.push_back(new TriggerNode( + triggers.push_back( + new TriggerNode( "beacon of light on main tank", - NextAction::array(0, new NextAction("beacon of light on main tank", ACTION_CRITICAL_HEAL + 7), nullptr))); + { + NextAction("beacon of light on main tank", ACTION_CRITICAL_HEAL + 7) + } + ) +); - triggers.push_back(new TriggerNode( + triggers.push_back( + new TriggerNode( "sacred shield on main tank", - NextAction::array(0, new NextAction("sacred shield on main tank", ACTION_CRITICAL_HEAL + 6), nullptr))); + { + NextAction("sacred shield on main tank", ACTION_CRITICAL_HEAL + 6) + } + ) +); } diff --git a/src/strategy/paladin/HealPaladinStrategy.h b/src/strategy/paladin/HealPaladinStrategy.h index eb13de15..f7f80223 100644 --- a/src/strategy/paladin/HealPaladinStrategy.h +++ b/src/strategy/paladin/HealPaladinStrategy.h @@ -17,7 +17,7 @@ public: void InitTriggers(std::vector& triggers) override; std::string const getName() override { return "heal"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; uint32 GetType() const override { return STRATEGY_TYPE_HEAL | STRATEGY_TYPE_RANGED; } }; diff --git a/src/strategy/paladin/OffhealRetPaladinStrategy.cpp b/src/strategy/paladin/OffhealRetPaladinStrategy.cpp index 3dd9c904..b25fc36b 100644 --- a/src/strategy/paladin/OffhealRetPaladinStrategy.cpp +++ b/src/strategy/paladin/OffhealRetPaladinStrategy.cpp @@ -25,58 +25,72 @@ public: private: static ActionNode* retribution_aura([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("retribution aura", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("devotion aura"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "retribution aura", + /*P*/ {}, + /*A*/ { NextAction("devotion aura") }, + /*C*/ {} + ); } static ActionNode* seal_of_corruption([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("seal of corruption", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("seal of vengeance"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "seal of corruption", + /*P*/ {}, + /*A*/ { NextAction("seal of vengeance") }, + /*C*/ {} + ); } static ActionNode* seal_of_vengeance([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("seal of vengeance", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("seal of command"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "seal of vengeance", + /*P*/ {}, + /*A*/ { NextAction("seal of command") }, + /*C*/ {} + ); } static ActionNode* seal_of_command([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("seal of command", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("seal of righteousness"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "seal of command", + /*P*/ {}, + /*A*/ { NextAction("seal of righteousness") }, + /*C*/ {} + ); } static ActionNode* blessing_of_might([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("blessing of might", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("blessing of kings"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "blessing of might", + /*P*/ {}, + /*A*/ { NextAction("blessing of kings") }, + /*C*/ {} + ); } static ActionNode* crusader_strike([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("crusader strike", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "crusader strike", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* divine_plea([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("divine plea", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "divine plea", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } }; @@ -85,13 +99,15 @@ OffhealRetPaladinStrategy::OffhealRetPaladinStrategy(PlayerbotAI* botAI) : Gener actionNodeFactories.Add(new OffhealRetPaladinStrategyActionNodeFactory()); } -NextAction** OffhealRetPaladinStrategy::getDefaultActions() +std::vector OffhealRetPaladinStrategy::getDefaultActions() { - return NextAction::array(0, new NextAction("hammer of wrath", ACTION_DEFAULT + 0.6f), - new NextAction("judgement of wisdom", ACTION_DEFAULT + 0.5f), - new NextAction("crusader strike", ACTION_DEFAULT + 0.4f), - new NextAction("divine storm", ACTION_DEFAULT + 0.3f), - new NextAction("melee", ACTION_DEFAULT), nullptr); + return { + NextAction("hammer of wrath", ACTION_DEFAULT + 0.6f), + NextAction("judgement of wisdom", ACTION_DEFAULT + 0.5f), + NextAction("crusader strike", ACTION_DEFAULT + 0.4f), + NextAction("divine storm", ACTION_DEFAULT + 0.3f), + NextAction("melee", ACTION_DEFAULT) + }; } void OffhealRetPaladinStrategy::InitTriggers(std::vector& triggers) @@ -100,44 +116,128 @@ void OffhealRetPaladinStrategy::InitTriggers(std::vector& triggers // Damage Triggers triggers.push_back( - new TriggerNode("seal", NextAction::array(0, new NextAction("seal of corruption", ACTION_HIGH), nullptr))); + new TriggerNode( + "seal", + { + NextAction("seal of corruption", ACTION_HIGH) + } + ) + ); triggers.push_back( - new TriggerNode("low mana", NextAction::array(0, new NextAction("seal of wisdom", ACTION_HIGH + 5), - new NextAction("divine plea", ACTION_HIGH + 4), nullptr))); + new TriggerNode( + "low mana", + { + NextAction("seal of wisdom", ACTION_HIGH + 5), + NextAction("divine plea", ACTION_HIGH + 4) + } + ) + ); triggers.push_back( - new TriggerNode("art of war", NextAction::array(0, new NextAction("exorcism", ACTION_HIGH + 1), nullptr))); - triggers.push_back(new TriggerNode( - "avenging wrath", NextAction::array(0, new NextAction("avenging wrath", ACTION_HIGH + 2), nullptr))); + new TriggerNode( + "art of war", + { + NextAction("exorcism", ACTION_HIGH + 1) + } + ) + ); triggers.push_back( - new TriggerNode("medium aoe", NextAction::array(0, new NextAction("divine storm", ACTION_HIGH + 4), - new NextAction("consecration", ACTION_HIGH + 3), nullptr))); - triggers.push_back(new TriggerNode("enemy out of melee", - NextAction::array(0, new NextAction("reach melee", ACTION_HIGH + 1), nullptr))); - triggers.push_back(new TriggerNode( - "retribution aura", NextAction::array(0, new NextAction("retribution aura", ACTION_NORMAL), nullptr))); - triggers.push_back(new TriggerNode( - "blessing of might", NextAction::array(0, new NextAction("blessing of might", ACTION_NORMAL + 1), nullptr))); - triggers.push_back(new TriggerNode( - "low health", NextAction::array(0, new NextAction("holy light", ACTION_CRITICAL_HEAL + 2), nullptr))); + new TriggerNode( + "avenging wrath", + { + NextAction("avenging wrath", ACTION_HIGH + 2) + } + ) + ); + triggers.push_back( + new TriggerNode( + "medium aoe", + { + NextAction("divine storm", ACTION_HIGH + 4), + NextAction("consecration", ACTION_HIGH + 3) + } + ) + ); + triggers.push_back( + new TriggerNode( + "enemy out of melee", + { + NextAction("reach melee", ACTION_HIGH + 1) + } + ) + ); + triggers.push_back( + new TriggerNode( + "retribution aura", + { + NextAction("retribution aura", ACTION_NORMAL) + } + ) + ); + triggers.push_back( + new TriggerNode( + "blessing of might", + { + NextAction("blessing of might", ACTION_NORMAL + 1) + } + ) + ); + triggers.push_back( + new TriggerNode( + "low health", + { + NextAction("holy light", ACTION_CRITICAL_HEAL + 2) + } + ) + ); // Healing Triggers triggers.push_back( - new TriggerNode("party member critical health", - NextAction::array(0, new NextAction("holy shock on party", ACTION_CRITICAL_HEAL + 6), - new NextAction("holy light on party", ACTION_CRITICAL_HEAL + 4), nullptr))); + new TriggerNode( + "party member critical health", + { + NextAction("holy shock on party", ACTION_CRITICAL_HEAL + 6), + NextAction("holy light on party", ACTION_CRITICAL_HEAL + 4) + } + ) + ); triggers.push_back( - new TriggerNode("party member low health", - NextAction::array(0, new NextAction("holy light on party", ACTION_MEDIUM_HEAL + 5), nullptr))); - triggers.push_back(new TriggerNode( - "party member medium health", - NextAction::array(0, new NextAction("flash of light on party", ACTION_LIGHT_HEAL + 8), nullptr))); - triggers.push_back(new TriggerNode( - "party member almost full health", - NextAction::array(0, new NextAction("flash of light on party", ACTION_LIGHT_HEAL + 3), nullptr))); - triggers.push_back(new TriggerNode( - "party member to heal out of spell range", - NextAction::array(0, new NextAction("reach party member to heal", ACTION_EMERGENCY + 3), nullptr))); - triggers.push_back(new TriggerNode( - "beacon of light on main tank", - NextAction::array(0, new NextAction("beacon of light on main tank", ACTION_CRITICAL_HEAL + 7), nullptr))); + new TriggerNode( + "party member low health", + { + NextAction("holy light on party", ACTION_MEDIUM_HEAL + 5) + } + ) + ); + triggers.push_back( + new TriggerNode( + "party member medium health", + { + NextAction("flash of light on party", ACTION_LIGHT_HEAL + 8) + } + ) + ); + triggers.push_back( + new TriggerNode( + "party member almost full health", + { + NextAction("flash of light on party", ACTION_LIGHT_HEAL + 3) + } + ) + ); + triggers.push_back( + new TriggerNode( + "party member to heal out of spell range", + { + NextAction("reach party member to heal", ACTION_EMERGENCY + 3) + } + ) + ); + triggers.push_back( + new TriggerNode( + "beacon of light on main tank", + { + NextAction("beacon of light on main tank", ACTION_CRITICAL_HEAL + 7) + } + ) + ); } diff --git a/src/strategy/paladin/OffhealRetPaladinStrategy.h b/src/strategy/paladin/OffhealRetPaladinStrategy.h index c634297a..3dfd24aa 100644 --- a/src/strategy/paladin/OffhealRetPaladinStrategy.h +++ b/src/strategy/paladin/OffhealRetPaladinStrategy.h @@ -17,7 +17,7 @@ public: void InitTriggers(std::vector& triggers) override; std::string const getName() override { return "offheal"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; uint32 GetType() const override { return STRATEGY_TYPE_COMBAT | STRATEGY_TYPE_DPS | STRATEGY_TYPE_HEAL | STRATEGY_TYPE_MELEE; diff --git a/src/strategy/paladin/PaladinBuffStrategies.cpp b/src/strategy/paladin/PaladinBuffStrategies.cpp index 439e3aaf..884c2f27 100644 --- a/src/strategy/paladin/PaladinBuffStrategies.cpp +++ b/src/strategy/paladin/PaladinBuffStrategies.cpp @@ -10,78 +10,74 @@ void PaladinBuffManaStrategy::InitTriggers(std::vector& triggers) { triggers.push_back(new TriggerNode("blessing of wisdom on party", - NextAction::array(0, new NextAction("blessing of wisdom on party", 11.0f), NULL))); + { NextAction("blessing of wisdom on party", 11.0f) })); triggers.push_back(new TriggerNode("blessing of kings on party", - NextAction::array(0, new NextAction("blessing of kings on party", 10.5f), NULL))); + { NextAction("blessing of kings on party", 10.5f) })); } void PaladinBuffHealthStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( new TriggerNode("blessing of sanctuary on party", - NextAction::array(0, new NextAction("blessing of sanctuary on party", 11.0f), nullptr))); - // triggers.push_back(new TriggerNode("blessing", NextAction::array(0, new NextAction("blessing of kings", - // ACTION_HIGH + 8), nullptr))); + { NextAction("blessing of sanctuary on party", 11.0f) })); } void PaladinBuffDpsStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( new TriggerNode("blessing of might on party", - NextAction::array(0, new NextAction("blessing of might on party", 11.0f), nullptr))); - // triggers.push_back(new TriggerNode("blessing", NextAction::array(0, new NextAction("blessing of might", - // ACTION_HIGH + 8), nullptr))); + { NextAction("blessing of might on party", 11.0f) })); } void PaladinShadowResistanceStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( new TriggerNode("shadow resistance aura", - NextAction::array(0, new NextAction("shadow resistance aura", ACTION_NORMAL), nullptr))); + { NextAction("shadow resistance aura", ACTION_NORMAL) })); } void PaladinFrostResistanceStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( new TriggerNode("frost resistance aura", - NextAction::array(0, new NextAction("frost resistance aura", ACTION_NORMAL), nullptr))); + { NextAction("frost resistance aura", ACTION_NORMAL) })); } void PaladinFireResistanceStrategy::InitTriggers(std::vector& triggers) { triggers.push_back(new TriggerNode( - "fire resistance aura", NextAction::array(0, new NextAction("fire resistance aura", ACTION_NORMAL), nullptr))); + "fire resistance aura", { NextAction("fire resistance aura", ACTION_NORMAL) })); } void PaladinBuffArmorStrategy::InitTriggers(std::vector& triggers) { triggers.push_back(new TriggerNode("devotion aura", - NextAction::array(0, new NextAction("devotion aura", ACTION_NORMAL), nullptr))); + { NextAction("devotion aura", ACTION_NORMAL) })); } void PaladinBuffAoeStrategy::InitTriggers(std::vector& triggers) { triggers.push_back(new TriggerNode( - "retribution aura", NextAction::array(0, new NextAction("retribution aura", ACTION_NORMAL), nullptr))); + "retribution aura", { NextAction("retribution aura", ACTION_NORMAL) })); } void PaladinBuffCastStrategy::InitTriggers(std::vector& triggers) { triggers.push_back(new TriggerNode( - "concentration aura", NextAction::array(0, new NextAction("concentration aura", ACTION_NORMAL), nullptr))); + "concentration aura", { NextAction("concentration aura", ACTION_NORMAL) })); } void PaladinBuffSpeedStrategy::InitTriggers(std::vector& triggers) { triggers.push_back(new TriggerNode( - "crusader aura", NextAction::array(0, new NextAction("crusader aura", ACTION_NORMAL), nullptr))); + "crusader aura", { NextAction("crusader aura", ACTION_NORMAL) })); } void PaladinBuffThreatStrategy::InitTriggers(std::vector& triggers) { triggers.push_back(new TriggerNode( - "righteous fury", NextAction::array(0, new NextAction("righteous fury", ACTION_HIGH + 8), nullptr))); + "righteous fury", { NextAction("righteous fury", ACTION_HIGH + 8) })); } void PaladinBuffStatsStrategy::InitTriggers(std::vector& triggers) @@ -89,10 +85,10 @@ void PaladinBuffStatsStrategy::InitTriggers(std::vector& triggers) // First Sanctuary (prio > Kings) triggers.push_back( new TriggerNode("blessing of sanctuary on party", - NextAction::array(0, new NextAction("blessing of sanctuary on party", 12.0f), nullptr))); + { NextAction("blessing of sanctuary on party", 12.0f) })); // After Kings triggers.push_back( new TriggerNode("blessing of kings on party", - NextAction::array(0, new NextAction("blessing of kings on party", 11.0f), nullptr))); + { NextAction("blessing of kings on party", 11.0f) })); } diff --git a/src/strategy/paladin/TankPaladinStrategy.cpp b/src/strategy/paladin/TankPaladinStrategy.cpp index 145f205d..b76116e0 100644 --- a/src/strategy/paladin/TankPaladinStrategy.cpp +++ b/src/strategy/paladin/TankPaladinStrategy.cpp @@ -12,7 +12,6 @@ class TankPaladinStrategyActionNodeFactory : public NamedObjectFactory TankPaladinStrategy::getDefaultActions() { - return NextAction::array(0, new NextAction("shield of righteousness", ACTION_DEFAULT + 0.6f), - new NextAction("hammer of the righteous", ACTION_DEFAULT + 0.5f), - new NextAction("judgement of wisdom", ACTION_DEFAULT + 0.4f), - // new NextAction("avenger's shield", ACTION_NORMAL + 3), - // new NextAction("consecration", ACTION_NORMAL + 2), - new NextAction("melee", ACTION_DEFAULT), NULL); + return { + NextAction("shield of righteousness", ACTION_DEFAULT + 0.6f), + NextAction("hammer of the righteous", ACTION_DEFAULT + 0.5f), + NextAction("judgement of wisdom", ACTION_DEFAULT + 0.4f), + NextAction("melee", ACTION_DEFAULT) + }; } void TankPaladinStrategy::InitTriggers(std::vector& triggers) @@ -73,45 +80,122 @@ void TankPaladinStrategy::InitTriggers(std::vector& triggers) GenericPaladinStrategy::InitTriggers(triggers); triggers.push_back( - new TriggerNode("seal", NextAction::array(0, new NextAction("seal of corruption", ACTION_HIGH), nullptr))); + new TriggerNode( + "seal", + { + NextAction("seal of corruption", ACTION_HIGH) + } + ) + ); triggers.push_back( - new TriggerNode("low mana", NextAction::array(0, new NextAction("seal of wisdom", ACTION_HIGH + 9), nullptr))); - // triggers.push_back(new TriggerNode("devotion aura", NextAction::array(0, new NextAction("devotion aura", 90.0f), - // NULL))); - + new TriggerNode( + "low mana", + { + NextAction("seal of wisdom", ACTION_HIGH + 9) + } + ) + ); triggers.push_back(new TriggerNode( - "light aoe", NextAction::array(0, new NextAction("avenger's shield", ACTION_HIGH + 5), nullptr))); + "light aoe", + { + NextAction("avenger's shield", ACTION_HIGH + 5) + } + ) +); triggers.push_back( - new TriggerNode("medium aoe", NextAction::array(0, new NextAction("consecration", ACTION_HIGH + 7), - new NextAction("avenger's shield", ACTION_HIGH + 6), nullptr))); - // triggers.push_back(new TriggerNode("avenger's shield", NextAction::array(0, new NextAction("avenger's shield", - // ACTION_HIGH + 7), nullptr))); - triggers.push_back(new TriggerNode( - "lose aggro", NextAction::array(0, new NextAction("hand of reckoning", ACTION_HIGH + 7), nullptr))); - // triggers.push_back(new TriggerNode("almost full health", NextAction::array(0, new NextAction("holy shield", - // ACTION_HIGH + 4), nullptr))); - triggers.push_back(new TriggerNode("medium health", - NextAction::array(0, new NextAction("holy shield", ACTION_HIGH + 4), nullptr))); + new TriggerNode( + "medium aoe", + { + NextAction("consecration", ACTION_HIGH + 7), + NextAction("avenger's shield", ACTION_HIGH + 6) + } + ) + ); triggers.push_back( - new TriggerNode("low health", NextAction::array(0, new NextAction("holy shield", ACTION_HIGH + 4), nullptr))); - triggers.push_back(new TriggerNode("critical health", - NextAction::array(0, new NextAction("holy shield", ACTION_HIGH + 4), nullptr))); - // triggers.push_back(new TriggerNode("blessing", NextAction::array(0, new NextAction("blessing of sanctuary", - // ACTION_HIGH + 9), nullptr))); - triggers.push_back(new TriggerNode( - "avenging wrath", NextAction::array(0, new NextAction("avenging wrath", ACTION_HIGH + 2), nullptr))); + new TriggerNode( + "lose aggro", + { + NextAction("hand of reckoning", ACTION_HIGH + 7) + } + ) + ); triggers.push_back( - new TriggerNode("target critical health", - NextAction::array(0, new NextAction("hammer of wrath", ACTION_CRITICAL_HEAL), nullptr))); - triggers.push_back(new TriggerNode( - "righteous fury", NextAction::array(0, new NextAction("righteous fury", ACTION_HIGH + 8), nullptr))); + new TriggerNode( + "medium health", + { NextAction("holy shield", ACTION_HIGH + 4) + } + ) + ); triggers.push_back( - new TriggerNode("medium group heal setting", - NextAction::array(0, new NextAction("divine sacrifice", ACTION_HIGH + 5), nullptr))); - triggers.push_back(new TriggerNode( - "enough mana", NextAction::array(0, new NextAction("consecration", ACTION_HIGH + 4), nullptr))); - triggers.push_back(new TriggerNode("not facing target", - NextAction::array(0, new NextAction("set facing", ACTION_NORMAL + 7), nullptr))); - triggers.push_back(new TriggerNode( - "enemy out of melee", NextAction::array(0, new NextAction("reach melee", ACTION_HIGH + 1), nullptr))); + new TriggerNode( + "low health", + { + NextAction("holy shield", ACTION_HIGH + 4) + } + ) + ); + triggers.push_back( + new TriggerNode( + "critical health", + { + NextAction("holy shield", ACTION_HIGH + 4) + } + ) + ); + triggers.push_back( + new TriggerNode( + "avenging wrath", + { + NextAction("avenging wrath", ACTION_HIGH + 2) + } + ) +); + triggers.push_back( + new TriggerNode( + "target critical health", + { + NextAction("hammer of wrath", ACTION_CRITICAL_HEAL) + } + ) + ); + triggers.push_back( + new TriggerNode( + "righteous fury", + { + NextAction("righteous fury", ACTION_HIGH + 8) + } + ) + ); + triggers.push_back( + new TriggerNode( + "medium group heal setting", + { + NextAction("divine sacrifice", ACTION_HIGH + 5) + } + ) + ); + triggers.push_back( + new TriggerNode( + "enough mana", + { + NextAction("consecration", ACTION_HIGH + 4) + } + ) + ); + triggers.push_back( + new TriggerNode( + "not facing target", + { + NextAction("set facing", ACTION_NORMAL + 7) + } + ) + ); + triggers.push_back( + new TriggerNode( + "enemy out of melee", + { + NextAction("reach melee", ACTION_HIGH + 1) + } + ) + ); } diff --git a/src/strategy/paladin/TankPaladinStrategy.h b/src/strategy/paladin/TankPaladinStrategy.h index 5f7e109d..b4a0e0ca 100644 --- a/src/strategy/paladin/TankPaladinStrategy.h +++ b/src/strategy/paladin/TankPaladinStrategy.h @@ -17,7 +17,7 @@ public: void InitTriggers(std::vector& triggers) override; std::string const getName() override { return "tank"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; uint32 GetType() const override { return STRATEGY_TYPE_TANK | STRATEGY_TYPE_MELEE; } }; diff --git a/src/strategy/priest/GenericPriestStrategy.cpp b/src/strategy/priest/GenericPriestStrategy.cpp index acf9d39d..60da1343 100644 --- a/src/strategy/priest/GenericPriestStrategy.cpp +++ b/src/strategy/priest/GenericPriestStrategy.cpp @@ -18,47 +18,30 @@ void GenericPriestStrategy::InitTriggers(std::vector& triggers) { CombatStrategy::InitTriggers(triggers); - // triggers.push_back(new TriggerNode("medium health", NextAction::array(0, new NextAction("greater heal", 25.0f), - // nullptr))); triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("power word: - // shield", 61.0f), new NextAction("greater heal", 60.0f), nullptr))); triggers.push_back(new TriggerNode("critical - // health", NextAction::array(0, new NextAction("remove shadowform", 72.0f), new NextAction("power word: - // shield", 71.0f), new NextAction("flash heal", 70.0f), nullptr))); triggers.push_back(new TriggerNode("party - // member critical health", NextAction::array(0, new NextAction("remove shadowform", 62.0f), new NextAction("power - // word: shield on party", 61.0f), new NextAction("flash heal on party", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("medium threat", NextAction::array(0, new NextAction("fade", 55.0f), nullptr))); - // triggers.push_back(new TriggerNode("enemy is close", NextAction::array(0, new NextAction("psychic - // scream", 50.0f), nullptr))); triggers.push_back(new TriggerNode("low mana", NextAction::array(0, new - // NextAction("inner focus", 42.0f), nullptr))); triggers.push_back(new TriggerNode("medium mana", - // NextAction::array(0, new NextAction("symbol of hope", ACTION_EMERGENCY), nullptr))); triggers.push_back(new - // TriggerNode("low mana", NextAction::array(0, new NextAction("consume magic", 10.0f), nullptr))); - // triggers.push_back( - // new TriggerNode("inner focus", NextAction::array(0, new NextAction("inner focus", 42.0f), nullptr))); - triggers.push_back(new TriggerNode("critical health", NextAction::array(0, new NextAction("desperate prayer", - ACTION_HIGH + 5), nullptr))); - // triggers.push_back(new TriggerNode("enemy is close", NextAction::array(0, new - // NextAction("elune's grace", ACTION_EMERGENCY), nullptr))); triggers.push_back(new TriggerNode("chastise", - // NextAction::array(0, new NextAction("chastise", ACTION_INTERRUPT), nullptr))); + triggers.push_back(new TriggerNode("medium threat", { NextAction("fade", 55.0f) })); + triggers.push_back(new TriggerNode("critical health", { NextAction("desperate prayer", + ACTION_HIGH + 5) })); triggers.push_back(new TriggerNode( - "critical health", NextAction::array(0, new NextAction("power word: shield", ACTION_NORMAL), NULL))); + "critical health", { NextAction("power word: shield", ACTION_NORMAL) })); triggers.push_back( - new TriggerNode("low health", NextAction::array(0, new NextAction("power word: shield", ACTION_HIGH), NULL))); + new TriggerNode("low health", { NextAction("power word: shield", ACTION_HIGH) })); triggers.push_back( new TriggerNode("medium mana", - NextAction::array(0, - new NextAction("shadowfiend", ACTION_HIGH + 2), - new NextAction("inner focus", ACTION_HIGH + 1), nullptr))); + { + NextAction("shadowfiend", ACTION_HIGH + 2), + NextAction("inner focus", ACTION_HIGH + 1) })); triggers.push_back( - new TriggerNode("low mana", NextAction::array(0, new NextAction("hymn of hope", ACTION_HIGH), NULL))); + new TriggerNode("low mana", { NextAction("hymn of hope", ACTION_HIGH) })); triggers.push_back(new TriggerNode("enemy too close for spell", - NextAction::array(0, new NextAction("flee", ACTION_MOVE + 9), nullptr))); - triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("apply oil", 1.0f), nullptr))); + { NextAction("flee", ACTION_MOVE + 9) })); + triggers.push_back(new TriggerNode("often", { NextAction("apply oil", 1.0f) })); triggers.push_back(new TriggerNode("being attacked", - NextAction::array(0, new NextAction("power word: shield", ACTION_HIGH + 1), nullptr))); - triggers.push_back(new TriggerNode("new pet", NextAction::array(0, new NextAction("set pet stance", 60.0f), nullptr))); + { NextAction("power word: shield", ACTION_HIGH + 1) })); + triggers.push_back(new TriggerNode("new pet", { NextAction("set pet stance", 60.0f) })); } PriestCureStrategy::PriestCureStrategy(PlayerbotAI* botAI) : Strategy(botAI) @@ -69,43 +52,41 @@ PriestCureStrategy::PriestCureStrategy(PlayerbotAI* botAI) : Strategy(botAI) void PriestCureStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( - new TriggerNode("dispel magic", NextAction::array(0, new NextAction("dispel magic", 41.0f), nullptr))); + new TriggerNode("dispel magic", { NextAction("dispel magic", 41.0f) })); triggers.push_back(new TriggerNode("dispel magic on party", - NextAction::array(0, new NextAction("dispel magic on party", 40.0f), nullptr))); + { NextAction("dispel magic on party", 40.0f) })); triggers.push_back( - new TriggerNode("cure disease", NextAction::array(0, new NextAction("abolish disease", 31.0f), nullptr))); + new TriggerNode("cure disease", { NextAction("abolish disease", 31.0f) })); triggers.push_back(new TriggerNode( - "party member cure disease", NextAction::array(0, new NextAction("abolish disease on party", 30.0f), nullptr))); + "party member cure disease", { NextAction("abolish disease on party", 30.0f) })); } void PriestBoostStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( - new TriggerNode("power infusion", NextAction::array(0, new NextAction("power infusion", 41.0f), nullptr))); - triggers.push_back(new TriggerNode("boost", NextAction::array(0, new NextAction("shadowfiend", 20.0f), nullptr))); + new TriggerNode("power infusion", { NextAction("power infusion", 41.0f) })); + triggers.push_back(new TriggerNode("boost", { NextAction("shadowfiend", 20.0f) })); } void PriestCcStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( - new TriggerNode("shackle undead", NextAction::array(0, new NextAction("shackle undead", 31.0f), nullptr))); + new TriggerNode("shackle undead", { NextAction("shackle undead", 31.0f) })); } void PriestHealerDpsStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( new TriggerNode("healer should attack", - NextAction::array(0, - new NextAction("shadow word: pain", ACTION_DEFAULT + 0.5f), - new NextAction("holy fire", ACTION_DEFAULT + 0.4f), - new NextAction("smite", ACTION_DEFAULT + 0.3f), - new NextAction("mind blast", ACTION_DEFAULT + 0.2f), - new NextAction("shoot", ACTION_DEFAULT), - nullptr))); + { + NextAction("shadow word: pain", ACTION_DEFAULT + 0.5f), + NextAction("holy fire", ACTION_DEFAULT + 0.4f), + NextAction("smite", ACTION_DEFAULT + 0.3f), + NextAction("mind blast", ACTION_DEFAULT + 0.2f), + NextAction("shoot", ACTION_DEFAULT) })); triggers.push_back( new TriggerNode("medium aoe and healer should attack", - NextAction::array(0, - new NextAction("mind sear", ACTION_DEFAULT + 0.5f), - nullptr))); + { + NextAction("mind sear", ACTION_DEFAULT + 0.5f) })); } diff --git a/src/strategy/priest/GenericPriestStrategyActionNodeFactory.h b/src/strategy/priest/GenericPriestStrategyActionNodeFactory.h index d96f2e19..ab6a0c2b 100644 --- a/src/strategy/priest/GenericPriestStrategyActionNodeFactory.h +++ b/src/strategy/priest/GenericPriestStrategyActionNodeFactory.h @@ -40,153 +40,185 @@ public: private: static ActionNode* inner_fire([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("inner fire", - /*P*/ NextAction::array(0, new NextAction("remove shadowform"), NULL), - /*A*/ NULL, - /*C*/ NULL); + return new ActionNode( + "inner fire", + /*P*/ { NextAction("remove shadowform") }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* holy_nova([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("holy nova", - /*P*/ NextAction::array(0, new NextAction("remove shadowform"), NULL), - /*A*/ NULL, - /*C*/ NULL); + return new ActionNode( + "holy nova", + /*P*/ { NextAction("remove shadowform") }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* power_word_fortitude([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("power word: fortitude", - /*P*/ NextAction::array(0, new NextAction("remove shadowform"), NULL), - /*A*/ NULL, - /*C*/ NULL); + return new ActionNode( + "power word: fortitude", + /*P*/ { NextAction("remove shadowform") }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* power_word_fortitude_on_party([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("power word: fortitude on party", - /*P*/ NextAction::array(0, new NextAction("remove shadowform"), NULL), - /*A*/ NULL, - /*C*/ NULL); + return new ActionNode( + "power word: fortitude on party", + /*P*/ { NextAction("remove shadowform") }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* divine_spirit([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("divine spirit", - /*P*/ NextAction::array(0, new NextAction("remove shadowform"), NULL), - /*A*/ NULL, - /*C*/ NULL); + return new ActionNode( + "divine spirit", + /*P*/ { NextAction("remove shadowform") }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* divine_spirit_on_party([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("divine spirit on party", - /*P*/ NextAction::array(0, new NextAction("remove shadowform"), NULL), - /*A*/ NULL, - /*C*/ NULL); + return new ActionNode( + "divine spirit on party", + /*P*/ { NextAction("remove shadowform") }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* power_word_shield([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("power word: shield", - /*P*/ NextAction::array(0, new NextAction("remove shadowform"), NULL), - // /*A*/ NextAction::array(0, new NextAction("renew", 50.0f), NULL), - /*A*/ NULL, - /*C*/ NULL); + return new ActionNode( + "power word: shield", + /*P*/ { NextAction("remove shadowform") }, + // /*A*/ { NextAction("renew", 50.0f) }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* power_word_shield_on_party([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("power word: shield on party", - /*P*/ NextAction::array(0, new NextAction("remove shadowform"), NULL), - // /*A*/ NextAction::array(0, new NextAction("renew on party", 50.0f), NULL), - /*A*/ NULL, - /*C*/ NULL); + return new ActionNode( + "power word: shield on party", + /*P*/ { NextAction("remove shadowform") }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* renew([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("renew", - /*P*/ NextAction::array(0, new NextAction("remove shadowform"), NULL), - /*A*/ NULL, - /*C*/ NULL); + return new ActionNode( + "renew", + /*P*/ { NextAction("remove shadowform") }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* renew_on_party([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("renew on party", - /*P*/ NextAction::array(0, new NextAction("remove shadowform"), NULL), - /*A*/ NULL, - /*C*/ NULL); + return new ActionNode( + "renew on party", + /*P*/ { NextAction("remove shadowform") }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* greater_heal([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("greater heal", - /*P*/ NextAction::array(0, new NextAction("remove shadowform"), NULL), - /*A*/ NextAction::array(0, new NextAction("heal"), NULL), - /*C*/ NULL); + return new ActionNode( + "greater heal", + /*P*/ { NextAction("remove shadowform") }, + /*A*/ { NextAction("heal") }, + /*C*/ {} + ); } static ActionNode* greater_heal_on_party([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("greater heal on party", - /*P*/ NextAction::array(0, new NextAction("remove shadowform"), NULL), - /*A*/ NextAction::array(0, new NextAction("heal on party"), NULL), - /*C*/ NULL); + return new ActionNode( + "greater heal on party", + /*P*/ { NextAction("remove shadowform") }, + /*A*/ { NextAction("heal on party") }, + /*C*/ {} + ); } static ActionNode* heal([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("heal", - /*P*/ NextAction::array(0, new NextAction("remove shadowform"), NULL), - /*A*/ NextAction::array(0, new NextAction("lesser heal"), NULL), - /*C*/ NULL); + return new ActionNode( + "heal", + /*P*/ { NextAction("remove shadowform") }, + /*A*/ { NextAction("lesser heal") }, + /*C*/ {} + ); } static ActionNode* heal_on_party([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("heal on party", - /*P*/ NextAction::array(0, new NextAction("remove shadowform"), NULL), - /*A*/ NextAction::array(0, new NextAction("lesser heal on party"), NULL), - /*C*/ NULL); + return new ActionNode( + "heal on party", + /*P*/ { NextAction("remove shadowform") }, + /*A*/ { NextAction("lesser heal on party") }, + /*C*/ {} + ); } static ActionNode* lesser_heal([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("lesser heal", - /*P*/ NextAction::array(0, new NextAction("remove shadowform"), NULL), - /*A*/ NULL, - /*C*/ NULL); + return new ActionNode( + "lesser heal", + /*P*/ { NextAction("remove shadowform") }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* lesser_heal_on_party([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("lesser heal on party", - /*P*/ NextAction::array(0, new NextAction("remove shadowform"), NULL), - /*A*/ NULL, - /*C*/ NULL); + return new ActionNode( + "lesser heal on party", + /*P*/ { NextAction("remove shadowform") }, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* flash_heal([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("flash heal", - /*P*/ NextAction::array(0, new NextAction("remove shadowform"), NULL), - /*A*/ NextAction::array(0, new NextAction("greater heal"), NULL), - /*C*/ NULL); + return new ActionNode( + "flash heal", + /*P*/ { NextAction("remove shadowform") }, + /*A*/ { NextAction("greater heal") }, + /*C*/ {} + ); } static ActionNode* flash_heal_on_party([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("flash heal on party", - /*P*/ NextAction::array(0, new NextAction("remove shadowform"), NULL), - /*A*/ NextAction::array(0, new NextAction("greater heal on party"), NULL), - /*C*/ NULL); + return new ActionNode( + "flash heal on party", + /*P*/ { NextAction("remove shadowform") }, + /*A*/ { NextAction("greater heal on party") }, + /*C*/ {} + ); } static ActionNode* psychic_scream([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("psychic scream", - /*P*/ NULL, - /*A*/ NextAction::array(0, new NextAction("fade"), NULL), - /*C*/ NULL); + return new ActionNode( + "psychic scream", + /*P*/ {}, + /*A*/ { NextAction("fade") }, + /*C*/ {} + ); } - // static ActionNode* fade([[maybe_unused]] PlayerbotAI* botAI) - // { - // return new ActionNode ("fade", - // /*P*/ NULL, - // /*A*/ NextAction::array(0, new NextAction("flee"), NULL), - // /*C*/ NULL); - // } + static ActionNode* shadowfiend([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("shadowfiend", - /*P*/ NULL, - // /*A*/ NextAction::array(0, new NextAction("hymn of hope"), NULL), - /*A*/ NULL, - /*C*/ NULL); + return new ActionNode( + "shadowfiend", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } }; @@ -200,8 +232,26 @@ public: } private: - ACTION_NODE_A(abolish_disease, "abolish disease", "cure disease"); - ACTION_NODE_A(abolish_disease_on_party, "abolish disease on party", "cure disease on party"); + + static ActionNode* abolish_disease([[maybe_unused]] PlayerbotAI* botAI) + { + return new ActionNode( + "abolish disease", + /*P*/ {}, + /*A*/ { NextAction("cure disease") }, + /*C*/ {} + ); + } + + static ActionNode* abolish_disease_on_party([[maybe_unused]] PlayerbotAI* botAI) + { + return new ActionNode( + "abolish disease on party", + /*P*/ {}, + /*A*/ { NextAction("cure disease on party") }, + /*C*/ {} + ); + } }; #endif diff --git a/src/strategy/priest/HealPriestStrategy.cpp b/src/strategy/priest/HealPriestStrategy.cpp index ecb59f6a..35f764e4 100644 --- a/src/strategy/priest/HealPriestStrategy.cpp +++ b/src/strategy/priest/HealPriestStrategy.cpp @@ -13,91 +13,107 @@ HealPriestStrategy::HealPriestStrategy(PlayerbotAI* botAI) : GenericPriestStrate actionNodeFactories.Add(new GenericPriestStrategyActionNodeFactory()); } -NextAction** HealPriestStrategy::getDefaultActions() +std::vector HealPriestStrategy::getDefaultActions() { - return NextAction::array(0, new NextAction("shoot", ACTION_DEFAULT), nullptr); + return { + NextAction("shoot", ACTION_DEFAULT) + }; } void HealPriestStrategy::InitTriggers(std::vector& triggers) { GenericPriestStrategy::InitTriggers(triggers); - // triggers.push_back(new TriggerNode( - // "enemy out of spell", - // NextAction::array(0, new NextAction("reach spell", ACTION_NORMAL + 9), NULL))); - - // triggers.push_back(new TriggerNode( - // "medium aoe heal", - // NextAction::array(0, - // new NextAction("circle of healing on party", ACTION_MEDIUM_HEAL + 8), - // // new NextAction("power word: shield on almost full health below", ACTION_MEDIUM_HEAL + 7), - // NULL))); - - triggers.push_back(new TriggerNode( - "group heal setting", - NextAction::array(0, - new NextAction("prayer of mending on party", ACTION_MEDIUM_HEAL + 8), - new NextAction("power word: shield on not full", ACTION_MEDIUM_HEAL + 7), - nullptr))); - - triggers.push_back(new TriggerNode( - "medium group heal setting", - NextAction::array(0, new NextAction("divine hymn", ACTION_CRITICAL_HEAL + 7), - new NextAction("prayer of mending on party", ACTION_CRITICAL_HEAL + 6), - new NextAction("power word: shield on not full", ACTION_CRITICAL_HEAL + 5), - new NextAction("prayer of healing on party", ACTION_CRITICAL_HEAL + 4), - nullptr))); - - triggers.push_back(new TriggerNode( - "party member critical health", - NextAction::array(0, new NextAction("power word: shield on party", ACTION_CRITICAL_HEAL + 5), - new NextAction("penance on party", ACTION_CRITICAL_HEAL + 4), - new NextAction("prayer of mending on party", ACTION_CRITICAL_HEAL + 3), - new NextAction("flash heal on party", ACTION_CRITICAL_HEAL + 2), - nullptr))); + triggers.push_back( + new TriggerNode( + "group heal setting", + { + NextAction("prayer of mending on party", ACTION_MEDIUM_HEAL + 8), + NextAction("power word: shield on not full", ACTION_MEDIUM_HEAL + 7) + } + ) + ); triggers.push_back( - new TriggerNode("party member low health", - NextAction::array(0, new NextAction("power word: shield on party", ACTION_MEDIUM_HEAL + 4), - new NextAction("prayer of mending on party", ACTION_MEDIUM_HEAL + 3), - new NextAction("penance on party", ACTION_MEDIUM_HEAL + 2), - new NextAction("flash heal on party", ACTION_MEDIUM_HEAL + 0), nullptr))); + new TriggerNode( + "medium group heal setting", + { + NextAction("divine hymn", ACTION_CRITICAL_HEAL + 7), + NextAction("prayer of mending on party", ACTION_CRITICAL_HEAL + 6), + NextAction("power word: shield on not full", ACTION_CRITICAL_HEAL + 5), + NextAction("prayer of healing on party", ACTION_CRITICAL_HEAL + 4) + } + ) + ); triggers.push_back( - new TriggerNode("party member medium health", - NextAction::array(0, new NextAction("power word: shield on party", ACTION_LIGHT_HEAL + 9), - new NextAction("prayer of mending on party", ACTION_LIGHT_HEAL + 7), - new NextAction("penance on party", ACTION_LIGHT_HEAL + 6), - new NextAction("flash heal on party", ACTION_LIGHT_HEAL + 5), - // new NextAction("renew on party", ACTION_LIGHT_HEAL + 8), - nullptr))); + new TriggerNode( + "party member critical health", + { + NextAction("power word: shield on party", ACTION_CRITICAL_HEAL + 5), + NextAction("penance on party", ACTION_CRITICAL_HEAL + 4), + NextAction("prayer of mending on party", ACTION_CRITICAL_HEAL + 3), + NextAction("flash heal on party", ACTION_CRITICAL_HEAL + 2) + } + ) + ); triggers.push_back( - new TriggerNode("party member almost full health", - NextAction::array(0, - // new NextAction("penance on party", ACTION_LIGHT_HEAL + 3), - new NextAction("prayer of mending on party", ACTION_LIGHT_HEAL + 2), - new NextAction("renew on party", ACTION_LIGHT_HEAL + 1), - nullptr))); + new TriggerNode( + "party member low health", + { + NextAction("power word: shield on party", ACTION_MEDIUM_HEAL + 4), + NextAction("prayer of mending on party", ACTION_MEDIUM_HEAL + 3), + NextAction("penance on party", ACTION_MEDIUM_HEAL + 2), + NextAction("flash heal on party", ACTION_MEDIUM_HEAL + 0) + } + ) + ); - // triggers.push_back(new TriggerNode("almost full health", NextAction::array(0, new NextAction("renew", 43.f), - // nullptr))); triggers.push_back(new TriggerNode("party member almost full health", NextAction::array(0, new - // NextAction("heal on party", 41.0f), new NextAction("renew on party", 40.0f), nullptr))); triggers.push_back(new - // TriggerNode("party member medium health", NextAction::array(0, new NextAction("greater heal on party", 47.0f), - // nullptr))); triggers.push_back(new TriggerNode("party member low health", NextAction::array(0, new - // NextAction("power word: shield on party", 51.0f), new NextAction("greater heal on party", 50.0f), nullptr))); - triggers.push_back(new TriggerNode( - "party member to heal out of spell range", - NextAction::array(0, new NextAction("reach party member to heal", ACTION_CRITICAL_HEAL + 10), nullptr))); - // triggers.push_back(new TriggerNode("medium aoe heal", NextAction::array(0, new NextAction("prayer of - // mending", 49.0f), nullptr))); triggers.push_back(new TriggerNode("medium aoe heal", NextAction::array(0, new - // NextAction("circle of healing on party", 48.0f), nullptr))); triggers.push_back(new TriggerNode("binding heal", - // NextAction::array(0, new NextAction("binding heal", 52.0f), nullptr))); triggers.push_back(new TriggerNode("low - // mana", NextAction::array(0, new NextAction("shadowfiend", ACTION_HIGH), nullptr))); - - triggers.push_back(new TriggerNode( - "critical health", NextAction::array(0, new NextAction("pain suppression", ACTION_EMERGENCY + 1), nullptr))); triggers.push_back( - new TriggerNode("protect party member", - NextAction::array(0, new NextAction("pain suppression on party", ACTION_EMERGENCY), nullptr))); + new TriggerNode( + "party member medium health", + { + NextAction("power word: shield on party", ACTION_LIGHT_HEAL + 9), + NextAction("prayer of mending on party", ACTION_LIGHT_HEAL + 7), + NextAction("penance on party", ACTION_LIGHT_HEAL + 6), + NextAction("flash heal on party", ACTION_LIGHT_HEAL + 5) + } + ) + ); + + triggers.push_back( + new TriggerNode( + "party member almost full health", + { + NextAction("prayer of mending on party", ACTION_LIGHT_HEAL + 2), + NextAction("renew on party", ACTION_LIGHT_HEAL + 1) + } + ) + ); + + triggers.push_back( + new TriggerNode( + "party member to heal out of spell range", + { + NextAction("reach party member to heal", ACTION_CRITICAL_HEAL + 10) + } + ) + ); + + triggers.push_back( + new TriggerNode( + "critical health", { + NextAction("pain suppression", ACTION_EMERGENCY + 1) + } + ) + ); + triggers.push_back( + new TriggerNode( + "protect party member", + { + NextAction("pain suppression on party", ACTION_EMERGENCY) + } + ) + ); } diff --git a/src/strategy/priest/HealPriestStrategy.h b/src/strategy/priest/HealPriestStrategy.h index e6db6621..49fd764e 100644 --- a/src/strategy/priest/HealPriestStrategy.h +++ b/src/strategy/priest/HealPriestStrategy.h @@ -16,7 +16,7 @@ public: HealPriestStrategy(PlayerbotAI* botAI); void InitTriggers(std::vector& triggers) override; - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; std::string const getName() override { return "heal"; } uint32 GetType() const override { return STRATEGY_TYPE_HEAL | STRATEGY_TYPE_RANGED; } }; diff --git a/src/strategy/priest/HolyPriestStrategy.cpp b/src/strategy/priest/HolyPriestStrategy.cpp index bdf804ed..399f21c6 100644 --- a/src/strategy/priest/HolyPriestStrategy.cpp +++ b/src/strategy/priest/HolyPriestStrategy.cpp @@ -15,10 +15,12 @@ public: private: static ActionNode* smite([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("smite", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("shoot"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "smite", + /*P*/ {}, + /*A*/ { NextAction("shoot") }, + /*C*/ {} + ); } }; @@ -27,11 +29,13 @@ HolyPriestStrategy::HolyPriestStrategy(PlayerbotAI* botAI) : HealPriestStrategy( actionNodeFactories.Add(new HolyPriestStrategyActionNodeFactory()); } -NextAction** HolyPriestStrategy::getDefaultActions() +std::vector HolyPriestStrategy::getDefaultActions() { - return NextAction::array(0, new NextAction("smite", ACTION_DEFAULT + 0.2f), - new NextAction("mana burn", ACTION_DEFAULT + 0.1f), - new NextAction("starshards", ACTION_DEFAULT), nullptr); + return { + NextAction("smite", ACTION_DEFAULT + 0.2f), + NextAction("mana burn", ACTION_DEFAULT + 0.1f), + NextAction("starshards", ACTION_DEFAULT) + }; } void HolyPriestStrategy::InitTriggers(std::vector& triggers) @@ -39,13 +43,37 @@ void HolyPriestStrategy::InitTriggers(std::vector& triggers) HealPriestStrategy::InitTriggers(triggers); triggers.push_back( - new TriggerNode("holy fire", NextAction::array(0, new NextAction("holy fire", ACTION_NORMAL + 9), nullptr))); + new TriggerNode( + "holy fire", + { + NextAction("holy fire", ACTION_NORMAL + 9) + } + ) + ); triggers.push_back( - new TriggerNode("shadowfiend", NextAction::array(0, new NextAction("shadowfiend", ACTION_HIGH), nullptr))); + new TriggerNode( + "shadowfiend", + { + NextAction("shadowfiend", ACTION_HIGH) + } + ) + ); triggers.push_back( - new TriggerNode("medium mana", NextAction::array(0, new NextAction("shadowfiend", ACTION_HIGH), nullptr))); + new TriggerNode( + "medium mana", + { + NextAction("shadowfiend", ACTION_HIGH) + } + ) + ); triggers.push_back( - new TriggerNode("low mana", NextAction::array(0, new NextAction("mana burn", ACTION_HIGH), nullptr))); + new TriggerNode( + "low mana", + { + NextAction("mana burn", ACTION_HIGH) + } + ) + ); } HolyHealPriestStrategy::HolyHealPriestStrategy(PlayerbotAI* botAI) : GenericPriestStrategy(botAI) @@ -53,9 +81,9 @@ HolyHealPriestStrategy::HolyHealPriestStrategy(PlayerbotAI* botAI) : GenericPrie actionNodeFactories.Add(new GenericPriestStrategyActionNodeFactory()); } -NextAction** HolyHealPriestStrategy::getDefaultActions() +std::vector HolyHealPriestStrategy::getDefaultActions() { - return NextAction::array(0, new NextAction("shoot", ACTION_DEFAULT), nullptr); + return { NextAction("shoot", ACTION_DEFAULT) }; } void HolyHealPriestStrategy::InitTriggers(std::vector& triggers) @@ -63,52 +91,80 @@ void HolyHealPriestStrategy::InitTriggers(std::vector& triggers) GenericPriestStrategy::InitTriggers(triggers); triggers.push_back( - new TriggerNode("group heal setting", - NextAction::array(0, - new NextAction("prayer of mending on party", ACTION_MEDIUM_HEAL + 9), - new NextAction("circle of healing on party", ACTION_MEDIUM_HEAL + 8), nullptr))); - - triggers.push_back(new TriggerNode( - "medium group heal setting", - NextAction::array(0, new NextAction("divine hymn", ACTION_CRITICAL_HEAL + 7), - new NextAction("prayer of mending on party", ACTION_CRITICAL_HEAL + 6), - new NextAction("circle of healing on party", ACTION_CRITICAL_HEAL + 5), - new NextAction("prayer of healing on party", ACTION_CRITICAL_HEAL + 4), nullptr))); - - triggers.push_back(new TriggerNode( - "party member critical health", - NextAction::array(0, - new NextAction("guardian spirit on party", ACTION_CRITICAL_HEAL + 6), - new NextAction("power word: shield on party", ACTION_CRITICAL_HEAL + 5), - new NextAction("prayer of mending on party", ACTION_CRITICAL_HEAL + 3), - new NextAction("greater heal on party", ACTION_MEDIUM_HEAL + 2), - new NextAction("flash heal on party", ACTION_CRITICAL_HEAL + 1), - nullptr))); + new TriggerNode( + "group heal setting", + { + NextAction("prayer of mending on party", ACTION_MEDIUM_HEAL + 9), + NextAction("circle of healing on party", ACTION_MEDIUM_HEAL + 8) + } + ) + ); triggers.push_back( - new TriggerNode("party member low health", - NextAction::array(0, new NextAction("circle of healing on party", ACTION_MEDIUM_HEAL + 4), - new NextAction("prayer of mending on party", ACTION_MEDIUM_HEAL + 3), - new NextAction("greater heal on party", ACTION_MEDIUM_HEAL + 2), - new NextAction("flash heal on party", ACTION_MEDIUM_HEAL + 1), nullptr))); + new TriggerNode( + "medium group heal setting", + { + NextAction("divine hymn", ACTION_CRITICAL_HEAL + 7), + NextAction("prayer of mending on party", ACTION_CRITICAL_HEAL + 6), + NextAction("circle of healing on party", ACTION_CRITICAL_HEAL + 5), + NextAction("prayer of healing on party", ACTION_CRITICAL_HEAL + 4) + } + ) + ); triggers.push_back( - new TriggerNode("party member medium health", - NextAction::array(0, new NextAction("circle of healing on party", ACTION_LIGHT_HEAL + 7), - new NextAction("prayer of mending on party", ACTION_LIGHT_HEAL + 6), - new NextAction("greater heal on party", ACTION_MEDIUM_HEAL + 5), - new NextAction("flash heal on party", ACTION_LIGHT_HEAL + 4), - // new NextAction("renew on party", ACTION_LIGHT_HEAL + 8), - nullptr))); + new TriggerNode( + "party member critical health", + { + NextAction("guardian spirit on party", ACTION_CRITICAL_HEAL + 6), + NextAction("power word: shield on party", ACTION_CRITICAL_HEAL + 5), + NextAction("prayer of mending on party", ACTION_CRITICAL_HEAL + 3), + NextAction("greater heal on party", ACTION_MEDIUM_HEAL + 2), + NextAction("flash heal on party", ACTION_CRITICAL_HEAL + 1), + } + ) + ); triggers.push_back( - new TriggerNode("party member almost full health", - NextAction::array(0, - new NextAction("renew on party", ACTION_LIGHT_HEAL + 2), - new NextAction("prayer of mending on party", ACTION_LIGHT_HEAL + 1), - nullptr))); + new TriggerNode( + "party member low health", + { + NextAction("circle of healing on party", ACTION_MEDIUM_HEAL + 4), + NextAction("prayer of mending on party", ACTION_MEDIUM_HEAL + 3), + NextAction("greater heal on party", ACTION_MEDIUM_HEAL + 2), + NextAction("flash heal on party", ACTION_MEDIUM_HEAL + 1) + } + ) + ); - triggers.push_back(new TriggerNode( - "party member to heal out of spell range", - NextAction::array(0, new NextAction("reach party member to heal", ACTION_CRITICAL_HEAL + 10), nullptr))); + triggers.push_back( + new TriggerNode( + "party member medium health", + { + NextAction("circle of healing on party", ACTION_LIGHT_HEAL + 7), + NextAction("prayer of mending on party", ACTION_LIGHT_HEAL + 6), + NextAction("greater heal on party", ACTION_MEDIUM_HEAL + 5), + NextAction("flash heal on party", ACTION_LIGHT_HEAL + 4), + } + ) + ); + + triggers.push_back( + new TriggerNode( + "party member almost full health", + { + NextAction("renew on party", ACTION_LIGHT_HEAL + 2), + NextAction("prayer of mending on party", ACTION_LIGHT_HEAL + 1), + } + ) + ); + + triggers.push_back( + new TriggerNode( + "party member to heal out of spell range", + { + NextAction("reach party member to heal", ACTION_CRITICAL_HEAL + 10) + } + ) + ); } diff --git a/src/strategy/priest/HolyPriestStrategy.h b/src/strategy/priest/HolyPriestStrategy.h index 87b28a98..5ae94c38 100644 --- a/src/strategy/priest/HolyPriestStrategy.h +++ b/src/strategy/priest/HolyPriestStrategy.h @@ -16,7 +16,7 @@ class HolyPriestStrategy : public HealPriestStrategy public: HolyPriestStrategy(PlayerbotAI* botAI); - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; void InitTriggers(std::vector& triggers) override; std::string const getName() override { return "holy dps"; } uint32 GetType() const override { return STRATEGY_TYPE_DPS | STRATEGY_TYPE_RANGED; } @@ -28,7 +28,7 @@ public: HolyHealPriestStrategy(PlayerbotAI* botAI); void InitTriggers(std::vector& triggers) override; - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; std::string const getName() override { return "holy heal"; } uint32 GetType() const override { return STRATEGY_TYPE_HEAL | STRATEGY_TYPE_RANGED; } }; diff --git a/src/strategy/priest/PriestNonCombatStrategy.cpp b/src/strategy/priest/PriestNonCombatStrategy.cpp index 38513106..6447d451 100644 --- a/src/strategy/priest/PriestNonCombatStrategy.cpp +++ b/src/strategy/priest/PriestNonCombatStrategy.cpp @@ -17,47 +17,37 @@ void PriestNonCombatStrategy::InitTriggers(std::vector& triggers) { NonCombatStrategy::InitTriggers(triggers); - // triggers.push_back(new TriggerNode("power word: fortitude", NextAction::array(0, new NextAction("power word: - // fortitude", 12.0f), nullptr))); triggers.push_back(new TriggerNode("divine spirit", NextAction::array(0, new - // NextAction("divine spirit", 14.0f), nullptr))); triggers.push_back( - new TriggerNode("inner fire", NextAction::array(0, new NextAction("inner fire", 10.0f), nullptr))); - // triggers.push_back(new TriggerNode("critical health", NextAction::array(0, new NextAction("greater heal", 70.0f), - // nullptr))); triggers.push_back(new TriggerNode("party member critical health", NextAction::array(0, new - // NextAction("greater heal on party", 60.0f), nullptr))); triggers.push_back(new TriggerNode("medium health", - // NextAction::array(0, new NextAction("renew", 41.0f), nullptr))); triggers.push_back(new TriggerNode("party member - // medium health", NextAction::array(0, new NextAction("renew on party", 40.0f), nullptr))); triggers.push_back(new - // TriggerNode("medium aoe heal", NextAction::array(0, new NextAction("lightwell", 42.f), nullptr))); + new TriggerNode("inner fire",{ NextAction("inner fire", 10.0f) })); triggers.push_back(new TriggerNode( - "party member dead", NextAction::array(0, new NextAction("remove shadowform", ACTION_CRITICAL_HEAL + 11), - new NextAction("resurrection", ACTION_CRITICAL_HEAL + 10), nullptr))); - // triggers.push_back(new TriggerNode("swimming", NextAction::array(0, new NextAction("levitate", 1.0f), nullptr))); - triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("apply oil", 1.0f), nullptr))); + "party member dead",{ NextAction("remove shadowform", ACTION_CRITICAL_HEAL + 11), + NextAction("resurrection", ACTION_CRITICAL_HEAL + 10) })); + triggers.push_back(new TriggerNode("often",{ NextAction("apply oil", 1.0f) })); triggers.push_back( new TriggerNode("party member critical health", - NextAction::array(0, new NextAction("renew on party", ACTION_CRITICAL_HEAL + 3), - new NextAction("penance on party", ACTION_CRITICAL_HEAL + 2), - new NextAction("greater heal on party", ACTION_CRITICAL_HEAL + 1), NULL))); + { NextAction("renew on party", ACTION_CRITICAL_HEAL + 3), + NextAction("penance on party", ACTION_CRITICAL_HEAL + 2), + NextAction("greater heal on party", ACTION_CRITICAL_HEAL + 1) })); triggers.push_back( new TriggerNode("party member low health", - NextAction::array(0, new NextAction("renew on party", ACTION_MEDIUM_HEAL + 3), - new NextAction("penance on party", ACTION_MEDIUM_HEAL + 2), - new NextAction("greater heal on party", ACTION_MEDIUM_HEAL + 1), NULL))); + { NextAction("renew on party", ACTION_MEDIUM_HEAL + 3), + NextAction("penance on party", ACTION_MEDIUM_HEAL + 2), + NextAction("greater heal on party", ACTION_MEDIUM_HEAL + 1) })); triggers.push_back( new TriggerNode("party member medium health", - NextAction::array(0, new NextAction("renew on party", ACTION_LIGHT_HEAL + 9), - new NextAction("penance on party", ACTION_LIGHT_HEAL + 8), NULL))); + { NextAction("renew on party", ACTION_LIGHT_HEAL + 9), + NextAction("penance on party", ACTION_LIGHT_HEAL + 8) })); triggers.push_back( new TriggerNode("party member almost full health", - NextAction::array(0, new NextAction("renew on party", ACTION_LIGHT_HEAL + 3), NULL))); + { NextAction("renew on party", ACTION_LIGHT_HEAL + 3) })); triggers.push_back( - new TriggerNode("group heal setting", NextAction::array(0, new NextAction("circle of healing on party", 27.0f), NULL))); + new TriggerNode("group heal setting",{ NextAction("circle of healing on party", 27.0f) })); triggers.push_back(new TriggerNode("new pet", - NextAction::array(0, new NextAction("set pet stance", 10.0f), nullptr))); + { NextAction("set pet stance", 10.0f) })); } void PriestBuffStrategy::InitTriggers(std::vector& triggers) @@ -66,19 +56,15 @@ void PriestBuffStrategy::InitTriggers(std::vector& triggers) triggers.push_back( new TriggerNode("prayer of fortitude on party", - NextAction::array(0, new NextAction("prayer of fortitude on party", 12.0f), nullptr))); + { NextAction("prayer of fortitude on party", 12.0f) })); triggers.push_back( new TriggerNode("prayer of spirit on party", - NextAction::array(0, new NextAction("prayer of spirit on party", 14.0f), nullptr))); + { NextAction("prayer of spirit on party", 14.0f) })); triggers.push_back( new TriggerNode("power word: fortitude on party", - NextAction::array(0, new NextAction("power word: fortitude on party", 11.0f), nullptr))); + { NextAction("power word: fortitude on party", 11.0f) })); triggers.push_back(new TriggerNode("divine spirit on party", - NextAction::array(0, new NextAction("divine spirit on party", 13.0f), nullptr))); - // triggers.push_back(new TriggerNode("fear ward", NextAction::array(0, new NextAction("fear ward", 10.0f), - // nullptr))); triggers.push_back(new TriggerNode("touch of weakness", NextAction::array(0, new NextAction("touch of - // weakness", 10.0f), nullptr))); triggers.push_back(new TriggerNode("shadowguard", NextAction::array(0, new - // NextAction("shadowguard", 10.0f), nullptr))); + { NextAction("divine spirit on party", 13.0f) })); } void PriestShadowResistanceStrategy::InitTriggers(std::vector& triggers) @@ -86,10 +72,8 @@ void PriestShadowResistanceStrategy::InitTriggers(std::vector& tri NonCombatStrategy::InitTriggers(triggers); triggers.push_back(new TriggerNode("shadow protection", - NextAction::array(0, new NextAction("shadow protection", 12.0f), nullptr))); + { NextAction("shadow protection", 12.0f) })); triggers.push_back( new TriggerNode("shadow protection on party", - NextAction::array(0, new NextAction("shadow protection on party", 11.0f), nullptr))); - // triggers.push_back(new TriggerNode("shadow protection on party", NextAction::array(0, new NextAction("shadow - // protection on party", 10.0f), nullptr))); + { NextAction("shadow protection on party", 11.0f) })); } diff --git a/src/strategy/priest/PriestNonCombatStrategyActionNodeFactory.h b/src/strategy/priest/PriestNonCombatStrategyActionNodeFactory.h index e12a1a67..c7d4aba8 100644 --- a/src/strategy/priest/PriestNonCombatStrategyActionNodeFactory.h +++ b/src/strategy/priest/PriestNonCombatStrategyActionNodeFactory.h @@ -38,115 +38,115 @@ private: static ActionNode* holy_nova([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("holy nova", - /*P*/ NextAction::array(0, new NextAction("remove shadowform"), NULL), - /*A*/ NULL, - /*C*/ NULL); + /*P*/ { NextAction("remove shadowform") }, + /*A*/ {}, + /*C*/ {}); } static ActionNode* power_word_shield([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("power word: shield", - /*P*/ NULL, - /*A*/ NextAction::array(0, new NextAction("renew", 50.0f), NULL), - /*C*/ NULL); + /*P*/ {}, + /*A*/ { NextAction("renew", 50.0f) }, + /*C*/ {}); } static ActionNode* power_word_shield_on_party([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("power word: shield on party", - /*P*/ NULL, - /*A*/ NextAction::array(0, new NextAction("renew on party", 50.0f), NULL), - /*C*/ NULL); + /*P*/ {}, + /*A*/ { NextAction("renew on party", 50.0f) }, + /*C*/ {}); } static ActionNode* renew([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("renew", - /*P*/ NextAction::array(0, new NextAction("remove shadowform"), NULL), - /*A*/ NULL, - /*C*/ NULL); + /*P*/ { NextAction("remove shadowform") }, + /*A*/ {}, + /*C*/ {}); } static ActionNode* renew_on_party([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("renew on party", - /*P*/ NextAction::array(0, new NextAction("remove shadowform"), NULL), - /*A*/ NULL, - /*C*/ NULL); + /*P*/ { NextAction("remove shadowform") }, + /*A*/ {}, + /*C*/ {}); } static ActionNode* greater_heal([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("greater heal", - /*P*/ NextAction::array(0, new NextAction("remove shadowform"), NULL), - /*A*/ NextAction::array(0, new NextAction("heal"), NULL), - /*C*/ NULL); + /*P*/ { NextAction("remove shadowform") }, + /*A*/ { NextAction("heal") }, + /*C*/ {}); } static ActionNode* greater_heal_on_party([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("greater heal on party", - /*P*/ NULL, - /*A*/ NextAction::array(0, new NextAction("heal on party"), NULL), - /*C*/ NULL); + /*P*/ {}, + /*A*/ { NextAction("heal on party") }, + /*C*/ {}); } static ActionNode* heal([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("heal", - /*P*/ NextAction::array(0, new NextAction("remove shadowform"), NULL), - /*A*/ NextAction::array(0, new NextAction("lesser heal"), NULL), - /*C*/ NULL); + /*P*/ { NextAction("remove shadowform") }, + /*A*/ { NextAction("lesser heal") }, + /*C*/ {}); } static ActionNode* heal_on_party([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("heal on party", - /*P*/ NextAction::array(0, new NextAction("remove shadowform"), NULL), - /*A*/ NextAction::array(0, new NextAction("lesser heal on party"), NULL), - /*C*/ NULL); + /*P*/ { NextAction("remove shadowform") }, + /*A*/ { NextAction("lesser heal on party") }, + /*C*/ {}); } static ActionNode* lesser_heal([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("lesser heal", - /*P*/ NextAction::array(0, new NextAction("remove shadowform"), NULL), - /*A*/ NULL, - /*C*/ NULL); + /*P*/ { NextAction("remove shadowform") }, + /*A*/ {}, + /*C*/ {}); } static ActionNode* lesser_heal_on_party([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("lesser heal on party", - /*P*/ NextAction::array(0, new NextAction("remove shadowform"), NULL), - /*A*/ NULL, - /*C*/ NULL); + /*P*/ { NextAction("remove shadowform") }, + /*A*/ {}, + /*C*/ {}); } static ActionNode* flash_heal([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("flash heal", - /*P*/ NextAction::array(0, new NextAction("remove shadowform"), NULL), - /*A*/ NULL, - /*C*/ NULL); + /*P*/ { NextAction("remove shadowform") }, + /*A*/ {}, + /*C*/ {}); } static ActionNode* flash_heal_on_party([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("flash heal on party", - /*P*/ NextAction::array(0, new NextAction("remove shadowform"), NULL), - /*A*/ NULL, - /*C*/ NULL); + /*P*/ { NextAction("remove shadowform") }, + /*A*/ {}, + /*C*/ {}); } static ActionNode* circle_of_healing([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("circle of healing on party", - /*P*/ NextAction::array(0, new NextAction("remove shadowform"), NULL), - // /*A*/ NextAction::array(0, new NextAction("flash heal on party"), NULL), - /*A*/ NULL, - /*C*/ NULL); + /*P*/ { NextAction("remove shadowform") }, + // /*A*/ { NextAction("flash heal on party") }, + /*A*/ {}, + /*C*/ {}); } static ActionNode* prayer_of_fortitude_on_party([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("prayer of fortitude on party", - /*P*/ NextAction::array(0, new NextAction("remove shadowform"), NULL), - /*A*/ NextAction::array(0, new NextAction("power word: fortitude on party"), NULL), - /*C*/ NULL); + /*P*/ { NextAction("remove shadowform") }, + /*A*/ { NextAction("power word: fortitude on party") }, + /*C*/ {}); } static ActionNode* prayer_of_spirit_on_party([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("prayer of spirit on party", - /*P*/ NextAction::array(0, new NextAction("remove shadowform"), NULL), - /*A*/ NextAction::array(0, new NextAction("divine spirit on party"), NULL), - /*C*/ NULL); + /*P*/ { NextAction("remove shadowform") }, + /*A*/ { NextAction("divine spirit on party") }, + /*C*/ {}); } }; diff --git a/src/strategy/priest/ShadowPriestStrategy.cpp b/src/strategy/priest/ShadowPriestStrategy.cpp index e6565b72..1308f722 100644 --- a/src/strategy/priest/ShadowPriestStrategy.cpp +++ b/src/strategy/priest/ShadowPriestStrategy.cpp @@ -13,62 +13,130 @@ ShadowPriestStrategy::ShadowPriestStrategy(PlayerbotAI* botAI) : GenericPriestSt actionNodeFactories.Add(new ShadowPriestStrategyActionNodeFactory()); } -NextAction** ShadowPriestStrategy::getDefaultActions() +std::vector ShadowPriestStrategy::getDefaultActions() { - return NextAction::array(0, new NextAction("mind blast", ACTION_DEFAULT + 0.3f), - new NextAction("mind flay", ACTION_DEFAULT + 0.2f), - new NextAction("shadow word: death", ACTION_DEFAULT + 0.1f), // cast during movement - new NextAction("shoot", ACTION_DEFAULT), nullptr); + return { + NextAction("mind blast", ACTION_DEFAULT + 0.3f), + NextAction("mind flay", ACTION_DEFAULT + 0.2f), + NextAction("shadow word: death", ACTION_DEFAULT + 0.1f), // cast during movement + NextAction("shoot", ACTION_DEFAULT) + }; } void ShadowPriestStrategy::InitTriggers(std::vector& triggers) { GenericPriestStrategy::InitTriggers(triggers); - // triggers.push_back(new TriggerNode("enemy out of spell", NextAction::array(0, new NextAction("reach spell", - // ACTION_MOVE + 9), nullptr))); triggers.push_back( - new TriggerNode("shadowform", NextAction::array(0, new NextAction("shadowform", ACTION_HIGH), nullptr))); - triggers.push_back(new TriggerNode("low mana", NextAction::array(0, new NextAction("dispersion", ACTION_HIGH - + 5), nullptr))); - triggers.push_back(new TriggerNode("critical health", NextAction::array(0, new NextAction("dispersion", ACTION_HIGH - + 5), nullptr))); + new TriggerNode( + "shadowform", + { + NextAction("shadowform", ACTION_HIGH) + } + ) + ); triggers.push_back( - new TriggerNode("vampiric embrace", NextAction::array(0, new NextAction("vampiric embrace", 16.0f), nullptr))); + new TriggerNode( + "low mana", + { + NextAction("dispersion", ACTION_HIGH + 5) + } + ) + ); triggers.push_back( - new TriggerNode("silence", NextAction::array(0, new NextAction("silence", ACTION_INTERRUPT + 1), nullptr))); + new TriggerNode( + "critical health", + { + NextAction("dispersion", ACTION_HIGH + 5) + } + ) + ); triggers.push_back( - new TriggerNode("silence on enemy healer", - NextAction::array(0, new NextAction("silence on enemy healer", ACTION_INTERRUPT), nullptr))); - // triggers.push_back(new TriggerNode("shadowfiend", NextAction::array(0, new NextAction("shadowfiend", - // ACTION_HIGH), nullptr))); triggers.push_back(new TriggerNode("medium mana", NextAction::array(0, new - // NextAction("shadowfiend", ACTION_HIGH), nullptr))); triggers.push_back(new TriggerNode("low mana", - // NextAction::array(0, new NextAction("mana burn", ACTION_HIGH), nullptr))); + new TriggerNode( + "vampiric embrace", + { + NextAction("vampiric embrace", 16.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "silence", + { + NextAction("silence", ACTION_INTERRUPT + 1) + } + ) + ); + triggers.push_back( + new TriggerNode( + "silence on enemy healer", + { + NextAction("silence on enemy healer", ACTION_INTERRUPT) + } + ) + ); } void ShadowPriestAoeStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode( - "shadow word: pain on attacker", - NextAction::array(0, new NextAction("shadow word: pain on attacker", ACTION_NORMAL + 5), nullptr))); - triggers.push_back(new TriggerNode( - "vampiric touch on attacker", - NextAction::array(0, new NextAction("vampiric touch on attacker", ACTION_NORMAL + 4), nullptr))); triggers.push_back( - new TriggerNode("mind sear channel check", NextAction::array(0, new NextAction("cancel channel", ACTION_HIGH + 5), nullptr))); + new TriggerNode( + "shadow word: pain on attacker", + { + NextAction("shadow word: pain on attacker", ACTION_NORMAL + 5) + } + ) + ); triggers.push_back( - new TriggerNode("medium aoe", NextAction::array(0, new NextAction("mind sear", ACTION_HIGH + 4), nullptr))); + new TriggerNode( + "vampiric touch on attacker", + { + NextAction("vampiric touch on attacker", ACTION_NORMAL + 4) + } + ) + ); + triggers.push_back( + new TriggerNode( + "mind sear channel check", + { + NextAction("cancel channel", ACTION_HIGH + 5) + } + ) + ); + triggers.push_back( + new TriggerNode( + "medium aoe", + { + NextAction("mind sear", ACTION_HIGH + 4) + } + ) + ); } void ShadowPriestDebuffStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode( - "vampiric touch", NextAction::array(0, new NextAction("vampiric touch", ACTION_HIGH + 3), nullptr))); - triggers.push_back(new TriggerNode( - "devouring plague", NextAction::array(0, new NextAction("devouring plague", ACTION_HIGH + 2), nullptr))); - triggers.push_back(new TriggerNode( - "shadow word: pain", NextAction::array(0, new NextAction("shadow word: pain", ACTION_HIGH + 1), nullptr))); - // triggers.push_back(new TriggerNode("feedback", NextAction::array(0, new NextAction("feedback", 80.0f), - // nullptr))); triggers.push_back(new TriggerNode("hex of weakness", NextAction::array(0, new NextAction("hex of - // weakness", 10.0f), nullptr))); + triggers.push_back( + new TriggerNode( + "vampiric touch", + { + NextAction("vampiric touch", ACTION_HIGH + 3) + } + ) + ); + triggers.push_back( + new TriggerNode( + "devouring plague", + { + NextAction("devouring plague", ACTION_HIGH + 2) + } + ) + ); + triggers.push_back( + new TriggerNode( + "shadow word: pain", + { + NextAction("shadow word: pain", ACTION_HIGH + 1) + } + ) + ); } diff --git a/src/strategy/priest/ShadowPriestStrategy.h b/src/strategy/priest/ShadowPriestStrategy.h index a6d8000d..6bf681b7 100644 --- a/src/strategy/priest/ShadowPriestStrategy.h +++ b/src/strategy/priest/ShadowPriestStrategy.h @@ -15,7 +15,7 @@ class ShadowPriestStrategy : public GenericPriestStrategy public: ShadowPriestStrategy(PlayerbotAI* botAI); - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; void InitTriggers(std::vector& triggers) override; std::string const getName() override { return "shadow"; } uint32 GetType() const override { return STRATEGY_TYPE_DPS | STRATEGY_TYPE_RANGED; } diff --git a/src/strategy/priest/ShadowPriestStrategyActionNodeFactory.h b/src/strategy/priest/ShadowPriestStrategyActionNodeFactory.h index e3dd4efa..4efcc6f6 100644 --- a/src/strategy/priest/ShadowPriestStrategyActionNodeFactory.h +++ b/src/strategy/priest/ShadowPriestStrategyActionNodeFactory.h @@ -26,33 +26,33 @@ private: static ActionNode* mind_blast([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("mind blast", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("mind flay"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("mind flay") }, + /*C*/ {}); } static ActionNode* mind_flay([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("mind flay", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("smite"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("smite") }, + /*C*/ {}); } static ActionNode* smite([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("smite", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("shoot"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("shoot") }, + /*C*/ {}); } static ActionNode* dispersion([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("dispersion", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("mana potion"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("mana potion") }, + /*C*/ {}); } }; diff --git a/src/strategy/raids/aq20/RaidAq20Strategy.cpp b/src/strategy/raids/aq20/RaidAq20Strategy.cpp index 2b8cbe8c..93e0462c 100644 --- a/src/strategy/raids/aq20/RaidAq20Strategy.cpp +++ b/src/strategy/raids/aq20/RaidAq20Strategy.cpp @@ -6,6 +6,6 @@ void RaidAq20Strategy::InitTriggers(std::vector& triggers) { triggers.push_back( new TriggerNode("aq20 move to crystal", - NextAction::array(0, new NextAction("aq20 use crystal", ACTION_RAID), nullptr))); + { NextAction("aq20 use crystal", ACTION_RAID) })); } diff --git a/src/strategy/raids/blackwinglair/RaidBwlStrategy.cpp b/src/strategy/raids/blackwinglair/RaidBwlStrategy.cpp index 1b784683..c65a80ec 100644 --- a/src/strategy/raids/blackwinglair/RaidBwlStrategy.cpp +++ b/src/strategy/raids/blackwinglair/RaidBwlStrategy.cpp @@ -5,11 +5,11 @@ void RaidBwlStrategy::InitTriggers(std::vector& triggers) { triggers.push_back(new TriggerNode("often", - NextAction::array(0, new NextAction("bwl check onyxia scale cloak", ACTION_RAID), NULL))); + { NextAction("bwl check onyxia scale cloak", ACTION_RAID) })); triggers.push_back(new TriggerNode("bwl suppression device", - NextAction::array(0, new NextAction("bwl turn off suppression device", ACTION_RAID), NULL))); + { NextAction("bwl turn off suppression device", ACTION_RAID) })); triggers.push_back(new TriggerNode("bwl affliction bronze", - NextAction::array(0, new NextAction("bwl use hourglass sand", ACTION_RAID), NULL))); + { NextAction("bwl use hourglass sand", ACTION_RAID) })); } diff --git a/src/strategy/raids/eyeofeternity/RaidEoEStrategy.cpp b/src/strategy/raids/eyeofeternity/RaidEoEStrategy.cpp index d06aa27f..3c0ff7ff 100644 --- a/src/strategy/raids/eyeofeternity/RaidEoEStrategy.cpp +++ b/src/strategy/raids/eyeofeternity/RaidEoEStrategy.cpp @@ -5,18 +5,14 @@ void RaidEoEStrategy::InitTriggers(std::vector& triggers) { triggers.push_back(new TriggerNode("malygos", - NextAction::array(0, new NextAction("malygos position", ACTION_MOVE), nullptr))); + { NextAction("malygos position", ACTION_MOVE) })); triggers.push_back(new TriggerNode("malygos", - NextAction::array(0, new NextAction("malygos target", ACTION_RAID + 1), nullptr))); - // triggers.push_back(new TriggerNode("power spark", - // NextAction::array(0, new NextAction("pull power spark", ACTION_RAID + 2), nullptr))); - // triggers.push_back(new TriggerNode("power spark", - // NextAction::array(0, new NextAction("kill power spark", ACTION_RAID + 3), nullptr))); + { NextAction("malygos target", ACTION_RAID + 1) })); triggers.push_back(new TriggerNode("group flying", - NextAction::array(0, new NextAction("eoe fly drake", ACTION_NORMAL + 1), nullptr))); + { NextAction("eoe fly drake", ACTION_NORMAL + 1) })); triggers.push_back(new TriggerNode("drake combat", - NextAction::array(0, new NextAction("eoe drake attack", ACTION_NORMAL + 5), nullptr))); + { NextAction("eoe drake attack", ACTION_NORMAL + 5) })); } void RaidEoEStrategy::InitMultipliers(std::vector &multipliers) diff --git a/src/strategy/raids/gruulslair/RaidGruulsLairStrategy.cpp b/src/strategy/raids/gruulslair/RaidGruulsLairStrategy.cpp index bd7c9cd9..9ec264ea 100644 --- a/src/strategy/raids/gruulslair/RaidGruulsLairStrategy.cpp +++ b/src/strategy/raids/gruulslair/RaidGruulsLairStrategy.cpp @@ -4,45 +4,45 @@ void RaidGruulsLairStrategy::InitTriggers(std::vector& triggers) { // High King Maulgar - triggers.push_back(new TriggerNode("high king maulgar is main tank", NextAction::array(0, - new NextAction("high king maulgar main tank attack maulgar", ACTION_RAID + 1), nullptr))); + triggers.push_back(new TriggerNode("high king maulgar is main tank", { + NextAction("high king maulgar main tank attack maulgar", ACTION_RAID + 1) })); - triggers.push_back(new TriggerNode("high king maulgar is first assist tank", NextAction::array(0, - new NextAction("high king maulgar first assist tank attack olm", ACTION_RAID + 1), nullptr))); + triggers.push_back(new TriggerNode("high king maulgar is first assist tank", { + NextAction("high king maulgar first assist tank attack olm", ACTION_RAID + 1) })); - triggers.push_back(new TriggerNode("high king maulgar is second assist tank", NextAction::array(0, - new NextAction("high king maulgar second assist tank attack blindeye", ACTION_RAID + 1), nullptr))); + triggers.push_back(new TriggerNode("high king maulgar is second assist tank", { + NextAction("high king maulgar second assist tank attack blindeye", ACTION_RAID + 1) })); - triggers.push_back(new TriggerNode("high king maulgar is mage tank", NextAction::array(0, - new NextAction("high king maulgar mage tank attack krosh", ACTION_RAID + 1), nullptr))); + triggers.push_back(new TriggerNode("high king maulgar is mage tank", { + NextAction("high king maulgar mage tank attack krosh", ACTION_RAID + 1) })); - triggers.push_back(new TriggerNode("high king maulgar is moonkin tank", NextAction::array(0, - new NextAction("high king maulgar moonkin tank attack kiggler", ACTION_RAID + 1), nullptr))); + triggers.push_back(new TriggerNode("high king maulgar is moonkin tank", { + NextAction("high king maulgar moonkin tank attack kiggler", ACTION_RAID + 1) })); - triggers.push_back(new TriggerNode("high king maulgar determining kill order", NextAction::array(0, - new NextAction("high king maulgar assign dps priority", ACTION_RAID + 1), nullptr))); + triggers.push_back(new TriggerNode("high king maulgar determining kill order", { + NextAction("high king maulgar assign dps priority", ACTION_RAID + 1) })); - triggers.push_back(new TriggerNode("high king maulgar healer in danger", NextAction::array(0, - new NextAction("high king maulgar healer find safe position", ACTION_RAID + 1), nullptr))); + triggers.push_back(new TriggerNode("high king maulgar healer in danger", { + NextAction("high king maulgar healer find safe position", ACTION_RAID + 1) })); - triggers.push_back(new TriggerNode("high king maulgar boss channeling whirlwind", NextAction::array(0, - new NextAction("high king maulgar run away from whirlwind", ACTION_EMERGENCY + 6), nullptr))); + triggers.push_back(new TriggerNode("high king maulgar boss channeling whirlwind", { + NextAction("high king maulgar run away from whirlwind", ACTION_EMERGENCY + 6) })); - triggers.push_back(new TriggerNode("high king maulgar wild felstalker spawned", NextAction::array(0, - new NextAction("high king maulgar banish felstalker", ACTION_RAID + 2), nullptr))); + triggers.push_back(new TriggerNode("high king maulgar wild felstalker spawned", { + NextAction("high king maulgar banish felstalker", ACTION_RAID + 2) })); - triggers.push_back(new TriggerNode("high king maulgar pulling olm and blindeye", NextAction::array(0, - new NextAction("high king maulgar misdirect olm and blindeye", ACTION_RAID + 2), nullptr))); + triggers.push_back(new TriggerNode("high king maulgar pulling olm and blindeye", { + NextAction("high king maulgar misdirect olm and blindeye", ACTION_RAID + 2) })); // Gruul the Dragonkiller - triggers.push_back(new TriggerNode("gruul the dragonkiller boss engaged by main tank", NextAction::array(0, - new NextAction("gruul the dragonkiller main tank position boss", ACTION_RAID + 1), nullptr))); + triggers.push_back(new TriggerNode("gruul the dragonkiller boss engaged by main tank", { + NextAction("gruul the dragonkiller main tank position boss", ACTION_RAID + 1) })); - triggers.push_back(new TriggerNode("gruul the dragonkiller boss engaged by range", NextAction::array(0, - new NextAction("gruul the dragonkiller spread ranged", ACTION_RAID + 1), nullptr))); + triggers.push_back(new TriggerNode("gruul the dragonkiller boss engaged by range", { + NextAction("gruul the dragonkiller spread ranged", ACTION_RAID + 1) })); - triggers.push_back(new TriggerNode("gruul the dragonkiller incoming shatter", NextAction::array(0, - new NextAction("gruul the dragonkiller shatter spread", ACTION_EMERGENCY + 6), nullptr))); + triggers.push_back(new TriggerNode("gruul the dragonkiller incoming shatter", { + NextAction("gruul the dragonkiller shatter spread", ACTION_EMERGENCY + 6) })); } void RaidGruulsLairStrategy::InitMultipliers(std::vector& multipliers) diff --git a/src/strategy/raids/icecrown/RaidIccStrategy.cpp b/src/strategy/raids/icecrown/RaidIccStrategy.cpp index 1acf1e78..e0dbe823 100644 --- a/src/strategy/raids/icecrown/RaidIccStrategy.cpp +++ b/src/strategy/raids/icecrown/RaidIccStrategy.cpp @@ -6,168 +6,168 @@ void RaidIccStrategy::InitTriggers(std::vector& triggers) { //Lord Marrogwar triggers.push_back(new TriggerNode("icc lm", - NextAction::array(0, new NextAction("icc lm tank position", ACTION_RAID + 5), - new NextAction("icc spike", ACTION_RAID + 3), nullptr))); + { NextAction("icc lm tank position", ACTION_RAID + 5), + NextAction("icc spike", ACTION_RAID + 3) })); //Lady Deathwhisper triggers.push_back(new TriggerNode("icc dark reckoning", - NextAction::array(0, new NextAction("icc dark reckoning", ACTION_MOVE + 5), nullptr))); + { NextAction("icc dark reckoning", ACTION_MOVE + 5) })); triggers.push_back(new TriggerNode("icc lady deathwhisper", - NextAction::array(0, new NextAction("icc ranged position lady deathwhisper", ACTION_MOVE + 2), - new NextAction("icc adds lady deathwhisper", ACTION_RAID + 3), - new NextAction("icc shade lady deathwhisper", ACTION_RAID + 4), nullptr))); + { NextAction("icc ranged position lady deathwhisper", ACTION_MOVE + 2), + NextAction("icc adds lady deathwhisper", ACTION_RAID + 3), + NextAction("icc shade lady deathwhisper", ACTION_RAID + 4) })); //Gunship Battle triggers.push_back(new TriggerNode("icc rotting frost giant tank position", - NextAction::array(0, new NextAction("icc rotting frost giant tank position", ACTION_RAID + 5), nullptr))); + { NextAction("icc rotting frost giant tank position", ACTION_RAID + 5) })); triggers.push_back(new TriggerNode("icc gunship cannon near", - NextAction::array(0, new NextAction("icc gunship enter cannon", ACTION_RAID + 6), nullptr))); + { NextAction("icc gunship enter cannon", ACTION_RAID + 6) })); triggers.push_back( new TriggerNode("icc in cannon", - NextAction::array(0, new NextAction("icc cannon fire", ACTION_RAID+5), nullptr))); + { NextAction("icc cannon fire", ACTION_RAID+5) })); triggers.push_back(new TriggerNode("icc gunship teleport ally", - NextAction::array(0, new NextAction("icc gunship teleport ally", ACTION_RAID + 4), nullptr))); + { NextAction("icc gunship teleport ally", ACTION_RAID + 4) })); triggers.push_back(new TriggerNode("icc gunship teleport horde", - NextAction::array(0, new NextAction("icc gunship teleport horde", ACTION_RAID + 4), nullptr))); + { NextAction("icc gunship teleport horde", ACTION_RAID + 4) })); //DBS triggers.push_back(new TriggerNode("icc dbs", - NextAction::array(0, new NextAction("icc dbs tank position", ACTION_RAID + 3), - new NextAction("icc adds dbs", ACTION_RAID + 5), nullptr))); + { NextAction("icc dbs tank position", ACTION_RAID + 3), + NextAction("icc adds dbs", ACTION_RAID + 5) })); triggers.push_back(new TriggerNode("icc dbs main tank rune of blood", - NextAction::array(0, new NextAction("taunt spell", ACTION_EMERGENCY + 4), nullptr))); + { NextAction("taunt spell", ACTION_EMERGENCY + 4) })); //DOGS triggers.push_back(new TriggerNode("icc stinky precious main tank mortal wound", - NextAction::array(0, new NextAction("taunt spell", ACTION_EMERGENCY + 4), nullptr))); + { NextAction("taunt spell", ACTION_EMERGENCY + 4) })); //FESTERGUT triggers.push_back(new TriggerNode("icc festergut group position", - NextAction::array(0, new NextAction("icc festergut group position", ACTION_MOVE + 4), nullptr))); + { NextAction("icc festergut group position", ACTION_MOVE + 4) })); triggers.push_back(new TriggerNode("icc festergut main tank gastric bloat", - NextAction::array(0, new NextAction("taunt spell", ACTION_EMERGENCY + 6), nullptr))); + { NextAction("taunt spell", ACTION_EMERGENCY + 6) })); triggers.push_back(new TriggerNode("icc festergut spore", - NextAction::array(0, new NextAction("icc festergut spore", ACTION_MOVE + 5), nullptr))); + { NextAction("icc festergut spore", ACTION_MOVE + 5) })); //ROTFACE triggers.push_back(new TriggerNode("icc rotface tank position", - NextAction::array(0, new NextAction("icc rotface tank position", ACTION_RAID + 5), nullptr))); + { NextAction("icc rotface tank position", ACTION_RAID + 5) })); triggers.push_back(new TriggerNode("icc rotface group position", - NextAction::array(0, new NextAction("icc rotface group position", ACTION_RAID + 6), nullptr))); + { NextAction("icc rotface group position", ACTION_RAID + 6) })); triggers.push_back(new TriggerNode("icc rotface move away from explosion", - NextAction::array(0, new NextAction("icc rotface move away from explosion", ACTION_RAID +7), nullptr))); + { NextAction("icc rotface move away from explosion", ACTION_RAID +7) })); //PP triggers.push_back(new TriggerNode("icc putricide volatile ooze", - NextAction::array(0, new NextAction("icc putricide volatile ooze", ACTION_RAID + 4), nullptr))); + { NextAction("icc putricide volatile ooze", ACTION_RAID + 4) })); triggers.push_back(new TriggerNode("icc putricide gas cloud", - NextAction::array(0, new NextAction("icc putricide gas cloud", ACTION_RAID + 5), nullptr))); + { NextAction("icc putricide gas cloud", ACTION_RAID + 5) })); triggers.push_back(new TriggerNode("icc putricide growing ooze puddle", - NextAction::array(0, new NextAction("icc putricide growing ooze puddle", ACTION_RAID + 3), nullptr))); + { NextAction("icc putricide growing ooze puddle", ACTION_RAID + 3) })); triggers.push_back(new TriggerNode("icc putricide main tank mutated plague", - NextAction::array(0, new NextAction("taunt spell", ACTION_RAID + 10), nullptr))); + { NextAction("taunt spell", ACTION_RAID + 10) })); triggers.push_back(new TriggerNode("icc putricide malleable goo", - NextAction::array(0, new NextAction("icc putricide avoid malleable goo", ACTION_RAID + 2), nullptr))); + { NextAction("icc putricide avoid malleable goo", ACTION_RAID + 2) })); //BPC triggers.push_back(new TriggerNode("icc bpc keleseth tank", - NextAction::array(0, new NextAction("icc bpc keleseth tank", ACTION_RAID + 1), nullptr))); + { NextAction("icc bpc keleseth tank", ACTION_RAID + 1) })); triggers.push_back(new TriggerNode("icc bpc main tank", - NextAction::array(0, new NextAction("icc bpc main tank", ACTION_RAID + 3), nullptr))); + { NextAction("icc bpc main tank", ACTION_RAID + 3) })); triggers.push_back(new TriggerNode("icc bpc empowered vortex", - NextAction::array(0, new NextAction("icc bpc empowered vortex", ACTION_RAID + 4), nullptr))); + { NextAction("icc bpc empowered vortex", ACTION_RAID + 4) })); triggers.push_back(new TriggerNode("icc bpc kinetic bomb", - NextAction::array(0, new NextAction("icc bpc kinetic bomb", ACTION_RAID + 6), nullptr))); + { NextAction("icc bpc kinetic bomb", ACTION_RAID + 6) })); triggers.push_back(new TriggerNode("icc bpc ball of flame", - NextAction::array(0, new NextAction("icc bpc ball of flame", ACTION_RAID + 7), nullptr))); + { NextAction("icc bpc ball of flame", ACTION_RAID + 7) })); //BQL triggers.push_back(new TriggerNode("icc bql group position", - NextAction::array(0, new NextAction("icc bql group position", ACTION_RAID), nullptr))); + { NextAction("icc bql group position", ACTION_RAID) })); triggers.push_back(new TriggerNode("icc bql pact of darkfallen", - NextAction::array(0, new NextAction("icc bql pact of darkfallen", ACTION_RAID +1), nullptr))); + { NextAction("icc bql pact of darkfallen", ACTION_RAID +1) })); triggers.push_back(new TriggerNode("icc bql vampiric bite", - NextAction::array(0, new NextAction("icc bql vampiric bite", ACTION_EMERGENCY + 5), nullptr))); + { NextAction("icc bql vampiric bite", ACTION_EMERGENCY + 5) })); //Sister Svalna triggers.push_back(new TriggerNode("icc valkyre spear", - NextAction::array(0, new NextAction("icc valkyre spear", ACTION_EMERGENCY + 5), nullptr))); + { NextAction("icc valkyre spear", ACTION_EMERGENCY + 5) })); triggers.push_back(new TriggerNode("icc sister svalna", - NextAction::array(0, new NextAction("icc sister svalna", ACTION_RAID + 5), nullptr))); + { NextAction("icc sister svalna", ACTION_RAID + 5) })); //VDW triggers.push_back(new TriggerNode("icc valithria group", - NextAction::array(0, new NextAction("icc valithria group", ACTION_RAID + 1), nullptr))); + { NextAction("icc valithria group", ACTION_RAID + 1) })); triggers.push_back(new TriggerNode("icc valithria portal", - NextAction::array(0, new NextAction("icc valithria portal", ACTION_RAID + 5), nullptr))); + { NextAction("icc valithria portal", ACTION_RAID + 5) })); triggers.push_back(new TriggerNode("icc valithria heal", - NextAction::array(0, new NextAction("icc valithria heal", ACTION_RAID+2), nullptr))); + { NextAction("icc valithria heal", ACTION_RAID+2) })); triggers.push_back(new TriggerNode("icc valithria dream cloud", - NextAction::array(0, new NextAction("icc valithria dream cloud", ACTION_RAID + 4), nullptr))); + { NextAction("icc valithria dream cloud", ACTION_RAID + 4) })); //SINDRAGOSA triggers.push_back(new TriggerNode("icc sindragosa group position", - NextAction::array(0, new NextAction("icc sindragosa group position", ACTION_RAID + 1), nullptr))); + { NextAction("icc sindragosa group position", ACTION_RAID + 1) })); triggers.push_back(new TriggerNode("icc sindragosa frost beacon", - NextAction::array(0, new NextAction("icc sindragosa frost beacon", ACTION_RAID + 5), nullptr))); + { NextAction("icc sindragosa frost beacon", ACTION_RAID + 5) })); triggers.push_back(new TriggerNode("icc sindragosa blistering cold", - NextAction::array(0, new NextAction("icc sindragosa blistering cold", ACTION_EMERGENCY + 4), nullptr))); + { NextAction("icc sindragosa blistering cold", ACTION_EMERGENCY + 4) })); triggers.push_back(new TriggerNode("icc sindragosa unchained magic", - NextAction::array(0, new NextAction("icc sindragosa unchained magic", ACTION_RAID + 2), nullptr))); + { NextAction("icc sindragosa unchained magic", ACTION_RAID + 2) })); triggers.push_back(new TriggerNode("icc sindragosa chilled to the bone", - NextAction::array(0, new NextAction("icc sindragosa chilled to the bone", ACTION_RAID + 2), nullptr))); + { NextAction("icc sindragosa chilled to the bone", ACTION_RAID + 2) })); triggers.push_back(new TriggerNode("icc sindragosa mystic buffet", - NextAction::array(0, new NextAction("icc sindragosa mystic buffet", ACTION_RAID + 3), nullptr))); + { NextAction("icc sindragosa mystic buffet", ACTION_RAID + 3) })); triggers.push_back(new TriggerNode("icc sindragosa main tank mystic buffet", - NextAction::array(0, new NextAction("taunt spell", ACTION_EMERGENCY + 3), nullptr))); + { NextAction("taunt spell", ACTION_EMERGENCY + 3) })); triggers.push_back(new TriggerNode("icc sindragosa frost bomb", - NextAction::array(0, new NextAction("icc sindragosa frost bomb", ACTION_RAID + 7), nullptr))); + { NextAction("icc sindragosa frost bomb", ACTION_RAID + 7) })); triggers.push_back(new TriggerNode("icc sindragosa tank swap position", - NextAction::array(0, new NextAction("icc sindragosa tank swap position", ACTION_EMERGENCY + 2), nullptr))); + { NextAction("icc sindragosa tank swap position", ACTION_EMERGENCY + 2) })); //LICH KING triggers.push_back(new TriggerNode("icc lich king shadow trap", - NextAction::array(0, new NextAction("icc lich king shadow trap", ACTION_RAID + 6), nullptr))); + { NextAction("icc lich king shadow trap", ACTION_RAID + 6) })); triggers.push_back(new TriggerNode("icc lich king necrotic plague", - NextAction::array(0, new NextAction("icc lich king necrotic plague", ACTION_RAID + 3), nullptr))); + { NextAction("icc lich king necrotic plague", ACTION_RAID + 3) })); triggers.push_back(new TriggerNode("icc lich king winter", - NextAction::array(0, new NextAction("icc lich king winter", ACTION_RAID +5), nullptr))); + { NextAction("icc lich king winter", ACTION_RAID +5) })); triggers.push_back(new TriggerNode("icc lich king adds", - NextAction::array(0, new NextAction("icc lich king adds", ACTION_RAID +2), nullptr))); + { NextAction("icc lich king adds", ACTION_RAID +2) })); } void RaidIccStrategy::InitMultipliers(std::vector& multipliers) diff --git a/src/strategy/raids/karazhan/RaidKarazhanStrategy.cpp b/src/strategy/raids/karazhan/RaidKarazhanStrategy.cpp index 041651af..04578f08 100644 --- a/src/strategy/raids/karazhan/RaidKarazhanStrategy.cpp +++ b/src/strategy/raids/karazhan/RaidKarazhanStrategy.cpp @@ -5,139 +5,139 @@ void RaidKarazhanStrategy::InitTriggers(std::vector& triggers) { // Trash triggers.push_back(new TriggerNode("mana warp is about to explode", - NextAction::array(0, new NextAction("mana warp stun creature before warp breach", ACTION_EMERGENCY + 6), nullptr) + { NextAction("mana warp stun creature before warp breach", ACTION_EMERGENCY + 6) } )); // Attumen the Huntsman triggers.push_back(new TriggerNode("attumen the huntsman need target priority", - NextAction::array(0, new NextAction("attumen the huntsman mark target", ACTION_RAID + 1), nullptr) + { NextAction("attumen the huntsman mark target", ACTION_RAID + 1) } )); triggers.push_back(new TriggerNode("attumen the huntsman attumen spawned", - NextAction::array(0, new NextAction("attumen the huntsman split bosses", ACTION_RAID + 2), nullptr) + { NextAction("attumen the huntsman split bosses", ACTION_RAID + 2) } )); triggers.push_back(new TriggerNode("attumen the huntsman attumen is mounted", - NextAction::array(0, new NextAction("attumen the huntsman stack behind", ACTION_RAID + 1), nullptr) + { NextAction("attumen the huntsman stack behind", ACTION_RAID + 1) } )); triggers.push_back(new TriggerNode("attumen the huntsman boss wipes aggro when mounting", - NextAction::array(0, new NextAction("attumen the huntsman manage dps timer", ACTION_RAID + 2), nullptr) + { NextAction("attumen the huntsman manage dps timer", ACTION_RAID + 2) } )); // Moroes triggers.push_back(new TriggerNode("moroes boss engaged by main tank", - NextAction::array(0, new NextAction("moroes main tank attack boss", ACTION_RAID + 1), nullptr) + { NextAction("moroes main tank attack boss", ACTION_RAID + 1) } )); triggers.push_back(new TriggerNode("moroes need target priority", - NextAction::array(0, new NextAction("moroes mark target", ACTION_RAID + 1), nullptr) + { NextAction("moroes mark target", ACTION_RAID + 1) } )); // Maiden of Virtue triggers.push_back(new TriggerNode("maiden of virtue healers are stunned by repentance", - NextAction::array(0, new NextAction("maiden of virtue move boss to healer", ACTION_RAID + 1), nullptr) + { NextAction("maiden of virtue move boss to healer", ACTION_RAID + 1) } )); triggers.push_back(new TriggerNode("maiden of virtue holy wrath deals chain damage", - NextAction::array(0, new NextAction("maiden of virtue position ranged", ACTION_RAID + 1), nullptr) + { NextAction("maiden of virtue position ranged", ACTION_RAID + 1) } )); // The Big Bad Wolf triggers.push_back(new TriggerNode("big bad wolf boss is chasing little red riding hood", - NextAction::array(0, new NextAction("big bad wolf run away from boss", ACTION_EMERGENCY + 6), nullptr) + { NextAction("big bad wolf run away from boss", ACTION_EMERGENCY + 6) } )); triggers.push_back(new TriggerNode("big bad wolf boss engaged by tank", - NextAction::array(0, new NextAction("big bad wolf position boss", ACTION_RAID + 1), nullptr) + { NextAction("big bad wolf position boss", ACTION_RAID + 1) } )); // Romulo and Julianne triggers.push_back(new TriggerNode("romulo and julianne both bosses revived", - NextAction::array(0, new NextAction("romulo and julianne mark target", ACTION_RAID + 1), nullptr) + { NextAction("romulo and julianne mark target", ACTION_RAID + 1) } )); // The Wizard of Oz triggers.push_back(new TriggerNode("wizard of oz need target priority", - NextAction::array(0, new NextAction("wizard of oz mark target", ACTION_RAID + 1), nullptr) + { NextAction("wizard of oz mark target", ACTION_RAID + 1) } )); triggers.push_back(new TriggerNode("wizard of oz strawman is vulnerable to fire", - NextAction::array(0, new NextAction("wizard of oz scorch strawman", ACTION_RAID + 2), nullptr) + { NextAction("wizard of oz scorch strawman", ACTION_RAID + 2) } )); // The Curator triggers.push_back(new TriggerNode("the curator astral flare spawned", - NextAction::array(0, new NextAction("the curator mark astral flare", ACTION_RAID + 1), nullptr) + { NextAction("the curator mark astral flare", ACTION_RAID + 1) } )); triggers.push_back(new TriggerNode("the curator boss engaged by tanks", - NextAction::array(0, new NextAction("the curator position boss", ACTION_RAID + 2), nullptr) + { NextAction("the curator position boss", ACTION_RAID + 2) } )); triggers.push_back(new TriggerNode("the curator astral flares cast arcing sear", - NextAction::array(0, new NextAction("the curator spread ranged", ACTION_RAID + 2), nullptr) + { NextAction("the curator spread ranged", ACTION_RAID + 2) } )); // Terestian Illhoof triggers.push_back(new TriggerNode("terestian illhoof need target priority", - NextAction::array(0, new NextAction("terestian illhoof mark target", ACTION_RAID + 1), nullptr) + { NextAction("terestian illhoof mark target", ACTION_RAID + 1) } )); // Shade of Aran triggers.push_back(new TriggerNode("shade of aran arcane explosion is casting", - NextAction::array(0, new NextAction("shade of aran run away from arcane explosion", ACTION_EMERGENCY + 6), nullptr) + { NextAction("shade of aran run away from arcane explosion", ACTION_EMERGENCY + 6) } )); triggers.push_back(new TriggerNode("shade of aran flame wreath is active", - NextAction::array(0, new NextAction("shade of aran stop moving during flame wreath", ACTION_EMERGENCY + 7), nullptr) + { NextAction("shade of aran stop moving during flame wreath", ACTION_EMERGENCY + 7) } )); triggers.push_back(new TriggerNode("shade of aran conjured elementals summoned", - NextAction::array(0, new NextAction("shade of aran mark conjured elemental", ACTION_RAID + 1), nullptr) + { NextAction("shade of aran mark conjured elemental", ACTION_RAID + 1) } )); triggers.push_back(new TriggerNode("shade of aran boss uses counterspell and blizzard", - NextAction::array(0, new NextAction("shade of aran ranged maintain distance", ACTION_RAID + 2), nullptr) + { NextAction("shade of aran ranged maintain distance", ACTION_RAID + 2) } )); // Netherspite triggers.push_back(new TriggerNode("netherspite red beam is active", - NextAction::array(0, new NextAction("netherspite block red beam", ACTION_EMERGENCY + 8), nullptr) + { NextAction("netherspite block red beam", ACTION_EMERGENCY + 8) } )); triggers.push_back(new TriggerNode("netherspite blue beam is active", - NextAction::array(0, new NextAction("netherspite block blue beam", ACTION_EMERGENCY + 8), nullptr) + { NextAction("netherspite block blue beam", ACTION_EMERGENCY + 8) } )); triggers.push_back(new TriggerNode("netherspite green beam is active", - NextAction::array(0, new NextAction("netherspite block green beam", ACTION_EMERGENCY + 8), nullptr) + { NextAction("netherspite block green beam", ACTION_EMERGENCY + 8) } )); triggers.push_back(new TriggerNode("netherspite bot is not beam blocker", - NextAction::array(0, new NextAction("netherspite avoid beam and void zone", ACTION_EMERGENCY + 7), nullptr) + { NextAction("netherspite avoid beam and void zone", ACTION_EMERGENCY + 7) } )); triggers.push_back(new TriggerNode("netherspite boss is banished", - NextAction::array(0, new NextAction("netherspite banish phase avoid void zone", ACTION_RAID + 1), nullptr) + { NextAction("netherspite banish phase avoid void zone", ACTION_RAID + 1) } )); triggers.push_back(new TriggerNode("netherspite need to manage timers and trackers", - NextAction::array(0, new NextAction("netherspite manage timers and trackers", ACTION_EMERGENCY + 10), nullptr) + { NextAction("netherspite manage timers and trackers", ACTION_EMERGENCY + 10) } )); // Prince Malchezaar triggers.push_back(new TriggerNode("prince malchezaar bot is enfeebled", - NextAction::array(0, new NextAction("prince malchezaar enfeebled avoid hazard", ACTION_EMERGENCY + 6), nullptr) + { NextAction("prince malchezaar enfeebled avoid hazard", ACTION_EMERGENCY + 6) } )); triggers.push_back(new TriggerNode("prince malchezaar infernals are spawned", - NextAction::array(0, new NextAction("prince malchezaar non tank avoid infernal", ACTION_EMERGENCY + 1), nullptr) + { NextAction("prince malchezaar non tank avoid infernal", ACTION_EMERGENCY + 1) } )); triggers.push_back(new TriggerNode("prince malchezaar boss engaged by main tank", - NextAction::array(0, new NextAction("prince malchezaar main tank movement", ACTION_EMERGENCY + 6), nullptr) + { NextAction("prince malchezaar main tank movement", ACTION_EMERGENCY + 6) } )); // Nightbane triggers.push_back(new TriggerNode("nightbane boss engaged by main tank", - NextAction::array(0, new NextAction("nightbane ground phase position boss", ACTION_RAID + 1), nullptr) + { NextAction("nightbane ground phase position boss", ACTION_RAID + 1) } )); triggers.push_back(new TriggerNode("nightbane ranged bots are in charred earth", - NextAction::array(0, new NextAction("nightbane ground phase rotate ranged positions", ACTION_EMERGENCY + 1), nullptr) + { NextAction("nightbane ground phase rotate ranged positions", ACTION_EMERGENCY + 1) } )); triggers.push_back(new TriggerNode("nightbane main tank is susceptible to fear", - NextAction::array(0, new NextAction("nightbane cast fear ward on main tank", ACTION_RAID + 2), nullptr) + { NextAction("nightbane cast fear ward on main tank", ACTION_RAID + 2) } )); triggers.push_back(new TriggerNode("nightbane pets ignore collision to chase flying boss", - NextAction::array(0, new NextAction("nightbane control pet aggression", ACTION_RAID + 2), nullptr) + { NextAction("nightbane control pet aggression", ACTION_RAID + 2) } )); triggers.push_back(new TriggerNode("nightbane boss is flying", - NextAction::array(0, new NextAction("nightbane flight phase movement", ACTION_RAID + 1), nullptr) + { NextAction("nightbane flight phase movement", ACTION_RAID + 1) } )); triggers.push_back(new TriggerNode("nightbane need to manage timers and trackers", - NextAction::array(0, new NextAction("nightbane manage timers and trackers", ACTION_EMERGENCY + 10), nullptr) + { NextAction("nightbane manage timers and trackers", ACTION_EMERGENCY + 10) } )); } diff --git a/src/strategy/raids/magtheridon/RaidMagtheridonStrategy.cpp b/src/strategy/raids/magtheridon/RaidMagtheridonStrategy.cpp index 27281dde..73d24082 100644 --- a/src/strategy/raids/magtheridon/RaidMagtheridonStrategy.cpp +++ b/src/strategy/raids/magtheridon/RaidMagtheridonStrategy.cpp @@ -3,35 +3,35 @@ void RaidMagtheridonStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("magtheridon incoming blast nova", NextAction::array(0, - new NextAction("magtheridon use manticron cube", ACTION_EMERGENCY + 10), nullptr))); + triggers.push_back(new TriggerNode("magtheridon incoming blast nova", { + NextAction("magtheridon use manticron cube", ACTION_EMERGENCY + 10) })); - triggers.push_back(new TriggerNode("magtheridon need to manage timers and assignments", NextAction::array(0, - new NextAction("magtheridon manage timers and assignments", ACTION_EMERGENCY + 1), nullptr))); + triggers.push_back(new TriggerNode("magtheridon need to manage timers and assignments", { + NextAction("magtheridon manage timers and assignments", ACTION_EMERGENCY + 1) })); - triggers.push_back(new TriggerNode("magtheridon burning abyssal spawned", NextAction::array(0, - new NextAction("magtheridon warlock cc burning abyssal", ACTION_RAID + 3), nullptr))); + triggers.push_back(new TriggerNode("magtheridon burning abyssal spawned", { + NextAction("magtheridon warlock cc burning abyssal", ACTION_RAID + 3) })); - triggers.push_back(new TriggerNode("magtheridon boss engaged by ranged", NextAction::array(0, - new NextAction("magtheridon spread ranged", ACTION_RAID + 2), nullptr))); + triggers.push_back(new TriggerNode("magtheridon boss engaged by ranged", { + NextAction("magtheridon spread ranged", ACTION_RAID + 2) })); - triggers.push_back(new TriggerNode("magtheridon pulling west and east channelers", NextAction::array(0, - new NextAction("magtheridon misdirect hellfire channelers", ACTION_RAID + 2), nullptr))); + triggers.push_back(new TriggerNode("magtheridon pulling west and east channelers", { + NextAction("magtheridon misdirect hellfire channelers", ACTION_RAID + 2) })); - triggers.push_back(new TriggerNode("magtheridon boss engaged by main tank", NextAction::array(0, - new NextAction("magtheridon main tank position boss", ACTION_RAID + 2), nullptr))); + triggers.push_back(new TriggerNode("magtheridon boss engaged by main tank", { + NextAction("magtheridon main tank position boss", ACTION_RAID + 2) })); - triggers.push_back(new TriggerNode("magtheridon first three channelers engaged by main tank", NextAction::array(0, - new NextAction("magtheridon main tank attack first three channelers", ACTION_RAID + 1), nullptr))); + triggers.push_back(new TriggerNode("magtheridon first three channelers engaged by main tank", { + NextAction("magtheridon main tank attack first three channelers", ACTION_RAID + 1) })); - triggers.push_back(new TriggerNode("magtheridon nw channeler engaged by first assist tank", NextAction::array(0, - new NextAction("magtheridon first assist tank attack nw channeler", ACTION_RAID + 1), nullptr))); + triggers.push_back(new TriggerNode("magtheridon nw channeler engaged by first assist tank", { + NextAction("magtheridon first assist tank attack nw channeler", ACTION_RAID + 1) })); - triggers.push_back(new TriggerNode("magtheridon ne channeler engaged by second assist tank", NextAction::array(0, - new NextAction("magtheridon second assist tank attack ne channeler", ACTION_RAID + 1), nullptr))); + triggers.push_back(new TriggerNode("magtheridon ne channeler engaged by second assist tank", { + NextAction("magtheridon second assist tank attack ne channeler", ACTION_RAID + 1) })); - triggers.push_back(new TriggerNode("magtheridon determining kill order", NextAction::array(0, - new NextAction("magtheridon assign dps priority", ACTION_RAID + 1), nullptr))); + triggers.push_back(new TriggerNode("magtheridon determining kill order", { + NextAction("magtheridon assign dps priority", ACTION_RAID + 1) })); } void RaidMagtheridonStrategy::InitMultipliers(std::vector& multipliers) diff --git a/src/strategy/raids/moltencore/RaidMcStrategy.cpp b/src/strategy/raids/moltencore/RaidMcStrategy.cpp index c6a5042e..3eddb76a 100644 --- a/src/strategy/raids/moltencore/RaidMcStrategy.cpp +++ b/src/strategy/raids/moltencore/RaidMcStrategy.cpp @@ -8,69 +8,69 @@ void RaidMcStrategy::InitTriggers(std::vector& triggers) // Lucifron triggers.push_back( new TriggerNode("mc lucifron shadow resistance", - NextAction::array(0, new NextAction("mc lucifron shadow resistance", ACTION_RAID), nullptr))); + { NextAction("mc lucifron shadow resistance", ACTION_RAID) })); // Magmadar // TODO: Fear ward / tremor totem, or general anti-fear strat development. Same as King Dred (Drak'Tharon) and faction commander (Nexus). triggers.push_back( new TriggerNode("mc magmadar fire resistance", - NextAction::array(0, new NextAction("mc magmadar fire resistance", ACTION_RAID), nullptr))); + { NextAction("mc magmadar fire resistance", ACTION_RAID) })); // Gehennas triggers.push_back( new TriggerNode("mc gehennas shadow resistance", - NextAction::array(0, new NextAction("mc gehennas shadow resistance", ACTION_RAID), nullptr))); + { NextAction("mc gehennas shadow resistance", ACTION_RAID) })); // Garr triggers.push_back( new TriggerNode("mc garr fire resistance", - NextAction::array(0, new NextAction("mc garr fire resistance", ACTION_RAID), nullptr))); + { NextAction("mc garr fire resistance", ACTION_RAID) })); // Baron Geddon triggers.push_back( new TriggerNode("mc baron geddon fire resistance", - NextAction::array(0, new NextAction("mc baron geddon fire resistance", ACTION_RAID), nullptr))); + { NextAction("mc baron geddon fire resistance", ACTION_RAID) })); triggers.push_back( new TriggerNode("mc living bomb debuff", - NextAction::array(0, new NextAction("mc move from group", ACTION_RAID), nullptr))); + { NextAction("mc move from group", ACTION_RAID) })); triggers.push_back( new TriggerNode("mc baron geddon inferno", - NextAction::array(0, new NextAction("mc move from baron geddon", ACTION_RAID), nullptr))); + { NextAction("mc move from baron geddon", ACTION_RAID) })); // Shazzrah triggers.push_back( new TriggerNode("mc shazzrah ranged", - NextAction::array(0, new NextAction("mc shazzrah move away", ACTION_RAID), nullptr))); + { NextAction("mc shazzrah move away", ACTION_RAID) })); // Sulfuron Harbinger // Alternatively, shadow resistance is also possible. triggers.push_back( new TriggerNode("mc sulfuron harbinger fire resistance", - NextAction::array(0, new NextAction("mc sulfuron harbinger fire resistance", ACTION_RAID), nullptr))); + { NextAction("mc sulfuron harbinger fire resistance", ACTION_RAID) })); // Golemagg the Incinerator triggers.push_back( new TriggerNode("mc golemagg fire resistance", - NextAction::array(0, new NextAction("mc golemagg fire resistance", ACTION_RAID), nullptr))); + { NextAction("mc golemagg fire resistance", ACTION_RAID) })); triggers.push_back( new TriggerNode("mc golemagg mark boss", - NextAction::array(0, new NextAction("mc golemagg mark boss", ACTION_RAID), nullptr))); + { NextAction("mc golemagg mark boss", ACTION_RAID) })); triggers.push_back( new TriggerNode("mc golemagg is main tank", - NextAction::array(0, new NextAction("mc golemagg main tank attack golemagg", ACTION_RAID), nullptr))); + { NextAction("mc golemagg main tank attack golemagg", ACTION_RAID) })); triggers.push_back( new TriggerNode("mc golemagg is assist tank", - NextAction::array(0, new NextAction("mc golemagg assist tank attack core rager", ACTION_RAID), nullptr))); + { NextAction("mc golemagg assist tank attack core rager", ACTION_RAID) })); // Majordomo Executus triggers.push_back( new TriggerNode("mc majordomo shadow resistance", - NextAction::array(0, new NextAction("mc majordomo shadow resistance", ACTION_RAID), nullptr))); + { NextAction("mc majordomo shadow resistance", ACTION_RAID) })); // Ragnaros triggers.push_back( new TriggerNode("mc ragnaros fire resistance", - NextAction::array(0, new NextAction("mc ragnaros fire resistance", ACTION_RAID), nullptr))); + { NextAction("mc ragnaros fire resistance", ACTION_RAID) })); } void RaidMcStrategy::InitMultipliers(std::vector& multipliers) diff --git a/src/strategy/raids/obsidiansanctum/RaidOsStrategy.cpp b/src/strategy/raids/obsidiansanctum/RaidOsStrategy.cpp index 244fdb11..4468de99 100644 --- a/src/strategy/raids/obsidiansanctum/RaidOsStrategy.cpp +++ b/src/strategy/raids/obsidiansanctum/RaidOsStrategy.cpp @@ -6,24 +6,24 @@ void RaidOsStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( new TriggerNode("sartharion tank", - NextAction::array(0, new NextAction("sartharion tank position", ACTION_MOVE), nullptr))); + { NextAction("sartharion tank position", ACTION_MOVE) })); triggers.push_back( new TriggerNode("twilight fissure", - NextAction::array(0, new NextAction("avoid twilight fissure", ACTION_RAID + 2), nullptr))); + { NextAction("avoid twilight fissure", ACTION_RAID + 2) })); triggers.push_back( new TriggerNode("flame tsunami", - NextAction::array(0, new NextAction("avoid flame tsunami", ACTION_RAID + 1), nullptr))); + { NextAction("avoid flame tsunami", ACTION_RAID + 1) })); triggers.push_back( new TriggerNode("sartharion dps", - NextAction::array(0, new NextAction("sartharion attack priority", ACTION_RAID), nullptr))); + { NextAction("sartharion attack priority", ACTION_RAID) })); // Flank dragon positioning triggers.push_back(new TriggerNode("sartharion melee positioning", - NextAction::array(0, new NextAction("rear flank", ACTION_MOVE + 4), nullptr))); + { NextAction("rear flank", ACTION_MOVE + 4) })); triggers.push_back(new TriggerNode("twilight portal enter", - NextAction::array(0, new NextAction("enter twilight portal", ACTION_RAID + 1), nullptr))); + { NextAction("enter twilight portal", ACTION_RAID + 1) })); triggers.push_back(new TriggerNode("twilight portal exit", - NextAction::array(0, new NextAction("exit twilight portal", ACTION_RAID + 1), nullptr))); + { NextAction("exit twilight portal", ACTION_RAID + 1) })); } void RaidOsStrategy::InitMultipliers(std::vector &multipliers) diff --git a/src/strategy/raids/onyxia/RaidOnyxiaStrategy.cpp b/src/strategy/raids/onyxia/RaidOnyxiaStrategy.cpp index 2e4d50d4..b1217f59 100644 --- a/src/strategy/raids/onyxia/RaidOnyxiaStrategy.cpp +++ b/src/strategy/raids/onyxia/RaidOnyxiaStrategy.cpp @@ -5,23 +5,23 @@ void RaidOnyxiaStrategy::InitTriggers(std::vector& triggers) // ----------- Phase 1 (100% - 65%) ----------- triggers.push_back(new TriggerNode( - "ony near tail", NextAction::array(0, new NextAction("ony move to side", ACTION_RAID + 2), nullptr))); + "ony near tail", { NextAction("ony move to side", ACTION_RAID + 2) })); triggers.push_back(new TriggerNode( - "ony avoid eggs", NextAction::array(0, new NextAction("ony avoid eggs move", ACTION_EMERGENCY + 5), nullptr))); + "ony avoid eggs", { NextAction("ony avoid eggs move", ACTION_EMERGENCY + 5) })); // ----------- Phase 2 (65% - 40%) ----------- triggers.push_back( new TriggerNode("ony deep breath warning", - NextAction::array(0, new NextAction("ony move to safe zone", ACTION_EMERGENCY + 5), nullptr))); + { NextAction("ony move to safe zone", ACTION_EMERGENCY + 5) })); triggers.push_back( new TriggerNode("ony fireball splash incoming", - NextAction::array(0, new NextAction("ony spread out", ACTION_EMERGENCY + 2), nullptr))); + { NextAction("ony spread out", ACTION_EMERGENCY + 2) })); triggers.push_back(new TriggerNode( - "ony whelps spawn", NextAction::array(0, new NextAction("ony kill whelps", ACTION_RAID + 1), nullptr))); + "ony whelps spawn", { NextAction("ony kill whelps", ACTION_RAID + 1) })); } void RaidOnyxiaStrategy::InitMultipliers(std::vector& multipliers) diff --git a/src/strategy/raids/ulduar/RaidUlduarStrategy.cpp b/src/strategy/raids/ulduar/RaidUlduarStrategy.cpp index 59b7b24d..3b9a426c 100644 --- a/src/strategy/raids/ulduar/RaidUlduarStrategy.cpp +++ b/src/strategy/raids/ulduar/RaidUlduarStrategy.cpp @@ -9,312 +9,312 @@ void RaidUlduarStrategy::InitTriggers(std::vector& triggers) // triggers.push_back(new TriggerNode( "flame leviathan vehicle near", - NextAction::array(0, new NextAction("flame leviathan enter vehicle", ACTION_RAID + 2), nullptr))); + { NextAction("flame leviathan enter vehicle", ACTION_RAID + 2) })); triggers.push_back(new TriggerNode( "flame leviathan on vehicle", - NextAction::array(0, new NextAction("flame leviathan vehicle", ACTION_RAID + 1), nullptr))); + { NextAction("flame leviathan vehicle", ACTION_RAID + 1) })); // // Razorscale // triggers.push_back(new TriggerNode( "razorscale avoid devouring flames", - NextAction::array(0, new NextAction("razorscale avoid devouring flames", ACTION_RAID + 1), nullptr))); + { NextAction("razorscale avoid devouring flames", ACTION_RAID + 1) })); triggers.push_back(new TriggerNode( "razorscale avoid sentinel", - NextAction::array(0, new NextAction("razorscale avoid sentinel", ACTION_RAID + 2), nullptr))); + { NextAction("razorscale avoid sentinel", ACTION_RAID + 2) })); triggers.push_back(new TriggerNode( "razorscale flying alone", - NextAction::array(0, new NextAction("razorscale ignore flying alone", ACTION_MOVE + 5), nullptr))); + { NextAction("razorscale ignore flying alone", ACTION_MOVE + 5) })); triggers.push_back(new TriggerNode( "razorscale avoid whirlwind", - NextAction::array(0, new NextAction("razorscale avoid whirlwind", ACTION_RAID + 3), nullptr))); + { NextAction("razorscale avoid whirlwind", ACTION_RAID + 3) })); triggers.push_back(new TriggerNode( "razorscale grounded", - NextAction::array(0, new NextAction("razorscale grounded", ACTION_RAID), nullptr))); + { NextAction("razorscale grounded", ACTION_RAID) })); triggers.push_back(new TriggerNode( "razorscale harpoon trigger", - NextAction::array(0, new NextAction("razorscale harpoon action", ACTION_MOVE), nullptr))); + { NextAction("razorscale harpoon action", ACTION_MOVE) })); triggers.push_back(new TriggerNode( "razorscale fuse armor trigger", - NextAction::array(0, new NextAction("razorscale fuse armor action", ACTION_RAID + 2), nullptr))); + { NextAction("razorscale fuse armor action", ACTION_RAID + 2) })); triggers.push_back(new TriggerNode( "razorscale fire resistance trigger", - NextAction::array(0, new NextAction("razorscale fire resistance action", ACTION_RAID), nullptr))); + { NextAction("razorscale fire resistance action", ACTION_RAID) })); // // Ignis // triggers.push_back(new TriggerNode( "ignis fire resistance trigger", - NextAction::array(0, new NextAction("ignis fire resistance action", ACTION_RAID), nullptr))); + { NextAction("ignis fire resistance action", ACTION_RAID) })); // // Iron Assembly // triggers.push_back(new TriggerNode( "iron assembly lightning tendrils trigger", - NextAction::array(0, new NextAction("iron assembly lightning tendrils action", ACTION_RAID), nullptr))); + { NextAction("iron assembly lightning tendrils action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "iron assembly overload trigger", - NextAction::array(0, new NextAction("iron assembly overload action", ACTION_RAID), nullptr))); + { NextAction("iron assembly overload action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "iron assembly rune of power trigger", - NextAction::array(0, new NextAction("iron assembly rune of power action", ACTION_RAID), nullptr))); + { NextAction("iron assembly rune of power action", ACTION_RAID) })); // // Kologarn // triggers.push_back(new TriggerNode( "kologarn fall from floor trigger", - NextAction::array(0, new NextAction("kologarn fall from floor action", ACTION_RAID + 1), nullptr))); + { NextAction("kologarn fall from floor action", ACTION_RAID + 1) })); triggers.push_back(new TriggerNode( "kologarn rti target trigger", - NextAction::array(0, new NextAction("kologarn rti target action", ACTION_RAID + 1), nullptr))); + { NextAction("kologarn rti target action", ACTION_RAID + 1) })); triggers.push_back(new TriggerNode( "kologarn eyebeam trigger", - NextAction::array(0, new NextAction("kologarn eyebeam action", ACTION_RAID + 1), nullptr))); + { NextAction("kologarn eyebeam action", ACTION_RAID + 1) })); triggers.push_back(new TriggerNode( "kologarn attack dps target trigger", - NextAction::array(0, new NextAction("attack rti target", ACTION_RAID), nullptr))); + { NextAction("attack rti target", ACTION_RAID) })); triggers.push_back(new TriggerNode( "kologarn mark dps target trigger", - NextAction::array(0, new NextAction("kologarn mark dps target action", ACTION_RAID), nullptr))); + { NextAction("kologarn mark dps target action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "kologarn nature resistance trigger", - NextAction::array(0, new NextAction("kologarn nature resistance action", ACTION_RAID), nullptr))); + { NextAction("kologarn nature resistance action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "kologarn rubble slowdown trigger", - NextAction::array(0, new NextAction("kologarn rubble slowdown action", ACTION_RAID), nullptr))); + { NextAction("kologarn rubble slowdown action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "kologarn crunch armor trigger", - NextAction::array(0, new NextAction("kologarn crunch armor action", ACTION_RAID), nullptr))); + { NextAction("kologarn crunch armor action", ACTION_RAID) })); // // Auriaya // triggers.push_back(new TriggerNode( "auriaya fall from floor trigger", - NextAction::array(0, new NextAction("auriaya fall from floor action", ACTION_RAID), nullptr))); + { NextAction("auriaya fall from floor action", ACTION_RAID) })); // // Hodir // triggers.push_back(new TriggerNode( "hodir near snowpacked icicle", - NextAction::array(0, new NextAction("hodir move snowpacked icicle", ACTION_RAID + 1), nullptr))); + { NextAction("hodir move snowpacked icicle", ACTION_RAID + 1) })); triggers.push_back(new TriggerNode( "hodir biting cold", - NextAction::array(0, new NextAction("hodir biting cold jump", ACTION_RAID), nullptr))); + { NextAction("hodir biting cold jump", ACTION_RAID) })); triggers.push_back(new TriggerNode( "hodir frost resistance trigger", - NextAction::array(0, new NextAction("hodir frost resistance action", ACTION_RAID), nullptr))); + { NextAction("hodir frost resistance action", ACTION_RAID) })); // // Freya // triggers.push_back(new TriggerNode( "freya near nature bomb", - NextAction::array(0, new NextAction("freya move away nature bomb", ACTION_RAID), nullptr))); + { NextAction("freya move away nature bomb", ACTION_RAID) })); triggers.push_back(new TriggerNode( "freya nature resistance trigger", - NextAction::array(0, new NextAction("freya nature resistance action", ACTION_RAID), nullptr))); + { NextAction("freya nature resistance action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "freya fire resistance trigger", - NextAction::array(0, new NextAction("freya fire resistance action", ACTION_RAID), nullptr))); + { NextAction("freya fire resistance action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "freya mark dps target trigger", - NextAction::array(0, new NextAction("freya mark dps target action", ACTION_RAID), nullptr))); + { NextAction("freya mark dps target action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "freya move to healing spore trigger", - NextAction::array(0, new NextAction("freya move to healing spore action", ACTION_RAID), nullptr))); + { NextAction("freya move to healing spore action", ACTION_RAID) })); // // Thorim // triggers.push_back(new TriggerNode( "thorim nature resistance trigger", - NextAction::array(0, new NextAction("thorim nature resistance action", ACTION_RAID), nullptr))); + { NextAction("thorim nature resistance action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "thorim frost resistance trigger", - NextAction::array(0, new NextAction("thorim frost resistance action", ACTION_RAID), nullptr))); + { NextAction("thorim frost resistance action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "thorim unbalancing strike trigger", - NextAction::array(0, new NextAction("thorim unbalancing strike action", ACTION_RAID), nullptr))); + { NextAction("thorim unbalancing strike action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "thorim mark dps target trigger", - NextAction::array(0, new NextAction("thorim mark dps target action", ACTION_RAID), nullptr))); + { NextAction("thorim mark dps target action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "thorim gauntlet positioning trigger", - NextAction::array(0, new NextAction("thorim gauntlet positioning action", ACTION_RAID), nullptr))); + { NextAction("thorim gauntlet positioning action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "thorim arena positioning trigger", - NextAction::array(0, new NextAction("thorim arena positioning action", ACTION_RAID), nullptr))); + { NextAction("thorim arena positioning action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "thorim fall from floor trigger", - NextAction::array(0, new NextAction("thorim fall from floor action", ACTION_RAID + 1), nullptr))); + { NextAction("thorim fall from floor action", ACTION_RAID + 1) })); triggers.push_back(new TriggerNode( "thorim phase 2 positioning trigger", - NextAction::array(0, new NextAction("thorim phase 2 positioning action", ACTION_RAID), nullptr))); + { NextAction("thorim phase 2 positioning action", ACTION_RAID) })); // // Mimiron // triggers.push_back(new TriggerNode( "mimiron p3wx2 laser barrage trigger", - NextAction::array(0, new NextAction("mimiron p3wx2 laser barrage action", ACTION_RAID + 2), nullptr))); + { NextAction("mimiron p3wx2 laser barrage action", ACTION_RAID + 2) })); triggers.push_back(new TriggerNode( "mimiron shock blast trigger", - NextAction::array(0, new NextAction("mimiron shock blast action", ACTION_RAID + 1), nullptr))); + { NextAction("mimiron shock blast action", ACTION_RAID + 1) })); triggers.push_back(new TriggerNode( "mimiron fire resistance trigger", - NextAction::array(0, new NextAction("mimiron fire resistance action", ACTION_RAID), nullptr))); + { NextAction("mimiron fire resistance action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "mimiron phase 1 positioning trigger", - NextAction::array(0, new NextAction("mimiron phase 1 positioning action", ACTION_RAID), nullptr))); + { NextAction("mimiron phase 1 positioning action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "mimiron rapid burst trigger", - NextAction::array(0, new NextAction("mimiron rapid burst action", ACTION_RAID), nullptr))); + { NextAction("mimiron rapid burst action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "mimiron aerial command unit trigger", - NextAction::array(0, new NextAction("mimiron aerial command unit action", ACTION_RAID), nullptr))); + { NextAction("mimiron aerial command unit action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "mimiron rocket strike trigger", - NextAction::array(0, new NextAction("mimiron rocket strike action", ACTION_RAID), nullptr))); + { NextAction("mimiron rocket strike action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "mimiron phase 4 mark dps trigger", - NextAction::array(0, new NextAction("mimiron phase 4 mark dps action", ACTION_RAID), nullptr))); + { NextAction("mimiron phase 4 mark dps action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "mimiron cheat trigger", - NextAction::array(0, new NextAction("mimiron cheat action", ACTION_RAID), nullptr))); + { NextAction("mimiron cheat action", ACTION_RAID) })); // // General Vezax // triggers.push_back(new TriggerNode( "vezax cheat trigger", - NextAction::array(0, new NextAction("vezax cheat action", ACTION_RAID), nullptr))); + { NextAction("vezax cheat action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "vezax shadow crash trigger", - NextAction::array(0, new NextAction("vezax shadow crash action", ACTION_RAID), nullptr))); + { NextAction("vezax shadow crash action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "vezax mark of the faceless trigger", - NextAction::array(0, new NextAction("vezax mark of the faceless action", ACTION_RAID), nullptr))); + { NextAction("vezax mark of the faceless action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "vezax shadow resistance trigger", - NextAction::array(0, new NextAction("vezax shadow resistance action", ACTION_RAID), nullptr))); + { NextAction("vezax shadow resistance action", ACTION_RAID) })); // // Yogg-Saron // triggers.push_back(new TriggerNode( "sara shadow resistance trigger", - NextAction::array(0, new NextAction("sara shadow resistance action", ACTION_RAID), nullptr))); + { NextAction("sara shadow resistance action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "yogg-saron shadow resistance trigger", - NextAction::array(0, new NextAction("yogg-saron shadow resistance action", ACTION_RAID), nullptr))); + { NextAction("yogg-saron shadow resistance action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "yogg-saron ominous cloud cheat trigger", - NextAction::array(0, new NextAction("yogg-saron ominous cloud cheat action", ACTION_RAID), nullptr))); + { NextAction("yogg-saron ominous cloud cheat action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "yogg-saron guardian positioning trigger", - NextAction::array(0, new NextAction("yogg-saron guardian positioning action", ACTION_RAID), nullptr))); + { NextAction("yogg-saron guardian positioning action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "yogg-saron sanity trigger", - NextAction::array(0, new NextAction("yogg-saron sanity action", ACTION_RAID + 1), nullptr))); + { NextAction("yogg-saron sanity action", ACTION_RAID + 1) })); triggers.push_back(new TriggerNode( "yogg-saron death orb trigger", - NextAction::array(0, new NextAction("yogg-saron death orb action", ACTION_RAID), nullptr))); + { NextAction("yogg-saron death orb action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "yogg-saron malady of the mind trigger", - NextAction::array(0, new NextAction("yogg-saron malady of the mind action", ACTION_RAID), nullptr))); + { NextAction("yogg-saron malady of the mind action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "yogg-saron mark target trigger", - NextAction::array(0, new NextAction("yogg-saron mark target action", ACTION_RAID), nullptr))); + { NextAction("yogg-saron mark target action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "yogg-saron brain link trigger", - NextAction::array(0, new NextAction("yogg-saron brain link action", ACTION_RAID), nullptr))); + { NextAction("yogg-saron brain link action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "yogg-saron move to enter portal trigger", - NextAction::array(0, new NextAction("yogg-saron move to enter portal action", ACTION_RAID), nullptr))); + { NextAction("yogg-saron move to enter portal action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "yogg-saron use portal trigger", - NextAction::array(0, new NextAction("yogg-saron use portal action", ACTION_RAID), nullptr))); + { NextAction("yogg-saron use portal action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "yogg-saron fall from floor trigger", - NextAction::array(0, new NextAction("yogg-saron fall from floor action", ACTION_RAID), nullptr))); + { NextAction("yogg-saron fall from floor action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "yogg-saron boss room movement cheat trigger", - NextAction::array(0, new NextAction("yogg-saron boss room movement cheat action", ACTION_RAID), nullptr))); + { NextAction("yogg-saron boss room movement cheat action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "yogg-saron illusion room trigger", - NextAction::array(0, new NextAction("yogg-saron illusion room action", ACTION_RAID), nullptr))); + { NextAction("yogg-saron illusion room action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "yogg-saron move to exit portal trigger", - NextAction::array(0, new NextAction("yogg-saron move to exit portal action", ACTION_RAID), nullptr))); + { NextAction("yogg-saron move to exit portal action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "yogg-saron lunatic gaze trigger", - NextAction::array(0, new NextAction("yogg-saron lunatic gaze action", ACTION_EMERGENCY), nullptr))); + { NextAction("yogg-saron lunatic gaze action", ACTION_EMERGENCY) })); triggers.push_back(new TriggerNode( "yogg-saron phase 3 positioning trigger", - NextAction::array(0, new NextAction("yogg-saron phase 3 positioning action", ACTION_RAID), nullptr))); + { NextAction("yogg-saron phase 3 positioning action", ACTION_RAID) })); } void RaidUlduarStrategy::InitMultipliers(std::vector& multipliers) diff --git a/src/strategy/raids/vaultofarchavon/RaidVoAStrategy.cpp b/src/strategy/raids/vaultofarchavon/RaidVoAStrategy.cpp index 505cac1b..db81477a 100644 --- a/src/strategy/raids/vaultofarchavon/RaidVoAStrategy.cpp +++ b/src/strategy/raids/vaultofarchavon/RaidVoAStrategy.cpp @@ -11,23 +11,23 @@ void RaidVoAStrategy::InitTriggers(std::vector& triggers) // triggers.push_back(new TriggerNode( "emalon lighting nova trigger", - NextAction::array(0, new NextAction("emalon lighting nova action", ACTION_RAID + 1), nullptr))); + { NextAction("emalon lighting nova action", ACTION_RAID + 1) })); triggers.push_back(new TriggerNode( "emalon mark boss trigger", - NextAction::array(0, new NextAction("emalon mark boss action", ACTION_RAID), nullptr))); + { NextAction("emalon mark boss action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "emalon overcharge trigger", - NextAction::array(0, new NextAction("emalon overcharge action", ACTION_RAID), nullptr))); + { NextAction("emalon overcharge action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "emalon fall from floor trigger", - NextAction::array(0, new NextAction("emalon fall from floor action", ACTION_RAID), nullptr))); + { NextAction("emalon fall from floor action", ACTION_RAID) })); triggers.push_back(new TriggerNode( "emalon nature resistance trigger", - NextAction::array(0, new NextAction("emalon nature resistance action", ACTION_RAID), nullptr))); + { NextAction("emalon nature resistance action", ACTION_RAID) })); // // Koralon the Flame Watcher @@ -35,5 +35,5 @@ void RaidVoAStrategy::InitTriggers(std::vector& triggers) triggers.push_back(new TriggerNode( "koralon fire resistance trigger", - NextAction::array(0, new NextAction("koralon fire resistance action", ACTION_RAID), nullptr))); + { NextAction("koralon fire resistance action", ACTION_RAID) })); } diff --git a/src/strategy/rogue/AssassinationRogueStrategy.cpp b/src/strategy/rogue/AssassinationRogueStrategy.cpp index ab192713..b8563893 100644 --- a/src/strategy/rogue/AssassinationRogueStrategy.cpp +++ b/src/strategy/rogue/AssassinationRogueStrategy.cpp @@ -17,31 +17,39 @@ public: private: static ActionNode* mutilate([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("mutilate", - /*P*/ NULL, - /*A*/ NextAction::array(0, new NextAction("backstab"), nullptr), - /*C*/ NULL); + return new ActionNode( + "mutilate", + /*P*/ {}, + /*A*/ { NextAction("backstab") }, + /*C*/ {} + ); } static ActionNode* envenom([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("envenom", - /*P*/ NULL, - /*A*/ NextAction::array(0, new NextAction("rupture"), nullptr), - /*C*/ NULL); + return new ActionNode( + "envenom", + /*P*/ {}, + /*A*/ { NextAction("rupture") }, + /*C*/ {} + ); } static ActionNode* backstab([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("backstab", - /*P*/ NULL, - /*A*/ NextAction::array(0, new NextAction("sinister strike"), nullptr), - /*C*/ NULL); + return new ActionNode( + "backstab", + /*P*/ {}, + /*A*/ { NextAction("sinister strike") }, + /*C*/ {} + ); } static ActionNode* rupture([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("rupture", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("eviscerate"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "rupture", + /*P*/ {}, + /*A*/ { NextAction("eviscerate") }, + /*C*/ {} + ); } }; @@ -50,65 +58,155 @@ AssassinationRogueStrategy::AssassinationRogueStrategy(PlayerbotAI* ai) : MeleeC actionNodeFactories.Add(new AssassinationRogueStrategyActionNodeFactory()); } -NextAction** AssassinationRogueStrategy::getDefaultActions() +std::vector AssassinationRogueStrategy::getDefaultActions() { - return NextAction::array(0, new NextAction("melee", ACTION_DEFAULT), NULL); + return { + NextAction("melee", ACTION_DEFAULT) + }; } void AssassinationRogueStrategy::InitTriggers(std::vector& triggers) { MeleeCombatStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("high energy available", - NextAction::array(0, new NextAction("garrote", ACTION_HIGH + 7), - new NextAction("ambush", ACTION_HIGH + 6), nullptr))); - - triggers.push_back(new TriggerNode("high energy available", - NextAction::array(0, new NextAction("mutilate", ACTION_NORMAL + 3), nullptr))); - - triggers.push_back(new TriggerNode( - "hunger for blood", NextAction::array(0, new NextAction("hunger for blood", ACTION_HIGH + 6), NULL))); - - triggers.push_back(new TriggerNode("slice and dice", - NextAction::array(0, new NextAction("slice and dice", ACTION_HIGH + 5), NULL))); - - triggers.push_back(new TriggerNode("combo points 3 available", - NextAction::array(0, new NextAction("envenom", ACTION_HIGH + 5), - new NextAction("eviscerate", ACTION_HIGH + 3), nullptr))); - - triggers.push_back(new TriggerNode("target with combo points almost dead", - NextAction::array(0, new NextAction("envenom", ACTION_HIGH + 4), - new NextAction("eviscerate", ACTION_HIGH + 2), nullptr))); + triggers.push_back( + new TriggerNode( + "high energy available", + { + NextAction("garrote", ACTION_HIGH + 7), + NextAction("ambush", ACTION_HIGH + 6) + } + ) + ); triggers.push_back( - new TriggerNode("expose armor", NextAction::array(0, new NextAction("expose armor", ACTION_HIGH + 3), NULL))); + new TriggerNode( + "high energy available", + { + NextAction("mutilate", ACTION_NORMAL + 3) + } + ) + ); triggers.push_back( - new TriggerNode("medium threat", NextAction::array(0, new NextAction("vanish", ACTION_HIGH), NULL))); + new TriggerNode( + "hunger for blood", + { + NextAction("hunger for blood", ACTION_HIGH + 6), + } + ) + ); triggers.push_back( - new TriggerNode("low health", NextAction::array(0, new NextAction("evasion", ACTION_HIGH + 9), - new NextAction("feint", ACTION_HIGH + 8), nullptr))); - - triggers.push_back(new TriggerNode( - "critical health", NextAction::array(0, new NextAction("cloak of shadows", ACTION_HIGH + 7), nullptr))); + new TriggerNode( + "slice and dice", + { + NextAction("slice and dice", ACTION_HIGH + 5), + } + ) + ); triggers.push_back( - new TriggerNode("kick", NextAction::array(0, new NextAction("kick", ACTION_INTERRUPT + 2), NULL))); + new TriggerNode( + "combo points 3 available", + { + NextAction("envenom", ACTION_HIGH + 5), + NextAction("eviscerate", ACTION_HIGH + 3) + } + ) + ); triggers.push_back( - new TriggerNode("kick on enemy healer", - NextAction::array(0, new NextAction("kick on enemy healer", ACTION_INTERRUPT + 1), NULL))); + new TriggerNode( + "target with combo points almost dead", + { + NextAction("envenom", ACTION_HIGH + 4), + NextAction("eviscerate", ACTION_HIGH + 2) + } + ) + ); triggers.push_back( - new TriggerNode("medium aoe", NextAction::array(0, new NextAction("fan of knives", ACTION_NORMAL + 5), NULL))); + new TriggerNode( + "expose armor", + { + NextAction("expose armor", ACTION_HIGH + 3), + } + ) + ); - triggers.push_back(new TriggerNode( - "low tank threat", - NextAction::array(0, new NextAction("tricks of the trade on main tank", ACTION_HIGH + 7), NULL))); + triggers.push_back( + new TriggerNode( + "medium threat", + { + NextAction("vanish", ACTION_HIGH), + } + ) + ); - triggers.push_back(new TriggerNode( - "enemy out of melee", - NextAction::array(0, new NextAction("stealth", ACTION_HIGH + 3), new NextAction("sprint", ACTION_HIGH + 2), - new NextAction("reach melee", ACTION_HIGH + 1), NULL))); + triggers.push_back( + new TriggerNode( + "low health", + { + NextAction("evasion", ACTION_HIGH + 9), + NextAction("feint", ACTION_HIGH + 8) + } + ) + ); + + triggers.push_back( + new TriggerNode( + "critical health", + { + NextAction("cloak of shadows", ACTION_HIGH + 7) + } + ) + ); + + triggers.push_back( + new TriggerNode( + "kick", + { + NextAction("kick", ACTION_INTERRUPT + 2), + } + ) + ); + + triggers.push_back( + new TriggerNode( + "kick on enemy healer", + { + NextAction("kick on enemy healer", ACTION_INTERRUPT + 1), + } + ) + ); + + triggers.push_back( + new TriggerNode( + "medium aoe", + { + NextAction("fan of knives", ACTION_NORMAL + 5), + } + ) + ); + + triggers.push_back( + new TriggerNode( + "low tank threat", + { + NextAction("tricks of the trade on main tank", ACTION_HIGH + 7), + } + ) + ); + + triggers.push_back( + new TriggerNode( + "enemy out of melee", + { + NextAction("stealth", ACTION_HIGH + 3), + NextAction("sprint", ACTION_HIGH + 2), + NextAction("reach melee", ACTION_HIGH + 1), + } + ) + ); } diff --git a/src/strategy/rogue/AssassinationRogueStrategy.h b/src/strategy/rogue/AssassinationRogueStrategy.h index ae36d272..5692528a 100644 --- a/src/strategy/rogue/AssassinationRogueStrategy.h +++ b/src/strategy/rogue/AssassinationRogueStrategy.h @@ -12,7 +12,7 @@ public: public: virtual void InitTriggers(std::vector& triggers) override; virtual std::string const getName() override { return "melee"; } - virtual NextAction** getDefaultActions() override; + virtual std::vector getDefaultActions() override; uint32 GetType() const override { return MeleeCombatStrategy::GetType() | STRATEGY_TYPE_DPS; } }; diff --git a/src/strategy/rogue/DpsRogueStrategy.cpp b/src/strategy/rogue/DpsRogueStrategy.cpp index a1e511df..22c6a6f8 100644 --- a/src/strategy/rogue/DpsRogueStrategy.cpp +++ b/src/strategy/rogue/DpsRogueStrategy.cpp @@ -24,52 +24,72 @@ public: private: static ActionNode* melee([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("melee", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("mutilate"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "melee", + /*P*/ {}, + /*A*/ { + NextAction("mutilate") }, + /*C*/ {} + ); } static ActionNode* mutilate([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("mutilate", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("sinister strike"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "mutilate", + /*P*/ {}, + /*A*/ { + NextAction("sinister strike") }, + /*C*/ {} + ); } static ActionNode* sinister_strike([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("sinister strike", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("melee"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "sinister strike", + /*P*/ {}, + /*A*/ { + NextAction("melee") }, + /*C*/ {} + ); } static ActionNode* kick([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("kick", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("kidney shot"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "kick", + /*P*/ {}, + /*A*/ { + NextAction("kidney shot") }, + /*C*/ {} + ); } static ActionNode* kidney_shot([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("kidney shot", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "kidney shot", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* backstab([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("backstab", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("mutilate"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "backstab", + /*P*/ {}, + /*A*/ { + NextAction("mutilate") }, + /*C*/ {} + ); } static ActionNode* rupture([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("rupture", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("eviscerate"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "rupture", + /*P*/ {}, + /*A*/ { + NextAction("eviscerate") }, + /*C*/ {} + ); } }; @@ -78,71 +98,157 @@ DpsRogueStrategy::DpsRogueStrategy(PlayerbotAI* botAI) : MeleeCombatStrategy(bot actionNodeFactories.Add(new DpsRogueStrategyActionNodeFactory()); } -NextAction** DpsRogueStrategy::getDefaultActions() +std::vector DpsRogueStrategy::getDefaultActions() { - return NextAction::array(0, new NextAction("killing spree", ACTION_DEFAULT + 0.1f), - new NextAction("melee", ACTION_DEFAULT), nullptr); + return { + NextAction("killing spree", ACTION_DEFAULT + 0.1f), + NextAction("melee", ACTION_DEFAULT) + }; } void DpsRogueStrategy::InitTriggers(std::vector& triggers) { MeleeCombatStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("high energy available", - NextAction::array(0, new NextAction("garrote", ACTION_HIGH + 7), - new NextAction("ambush", ACTION_HIGH + 6), nullptr))); - - triggers.push_back(new TriggerNode( - "high energy available", NextAction::array(0, new NextAction("sinister strike", ACTION_NORMAL + 3), nullptr))); - - triggers.push_back(new TriggerNode( - "slice and dice", NextAction::array(0, new NextAction("slice and dice", ACTION_HIGH + 2), nullptr))); - - triggers.push_back(new TriggerNode("combo points available", - NextAction::array(0, new NextAction("rupture", ACTION_HIGH + 1), - new NextAction("eviscerate", ACTION_HIGH), nullptr))); - - triggers.push_back(new TriggerNode("target with combo points almost dead", - NextAction::array(0, new NextAction("eviscerate", ACTION_HIGH + 2), nullptr))); + triggers.push_back( + new TriggerNode( + "high energy available", + { + NextAction("garrote", ACTION_HIGH + 7), + NextAction("ambush", ACTION_HIGH + 6) + } + ) + ); triggers.push_back( - new TriggerNode("medium threat", NextAction::array(0, new NextAction("vanish", ACTION_HIGH), nullptr))); + new TriggerNode( + "high energy available", + { + NextAction("sinister strike", ACTION_NORMAL + 3) + } + ) + ); triggers.push_back( - new TriggerNode("low health", NextAction::array(0, new NextAction("evasion", ACTION_HIGH + 9), - new NextAction("feint", ACTION_HIGH + 8), nullptr))); - - triggers.push_back(new TriggerNode( - "critical health", NextAction::array(0, new NextAction("cloak of shadows", ACTION_HIGH + 7), nullptr))); + new TriggerNode( + "slice and dice", + { + NextAction("slice and dice", ACTION_HIGH + 2) + } + ) + ); triggers.push_back( - new TriggerNode("kick", NextAction::array(0, new NextAction("kick", ACTION_INTERRUPT + 2), nullptr))); + new TriggerNode( + "combo points available", + { + NextAction("rupture", ACTION_HIGH + 1), + NextAction("eviscerate", ACTION_HIGH) + } + ) + ); triggers.push_back( - new TriggerNode("kick on enemy healer", - NextAction::array(0, new NextAction("kick on enemy healer", ACTION_INTERRUPT + 1), nullptr))); - - // triggers.push_back(new TriggerNode( - // "behind target", - // NextAction::array(0, new NextAction("backstab", ACTION_NORMAL), nullptr))); + new TriggerNode( + "target with combo points almost dead", + { + NextAction("eviscerate", ACTION_HIGH + 2) + } + ) + ); triggers.push_back( - new TriggerNode("light aoe", NextAction::array(0, new NextAction("blade flurry", ACTION_HIGH + 3), nullptr))); + new TriggerNode( + "medium threat", + { + NextAction("vanish", ACTION_HIGH) + } + ) + ); - triggers.push_back(new TriggerNode("blade flurry", - NextAction::array(0, new NextAction("blade flurry", ACTION_HIGH + 2), nullptr))); + triggers.push_back( + new TriggerNode( + "low health", + { + NextAction("evasion", ACTION_HIGH + 9), + NextAction("feint", ACTION_HIGH + 8) + } + ) + ); - triggers.push_back(new TriggerNode( - "enemy out of melee", - NextAction::array(0, new NextAction("stealth", ACTION_HIGH + 3), new NextAction("sprint", ACTION_HIGH + 2), - new NextAction("reach melee", ACTION_HIGH + 1), nullptr))); + triggers.push_back( + new TriggerNode( + "critical health", + { + NextAction("cloak of shadows", ACTION_HIGH + 7) + } + ) + ); - triggers.push_back(new TriggerNode("expose armor", - NextAction::array(0, new NextAction("expose armor", ACTION_HIGH + 3), nullptr))); + triggers.push_back( + new TriggerNode( + "kick", + { + NextAction("kick", ACTION_INTERRUPT + 2) + } + ) + ); - triggers.push_back(new TriggerNode( - "low tank threat", - NextAction::array(0, new NextAction("tricks of the trade on main tank", ACTION_HIGH + 7), nullptr))); + triggers.push_back( + new TriggerNode( + "kick on enemy healer", + { + NextAction("kick on enemy healer", ACTION_INTERRUPT + 1) + } + ) + ); + + triggers.push_back( + new TriggerNode( + "light aoe", + { + NextAction("blade flurry", ACTION_HIGH + 3) + } + ) + ); + + triggers.push_back( + new TriggerNode( + "blade flurry", + { + NextAction("blade flurry", ACTION_HIGH + 2) + } + ) + ); + + triggers.push_back( + new TriggerNode( + "enemy out of melee", + { + NextAction("stealth", ACTION_HIGH + 3), + NextAction("sprint", ACTION_HIGH + 2), + NextAction("reach melee", ACTION_HIGH + 1) + } + ) + ); + + triggers.push_back( + new TriggerNode( + "expose armor", + { + NextAction("expose armor", ACTION_HIGH + 3) + } + ) + ); + + triggers.push_back( + new TriggerNode( + "low tank threat", + { + NextAction("tricks of the trade on main tank", ACTION_HIGH + 7) + } + ) + ); } class StealthedRogueStrategyActionNodeFactory : public NamedObjectFactory @@ -160,42 +266,52 @@ public: private: static ActionNode* ambush([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("ambush", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("garrote"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "ambush", + /*P*/ {}, + /*A*/ { NextAction("garrote") }, + /*C*/ {} + ); } static ActionNode* cheap_shot([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("cheap shot", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "cheap shot", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* garrote([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("garrote", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "garrote", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* sap([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("sap", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "sap", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* sinister_strike([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("sinister strike", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("cheap shot"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "sinister strike", + /*P*/ {}, + /*A*/ { NextAction("cheap shot") }, + /*C*/ {} + ); } }; @@ -204,60 +320,147 @@ StealthedRogueStrategy::StealthedRogueStrategy(PlayerbotAI* botAI) : Strategy(bo actionNodeFactories.Add(new StealthedRogueStrategyActionNodeFactory()); } -NextAction** StealthedRogueStrategy::getDefaultActions() +std::vector StealthedRogueStrategy::getDefaultActions() { - return NextAction::array( - 0, new NextAction("ambush", ACTION_NORMAL + 4), new NextAction("backstab", ACTION_NORMAL + 3), - new NextAction("cheap shot", ACTION_NORMAL + 2), new NextAction("sinister strike", ACTION_NORMAL + 1), - new NextAction("melee", ACTION_NORMAL), nullptr); + return { + NextAction("ambush", ACTION_NORMAL + 4), + NextAction("backstab", ACTION_NORMAL + 3), + NextAction("cheap shot", ACTION_NORMAL + 2), + NextAction("sinister strike", ACTION_NORMAL + 1), + NextAction("melee", ACTION_NORMAL) + }; } void StealthedRogueStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("combo points available", - NextAction::array(0, new NextAction("eviscerate", ACTION_HIGH), nullptr))); triggers.push_back( - new TriggerNode("kick", NextAction::array(0, new NextAction("cheap shot", ACTION_INTERRUPT), nullptr))); - triggers.push_back(new TriggerNode("kick on enemy healer", - NextAction::array(0, new NextAction("cheap shot", ACTION_INTERRUPT), nullptr))); + new TriggerNode( + "combo points available", + { + NextAction("eviscerate", ACTION_HIGH) + } + ) + ); triggers.push_back( - new TriggerNode("behind target", NextAction::array(0, new NextAction("ambush", ACTION_HIGH), nullptr))); + new TriggerNode( + "kick", + { + NextAction("cheap shot", ACTION_INTERRUPT) + } + ) + ); triggers.push_back( - new TriggerNode("not behind target", NextAction::array(0, new NextAction("cheap shot", ACTION_HIGH), nullptr))); - triggers.push_back(new TriggerNode("enemy flagcarrier near", - NextAction::array(0, new NextAction("sprint", ACTION_EMERGENCY + 1), nullptr))); + new TriggerNode( + "kick on enemy healer", + { + NextAction("cheap shot", ACTION_INTERRUPT) + } + ) + ); triggers.push_back( - new TriggerNode("unstealth", NextAction::array(0, new NextAction("unstealth", ACTION_NORMAL), nullptr))); - /*triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("food", ACTION_EMERGENCY + - * 1), nullptr)));*/ - triggers.push_back(new TriggerNode( - "no stealth", NextAction::array(0, new NextAction("check stealth", ACTION_EMERGENCY), nullptr))); + new TriggerNode( + "behind target", + { + NextAction("ambush", ACTION_HIGH) + } + ) + ); triggers.push_back( - new TriggerNode("sprint", NextAction::array(0, new NextAction("sprint", ACTION_INTERRUPT), nullptr))); + new TriggerNode( + "not behind target", + { + NextAction("cheap shot", ACTION_HIGH) + } + ) + ); + triggers.push_back( + new TriggerNode( + "enemy flagcarrier near", + { + NextAction("sprint", ACTION_EMERGENCY + 1) + } + ) + ); + triggers.push_back( + new TriggerNode( + "unstealth", + { + NextAction("unstealth", ACTION_NORMAL) + } + ) + ); + + triggers.push_back( + new TriggerNode( + "no stealth", + { + NextAction("check stealth", ACTION_EMERGENCY) + } + ) + ); + triggers.push_back( + new TriggerNode( + "sprint", + { + NextAction("sprint", ACTION_INTERRUPT) + } + ) + ); } void StealthStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( - new TriggerNode("stealth", NextAction::array(0, new NextAction("stealth", ACTION_INTERRUPT), nullptr))); + new TriggerNode( + "stealth", + { + NextAction("stealth", ACTION_INTERRUPT) + } + ) + ); } void RogueAoeStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( - new TriggerNode("light aoe", NextAction::array(0, new NextAction("blade flurry", ACTION_HIGH), nullptr))); - triggers.push_back(new TriggerNode( - "medium aoe", NextAction::array(0, new NextAction("fan of knives", ACTION_NORMAL + 5), nullptr))); + new TriggerNode( + "light aoe", + { + NextAction("blade flurry", ACTION_HIGH) + } + ) + ); + triggers.push_back( + new TriggerNode( + "medium aoe", + { + NextAction("fan of knives", ACTION_NORMAL + 5) + } + ) + ); } void RogueBoostStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode( - "adrenaline rush", NextAction::array(0, new NextAction("adrenaline rush", ACTION_HIGH + 2), nullptr))); + triggers.push_back( + new TriggerNode( + "adrenaline rush", + { + NextAction("adrenaline rush", ACTION_HIGH + 2) + } + ) + ); } void RogueCcStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("sap", NextAction::array(0, new NextAction("stealth", ACTION_INTERRUPT), - new NextAction("sap", ACTION_INTERRUPT), nullptr))); + triggers.push_back( + new TriggerNode( + "sap", + { + NextAction("stealth", ACTION_INTERRUPT), + NextAction("sap", ACTION_INTERRUPT) + } + ) + ); } diff --git a/src/strategy/rogue/DpsRogueStrategy.h b/src/strategy/rogue/DpsRogueStrategy.h index 8e9a79b2..ae418b6c 100644 --- a/src/strategy/rogue/DpsRogueStrategy.h +++ b/src/strategy/rogue/DpsRogueStrategy.h @@ -18,7 +18,7 @@ public: void InitTriggers(std::vector& triggers) override; std::string const getName() override { return "dps"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; uint32 GetType() const override { return MeleeCombatStrategy::GetType() | STRATEGY_TYPE_DPS; } }; @@ -29,7 +29,7 @@ public: void InitTriggers(std::vector& triggers) override; std::string const getName() override { return "stealthed"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; }; class StealthStrategy : public Strategy diff --git a/src/strategy/rogue/GenericRogueNonCombatStrategy.cpp b/src/strategy/rogue/GenericRogueNonCombatStrategy.cpp index bfdcacd7..88838f2d 100644 --- a/src/strategy/rogue/GenericRogueNonCombatStrategy.cpp +++ b/src/strategy/rogue/GenericRogueNonCombatStrategy.cpp @@ -19,9 +19,9 @@ private: static ActionNode* use_deadly_poison_on_off_hand([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("use deadly poison on off hand", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("use instant poison on off hand"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("use instant poison on off hand") }, + /*C*/ {}); } }; @@ -35,24 +35,16 @@ void GenericRogueNonCombatStrategy::InitTriggers(std::vector& trig NonCombatStrategy::InitTriggers(triggers); triggers.push_back(new TriggerNode("player has flag", - NextAction::array(0, new NextAction("sprint", ACTION_EMERGENCY + 1), nullptr))); + { NextAction("sprint", ACTION_EMERGENCY + 1) })); triggers.push_back(new TriggerNode("enemy flagcarrier near", - NextAction::array(0, new NextAction("sprint", ACTION_EMERGENCY + 2), nullptr))); - // triggers.push_back(new TriggerNode("unstealth", NextAction::array(0, new NextAction("unstealth", 1.0f), - // nullptr))); triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("apply - // poison", 1.0f), nullptr))); - + { NextAction("sprint", ACTION_EMERGENCY + 2) })); triggers.push_back( new TriggerNode("main hand weapon no enchant", - NextAction::array(0, new NextAction("use instant poison on main hand", 20.0f), NULL))); + { NextAction("use instant poison on main hand", 20.0f) })); triggers.push_back( new TriggerNode("off hand weapon no enchant", - NextAction::array(0, new NextAction("use deadly poison on off hand", 19.0f), NULL))); + { NextAction("use deadly poison on off hand", 19.0f) })); - // triggers.push_back(new TriggerNode( - // "off hand weapon no enchant", - // NextAction::array(0, new NextAction("use instant poison", 18.0f), NULL))); - - triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("unstealth", 30.0f), NULL))); + triggers.push_back(new TriggerNode("often", { NextAction("unstealth", 30.0f) })); } diff --git a/src/strategy/rpg/NewRpgStrategy.cpp b/src/strategy/rpg/NewRpgStrategy.cpp index 019b0c6b..030ad6b4 100644 --- a/src/strategy/rpg/NewRpgStrategy.cpp +++ b/src/strategy/rpg/NewRpgStrategy.cpp @@ -9,36 +9,67 @@ NewRpgStrategy::NewRpgStrategy(PlayerbotAI* botAI) : Strategy(botAI) {} -NextAction** NewRpgStrategy::getDefaultActions() +std::vector NewRpgStrategy::getDefaultActions() { // the releavance should be greater than grind - return NextAction::array(0, - new NextAction("new rpg status update", 11.0f), - nullptr); + return { + NextAction("new rpg status update", 11.0f) + }; } void NewRpgStrategy::InitTriggers(std::vector& triggers) { triggers.push_back( - new TriggerNode("go grind status", NextAction::array(0, new NextAction("new rpg go grind", 3.0f), nullptr))); - + new TriggerNode( + "go grind status", + { + NextAction("new rpg go grind", 3.0f) + } + ) + ); triggers.push_back( - new TriggerNode("go camp status", NextAction::array(0, new NextAction("new rpg go camp", 3.0f), nullptr))); - + new TriggerNode( + "go camp status", + { + NextAction("new rpg go camp", 3.0f) + } + ) + ); triggers.push_back( - new TriggerNode("wander random status", NextAction::array(0, new NextAction("new rpg wander random", 3.0f), nullptr))); - + new TriggerNode( + "wander random status", + { + NextAction("new rpg wander random", 3.0f) + } + ) + ); triggers.push_back( - new TriggerNode("wander npc status", NextAction::array(0, new NextAction("new rpg wander npc", 3.0f), nullptr))); - + new TriggerNode( + "wander npc status", + { + NextAction("new rpg wander npc", 3.0f) + } + ) + ); triggers.push_back( - new TriggerNode("do quest status", NextAction::array(0, new NextAction("new rpg do quest", 3.0f), nullptr))); - + new TriggerNode( + "do quest status", + { + NextAction("new rpg do quest", 3.0f) + } + ) + ); triggers.push_back( - new TriggerNode("travel flight status", NextAction::array(0, new NextAction("new rpg travel flight", 3.0f), nullptr))); + new TriggerNode( + "travel flight status", + { + NextAction("new rpg travel flight", 3.0f) + } + ) + ); } void NewRpgStrategy::InitMultipliers(std::vector& multipliers) { - // multipliers.push_back(new RpgActionMultiplier(botAI)); + } diff --git a/src/strategy/rpg/NewRpgStrategy.h b/src/strategy/rpg/NewRpgStrategy.h index b1b1e156..47b2a550 100644 --- a/src/strategy/rpg/NewRpgStrategy.h +++ b/src/strategy/rpg/NewRpgStrategy.h @@ -18,7 +18,7 @@ public: NewRpgStrategy(PlayerbotAI* botAI); std::string const getName() override { return "new rpg"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; void InitTriggers(std::vector& triggers) override; void InitMultipliers(std::vector& multipliers) override; }; diff --git a/src/strategy/shaman/ElementalShamanStrategy.cpp b/src/strategy/shaman/ElementalShamanStrategy.cpp index 350b3472..c1295687 100644 --- a/src/strategy/shaman/ElementalShamanStrategy.cpp +++ b/src/strategy/shaman/ElementalShamanStrategy.cpp @@ -25,15 +25,15 @@ public: } private: - static ActionNode* flame_shock(PlayerbotAI*) { return new ActionNode("flame shock", nullptr, nullptr, nullptr); } - static ActionNode* earth_shock(PlayerbotAI*) { return new ActionNode("earth shock", nullptr, nullptr, nullptr); } - static ActionNode* lava_burst(PlayerbotAI*) { return new ActionNode("lava burst", nullptr, nullptr, nullptr); } - static ActionNode* lightning_bolt(PlayerbotAI*) { return new ActionNode("lightning bolt", nullptr, nullptr, nullptr); } - static ActionNode* call_of_the_elements(PlayerbotAI*) { return new ActionNode("call of the elements", nullptr, nullptr, nullptr); } - static ActionNode* elemental_mastery(PlayerbotAI*) { return new ActionNode("elemental mastery", nullptr, nullptr, nullptr); } - static ActionNode* stoneclaw_totem(PlayerbotAI*) { return new ActionNode("stoneclaw totem", nullptr, nullptr, nullptr); } - static ActionNode* water_shield(PlayerbotAI*) { return new ActionNode("water shield", nullptr, nullptr, nullptr); } - static ActionNode* thunderstorm(PlayerbotAI*) { return new ActionNode("thunderstorm", nullptr, nullptr, nullptr); } + static ActionNode* flame_shock(PlayerbotAI*) { return new ActionNode("flame shock", {}, {}, {}); } + static ActionNode* earth_shock(PlayerbotAI*) { return new ActionNode("earth shock", {}, {}, {}); } + static ActionNode* lava_burst(PlayerbotAI*) { return new ActionNode("lava burst", {}, {}, {}); } + static ActionNode* lightning_bolt(PlayerbotAI*) { return new ActionNode("lightning bolt", {}, {}, {}); } + static ActionNode* call_of_the_elements(PlayerbotAI*) { return new ActionNode("call of the elements", {}, {}, {}); } + static ActionNode* elemental_mastery(PlayerbotAI*) { return new ActionNode("elemental mastery", {}, {}, {}); } + static ActionNode* stoneclaw_totem(PlayerbotAI*) { return new ActionNode("stoneclaw totem", {}, {}, {}); } + static ActionNode* water_shield(PlayerbotAI*) { return new ActionNode("water shield", {}, {}, {}); } + static ActionNode* thunderstorm(PlayerbotAI*) { return new ActionNode("thunderstorm", {}, {}, {}); } }; // ===== Single Target Strategy ===== @@ -43,11 +43,12 @@ ElementalShamanStrategy::ElementalShamanStrategy(PlayerbotAI* botAI) : GenericSh } // ===== Default Actions ===== -NextAction** ElementalShamanStrategy::getDefaultActions() +std::vector ElementalShamanStrategy::getDefaultActions() { - return NextAction::array(0, new NextAction("lava burst", 5.2f), - new NextAction("lightning bolt", 5.0f), - nullptr); + return { + NextAction("lava burst", 5.2f), + NextAction("lightning bolt", 5.0f) + }; } // ===== Trigger Initialization === @@ -56,20 +57,76 @@ void ElementalShamanStrategy::InitTriggers(std::vector& triggers) GenericShamanStrategy::InitTriggers(triggers); // Totem Triggers - triggers.push_back(new TriggerNode("call of the elements", NextAction::array(0, new NextAction("call of the elements", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("stoneclaw totem", 40.0f), nullptr))); + triggers.push_back( + new TriggerNode( + "call of the elements", + { + NextAction("call of the elements", 60.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "low health", + { + NextAction("stoneclaw totem", 40.0f) + } + ) + ); // Cooldown Trigger - triggers.push_back(new TriggerNode("elemental mastery", NextAction::array(0, new NextAction("elemental mastery", 29.0f), nullptr))); + triggers.push_back( + new TriggerNode( + "elemental mastery", + { + NextAction("elemental mastery", 29.0f) + } + ) + ); // Damage Triggers - triggers.push_back(new TriggerNode("earth shock execute", NextAction::array(0, new NextAction("earth shock", 5.5f), nullptr))); - triggers.push_back(new TriggerNode("flame shock", NextAction::array(0, new NextAction("flame shock", 5.3f), nullptr))); + triggers.push_back( + new TriggerNode( + "earth shock execute", + { + NextAction("earth shock", 5.5f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "flame shock", + { + NextAction("flame shock", 5.3f) + } + ) + ); // Mana Triggers - triggers.push_back(new TriggerNode("water shield", NextAction::array(0, new NextAction("water shield", 19.5f), nullptr))); - triggers.push_back(new TriggerNode("high mana", NextAction::array(0, new NextAction("thunderstorm", 19.0f), nullptr))); + triggers.push_back( + new TriggerNode( + "water shield", + { + NextAction("water shield", 19.5f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "high mana", + { + NextAction("thunderstorm", 19.0f) + } + ) + ); // Range Triggers - triggers.push_back(new TriggerNode("enemy is close", NextAction::array(0, new NextAction("thunderstorm", 19.0f), nullptr))); + triggers.push_back( + new TriggerNode( + "enemy is close", + { + NextAction("thunderstorm", 19.0f) + } + ) + ); } diff --git a/src/strategy/shaman/ElementalShamanStrategy.h b/src/strategy/shaman/ElementalShamanStrategy.h index 44f883c7..3c584856 100644 --- a/src/strategy/shaman/ElementalShamanStrategy.h +++ b/src/strategy/shaman/ElementalShamanStrategy.h @@ -16,7 +16,7 @@ public: ElementalShamanStrategy(PlayerbotAI* botAI); void InitTriggers(std::vector& triggers) override; - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; std::string const getName() override { return "ele"; } uint32 GetType() const override { return STRATEGY_TYPE_COMBAT | STRATEGY_TYPE_DPS | STRATEGY_TYPE_RANGED; } }; diff --git a/src/strategy/shaman/EnhancementShamanStrategy.cpp b/src/strategy/shaman/EnhancementShamanStrategy.cpp index c38b0409..4b7fb715 100644 --- a/src/strategy/shaman/EnhancementShamanStrategy.cpp +++ b/src/strategy/shaman/EnhancementShamanStrategy.cpp @@ -25,21 +25,23 @@ public: } private: - static ActionNode* stormstrike(PlayerbotAI*) { return new ActionNode("stormstrike", nullptr, nullptr, nullptr); } + static ActionNode* stormstrike(PlayerbotAI*) { return new ActionNode("stormstrike", {}, {}, {}); } static ActionNode* lava_lash([[maybe_unused]] PlayerbotAI* botAI) { - return new ActionNode("lava lash", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("melee"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "lava lash", + /*P*/ {}, + /*A*/ { NextAction("melee") }, + /*C*/ {} + ); } - static ActionNode* feral_spirit(PlayerbotAI*) { return new ActionNode("feral spirit", nullptr, nullptr, nullptr); } - static ActionNode* lightning_bolt(PlayerbotAI*) { return new ActionNode("lightning bolt", nullptr, nullptr, nullptr); } - static ActionNode* earth_shock(PlayerbotAI*) { return new ActionNode("earth shock", nullptr, nullptr, nullptr); } - static ActionNode* flame_shock(PlayerbotAI*) { return new ActionNode("flame shock", nullptr, nullptr, nullptr); } - static ActionNode* shamanistic_rage(PlayerbotAI*) { return new ActionNode("shamanistic rage", nullptr, nullptr, nullptr); } - static ActionNode* call_of_the_elements(PlayerbotAI*) { return new ActionNode("call of the elements", nullptr, nullptr, nullptr); } - static ActionNode* lightning_shield(PlayerbotAI*) { return new ActionNode("lightning shield", nullptr, nullptr, nullptr); } + static ActionNode* feral_spirit(PlayerbotAI*) { return new ActionNode("feral spirit", {}, {}, {}); } + static ActionNode* lightning_bolt(PlayerbotAI*) { return new ActionNode("lightning bolt", {}, {}, {}); } + static ActionNode* earth_shock(PlayerbotAI*) { return new ActionNode("earth shock", {}, {}, {}); } + static ActionNode* flame_shock(PlayerbotAI*) { return new ActionNode("flame shock", {}, {}, {}); } + static ActionNode* shamanistic_rage(PlayerbotAI*) { return new ActionNode("shamanistic rage", {}, {}, {}); } + static ActionNode* call_of_the_elements(PlayerbotAI*) { return new ActionNode("call of the elements", {}, {}, {}); } + static ActionNode* lightning_shield(PlayerbotAI*) { return new ActionNode("lightning shield", {}, {}, {}); } }; // ===== Single Target Strategy ===== @@ -49,14 +51,15 @@ EnhancementShamanStrategy::EnhancementShamanStrategy(PlayerbotAI* botAI) : Gener } // ===== Default Actions ===== -NextAction** EnhancementShamanStrategy::getDefaultActions() +std::vector EnhancementShamanStrategy::getDefaultActions() { - return NextAction::array(0, - new NextAction("stormstrike", 5.5f), - new NextAction("feral spirit", 5.4f), - new NextAction("earth shock", 5.3f), - new NextAction("lava lash", 5.2f), - new NextAction("melee", 5.0f), NULL); + return { + NextAction("stormstrike", 5.5f), + NextAction("feral spirit", 5.4f), + NextAction("earth shock", 5.3f), + NextAction("lava lash", 5.2f), + NextAction("melee", 5.0f) + }; } // ===== Trigger Initialization === @@ -65,19 +68,82 @@ void EnhancementShamanStrategy::InitTriggers(std::vector& triggers GenericShamanStrategy::InitTriggers(triggers); // Totem Trigger - triggers.push_back(new TriggerNode("call of the elements and enemy within melee", NextAction::array(0, new NextAction("call of the elements", 60.0f), nullptr))); + triggers.push_back( + new TriggerNode( + "call of the elements and enemy within melee", + { + NextAction("call of the elements", 60.0f) + } + ) + ); // Spirit Walk Trigger - triggers.push_back(new TriggerNode("spirit walk ready", NextAction::array(0, new NextAction("spirit walk", 50.0f), nullptr))); + triggers.push_back( + new TriggerNode( + "spirit walk ready", + { + NextAction("spirit walk", 50.0f) + } + ) + ); // Damage Triggers - triggers.push_back(new TriggerNode("enemy out of melee", NextAction::array(0, new NextAction("reach melee", 40.0f), nullptr))); - triggers.push_back(new TriggerNode("maelstrom weapon 5", NextAction::array(0, new NextAction("lightning bolt", 20.0f), nullptr))); - triggers.push_back(new TriggerNode("maelstrom weapon 4", NextAction::array(0, new NextAction("lightning bolt", 19.5f), nullptr))); - triggers.push_back(new TriggerNode("flame shock", NextAction::array(0, new NextAction("flame shock", 19.0f), nullptr))); - triggers.push_back(new TriggerNode("lightning shield", NextAction::array(0, new NextAction("lightning shield", 18.5f), nullptr))); + triggers.push_back( + new TriggerNode( + "enemy out of melee", + { + NextAction("reach melee", 40.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "maelstrom weapon 5", + { + NextAction("lightning bolt", 20.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "maelstrom weapon 4", + { + NextAction("lightning bolt", 19.5f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "flame shock", + { + NextAction("flame shock", 19.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "lightning shield", + { + NextAction("lightning shield", 18.5f) + } + ) + ); // Health/Mana Triggers - triggers.push_back(new TriggerNode("medium mana", NextAction::array(0, new NextAction("shamanistic rage", 23.0f), nullptr))); - triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("shamanistic rage", 23.0f), nullptr))); + triggers.push_back( + new TriggerNode( + "medium mana", + { + NextAction("shamanistic rage", 23.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "low health", + { + NextAction("shamanistic rage", 23.0f) + } + ) + ); } diff --git a/src/strategy/shaman/EnhancementShamanStrategy.h b/src/strategy/shaman/EnhancementShamanStrategy.h index 04e29907..1ebfb869 100644 --- a/src/strategy/shaman/EnhancementShamanStrategy.h +++ b/src/strategy/shaman/EnhancementShamanStrategy.h @@ -16,7 +16,7 @@ public: EnhancementShamanStrategy(PlayerbotAI* botAI); void InitTriggers(std::vector& triggers) override; - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; std::string const getName() override { return "enh"; } uint32 GetType() const override { return STRATEGY_TYPE_COMBAT | STRATEGY_TYPE_DPS | STRATEGY_TYPE_MELEE; } }; diff --git a/src/strategy/shaman/GenericShamanStrategy.cpp b/src/strategy/shaman/GenericShamanStrategy.cpp index 2df84edd..fd47d023 100644 --- a/src/strategy/shaman/GenericShamanStrategy.cpp +++ b/src/strategy/shaman/GenericShamanStrategy.cpp @@ -40,59 +40,59 @@ private: static ActionNode* totem_of_wrath([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("totem of wrath", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("flametongue totem"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("flametongue totem") }, + /*C*/ {}); } static ActionNode* flametongue_totem([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("flametongue totem", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("searing totem"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("searing totem") }, + /*C*/ {}); } static ActionNode* magma_totem([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("magma totem", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("searing totem"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("searing totem") }, + /*C*/ {}); } - static ActionNode* searing_totem(PlayerbotAI*) { return new ActionNode("searing totem", nullptr, nullptr, nullptr); } + static ActionNode* searing_totem(PlayerbotAI*) { return new ActionNode("searing totem", {}, {}, {}); } static ActionNode* strength_of_earth_totem([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("strength of earth totem", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("stoneskin totem"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("stoneskin totem") }, + /*C*/ {}); } - static ActionNode* stoneskin_totem(PlayerbotAI*) { return new ActionNode("stoneskin totem", nullptr, nullptr, nullptr); } + static ActionNode* stoneskin_totem(PlayerbotAI*) { return new ActionNode("stoneskin totem", {}, {}, {}); } static ActionNode* cleansing_totem([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("cleansing totem", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("mana spring totem"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("mana spring totem") }, + /*C*/ {}); } - static ActionNode* mana_spring_totem(PlayerbotAI*) { return new ActionNode("mana spring totem", nullptr, nullptr, nullptr); } - static ActionNode* healing_stream_totem(PlayerbotAI*) { return new ActionNode("healing stream totem", nullptr, nullptr, nullptr); } + static ActionNode* mana_spring_totem(PlayerbotAI*) { return new ActionNode("mana spring totem", {}, {}, {}); } + static ActionNode* healing_stream_totem(PlayerbotAI*) { return new ActionNode("healing stream totem", {}, {}, {}); } static ActionNode* wrath_of_air_totem([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("wrath of air totem", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("windfury totem"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("windfury totem") }, + /*C*/ {}); } static ActionNode* windfury_totem([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("windfury totem", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("grounding totem"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("grounding totem") }, + /*C*/ {}); } - static ActionNode* grounding_totem(PlayerbotAI*) { return new ActionNode("grounding totem", nullptr, nullptr, nullptr); } - static ActionNode* wind_shear(PlayerbotAI*) { return new ActionNode("wind shear", nullptr, nullptr, nullptr); } - static ActionNode* purge(PlayerbotAI*) { return new ActionNode("purge", nullptr, nullptr, nullptr); } + static ActionNode* grounding_totem(PlayerbotAI*) { return new ActionNode("grounding totem", {}, {}, {}); } + static ActionNode* wind_shear(PlayerbotAI*) { return new ActionNode("wind shear", {}, {}, {}); } + static ActionNode* purge(PlayerbotAI*) { return new ActionNode("purge", {}, {}, {}); } }; GenericShamanStrategy::GenericShamanStrategy(PlayerbotAI* botAI) : CombatStrategy(botAI) @@ -104,42 +104,42 @@ void GenericShamanStrategy::InitTriggers(std::vector& triggers) { CombatStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("wind shear", NextAction::array(0, new NextAction("wind shear", 23.0f), nullptr))); - triggers.push_back(new TriggerNode("wind shear on enemy healer", NextAction::array(0, new NextAction("wind shear on enemy healer", 23.0f), nullptr))); - triggers.push_back(new TriggerNode("purge", NextAction::array(0, new NextAction("purge", ACTION_DISPEL), nullptr))); - triggers.push_back(new TriggerNode("medium mana", NextAction::array(0, new NextAction("mana potion", ACTION_DISPEL), nullptr))); - triggers.push_back(new TriggerNode("new pet", NextAction::array(0, new NextAction("set pet stance", 65.0f), nullptr))); + triggers.push_back(new TriggerNode("wind shear", { NextAction("wind shear", 23.0f), })); + triggers.push_back(new TriggerNode("wind shear on enemy healer", { NextAction("wind shear on enemy healer", 23.0f), })); + triggers.push_back(new TriggerNode("purge", { NextAction("purge", ACTION_DISPEL), })); + triggers.push_back(new TriggerNode("medium mana", { NextAction("mana potion", ACTION_DISPEL), })); + triggers.push_back(new TriggerNode("new pet", { NextAction("set pet stance", 65.0f), })); } void ShamanCureStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("cure poison", NextAction::array(0, new NextAction("cure poison", 21.0f), nullptr))); - triggers.push_back(new TriggerNode("party member cure poison", NextAction::array(0, new NextAction("cure poison on party", 21.0f), nullptr))); - triggers.push_back(new TriggerNode("cleanse spirit poison", NextAction::array(0, new NextAction("cleanse spirit", 24.0f), nullptr))); - triggers.push_back(new TriggerNode("party member cleanse spirit poison", NextAction::array(0, new NextAction("cleanse spirit poison on party", 23.0f), nullptr))); - triggers.push_back(new TriggerNode("cure disease", NextAction::array(0, new NextAction("cure disease", 31.0f), nullptr))); - triggers.push_back(new TriggerNode("party member cure disease", NextAction::array(0, new NextAction("cure disease on party", 30.0f), nullptr))); - triggers.push_back(new TriggerNode("cleanse spirit disease", NextAction::array(0, new NextAction("cleanse spirit", 24.0f), nullptr))); - triggers.push_back(new TriggerNode("party member cleanse spirit disease", NextAction::array(0, new NextAction("cleanse spirit disease on party", 23.0f), nullptr))); - triggers.push_back(new TriggerNode("cleanse spirit curse", NextAction::array(0, new NextAction("cleanse spirit", 24.0f), nullptr))); - triggers.push_back(new TriggerNode("party member cleanse spirit curse", NextAction::array(0, new NextAction("cleanse spirit curse on party", 23.0f), nullptr))); + triggers.push_back(new TriggerNode("cure poison", { NextAction("cure poison", 21.0f), })); + triggers.push_back(new TriggerNode("party member cure poison", { NextAction("cure poison on party", 21.0f), })); + triggers.push_back(new TriggerNode("cleanse spirit poison", { NextAction("cleanse spirit", 24.0f), })); + triggers.push_back(new TriggerNode("party member cleanse spirit poison", { NextAction("cleanse spirit poison on party", 23.0f), })); + triggers.push_back(new TriggerNode("cure disease", { NextAction("cure disease", 31.0f), })); + triggers.push_back(new TriggerNode("party member cure disease", { NextAction("cure disease on party", 30.0f), })); + triggers.push_back(new TriggerNode("cleanse spirit disease", { NextAction("cleanse spirit", 24.0f), })); + triggers.push_back(new TriggerNode("party member cleanse spirit disease", { NextAction("cleanse spirit disease on party", 23.0f), })); + triggers.push_back(new TriggerNode("cleanse spirit curse", { NextAction("cleanse spirit", 24.0f), })); + triggers.push_back(new TriggerNode("party member cleanse spirit curse", { NextAction("cleanse spirit curse on party", 23.0f), })); } void ShamanBoostStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("heroism", NextAction::array(0, new NextAction("heroism", 30.0f), nullptr))); - triggers.push_back(new TriggerNode("bloodlust", NextAction::array(0, new NextAction("bloodlust", 30.0f), nullptr))); + triggers.push_back(new TriggerNode("heroism", { NextAction("heroism", 30.0f), })); + triggers.push_back(new TriggerNode("bloodlust", { NextAction("bloodlust", 30.0f), })); Player* bot = botAI->GetBot(); int tab = AiFactory::GetPlayerSpecTab(bot); if (tab == 0) // Elemental { - triggers.push_back(new TriggerNode("fire elemental totem", NextAction::array(0, new NextAction("fire elemental totem", 23.0f), nullptr))); + triggers.push_back(new TriggerNode("fire elemental totem", { NextAction("fire elemental totem", 23.0f), })); } else if (tab == 1) // Enhancement { - triggers.push_back(new TriggerNode("fire elemental totem", NextAction::array(0, new NextAction("fire elemental totem melee", 24.0f), nullptr))); + triggers.push_back(new TriggerNode("fire elemental totem", { NextAction("fire elemental totem melee", 24.0f), })); } } @@ -151,18 +151,18 @@ void ShamanAoeStrategy::InitTriggers(std::vector& triggers) if (tab == 0) // Elemental { - triggers.push_back(new TriggerNode("medium aoe",NextAction::array(0, new NextAction("fire nova", 23.0f), nullptr))); - triggers.push_back(new TriggerNode("chain lightning no cd", NextAction::array(0, new NextAction("chain lightning", 5.6f), nullptr))); + triggers.push_back(new TriggerNode("medium aoe",{ NextAction("fire nova", 23.0f), })); + triggers.push_back(new TriggerNode("chain lightning no cd", { NextAction("chain lightning", 5.6f), })); } else if (tab == 1) // Enhancement { - triggers.push_back(new TriggerNode("medium aoe",NextAction::array(0, - new NextAction("magma totem", 24.0f), - new NextAction("fire nova", 23.0f), nullptr))); + triggers.push_back(new TriggerNode("medium aoe",{ + NextAction("magma totem", 24.0f), + NextAction("fire nova", 23.0f), })); - triggers.push_back(new TriggerNode("maelstrom weapon 5 and medium aoe", NextAction::array(0, new NextAction("chain lightning", 22.0f), nullptr))); - triggers.push_back(new TriggerNode("maelstrom weapon 4 and medium aoe", NextAction::array(0, new NextAction("chain lightning", 21.0f), nullptr))); - triggers.push_back(new TriggerNode("enemy within melee", NextAction::array(0, new NextAction("fire nova", 5.1f), nullptr))); + triggers.push_back(new TriggerNode("maelstrom weapon 5 and medium aoe", { NextAction("chain lightning", 22.0f), })); + triggers.push_back(new TriggerNode("maelstrom weapon 4 and medium aoe", { NextAction("chain lightning", 21.0f), })); + triggers.push_back(new TriggerNode("enemy within melee", { NextAction("fire nova", 5.1f), })); } else if (tab == 2) // Restoration { diff --git a/src/strategy/shaman/RestoShamanStrategy.cpp b/src/strategy/shaman/RestoShamanStrategy.cpp index ea7476b4..698531a8 100644 --- a/src/strategy/shaman/RestoShamanStrategy.cpp +++ b/src/strategy/shaman/RestoShamanStrategy.cpp @@ -36,26 +36,26 @@ private: static ActionNode* mana_tide_totem([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("mana tide totem", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("mana potion"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("mana potion") }, + /*C*/ {}); } - static ActionNode* call_of_the_elements(PlayerbotAI*) { return new ActionNode("call of the elements", nullptr, nullptr, nullptr); } - static ActionNode* stoneclaw_totem(PlayerbotAI*) { return new ActionNode("stoneclaw totem", nullptr, nullptr, nullptr); } - static ActionNode* riptide_on_party(PlayerbotAI*) { return new ActionNode("riptide on party", nullptr, nullptr, nullptr); } - static ActionNode* chain_heal_on_party(PlayerbotAI*) { return new ActionNode("chain heal on party", nullptr, nullptr, nullptr); } - static ActionNode* healing_wave_on_party(PlayerbotAI*) { return new ActionNode("healing wave on party", nullptr, nullptr, nullptr); } - static ActionNode* lesser_healing_wave_on_party(PlayerbotAI*) { return new ActionNode("lesser healing wave on party", nullptr, nullptr, nullptr); } - static ActionNode* earth_shield_on_main_tank(PlayerbotAI*) { return new ActionNode("earth shield on main tank", nullptr, nullptr, nullptr); } - static ActionNode* cleanse_spirit_poison_on_party(PlayerbotAI*) { return new ActionNode("cleanse spirit poison on party", nullptr, nullptr, nullptr); } - static ActionNode* cleanse_spirit_disease_on_party(PlayerbotAI*) { return new ActionNode("cleanse spirit disease on party", nullptr, nullptr, nullptr); } - static ActionNode* cleanse_spirit_curse_on_party(PlayerbotAI*) { return new ActionNode("cleanse spirit curse on party", nullptr, nullptr, nullptr); } - static ActionNode* cleansing_totem(PlayerbotAI*) { return new ActionNode("cleansing totem", nullptr, nullptr, nullptr); } - static ActionNode* water_shield(PlayerbotAI*) { return new ActionNode("water shield", nullptr, nullptr, nullptr); } - static ActionNode* flame_shock(PlayerbotAI*) { return new ActionNode("flame shock", nullptr, nullptr, nullptr); } - static ActionNode* lava_burst(PlayerbotAI*) { return new ActionNode("lava burst", nullptr, nullptr, nullptr); } - static ActionNode* lightning_bolt(PlayerbotAI*) { return new ActionNode("lightning bolt", nullptr, nullptr, nullptr); } - static ActionNode* chain_lightning(PlayerbotAI*) { return new ActionNode("chain lightning", nullptr, nullptr, nullptr); } + static ActionNode* call_of_the_elements(PlayerbotAI*) { return new ActionNode("call of the elements", {}, {}, {}); } + static ActionNode* stoneclaw_totem(PlayerbotAI*) { return new ActionNode("stoneclaw totem", {}, {}, {}); } + static ActionNode* riptide_on_party(PlayerbotAI*) { return new ActionNode("riptide on party", {}, {}, {}); } + static ActionNode* chain_heal_on_party(PlayerbotAI*) { return new ActionNode("chain heal on party", {}, {}, {}); } + static ActionNode* healing_wave_on_party(PlayerbotAI*) { return new ActionNode("healing wave on party", {}, {}, {}); } + static ActionNode* lesser_healing_wave_on_party(PlayerbotAI*) { return new ActionNode("lesser healing wave on party", {}, {}, {}); } + static ActionNode* earth_shield_on_main_tank(PlayerbotAI*) { return new ActionNode("earth shield on main tank", {}, {}, {}); } + static ActionNode* cleanse_spirit_poison_on_party(PlayerbotAI*) { return new ActionNode("cleanse spirit poison on party", {}, {}, {}); } + static ActionNode* cleanse_spirit_disease_on_party(PlayerbotAI*) { return new ActionNode("cleanse spirit disease on party", {}, {}, {}); } + static ActionNode* cleanse_spirit_curse_on_party(PlayerbotAI*) { return new ActionNode("cleanse spirit curse on party", {}, {}, {}); } + static ActionNode* cleansing_totem(PlayerbotAI*) { return new ActionNode("cleansing totem", {}, {}, {}); } + static ActionNode* water_shield(PlayerbotAI*) { return new ActionNode("water shield", {}, {}, {}); } + static ActionNode* flame_shock(PlayerbotAI*) { return new ActionNode("flame shock", {}, {}, {}); } + static ActionNode* lava_burst(PlayerbotAI*) { return new ActionNode("lava burst", {}, {}, {}); } + static ActionNode* lightning_bolt(PlayerbotAI*) { return new ActionNode("lightning bolt", {}, {}, {}); } + static ActionNode* chain_lightning(PlayerbotAI*) { return new ActionNode("chain lightning", {}, {}, {}); } }; // ===== Single Target Strategy ===== @@ -70,55 +70,55 @@ void RestoShamanStrategy::InitTriggers(std::vector& triggers) GenericShamanStrategy::InitTriggers(triggers); // Totem Triggers - triggers.push_back(new TriggerNode("call of the elements", NextAction::array(0, new NextAction("call of the elements", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("stoneclaw totem", 40.0f), nullptr))); - triggers.push_back(new TriggerNode("medium mana", NextAction::array(0, new NextAction("mana tide totem", ACTION_HIGH + 5), NULL))); + triggers.push_back(new TriggerNode("call of the elements", { NextAction("call of the elements", 60.0f) })); + triggers.push_back(new TriggerNode("low health", { NextAction("stoneclaw totem", 40.0f) })); + triggers.push_back(new TriggerNode("medium mana", { NextAction("mana tide totem", ACTION_HIGH + 5) })); // Healing Triggers - triggers.push_back(new TriggerNode("group heal setting", NextAction::array(0, - new NextAction("riptide on party", 27.0f), - new NextAction("chain heal on party", 26.0f), NULL))); + triggers.push_back(new TriggerNode("group heal setting", { + NextAction("riptide on party", 27.0f), + NextAction("chain heal on party", 26.0f) })); - triggers.push_back(new TriggerNode("party member critical health", NextAction::array(0, - new NextAction("riptide on party", 25.0f), - new NextAction("healing wave on party", 24.0f), - new NextAction("lesser healing wave on party", 23.0f), nullptr))); + triggers.push_back(new TriggerNode("party member critical health", { + NextAction("riptide on party", 25.0f), + NextAction("healing wave on party", 24.0f), + NextAction("lesser healing wave on party", 23.0f) })); - triggers.push_back(new TriggerNode("party member low health", NextAction::array(0, - new NextAction("riptide on party", 19.0f), - new NextAction("healing wave on party", 18.0f), - new NextAction("lesser healing wave on party", 17.0f), nullptr))); + triggers.push_back(new TriggerNode("party member low health", { + NextAction("riptide on party", 19.0f), + NextAction("healing wave on party", 18.0f), + NextAction("lesser healing wave on party", 17.0f) })); - triggers.push_back(new TriggerNode("party member medium health", NextAction::array(0, - new NextAction("riptide on party", 16.0f), - new NextAction("healing wave on party", 15.0f), - new NextAction("lesser healing wave on party", 14.0f), nullptr))); + triggers.push_back(new TriggerNode("party member medium health", { + NextAction("riptide on party", 16.0f), + NextAction("healing wave on party", 15.0f), + NextAction("lesser healing wave on party", 14.0f) })); - triggers.push_back(new TriggerNode("party member almost full health", NextAction::array(0, - new NextAction("riptide on party", 12.0f), - new NextAction("lesser healing wave on party", 11.0f), nullptr))); + triggers.push_back(new TriggerNode("party member almost full health", { + NextAction("riptide on party", 12.0f), + NextAction("lesser healing wave on party", 11.0f) })); - triggers.push_back(new TriggerNode("earth shield on main tank", NextAction::array(0, new NextAction("earth shield on main tank", ACTION_HIGH + 7), NULL))); + triggers.push_back(new TriggerNode("earth shield on main tank", { NextAction("earth shield on main tank", ACTION_HIGH + 7) })); // Dispel Triggers - triggers.push_back(new TriggerNode("party member cleanse spirit poison", NextAction::array(0, new NextAction("cleanse spirit poison on party", ACTION_DISPEL + 2), nullptr))); - triggers.push_back(new TriggerNode("party member cleanse spirit disease", NextAction::array(0, new NextAction("cleanse spirit disease on party", ACTION_DISPEL + 2), nullptr))); - triggers.push_back(new TriggerNode("party member cleanse spirit curse",NextAction::array(0, new NextAction("cleanse spirit curse on party", ACTION_DISPEL + 2), NULL))); + triggers.push_back(new TriggerNode("party member cleanse spirit poison", { NextAction("cleanse spirit poison on party", ACTION_DISPEL + 2) })); + triggers.push_back(new TriggerNode("party member cleanse spirit disease", { NextAction("cleanse spirit disease on party", ACTION_DISPEL + 2) })); + triggers.push_back(new TriggerNode("party member cleanse spirit curse",{ NextAction("cleanse spirit curse on party", ACTION_DISPEL + 2) })); // Range/Mana Triggers - triggers.push_back(new TriggerNode("enemy too close for spell", NextAction::array(0, new NextAction("flee", ACTION_MOVE + 9), nullptr))); - triggers.push_back(new TriggerNode("party member to heal out of spell range", NextAction::array(0, new NextAction("reach party member to heal", ACTION_CRITICAL_HEAL + 1), nullptr))); - triggers.push_back(new TriggerNode("water shield", NextAction::array(0, new NextAction("water shield", 19.5f), nullptr))); + triggers.push_back(new TriggerNode("enemy too close for spell", { NextAction("flee", ACTION_MOVE + 9) })); + triggers.push_back(new TriggerNode("party member to heal out of spell range", { NextAction("reach party member to heal", ACTION_CRITICAL_HEAL + 1) })); + triggers.push_back(new TriggerNode("water shield", { NextAction("water shield", 19.5f) })); } void ShamanHealerDpsStrategy::InitTriggers(std::vector& triggers) { triggers.push_back(new TriggerNode("healer should attack", - NextAction::array(0, new NextAction("flame shock", ACTION_DEFAULT + 0.2f), - new NextAction("lava burst", ACTION_DEFAULT + 0.1f), - new NextAction("lightning bolt", ACTION_DEFAULT), nullptr))); + { NextAction("flame shock", ACTION_DEFAULT + 0.2f), + NextAction("lava burst", ACTION_DEFAULT + 0.1f), + NextAction("lightning bolt", ACTION_DEFAULT) })); triggers.push_back( new TriggerNode("medium aoe and healer should attack", - NextAction::array(0, new NextAction("chain lightning", ACTION_DEFAULT + 0.3f), nullptr))); + { NextAction("chain lightning", ACTION_DEFAULT + 0.3f) })); } diff --git a/src/strategy/shaman/ShamanNonCombatStrategy.cpp b/src/strategy/shaman/ShamanNonCombatStrategy.cpp index 623b013e..c7200053 100644 --- a/src/strategy/shaman/ShamanNonCombatStrategy.cpp +++ b/src/strategy/shaman/ShamanNonCombatStrategy.cpp @@ -25,33 +25,33 @@ private: static ActionNode* flametongue_weapon([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("flametongue weapon", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("rockbiter weapon"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("rockbiter weapon") }, + /*C*/ {}); } static ActionNode* frostbrand_weapon([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("frostbrand weapon", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("flametongue weapon"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("flametongue weapon") }, + /*C*/ {}); } static ActionNode* windfury_weapon([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("windfury weapon", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("flametongue weapon"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("flametongue weapon") }, + /*C*/ {}); } static ActionNode* earthliving_weapon([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("earthliving weapon", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("flametongue weapon"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("flametongue weapon") }, + /*C*/ {}); } - static ActionNode* wind_shear(PlayerbotAI*) { return new ActionNode("wind shear", nullptr, nullptr, nullptr); } - static ActionNode* purge(PlayerbotAI*) { return new ActionNode("purge", nullptr, nullptr, nullptr); } + static ActionNode* wind_shear(PlayerbotAI*) { return new ActionNode("wind shear", {}, {}, {}); } + static ActionNode* purge(PlayerbotAI*) { return new ActionNode("purge", {}, {}, {}); } }; ShamanNonCombatStrategy::ShamanNonCombatStrategy(PlayerbotAI* botAI) : NonCombatStrategy(botAI) @@ -64,29 +64,29 @@ void ShamanNonCombatStrategy::InitTriggers(std::vector& triggers) NonCombatStrategy::InitTriggers(triggers); // Totemic Recall - triggers.push_back(new TriggerNode("totemic recall", NextAction::array(0, new NextAction("totemic recall", 60.0f), nullptr))); + triggers.push_back(new TriggerNode("totemic recall", { NextAction("totemic recall", 60.0f), })); // Healing/Resurrect Triggers - triggers.push_back(new TriggerNode("party member dead", NextAction::array(0, new NextAction("ancestral spirit", ACTION_CRITICAL_HEAL + 10), nullptr))); - triggers.push_back(new TriggerNode("party member critical health", NextAction::array(0, - new NextAction("riptide on party", 31.0f), - new NextAction("healing wave on party", 30.0f), NULL))); - triggers.push_back(new TriggerNode("party member low health",NextAction::array(0, - new NextAction("riptide on party", 29.0f), - new NextAction("healing wave on party", 28.0f), NULL))); - triggers.push_back(new TriggerNode("party member medium health",NextAction::array(0, - new NextAction("riptide on party", 27.0f), - new NextAction("healing wave on party", 26.0f), NULL))); - triggers.push_back(new TriggerNode("party member almost full health",NextAction::array(0, - new NextAction("riptide on party", 25.0f), - new NextAction("lesser healing wave on party", 24.0f), NULL))); - triggers.push_back(new TriggerNode("group heal setting",NextAction::array(0, new NextAction("chain heal on party", 27.0f), NULL))); + triggers.push_back(new TriggerNode("party member dead", { NextAction("ancestral spirit", ACTION_CRITICAL_HEAL + 10), })); + triggers.push_back(new TriggerNode("party member critical health", { + NextAction("riptide on party", 31.0f), + NextAction("healing wave on party", 30.0f) })); + triggers.push_back(new TriggerNode("party member low health",{ + NextAction("riptide on party", 29.0f), + NextAction("healing wave on party", 28.0f) })); + triggers.push_back(new TriggerNode("party member medium health",{ + NextAction("riptide on party", 27.0f), + NextAction("healing wave on party", 26.0f) })); + triggers.push_back(new TriggerNode("party member almost full health",{ + NextAction("riptide on party", 25.0f), + NextAction("lesser healing wave on party", 24.0f) })); + triggers.push_back(new TriggerNode("group heal setting",{ NextAction("chain heal on party", 27.0f) })); // Cure Triggers - triggers.push_back(new TriggerNode("cure poison", NextAction::array(0, new NextAction("cure poison", 21.0f), nullptr))); - triggers.push_back(new TriggerNode("party member cure poison", NextAction::array(0, new NextAction("cure poison on party", 21.0f), nullptr))); - triggers.push_back(new TriggerNode("cure disease", NextAction::array(0, new NextAction("cure disease", 31.0f), nullptr))); - triggers.push_back(new TriggerNode("party member cure disease", NextAction::array(0, new NextAction("cure disease on party", 30.0f), nullptr))); + triggers.push_back(new TriggerNode("cure poison", { NextAction("cure poison", 21.0f), })); + triggers.push_back(new TriggerNode("party member cure poison", { NextAction("cure poison on party", 21.0f), })); + triggers.push_back(new TriggerNode("cure disease", { NextAction("cure disease", 31.0f), })); + triggers.push_back(new TriggerNode("party member cure disease", { NextAction("cure disease on party", 30.0f), })); // Out of Combat Buff Triggers Player* bot = botAI->GetBot(); @@ -94,30 +94,30 @@ void ShamanNonCombatStrategy::InitTriggers(std::vector& triggers) if (tab == 0) // Elemental { - triggers.push_back(new TriggerNode("main hand weapon no imbue", NextAction::array(0, new NextAction("flametongue weapon", 22.0f), nullptr))); - triggers.push_back(new TriggerNode("water shield", NextAction::array(0, new NextAction("water shield", 21.0f), nullptr))); + triggers.push_back(new TriggerNode("main hand weapon no imbue", { NextAction("flametongue weapon", 22.0f), })); + triggers.push_back(new TriggerNode("water shield", { NextAction("water shield", 21.0f), })); } else if (tab == 1) // Enhancement { - triggers.push_back(new TriggerNode("main hand weapon no imbue", NextAction::array(0, new NextAction("windfury weapon", 22.0f), nullptr))); - triggers.push_back(new TriggerNode("off hand weapon no imbue", NextAction::array(0, new NextAction("flametongue weapon", 21.0f), nullptr))); - triggers.push_back(new TriggerNode("lightning shield", NextAction::array(0, new NextAction("lightning shield", 20.0f), nullptr))); + triggers.push_back(new TriggerNode("main hand weapon no imbue", { NextAction("windfury weapon", 22.0f), })); + triggers.push_back(new TriggerNode("off hand weapon no imbue", { NextAction("flametongue weapon", 21.0f), })); + triggers.push_back(new TriggerNode("lightning shield", { NextAction("lightning shield", 20.0f), })); } else if (tab == 2) // Restoration { - triggers.push_back(new TriggerNode("main hand weapon no imbue",NextAction::array(0, new NextAction("earthliving weapon", 22.0f), nullptr))); - triggers.push_back(new TriggerNode("water shield", NextAction::array(0, new NextAction("water shield", 20.0f), nullptr))); + triggers.push_back(new TriggerNode("main hand weapon no imbue",{ NextAction("earthliving weapon", 22.0f), })); + triggers.push_back(new TriggerNode("water shield", { NextAction("water shield", 20.0f), })); } // Buff Triggers while swimming - triggers.push_back(new TriggerNode("water breathing", NextAction::array(0, new NextAction("water breathing", 12.0f), nullptr))); - triggers.push_back(new TriggerNode("water walking", NextAction::array(0, new NextAction("water walking", 12.0f), nullptr))); - triggers.push_back(new TriggerNode("water breathing on party", NextAction::array(0, new NextAction("water breathing on party", 11.0f), nullptr))); - triggers.push_back(new TriggerNode("water walking on party", NextAction::array(0, new NextAction("water walking on party", 11.0f), nullptr))); + triggers.push_back(new TriggerNode("water breathing", { NextAction("water breathing", 12.0f), })); + triggers.push_back(new TriggerNode("water walking", { NextAction("water walking", 12.0f), })); + triggers.push_back(new TriggerNode("water breathing on party", { NextAction("water breathing on party", 11.0f), })); + triggers.push_back(new TriggerNode("water walking on party", { NextAction("water walking on party", 11.0f), })); // Pet Triggers - triggers.push_back(new TriggerNode("has pet", NextAction::array(0, new NextAction("toggle pet spell", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("new pet", NextAction::array(0, new NextAction("set pet stance", 65.0f), nullptr))); + triggers.push_back(new TriggerNode("has pet", { NextAction("toggle pet spell", 60.0f), })); + triggers.push_back(new TriggerNode("new pet", { NextAction("set pet stance", 65.0f), })); } void ShamanNonCombatStrategy::InitMultipliers(std::vector& multipliers) diff --git a/src/strategy/shaman/TotemsShamanStrategy.cpp b/src/strategy/shaman/TotemsShamanStrategy.cpp index d9149b8c..d00cc5e6 100644 --- a/src/strategy/shaman/TotemsShamanStrategy.cpp +++ b/src/strategy/shaman/TotemsShamanStrategy.cpp @@ -15,32 +15,32 @@ StrengthOfEarthTotemStrategy::StrengthOfEarthTotemStrategy(PlayerbotAI* botAI) : void StrengthOfEarthTotemStrategy::InitTriggers(std::vector& triggers) { GenericShamanStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("set strength of earth totem", NextAction::array(0, new NextAction("set strength of earth totem", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("no earth totem", NextAction::array(0, new NextAction("strength of earth totem", 55.0f), nullptr))); + triggers.push_back(new TriggerNode("set strength of earth totem", { NextAction("set strength of earth totem", 60.0f) })); + triggers.push_back(new TriggerNode("no earth totem", { NextAction("strength of earth totem", 55.0f) })); } StoneclawTotemStrategy::StoneclawTotemStrategy(PlayerbotAI* botAI) : GenericShamanStrategy(botAI) {} void StoneclawTotemStrategy::InitTriggers(std::vector& triggers) { GenericShamanStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("set stoneskin totem", NextAction::array(0, new NextAction("set stoneskin totem", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("no earth totem", NextAction::array(0, new NextAction("stoneskin totem", 55.0f), nullptr))); + triggers.push_back(new TriggerNode("set stoneskin totem", { NextAction("set stoneskin totem", 60.0f) })); + triggers.push_back(new TriggerNode("no earth totem", { NextAction("stoneskin totem", 55.0f) })); } EarthTotemStrategy::EarthTotemStrategy(PlayerbotAI* botAI) : GenericShamanStrategy(botAI) {} void EarthTotemStrategy::InitTriggers(std::vector& triggers) { GenericShamanStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("set tremor totem", NextAction::array(0, new NextAction("set tremor totem", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("no earth totem", NextAction::array(0, new NextAction("tremor totem", 55.0f), nullptr))); + triggers.push_back(new TriggerNode("set tremor totem", { NextAction("set tremor totem", 60.0f) })); + triggers.push_back(new TriggerNode("no earth totem", { NextAction("tremor totem", 55.0f) })); } EarthbindTotemStrategy::EarthbindTotemStrategy(PlayerbotAI* botAI) : GenericShamanStrategy(botAI) {} void EarthbindTotemStrategy::InitTriggers(std::vector& triggers) { GenericShamanStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("set earthbind totem", NextAction::array(0, new NextAction("set earthbind totem", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("no earth totem", NextAction::array(0, new NextAction("earthbind totem", 55.0f), nullptr))); + triggers.push_back(new TriggerNode("set earthbind totem", { NextAction("set earthbind totem", 60.0f) })); + triggers.push_back(new TriggerNode("no earth totem", { NextAction("earthbind totem", 55.0f) })); } // Fire Totems @@ -48,24 +48,24 @@ SearingTotemStrategy::SearingTotemStrategy(PlayerbotAI* botAI) : GenericShamanSt void SearingTotemStrategy::InitTriggers(std::vector& triggers) { GenericShamanStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("set searing totem", NextAction::array(0, new NextAction("set searing totem", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("no fire totem", NextAction::array(0, new NextAction("searing totem", 55.0f), nullptr))); + triggers.push_back(new TriggerNode("set searing totem", { NextAction("set searing totem", 60.0f) })); + triggers.push_back(new TriggerNode("no fire totem", { NextAction("searing totem", 55.0f) })); } MagmaTotemStrategy::MagmaTotemStrategy(PlayerbotAI* botAI) : GenericShamanStrategy(botAI) {} void MagmaTotemStrategy::InitTriggers(std::vector& triggers) { GenericShamanStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("set magma totem", NextAction::array(0, new NextAction("set magma totem", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("no fire totem", NextAction::array(0, new NextAction("magma totem", 55.0f), nullptr))); + triggers.push_back(new TriggerNode("set magma totem", { NextAction("set magma totem", 60.0f) })); + triggers.push_back(new TriggerNode("no fire totem", { NextAction("magma totem", 55.0f) })); } FlametongueTotemStrategy::FlametongueTotemStrategy(PlayerbotAI* botAI) : GenericShamanStrategy(botAI) {} void FlametongueTotemStrategy::InitTriggers(std::vector& triggers) { GenericShamanStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("set flametongue totem", NextAction::array(0, new NextAction("set flametongue totem", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("no fire totem", NextAction::array(0, new NextAction("flametongue totem", 55.0f), nullptr))); + triggers.push_back(new TriggerNode("set flametongue totem", { NextAction("set flametongue totem", 60.0f) })); + triggers.push_back(new TriggerNode("no fire totem", { NextAction("flametongue totem", 55.0f) })); } TotemOfWrathStrategy::TotemOfWrathStrategy(PlayerbotAI* botAI) : GenericShamanStrategy(botAI) {} @@ -76,21 +76,21 @@ void TotemOfWrathStrategy::InitTriggers(std::vector& triggers) Player* bot = botAI->GetBot(); if (bot->HasSpell(30706)) { - triggers.push_back(new TriggerNode("set totem of wrath", NextAction::array(0, new NextAction("set totem of wrath", 60.0f), nullptr))); + triggers.push_back(new TriggerNode("set totem of wrath", { NextAction("set totem of wrath", 60.0f) })); } else if (bot->HasSpell(8227)) { - triggers.push_back(new TriggerNode("set flametongue totem", NextAction::array(0, new NextAction("set flametongue totem", 60.0f), nullptr))); + triggers.push_back(new TriggerNode("set flametongue totem", { NextAction("set flametongue totem", 60.0f) })); } - triggers.push_back(new TriggerNode("no fire totem", NextAction::array(0, new NextAction("totem of wrath", 55.0f), nullptr))); + triggers.push_back(new TriggerNode("no fire totem", { NextAction("totem of wrath", 55.0f) })); } FrostResistanceTotemStrategy::FrostResistanceTotemStrategy(PlayerbotAI* botAI) : GenericShamanStrategy(botAI) {} void FrostResistanceTotemStrategy::InitTriggers(std::vector& triggers) { GenericShamanStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("set frost resistance totem", NextAction::array(0, new NextAction("set frost resistance totem", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("no fire totem", NextAction::array(0, new NextAction("frost resistance totem", 55.0f), nullptr))); + triggers.push_back(new TriggerNode("set frost resistance totem", { NextAction("set frost resistance totem", 60.0f) })); + triggers.push_back(new TriggerNode("no fire totem", { NextAction("frost resistance totem", 55.0f) })); } // Water Totems @@ -98,16 +98,16 @@ HealingStreamTotemStrategy::HealingStreamTotemStrategy(PlayerbotAI* botAI) : Gen void HealingStreamTotemStrategy::InitTriggers(std::vector& triggers) { GenericShamanStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("set healing stream totem", NextAction::array(0, new NextAction("set healing stream totem", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("no water totem", NextAction::array(0, new NextAction("healing stream totem", 55.0f), nullptr))); + triggers.push_back(new TriggerNode("set healing stream totem", { NextAction("set healing stream totem", 60.0f) })); + triggers.push_back(new TriggerNode("no water totem", { NextAction("healing stream totem", 55.0f) })); } ManaSpringTotemStrategy::ManaSpringTotemStrategy(PlayerbotAI* botAI) : GenericShamanStrategy(botAI) {} void ManaSpringTotemStrategy::InitTriggers(std::vector& triggers) { GenericShamanStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("set mana spring totem", NextAction::array(0, new NextAction("set mana spring totem", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("no water totem", NextAction::array(0, new NextAction("mana spring totem", 55.0f), nullptr))); + triggers.push_back(new TriggerNode("set mana spring totem", { NextAction("set mana spring totem", 60.0f) })); + triggers.push_back(new TriggerNode("no water totem", { NextAction("mana spring totem", 55.0f) })); } CleansingTotemStrategy::CleansingTotemStrategy(PlayerbotAI* botAI) : GenericShamanStrategy(botAI) {} @@ -118,21 +118,21 @@ void CleansingTotemStrategy::InitTriggers(std::vector& triggers) Player* bot = botAI->GetBot(); if (bot->HasSpell(8170)) { - triggers.push_back(new TriggerNode("set cleansing totem", NextAction::array(0, new NextAction("set cleansing totem", 60.0f), nullptr))); + triggers.push_back(new TriggerNode("set cleansing totem", { NextAction("set cleansing totem", 60.0f) })); } else if (bot->HasSpell(5675)) { - triggers.push_back(new TriggerNode("set mana spring totem", NextAction::array(0, new NextAction("set mana spring totem", 60.0f), nullptr))); + triggers.push_back(new TriggerNode("set mana spring totem", { NextAction("set mana spring totem", 60.0f) })); } - triggers.push_back(new TriggerNode("no water totem", NextAction::array(0, new NextAction("cleansing totem", 55.0f), nullptr))); + triggers.push_back(new TriggerNode("no water totem", { NextAction("cleansing totem", 55.0f) })); } FireResistanceTotemStrategy::FireResistanceTotemStrategy(PlayerbotAI* botAI) : GenericShamanStrategy(botAI) {} void FireResistanceTotemStrategy::InitTriggers(std::vector& triggers) { GenericShamanStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("set fire resistance totem", NextAction::array(0, new NextAction("set fire resistance totem", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("no water totem", NextAction::array(0, new NextAction("fire resistance totem", 55.0f), nullptr))); + triggers.push_back(new TriggerNode("set fire resistance totem", { NextAction("set fire resistance totem", 60.0f) })); + triggers.push_back(new TriggerNode("no water totem", { NextAction("fire resistance totem", 55.0f) })); } // Air Totems @@ -144,14 +144,14 @@ void WrathOfAirTotemStrategy::InitTriggers(std::vector& triggers) Player* bot = botAI->GetBot(); if (bot->HasSpell(3738)) { - triggers.push_back(new TriggerNode("set wrath of air totem", NextAction::array(0, new NextAction("set wrath of air totem", 60.0f), nullptr))); + triggers.push_back(new TriggerNode("set wrath of air totem", { NextAction("set wrath of air totem", 60.0f) })); } else if (bot->HasSpell(8177)) { - triggers.push_back(new TriggerNode("set grounding totem", NextAction::array(0, new NextAction("set grounding totem", 60.0f), nullptr))); + triggers.push_back(new TriggerNode("set grounding totem", { NextAction("set grounding totem", 60.0f) })); } triggers.push_back( - new TriggerNode("no air totem", NextAction::array(0, new NextAction("wrath of air totem", 55.0f), nullptr))); + new TriggerNode("no air totem", { NextAction("wrath of air totem", 55.0f) })); } WindfuryTotemStrategy::WindfuryTotemStrategy(PlayerbotAI* botAI) : GenericShamanStrategy(botAI) {} @@ -162,27 +162,27 @@ void WindfuryTotemStrategy::InitTriggers(std::vector& triggers) Player* bot = botAI->GetBot(); if (bot->HasSpell(8512)) { - triggers.push_back(new TriggerNode("set windfury totem", NextAction::array(0, new NextAction("set windfury totem", 60.0f), nullptr))); + triggers.push_back(new TriggerNode("set windfury totem", { NextAction("set windfury totem", 60.0f) })); } else if (bot->HasSpell(8177)) { - triggers.push_back(new TriggerNode("set grounding totem", NextAction::array(0, new NextAction("set grounding totem", 60.0f), nullptr))); + triggers.push_back(new TriggerNode("set grounding totem", { NextAction("set grounding totem", 60.0f) })); } - triggers.push_back(new TriggerNode("no air totem", NextAction::array(0, new NextAction("windfury totem", 55.0f), nullptr))); + triggers.push_back(new TriggerNode("no air totem", { NextAction("windfury totem", 55.0f) })); } NatureResistanceTotemStrategy::NatureResistanceTotemStrategy(PlayerbotAI* botAI) : GenericShamanStrategy(botAI) {} void NatureResistanceTotemStrategy::InitTriggers(std::vector& triggers) { GenericShamanStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("set nature resistance totem", NextAction::array(0, new NextAction("set nature resistance totem", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("no air totem", NextAction::array(0, new NextAction("nature resistance totem", 55.0f), nullptr))); + triggers.push_back(new TriggerNode("set nature resistance totem", { NextAction("set nature resistance totem", 60.0f) })); + triggers.push_back(new TriggerNode("no air totem", { NextAction("nature resistance totem", 55.0f) })); } GroundingTotemStrategy::GroundingTotemStrategy(PlayerbotAI* botAI) : GenericShamanStrategy(botAI) {} void GroundingTotemStrategy::InitTriggers(std::vector& triggers) { GenericShamanStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("set grounding totem", NextAction::array(0, new NextAction("set grounding totem", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("no air totem", NextAction::array(0, new NextAction("grounding totem", 55.0f), nullptr))); + triggers.push_back(new TriggerNode("set grounding totem", { NextAction("set grounding totem", 60.0f) })); + triggers.push_back(new TriggerNode("no air totem", { NextAction("grounding totem", 55.0f) })); } diff --git a/src/strategy/warlock/AfflictionWarlockStrategy.cpp b/src/strategy/warlock/AfflictionWarlockStrategy.cpp index c35127f2..78da04d9 100644 --- a/src/strategy/warlock/AfflictionWarlockStrategy.cpp +++ b/src/strategy/warlock/AfflictionWarlockStrategy.cpp @@ -27,18 +27,18 @@ public: } private: - static ActionNode* corruption(PlayerbotAI*) { return new ActionNode("corruption", nullptr, nullptr, nullptr); } - static ActionNode* corruption_on_attacker(PlayerbotAI*) { return new ActionNode("corruption on attacker", nullptr, nullptr, nullptr); } - static ActionNode* unstable_affliction(PlayerbotAI*) { return new ActionNode("unstable affliction", nullptr, nullptr, nullptr); } - static ActionNode* unstable_affliction_on_attacker(PlayerbotAI*) { return new ActionNode("unstable affliction on attacker", nullptr, nullptr, nullptr); } - static ActionNode* haunt(PlayerbotAI*) { return new ActionNode("haunt", nullptr, nullptr, nullptr); } - static ActionNode* shadow_bolt(PlayerbotAI*) { return new ActionNode("shadow bolt", nullptr, nullptr, nullptr); } - static ActionNode* drain_soul(PlayerbotAI*) { return new ActionNode("drain soul", nullptr, nullptr, nullptr); } - static ActionNode* life_tap(PlayerbotAI*) { return new ActionNode("life tap", nullptr, nullptr, nullptr); } - static ActionNode* shadowflame(PlayerbotAI*) { return new ActionNode("shadowflame", nullptr, nullptr, nullptr); } - static ActionNode* seed_of_corruption_on_attacker(PlayerbotAI*) { return new ActionNode("seed of corruption on attacker", nullptr, nullptr, nullptr); } - static ActionNode* seed_of_corruption(PlayerbotAI*) { return new ActionNode("seed of corruption", nullptr, nullptr, nullptr); } - static ActionNode* rain_of_fire(PlayerbotAI*) { return new ActionNode("rain of fire", nullptr, nullptr, nullptr); } + static ActionNode* corruption(PlayerbotAI*) { return new ActionNode("corruption", {}, {}, {}); } + static ActionNode* corruption_on_attacker(PlayerbotAI*) { return new ActionNode("corruption on attacker", {}, {}, {}); } + static ActionNode* unstable_affliction(PlayerbotAI*) { return new ActionNode("unstable affliction", {}, {}, {}); } + static ActionNode* unstable_affliction_on_attacker(PlayerbotAI*) { return new ActionNode("unstable affliction on attacker", {}, {}, {}); } + static ActionNode* haunt(PlayerbotAI*) { return new ActionNode("haunt", {}, {}, {}); } + static ActionNode* shadow_bolt(PlayerbotAI*) { return new ActionNode("shadow bolt", {}, {}, {}); } + static ActionNode* drain_soul(PlayerbotAI*) { return new ActionNode("drain soul", {}, {}, {}); } + static ActionNode* life_tap(PlayerbotAI*) { return new ActionNode("life tap", {}, {}, {}); } + static ActionNode* shadowflame(PlayerbotAI*) { return new ActionNode("shadowflame", {}, {}, {}); } + static ActionNode* seed_of_corruption_on_attacker(PlayerbotAI*) { return new ActionNode("seed of corruption on attacker", {}, {}, {}); } + static ActionNode* seed_of_corruption(PlayerbotAI*) { return new ActionNode("seed of corruption", {}, {}, {}); } + static ActionNode* rain_of_fire(PlayerbotAI*) { return new ActionNode("rain of fire", {}, {}, {}); } }; // ===== Single Target Strategy ===== @@ -48,14 +48,15 @@ AfflictionWarlockStrategy::AfflictionWarlockStrategy(PlayerbotAI* botAI) : Gener } // ===== Default Actions ===== -NextAction** AfflictionWarlockStrategy::getDefaultActions() +std::vector AfflictionWarlockStrategy::getDefaultActions() { - return NextAction::array( 0, - new NextAction("corruption", 5.5f), - new NextAction("unstable affliction", 5.4f), - new NextAction("haunt", 5.3f), - new NextAction("shadow bolt", 5.2f), - new NextAction("shoot", 5.0f), nullptr); + return { + NextAction("corruption", 5.5f), + NextAction("unstable affliction", 5.4f), + NextAction("haunt", 5.3f), + NextAction("shadow bolt", 5.2f), + NextAction("shoot", 5.0f) + }; } // ===== Trigger Initialization === @@ -64,19 +65,89 @@ void AfflictionWarlockStrategy::InitTriggers(std::vector& triggers GenericWarlockStrategy::InitTriggers(triggers); // Main DoT triggers for high uptime - triggers.push_back(new TriggerNode("corruption on attacker", NextAction::array(0, new NextAction("corruption on attacker", 19.5f), nullptr))); - triggers.push_back(new TriggerNode("unstable affliction on attacker", NextAction::array(0, new NextAction("unstable affliction on attacker", 19.0f), nullptr))); - triggers.push_back(new TriggerNode("corruption", NextAction::array(0, new NextAction("corruption", 18.0f), nullptr))); - triggers.push_back(new TriggerNode("unstable affliction", NextAction::array(0, new NextAction("unstable affliction", 17.5f), nullptr))); - triggers.push_back(new TriggerNode("haunt", NextAction::array(0, new NextAction("haunt", 16.5f), nullptr))); + triggers.push_back( + new TriggerNode( + "corruption on attacker", + { + NextAction("corruption on attacker", 19.5f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "unstable affliction on attacker", + { + NextAction("unstable affliction on attacker", 19.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "corruption", + { + NextAction("corruption", 18.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "unstable affliction", + { + NextAction("unstable affliction", 17.5f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "haunt", + { + NextAction("haunt", 16.5f) + } + ) + ); // Drain Soul as execute if target is low HP // Shadow Trance for free casts - triggers.push_back(new TriggerNode("shadow trance", NextAction::array(0, new NextAction("shadow bolt", 16.0f), nullptr))); - triggers.push_back(new TriggerNode("target critical health", NextAction::array(0, new NextAction("drain soul", 15.5f), nullptr))); + triggers.push_back( + new TriggerNode( + "shadow trance", + { + NextAction("shadow bolt", 16.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "target critical health", + { + NextAction("drain soul", 15.5f) + } + ) + ); // Life Tap glyph buff, and Life Tap as filler - triggers.push_back(new TriggerNode("life tap glyph buff", NextAction::array(0, new NextAction("life tap", 29.5f), nullptr))); - triggers.push_back(new TriggerNode("life tap", NextAction::array(0, new NextAction("life tap", 5.1f), nullptr))); + triggers.push_back( + new TriggerNode( + "life tap glyph buff", + { + NextAction("life tap", 29.5f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "life tap", + { + NextAction("life tap", 5.1f) + } + ) + ); - triggers.push_back(new TriggerNode("enemy too close for spell", NextAction::array(0, new NextAction("flee", 39.0f), nullptr))); + triggers.push_back( + new TriggerNode( + "enemy too close for spell", + { + NextAction("flee", 39.0f) + } + ) + ); } diff --git a/src/strategy/warlock/AfflictionWarlockStrategy.h b/src/strategy/warlock/AfflictionWarlockStrategy.h index 1585c448..503715bd 100644 --- a/src/strategy/warlock/AfflictionWarlockStrategy.h +++ b/src/strategy/warlock/AfflictionWarlockStrategy.h @@ -18,7 +18,7 @@ public: void InitTriggers(std::vector& triggers) override; std::string const getName() override { return "affli"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; }; #endif diff --git a/src/strategy/warlock/DemonologyWarlockStrategy.cpp b/src/strategy/warlock/DemonologyWarlockStrategy.cpp index f41bf96f..6bb4e9de 100644 --- a/src/strategy/warlock/DemonologyWarlockStrategy.cpp +++ b/src/strategy/warlock/DemonologyWarlockStrategy.cpp @@ -31,22 +31,22 @@ public: } private: - static ActionNode* metamorphosis(PlayerbotAI*) { return new ActionNode("metamorphosis", nullptr, nullptr, nullptr); } - static ActionNode* demonic_empowerment(PlayerbotAI*) { return new ActionNode("demonic empowerment", nullptr, nullptr, nullptr); } - static ActionNode* corruption(PlayerbotAI*) { return new ActionNode("corruption", nullptr, nullptr, nullptr); } - static ActionNode* corruption_on_attacker(PlayerbotAI*) { return new ActionNode("corruption on attacker", nullptr, nullptr, nullptr); } - static ActionNode* immolate(PlayerbotAI*) { return new ActionNode("immolate", nullptr, nullptr, nullptr); } - static ActionNode* immolate_on_attacker(PlayerbotAI*) { return new ActionNode("immolate on attacker", nullptr, nullptr, nullptr); } - static ActionNode* incinerate(PlayerbotAI*) { return new ActionNode("incinerate", nullptr, nullptr, nullptr); } - static ActionNode* soul_fire(PlayerbotAI*) { return new ActionNode("soul fire", nullptr, nullptr, nullptr); } - static ActionNode* shadow_bolt(PlayerbotAI*) { return new ActionNode("shadow bolt", nullptr, nullptr, nullptr); } - static ActionNode* life_tap(PlayerbotAI*) { return new ActionNode("life tap", nullptr, nullptr, nullptr); } - static ActionNode* immolation_aura(PlayerbotAI*) { return new ActionNode("immolation aura", nullptr, nullptr, nullptr); } - static ActionNode* shadowflame(PlayerbotAI*) { return new ActionNode("shadowflame", nullptr, nullptr, nullptr); } - static ActionNode* seed_of_corruption_on_attacker(PlayerbotAI*) { return new ActionNode("seed of corruption on attacker", nullptr, nullptr, nullptr); } - static ActionNode* seed_of_corruption(PlayerbotAI*) { return new ActionNode("seed of corruption", nullptr, nullptr, nullptr); } - static ActionNode* rain_of_fire(PlayerbotAI*) { return new ActionNode("rain of fire", nullptr, nullptr, nullptr); } - static ActionNode* demon_charge(PlayerbotAI*) { return new ActionNode("demon charge", nullptr, nullptr, nullptr); } + static ActionNode* metamorphosis(PlayerbotAI*) { return new ActionNode("metamorphosis", {}, {}, {}); } + static ActionNode* demonic_empowerment(PlayerbotAI*) { return new ActionNode("demonic empowerment", {}, {}, {}); } + static ActionNode* corruption(PlayerbotAI*) { return new ActionNode("corruption", {}, {}, {}); } + static ActionNode* corruption_on_attacker(PlayerbotAI*) { return new ActionNode("corruption on attacker", {}, {}, {}); } + static ActionNode* immolate(PlayerbotAI*) { return new ActionNode("immolate", {}, {}, {}); } + static ActionNode* immolate_on_attacker(PlayerbotAI*) { return new ActionNode("immolate on attacker", {}, {}, {}); } + static ActionNode* incinerate(PlayerbotAI*) { return new ActionNode("incinerate", {}, {}, {}); } + static ActionNode* soul_fire(PlayerbotAI*) { return new ActionNode("soul fire", {}, {}, {}); } + static ActionNode* shadow_bolt(PlayerbotAI*) { return new ActionNode("shadow bolt", {}, {}, {}); } + static ActionNode* life_tap(PlayerbotAI*) { return new ActionNode("life tap", {}, {}, {}); } + static ActionNode* immolation_aura(PlayerbotAI*) { return new ActionNode("immolation aura", {}, {}, {}); } + static ActionNode* shadowflame(PlayerbotAI*) { return new ActionNode("shadowflame", {}, {}, {}); } + static ActionNode* seed_of_corruption_on_attacker(PlayerbotAI*) { return new ActionNode("seed of corruption on attacker", {}, {}, {}); } + static ActionNode* seed_of_corruption(PlayerbotAI*) { return new ActionNode("seed of corruption", {}, {}, {}); } + static ActionNode* rain_of_fire(PlayerbotAI*) { return new ActionNode("rain of fire", {}, {}, {}); } + static ActionNode* demon_charge(PlayerbotAI*) { return new ActionNode("demon charge", {}, {}, {}); } }; // ===== Single Target Strategy ===== @@ -56,14 +56,14 @@ DemonologyWarlockStrategy::DemonologyWarlockStrategy(PlayerbotAI* botAI) : Gener } // ===== Default Actions ===== -NextAction** DemonologyWarlockStrategy::getDefaultActions() +std::vector DemonologyWarlockStrategy::getDefaultActions() { - return NextAction::array(0, - new NextAction("corruption", 5.5f), - new NextAction("immolate", 5.4f), - new NextAction("shadow bolt", 5.3f), - new NextAction("incinerate", 5.2f), - new NextAction("shoot", 5.0f), nullptr); + return { + NextAction("corruption", 5.5f), + NextAction("immolate", 5.4f), + NextAction("shadow bolt", 5.3f), + NextAction("incinerate", 5.2f), + NextAction("shoot", 5.0f) }; } // ===== Trigger Initialization === @@ -72,24 +72,101 @@ void DemonologyWarlockStrategy::InitTriggers(std::vector& triggers GenericWarlockStrategy::InitTriggers(triggers); // High priority cooldowns - triggers.push_back(new TriggerNode("metamorphosis", NextAction::array(0, new NextAction("metamorphosis", 28.5f), nullptr))); - triggers.push_back(new TriggerNode("demonic empowerment", NextAction::array(0, new NextAction("demonic empowerment", 28.0f), nullptr))); + triggers.push_back( + new TriggerNode( + "metamorphosis", + { + NextAction("metamorphosis", 28.5f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "demonic empowerment", + { + NextAction("demonic empowerment", 28.0f) + } + ) + ); // Main DoT triggers for high uptime - triggers.push_back(new TriggerNode("corruption on attacker", NextAction::array(0, new NextAction("corruption on attacker", 19.5f), nullptr))); - triggers.push_back(new TriggerNode("immolate on attacker", NextAction::array(0, new NextAction("immolate on attacker", 19.0f), nullptr))); - triggers.push_back(new TriggerNode("corruption", NextAction::array(0, new NextAction("corruption", 18.0f), nullptr))); - triggers.push_back(new TriggerNode("immolate", NextAction::array(0, new NextAction("immolate", 17.5f), nullptr))); + triggers.push_back( + new TriggerNode( + "corruption on attacker", + { + NextAction("corruption on attacker", 19.5f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "immolate on attacker", + { + NextAction("immolate on attacker", 19.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "corruption", + { + NextAction("corruption", 18.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "immolate", + { + NextAction("immolate", 17.5f) + } + ) + ); // Procs - triggers.push_back(new TriggerNode("decimation", NextAction::array(0, new NextAction("soul fire", 17.0f), nullptr))); - triggers.push_back(new TriggerNode("molten core", NextAction::array(0, new NextAction("incinerate", 16.5f), nullptr))); + triggers.push_back( + new TriggerNode( + "decimation", + { + NextAction("soul fire", 17.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "molten core", + { + NextAction("incinerate", 16.5f) + } + ) + ); // Life Tap glyph buff, and Life Tap as filler - triggers.push_back(new TriggerNode("life tap glyph buff", NextAction::array(0, new NextAction("life tap", 29.5f), nullptr))); - triggers.push_back(new TriggerNode("life tap", NextAction::array(0, new NextAction("life tap", 5.1f), nullptr))); + triggers.push_back( + new TriggerNode( + "life tap glyph buff", + { + NextAction("life tap", 29.5f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "life tap", + { + NextAction("life tap", 5.1f) + } + ) + ); - triggers.push_back(new TriggerNode("meta melee flee check", NextAction::array(0, new NextAction("flee", 39.0f), nullptr))); + triggers.push_back( + new TriggerNode( + "meta melee flee check", + { + NextAction("flee", 39.0f) + } + ) + ); } // Combat strategy to run to melee for Immolation Aura @@ -100,7 +177,13 @@ MetaMeleeAoeStrategy::MetaMeleeAoeStrategy(PlayerbotAI* botAI) : CombatStrategy( void MetaMeleeAoeStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("immolation aura active", NextAction::array(0, - new NextAction("reach melee", 25.5f), - new NextAction("demon charge", 25.0f), nullptr))); + triggers.push_back( + new TriggerNode( + "immolation aura active", + { + NextAction("reach melee", 25.5f), + NextAction("demon charge", 25.0f) + } + ) + ); } diff --git a/src/strategy/warlock/DemonologyWarlockStrategy.h b/src/strategy/warlock/DemonologyWarlockStrategy.h index df853c85..5a84175a 100644 --- a/src/strategy/warlock/DemonologyWarlockStrategy.h +++ b/src/strategy/warlock/DemonologyWarlockStrategy.h @@ -18,7 +18,7 @@ public: void InitTriggers(std::vector& triggers) override; std::string const getName() override { return "demo"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; }; class MetaMeleeAoeStrategy : public CombatStrategy diff --git a/src/strategy/warlock/DestructionWarlockStrategy.cpp b/src/strategy/warlock/DestructionWarlockStrategy.cpp index dd0ce086..af44de01 100644 --- a/src/strategy/warlock/DestructionWarlockStrategy.cpp +++ b/src/strategy/warlock/DestructionWarlockStrategy.cpp @@ -29,20 +29,20 @@ public: } private: - static ActionNode* immolate(PlayerbotAI*) { return new ActionNode("immolate", nullptr, nullptr, nullptr); } - static ActionNode* conflagrate(PlayerbotAI*) { return new ActionNode("conflagrate", nullptr, nullptr, nullptr); } - static ActionNode* chaos_bolt(PlayerbotAI*) { return new ActionNode("chaos bolt", nullptr, nullptr, nullptr); } - static ActionNode* incinerate(PlayerbotAI*) { return new ActionNode("incinerate", nullptr, nullptr, nullptr); } - static ActionNode* corruption(PlayerbotAI*) { return new ActionNode("corruption", nullptr, nullptr, nullptr); } - static ActionNode* corruption_on_attacker(PlayerbotAI*) { return new ActionNode("corruption on attacker", nullptr, nullptr, nullptr); } - static ActionNode* shadow_bolt(PlayerbotAI*) { return new ActionNode("shadow bolt", nullptr, nullptr, nullptr); } - static ActionNode* shadowburn(PlayerbotAI*) { return new ActionNode("shadowburn", nullptr, nullptr, nullptr); } - static ActionNode* life_tap(PlayerbotAI*) { return new ActionNode("life tap", nullptr, nullptr, nullptr); } - static ActionNode* shadowfury(PlayerbotAI*) { return new ActionNode("shadowfury", nullptr, nullptr, nullptr); } - static ActionNode* shadowflame(PlayerbotAI*) { return new ActionNode("shadowflame", nullptr, nullptr, nullptr); } - static ActionNode* seed_of_corruption(PlayerbotAI*) { return new ActionNode("seed of corruption", nullptr, nullptr, nullptr); } - static ActionNode* seed_of_corruption_on_attacker(PlayerbotAI*) { return new ActionNode("seed of corruption on attacker", nullptr, nullptr, nullptr); } - static ActionNode* rain_of_fire(PlayerbotAI*) { return new ActionNode("rain of fire", nullptr, nullptr, nullptr); } + static ActionNode* immolate(PlayerbotAI*) { return new ActionNode("immolate", {}, {}, {}); } + static ActionNode* conflagrate(PlayerbotAI*) { return new ActionNode("conflagrate", {}, {}, {}); } + static ActionNode* chaos_bolt(PlayerbotAI*) { return new ActionNode("chaos bolt", {}, {}, {}); } + static ActionNode* incinerate(PlayerbotAI*) { return new ActionNode("incinerate", {}, {}, {}); } + static ActionNode* corruption(PlayerbotAI*) { return new ActionNode("corruption", {}, {}, {}); } + static ActionNode* corruption_on_attacker(PlayerbotAI*) { return new ActionNode("corruption on attacker", {}, {}, {}); } + static ActionNode* shadow_bolt(PlayerbotAI*) { return new ActionNode("shadow bolt", {}, {}, {}); } + static ActionNode* shadowburn(PlayerbotAI*) { return new ActionNode("shadowburn", {}, {}, {}); } + static ActionNode* life_tap(PlayerbotAI*) { return new ActionNode("life tap", {}, {}, {}); } + static ActionNode* shadowfury(PlayerbotAI*) { return new ActionNode("shadowfury", {}, {}, {}); } + static ActionNode* shadowflame(PlayerbotAI*) { return new ActionNode("shadowflame", {}, {}, {}); } + static ActionNode* seed_of_corruption(PlayerbotAI*) { return new ActionNode("seed of corruption", {}, {}, {}); } + static ActionNode* seed_of_corruption_on_attacker(PlayerbotAI*) { return new ActionNode("seed of corruption on attacker", {}, {}, {}); } + static ActionNode* rain_of_fire(PlayerbotAI*) { return new ActionNode("rain of fire", {}, {}, {}); } }; // ===== Single Target Strategy ===== @@ -52,16 +52,17 @@ DestructionWarlockStrategy::DestructionWarlockStrategy(PlayerbotAI* botAI) : Gen } // ===== Default Actions ===== -NextAction** DestructionWarlockStrategy::getDefaultActions() +std::vector DestructionWarlockStrategy::getDefaultActions() { - return NextAction::array( 0, - new NextAction("immolate", 5.9f), - new NextAction("conflagrate", 5.8f), - new NextAction("chaos bolt", 5.7f), - new NextAction("incinerate", 5.6f), - new NextAction("corruption", 5.3f), // Note: Corruption and Shadow Bolt won't be used after the character learns Incinerate at level 64 - new NextAction("shadow bolt", 5.2f), - new NextAction("shoot", 5.0f), nullptr); + return { + NextAction("immolate", 5.9f), + NextAction("conflagrate", 5.8f), + NextAction("chaos bolt", 5.7f), + NextAction("incinerate", 5.6f), + NextAction("corruption", 5.3f), // Note: Corruption and Shadow Bolt won't be used after the character learns Incinerate at level 64 + NextAction("shadow bolt", 5.2f), + NextAction("shoot", 5.0f) + }; } // ===== Trigger Initialization === @@ -70,20 +71,83 @@ void DestructionWarlockStrategy::InitTriggers(std::vector& trigger GenericWarlockStrategy::InitTriggers(triggers); // Main DoT triggers for high uptime + high priority cooldowns - triggers.push_back(new TriggerNode("immolate", NextAction::array(0, new NextAction("immolate", 20.0f), nullptr))); - triggers.push_back(new TriggerNode("conflagrate", NextAction::array(0, new NextAction("conflagrate", 19.5f), nullptr))); - triggers.push_back(new TriggerNode("chaos bolt", NextAction::array(0, new NextAction("chaos bolt", 19.0f), nullptr))); + triggers.push_back( + new TriggerNode( + "immolate", + { + NextAction("immolate", 20.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "conflagrate", + { + NextAction("conflagrate", 19.5f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "chaos bolt", + { + NextAction("chaos bolt", 19.0f) + } + ) + ); // Note: Corruption won't be used after the character learns Incinerate at level 64 - triggers.push_back(new TriggerNode("corruption on attacker", NextAction::array(0, new NextAction("corruption on attacker", 5.5f), nullptr))); - triggers.push_back(new TriggerNode("corruption", NextAction::array(0, new NextAction("corruption", 5.4f), nullptr))); + triggers.push_back( + new TriggerNode( + "corruption on attacker", + { + NextAction("corruption on attacker", 5.5f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "corruption", + { + NextAction("corruption", 5.4f) + } + ) + ); // Shadowburn as execute if target is low HP - triggers.push_back(new TriggerNode("target critical health", NextAction::array(0, new NextAction("shadowburn", 18.0f), nullptr))); + triggers.push_back( + new TriggerNode( + "target critical health", + { + NextAction("shadowburn", 18.0f) + } + ) + ); // Life Tap glyph buff, and Life Tap as filler - triggers.push_back(new TriggerNode("life tap glyph buff", NextAction::array(0, new NextAction("life tap", 29.5f), nullptr))); - triggers.push_back(new TriggerNode("life tap", NextAction::array(0, new NextAction("life tap", 5.1f), nullptr))); + triggers.push_back( + new TriggerNode( + "life tap glyph buff", + { + NextAction("life tap", 29.5f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "life tap", + { + NextAction("life tap", 5.1f) + } + ) + ); - triggers.push_back(new TriggerNode("enemy too close for spell", NextAction::array(0, new NextAction("flee", 39.0f), nullptr))); + triggers.push_back( + new TriggerNode( + "enemy too close for spell", + { + NextAction("flee", 39.0f) + } + ) + ); } diff --git a/src/strategy/warlock/DestructionWarlockStrategy.h b/src/strategy/warlock/DestructionWarlockStrategy.h index 46759d74..68fe67bb 100644 --- a/src/strategy/warlock/DestructionWarlockStrategy.h +++ b/src/strategy/warlock/DestructionWarlockStrategy.h @@ -18,7 +18,7 @@ public: void InitTriggers(std::vector& triggers) override; std::string const getName() override { return "destro"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; }; #endif diff --git a/src/strategy/warlock/GenericWarlockNonCombatStrategy.cpp b/src/strategy/warlock/GenericWarlockNonCombatStrategy.cpp index 72484e37..a78ff0a9 100644 --- a/src/strategy/warlock/GenericWarlockNonCombatStrategy.cpp +++ b/src/strategy/warlock/GenericWarlockNonCombatStrategy.cpp @@ -28,45 +28,45 @@ private: static ActionNode* fel_armor([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("fel armor", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("demon armor"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("demon armor") }, + /*C*/ {}); } static ActionNode* demon_armor([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("demon armor", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("demon skin"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("demon skin") }, + /*C*/ {}); } static ActionNode* summon_voidwalker([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("summon voidwalker", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("summon imp"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("summon imp") }, + /*C*/ {}); } static ActionNode* summon_succubus([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("summon succubus", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("summon voidwalker"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("summon voidwalker") }, + /*C*/ {}); } static ActionNode* summon_felhunter([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("summon felhunter", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("summon succubus"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("summon succubus") }, + /*C*/ {}); } static ActionNode* summon_felguard([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("summon felguard", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("summon felhunter"), nullptr), - /*C*/ nullptr); + /*P*/ {}, + /*A*/ { NextAction("summon felhunter") }, + /*C*/ {}); } }; @@ -78,16 +78,16 @@ GenericWarlockNonCombatStrategy::GenericWarlockNonCombatStrategy(PlayerbotAI* bo void GenericWarlockNonCombatStrategy::InitTriggers(std::vector& triggers) { NonCombatStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("has pet", NextAction::array(0, new NextAction("toggle pet spell", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("new pet", NextAction::array(0, new NextAction("set pet stance", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("no pet", NextAction::array(0, new NextAction("fel domination", 30.0f), nullptr))); - triggers.push_back(new TriggerNode("no soul shard", NextAction::array(0, new NextAction("create soul shard", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("too many soul shards", NextAction::array(0, new NextAction("destroy soul shard", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("soul link", NextAction::array(0, new NextAction("soul link", 28.0f), nullptr))); - triggers.push_back(new TriggerNode("demon armor", NextAction::array(0, new NextAction("fel armor", 27.0f), nullptr))); - triggers.push_back(new TriggerNode("no healthstone", NextAction::array(0, new NextAction("create healthstone", 26.0f), nullptr))); - triggers.push_back(new TriggerNode("no soulstone", NextAction::array(0, new NextAction("create soulstone", 25.0f), nullptr))); - triggers.push_back(new TriggerNode("life tap", NextAction::array(0, new NextAction("life tap", 23.0f), nullptr))); + triggers.push_back(new TriggerNode("has pet", { NextAction("toggle pet spell", 60.0f) })); + triggers.push_back(new TriggerNode("new pet", { NextAction("set pet stance", 60.0f) })); + triggers.push_back(new TriggerNode("no pet", { NextAction("fel domination", 30.0f) })); + triggers.push_back(new TriggerNode("no soul shard", { NextAction("create soul shard", 60.0f) })); + triggers.push_back(new TriggerNode("too many soul shards", { NextAction("destroy soul shard", 60.0f) })); + triggers.push_back(new TriggerNode("soul link", { NextAction("soul link", 28.0f) })); + triggers.push_back(new TriggerNode("demon armor", { NextAction("fel armor", 27.0f) })); + triggers.push_back(new TriggerNode("no healthstone", { NextAction("create healthstone", 26.0f) })); + triggers.push_back(new TriggerNode("no soulstone", { NextAction("create soulstone", 25.0f) })); + triggers.push_back(new TriggerNode("life tap", { NextAction("life tap", 23.0f) })); } // Non-combat strategy for summoning a Imp @@ -98,8 +98,8 @@ SummonImpStrategy::SummonImpStrategy(PlayerbotAI* ai) : NonCombatStrategy(ai) {} void SummonImpStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("no pet", NextAction::array(0, new NextAction("summon imp", 29.0f), NULL))); - triggers.push_back(new TriggerNode("wrong pet", NextAction::array(0, new NextAction("summon imp", 29.0f), NULL))); + triggers.push_back(new TriggerNode("no pet", { NextAction("summon imp", 29.0f) })); + triggers.push_back(new TriggerNode("wrong pet", { NextAction("summon imp", 29.0f) })); } // Non-combat strategy for summoning a Voidwalker @@ -110,8 +110,8 @@ SummonVoidwalkerStrategy::SummonVoidwalkerStrategy(PlayerbotAI* ai) : NonCombatS void SummonVoidwalkerStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("no pet", NextAction::array(0, new NextAction("summon voidwalker", 29.0f), NULL))); - triggers.push_back(new TriggerNode("wrong pet", NextAction::array(0, new NextAction("summon voidwalker", 29.0f), NULL))); + triggers.push_back(new TriggerNode("no pet", { NextAction("summon voidwalker", 29.0f) })); + triggers.push_back(new TriggerNode("wrong pet", { NextAction("summon voidwalker", 29.0f) })); } // Non-combat strategy for summoning a Succubus @@ -122,8 +122,8 @@ SummonSuccubusStrategy::SummonSuccubusStrategy(PlayerbotAI* ai) : NonCombatStrat void SummonSuccubusStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("no pet", NextAction::array(0, new NextAction("summon succubus", 29.0f), NULL))); - triggers.push_back(new TriggerNode("wrong pet", NextAction::array(0, new NextAction("summon succubus", 29.0f), NULL))); + triggers.push_back(new TriggerNode("no pet", { NextAction("summon succubus", 29.0f) })); + triggers.push_back(new TriggerNode("wrong pet", { NextAction("summon succubus", 29.0f) })); } // Non-combat strategy for summoning a Felhunter @@ -134,8 +134,8 @@ SummonFelhunterStrategy::SummonFelhunterStrategy(PlayerbotAI* ai) : NonCombatStr void SummonFelhunterStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("no pet", NextAction::array(0, new NextAction("summon felhunter", 29.0f), NULL))); - triggers.push_back(new TriggerNode("wrong pet", NextAction::array(0, new NextAction("summon felhunter", 29.0f), NULL))); + triggers.push_back(new TriggerNode("no pet", { NextAction("summon felhunter", 29.0f) })); + triggers.push_back(new TriggerNode("wrong pet", { NextAction("summon felhunter", 29.0f) })); } // Non-combat strategy for summoning a Felguard @@ -146,8 +146,8 @@ SummonFelguardStrategy::SummonFelguardStrategy(PlayerbotAI* ai) : NonCombatStrat void SummonFelguardStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("no pet", NextAction::array(0, new NextAction("summon felguard", 29.0f), NULL))); - triggers.push_back(new TriggerNode("wrong pet", NextAction::array(0, new NextAction("summon felguard", 29.0f), NULL))); + triggers.push_back(new TriggerNode("no pet", { NextAction("summon felguard", 29.0f) })); + triggers.push_back(new TriggerNode("wrong pet", { NextAction("summon felguard", 29.0f) })); } // Non-combat strategy for selecting themselves to receive soulstone @@ -158,7 +158,7 @@ SoulstoneSelfStrategy::SoulstoneSelfStrategy(PlayerbotAI* ai) : NonCombatStrateg void SoulstoneSelfStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("soulstone", NextAction::array(0, new NextAction("soulstone self", 24.0f), NULL))); + triggers.push_back(new TriggerNode("soulstone", { NextAction("soulstone self", 24.0f) })); } // Non-combat strategy for selecting the master to receive soulstone @@ -169,7 +169,7 @@ SoulstoneMasterStrategy::SoulstoneMasterStrategy(PlayerbotAI* ai) : NonCombatStr void SoulstoneMasterStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("soulstone", NextAction::array(0, new NextAction("soulstone master", 24.0f), NULL))); + triggers.push_back(new TriggerNode("soulstone", { NextAction("soulstone master", 24.0f) })); } // Non-combat strategy for selecting tanks to receive soulstone @@ -180,7 +180,7 @@ SoulstoneTankStrategy::SoulstoneTankStrategy(PlayerbotAI* ai) : NonCombatStrateg void SoulstoneTankStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("soulstone", NextAction::array(0, new NextAction("soulstone tank", 24.0f), NULL))); + triggers.push_back(new TriggerNode("soulstone", { NextAction("soulstone tank", 24.0f) })); } // Non-combat strategy for selecting healers to receive soulstone @@ -191,7 +191,7 @@ SoulstoneHealerStrategy::SoulstoneHealerStrategy(PlayerbotAI* ai) : NonCombatStr void SoulstoneHealerStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("soulstone", NextAction::array(0, new NextAction("soulstone healer", 24.0f), NULL))); + triggers.push_back(new TriggerNode("soulstone", { NextAction("soulstone healer", 24.0f) })); } // Non-combat strategy for using Spellstone @@ -202,8 +202,8 @@ UseSpellstoneStrategy::UseSpellstoneStrategy(PlayerbotAI* ai) : NonCombatStrateg void UseSpellstoneStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("no spellstone", NextAction::array(0, new NextAction("create spellstone", 24.0f), nullptr))); - triggers.push_back(new TriggerNode("spellstone", NextAction::array(0, new NextAction("spellstone", 24.0f), nullptr))); + triggers.push_back(new TriggerNode("no spellstone", { NextAction("create spellstone", 24.0f) })); + triggers.push_back(new TriggerNode("spellstone", { NextAction("spellstone", 24.0f) })); } // Non-combat strategy for using Firestone @@ -214,6 +214,6 @@ UseFirestoneStrategy::UseFirestoneStrategy(PlayerbotAI* ai) : NonCombatStrategy( void UseFirestoneStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("no firestone", NextAction::array(0, new NextAction("create firestone", 24.0f), nullptr))); - triggers.push_back(new TriggerNode("firestone", NextAction::array(0, new NextAction("firestone", 24.0f), nullptr))); + triggers.push_back(new TriggerNode("no firestone", { NextAction("create firestone", 24.0f) })); + triggers.push_back(new TriggerNode("firestone", { NextAction("firestone", 24.0f) })); } diff --git a/src/strategy/warlock/GenericWarlockStrategy.cpp b/src/strategy/warlock/GenericWarlockStrategy.cpp index dfa704ff..17597765 100644 --- a/src/strategy/warlock/GenericWarlockStrategy.cpp +++ b/src/strategy/warlock/GenericWarlockStrategy.cpp @@ -20,11 +20,11 @@ public: } private: - static ActionNode* banish_on_cc(PlayerbotAI*) { return new ActionNode("banish on cc", nullptr, nullptr, nullptr); } - static ActionNode* fear_on_cc(PlayerbotAI*) { return new ActionNode("fear on cc", nullptr, nullptr, nullptr); } - static ActionNode* spell_lock(PlayerbotAI*) { return new ActionNode("spell lock", nullptr, nullptr, nullptr); } - static ActionNode* devour_magic_purge(PlayerbotAI*) { return new ActionNode("devour magic purge", nullptr, nullptr, nullptr); } - static ActionNode* devour_magic_cleanse(PlayerbotAI*) { return new ActionNode("devour magic cleanse", nullptr, nullptr, nullptr); } + static ActionNode* banish_on_cc(PlayerbotAI*) { return new ActionNode("banish on cc", {}, {}, {}); } + static ActionNode* fear_on_cc(PlayerbotAI*) { return new ActionNode("fear on cc", {}, {}, {}); } + static ActionNode* spell_lock(PlayerbotAI*) { return new ActionNode("spell lock", {}, {}, {}); } + static ActionNode* devour_magic_purge(PlayerbotAI*) { return new ActionNode("devour magic purge", {}, {}, {}); } + static ActionNode* devour_magic_cleanse(PlayerbotAI*) { return new ActionNode("devour magic cleanse", {}, {}, {}); } }; GenericWarlockStrategy::GenericWarlockStrategy(PlayerbotAI* botAI) : CombatStrategy(botAI) @@ -32,35 +32,98 @@ GenericWarlockStrategy::GenericWarlockStrategy(PlayerbotAI* botAI) : CombatStrat actionNodeFactories.Add(new GenericWarlockStrategyActionNodeFactory()); } -NextAction** GenericWarlockStrategy::getDefaultActions() { return NextAction::array(0, nullptr); } +std::vector GenericWarlockStrategy::getDefaultActions() +{ + return {}; +} void GenericWarlockStrategy::InitTriggers(std::vector& triggers) { CombatStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("low mana", NextAction::array(0, new NextAction("life tap", 95.0f), nullptr))); - triggers.push_back(new TriggerNode("medium threat", NextAction::array(0, new NextAction("soulshatter", 55.0f), nullptr))); - triggers.push_back(new TriggerNode("spell lock", NextAction::array(0, new NextAction("spell lock", 40.0f), nullptr))); - triggers.push_back(new TriggerNode("no soul shard", NextAction::array(0, new NextAction("create soul shard", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("too many soul shards", NextAction::array(0, new NextAction("destroy soul shard", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("devour magic purge", NextAction::array(0, new NextAction("devour magic purge", 50.0f), nullptr))); - triggers.push_back(new TriggerNode("devour magic cleanse", NextAction::array(0, new NextAction("devour magic cleanse", 50.0f), nullptr))); + triggers.push_back( + new TriggerNode( + "low mana", + { + NextAction("life tap", 95.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "medium threat", + { + NextAction("soulshatter", 55.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "spell lock", + { + NextAction("spell lock", 40.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "no soul shard", + { + NextAction("create soul shard", 60.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "too many soul shards", + { + NextAction("destroy soul shard", 60.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "devour magic purge", + { + NextAction("devour magic purge", 50.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "devour magic cleanse", + { + NextAction("devour magic cleanse", 50.0f) + } + ) + ); } // ===== AoE Strategy, 3+ enemies ===== void AoEWarlockStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("medium aoe", NextAction::array(0, - new NextAction("immolation aura", 26.0f), - new NextAction("shadowfury", 23.0f), - new NextAction("shadowflame", 22.5f), - new NextAction("seed of corruption on attacker", 22.0f), - new NextAction("seed of corruption", 21.5f), - new NextAction("rain of fire", 21.0f), nullptr))); + triggers.push_back( + new TriggerNode( + "medium aoe", + { + NextAction("immolation aura", 26.0f), + NextAction("shadowfury", 23.0f), + NextAction("shadowflame", 22.5f), + NextAction("seed of corruption on attacker", 22.0f), + NextAction("seed of corruption", 21.5f), + NextAction("rain of fire", 21.0f) + } + ) + ); triggers.push_back( - new TriggerNode("rain of fire channel check", NextAction::array(0, new NextAction("cancel channel", 21.5f), nullptr))); + new TriggerNode("rain of fire channel check", + { + NextAction("cancel channel", 21.5f) + } + ) + ); } void WarlockBoostStrategy::InitTriggers(std::vector& triggers) @@ -75,8 +138,22 @@ void WarlockPetStrategy::InitTriggers(std::vector& triggers) void WarlockCcStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("banish", NextAction::array(0, new NextAction("banish on cc", 33.0f), nullptr))); - triggers.push_back(new TriggerNode("fear", NextAction::array(0, new NextAction("fear on cc", 32.0f), nullptr))); + triggers.push_back( + new TriggerNode( + "banish", + { + NextAction("banish on cc", 33.0f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "fear", + { + NextAction("fear on cc", 32.0f) + } + ) + ); } // Combat strategy for using Curse of Agony @@ -85,8 +162,22 @@ void WarlockCcStrategy::InitTriggers(std::vector& triggers) // To disable, type "co -curse of agony" void WarlockCurseOfAgonyStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("curse of agony on attacker", NextAction::array(0, new NextAction("curse of agony on attacker", 18.5f), nullptr))); - triggers.push_back(new TriggerNode("curse of agony", NextAction::array(0, new NextAction("curse of agony", 17.0f), nullptr))); + triggers.push_back( + new TriggerNode( + "curse of agony on attacker", + { + NextAction("curse of agony on attacker", 18.5f) + } + ) + ); + triggers.push_back( + new TriggerNode( + "curse of agony", + { + NextAction("curse of agony", 17.0f) + } + ) + ); } // Combat strategy for using Curse of the Elements @@ -95,7 +186,14 @@ void WarlockCurseOfAgonyStrategy::InitTriggers(std::vector& trigge // To disable, type "co -curse of elements" void WarlockCurseOfTheElementsStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("curse of the elements", NextAction::array(0, new NextAction("curse of the elements", 29.0f), nullptr))); + triggers.push_back( + new TriggerNode( + "curse of the elements", + { + NextAction("curse of the elements", 29.0f) + } + ) + ); } // Combat strategy for using Curse of Doom @@ -104,7 +202,14 @@ void WarlockCurseOfTheElementsStrategy::InitTriggers(std::vector& // To disable, type "co -curse of doom" void WarlockCurseOfDoomStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("curse of doom", NextAction::array(0, new NextAction("curse of doom", 29.0f), nullptr))); + triggers.push_back( + new TriggerNode( + "curse of doom", + { + NextAction("curse of doom", 29.0f) + } + ) + ); } // Combat strategy for using Curse of Exhaustion @@ -113,7 +218,14 @@ void WarlockCurseOfDoomStrategy::InitTriggers(std::vector& trigger // To disable, type "co -curse of exhaustion" void WarlockCurseOfExhaustionStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("curse of exhaustion", NextAction::array(0, new NextAction("curse of exhaustion", 29.0f), nullptr))); + triggers.push_back( + new TriggerNode( + "curse of exhaustion", + { + NextAction("curse of exhaustion", 29.0f) + } + ) + ); } // Combat strategy for using Curse of Tongues @@ -122,7 +234,14 @@ void WarlockCurseOfExhaustionStrategy::InitTriggers(std::vector& t // To disable, type "co -curse of tongues" void WarlockCurseOfTonguesStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("curse of tongues", NextAction::array(0, new NextAction("curse of tongues", 29.0f), nullptr))); + triggers.push_back( + new TriggerNode( + "curse of tongues", + { + NextAction("curse of tongues", 29.0f) + } + ) + ); } // Combat strategy for using Curse of Weakness @@ -131,5 +250,12 @@ void WarlockCurseOfTonguesStrategy::InitTriggers(std::vector& trig // To disable, type "co -curse of weakness" void WarlockCurseOfWeaknessStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("curse of weakness", NextAction::array(0, new NextAction("curse of weakness", 29.0f), nullptr))); + triggers.push_back( + new TriggerNode( + "curse of weakness", + { + NextAction("curse of weakness", 29.0f) + } + ) + ); } diff --git a/src/strategy/warlock/GenericWarlockStrategy.h b/src/strategy/warlock/GenericWarlockStrategy.h index 2fda9c03..a44a03de 100644 --- a/src/strategy/warlock/GenericWarlockStrategy.h +++ b/src/strategy/warlock/GenericWarlockStrategy.h @@ -17,7 +17,7 @@ public: std::string const getName() override { return "warlock"; } void InitTriggers(std::vector& triggers) override; - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; uint32 GetType() const override { return CombatStrategy::GetType() | STRATEGY_TYPE_RANGED | STRATEGY_TYPE_DPS; } }; diff --git a/src/strategy/warlock/TankWarlockStrategy.cpp b/src/strategy/warlock/TankWarlockStrategy.cpp index 2328169a..c54fd596 100644 --- a/src/strategy/warlock/TankWarlockStrategy.cpp +++ b/src/strategy/warlock/TankWarlockStrategy.cpp @@ -23,8 +23,8 @@ public: } private: - static ActionNode* shadow_ward(PlayerbotAI*) { return new ActionNode("shadow ward", nullptr, nullptr, nullptr); } - static ActionNode* searing_pain(PlayerbotAI*) { return new ActionNode("searing pain", nullptr, nullptr, nullptr); } + static ActionNode* shadow_ward(PlayerbotAI*) { return new ActionNode("shadow ward", {}, {}, {}); } + static ActionNode* searing_pain(PlayerbotAI*) { return new ActionNode("searing pain", {}, {}, {}); } }; // ===== Warlock Tank Combat Strategy ===== @@ -33,10 +33,13 @@ TankWarlockStrategy::TankWarlockStrategy(PlayerbotAI* botAI) : GenericWarlockStr actionNodeFactories.Add(new TankWarlockStrategyActionNodeFactory()); } -NextAction** TankWarlockStrategy::getDefaultActions() +std::vector TankWarlockStrategy::getDefaultActions() { // Shadow Ward is the highest priority, Searing Pain next. - return NextAction::array(0, new NextAction("shadow ward", 27.5f), new NextAction("searing pain", 27.0f), nullptr); + return { + NextAction("shadow ward", 27.5f), + NextAction("searing pain", 27.0f) + }; } void TankWarlockStrategy::InitTriggers(std::vector& triggers) diff --git a/src/strategy/warlock/TankWarlockStrategy.h b/src/strategy/warlock/TankWarlockStrategy.h index 240f9515..f20ffe89 100644 --- a/src/strategy/warlock/TankWarlockStrategy.h +++ b/src/strategy/warlock/TankWarlockStrategy.h @@ -17,7 +17,7 @@ public: std::string const getName() override { return "tank"; } void InitTriggers(std::vector& triggers) override; - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; }; #endif diff --git a/src/strategy/warrior/ArmsWarriorStrategy.cpp b/src/strategy/warrior/ArmsWarriorStrategy.cpp index ca967583..eba5677e 100644 --- a/src/strategy/warrior/ArmsWarriorStrategy.cpp +++ b/src/strategy/warrior/ArmsWarriorStrategy.cpp @@ -23,34 +23,84 @@ public: } private: - ACTION_NODE_A(charge, "charge", "reach melee"); - ACTION_NODE_A(death_wish, "death wish", "bloodrage"); - ACTION_NODE_A(piercing_howl, "piercing howl", "mocking blow"); - ACTION_NODE_A(mocking_blow, "mocking blow", "hamstring"); - ACTION_NODE_A(heroic_strike, "heroic strike", "melee"); + static ActionNode* charge(PlayerbotAI* botAI) + { + return new ActionNode( + "charge", + /*P*/ {}, + /*A*/ { NextAction("reach melee") }, + /*C*/ {} + ); + } + + static ActionNode* death_wish(PlayerbotAI* botAI) + { + return new ActionNode( + "death wish", + /*P*/ {}, + /*A*/ { NextAction("bloodrage") }, + /*C*/ {} + ); + } + + static ActionNode* piercing_howl(PlayerbotAI* botAI) + { + return new ActionNode( + "piercing howl", + /*P*/ {}, + /*A*/ { NextAction("mocking blow") }, + /*C*/ {} + ); + } + + static ActionNode* mocking_blow(PlayerbotAI* botAI) + { + return new ActionNode( + "mocking blow", + /*P*/ {}, + /*A*/ { NextAction("hamstring") }, + /*C*/ {} + ); + } + + static ActionNode* heroic_strike(PlayerbotAI* botAI) + { + return new ActionNode( + "heroic strike", + /*P*/ {}, + /*A*/ { NextAction("melee") }, + /*C*/ {} + ); + } static ActionNode* enraged_regeneration(PlayerbotAI* botAI) { - return new ActionNode("enraged regeneration", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "enraged regeneration", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* retaliation(PlayerbotAI* botAI) { - return new ActionNode("retaliation", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "retaliation", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* shattering_throw(PlayerbotAI* botAI) { - return new ActionNode("shattering throw", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "shattering throw", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } }; @@ -59,85 +109,186 @@ ArmsWarriorStrategy::ArmsWarriorStrategy(PlayerbotAI* botAI) : GenericWarriorStr actionNodeFactories.Add(new ArmsWarriorStrategyActionNodeFactory()); } -NextAction** ArmsWarriorStrategy::getDefaultActions() +std::vector ArmsWarriorStrategy::getDefaultActions() { - return NextAction::array(0, new NextAction("bladestorm", ACTION_DEFAULT + 0.2f), - new NextAction("mortal strike", ACTION_DEFAULT + 0.1f), - new NextAction("melee", ACTION_DEFAULT), nullptr); + return { + NextAction("bladestorm", ACTION_DEFAULT + 0.2f), + NextAction("mortal strike", ACTION_DEFAULT + 0.1f), + NextAction("melee", ACTION_DEFAULT) + }; } - void ArmsWarriorStrategy::InitTriggers(std::vector& triggers) { GenericWarriorStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("enemy out of melee", - NextAction::array(0, new NextAction("charge", ACTION_MOVE + 10), nullptr))); - - triggers.push_back(new TriggerNode("battle stance", - NextAction::array(0, new NextAction("battle stance", ACTION_HIGH + 10), nullptr))); - - triggers.push_back(new TriggerNode("battle shout", - NextAction::array(0, new NextAction("battle shout", ACTION_HIGH + 9), nullptr))); - - triggers.push_back(new TriggerNode("rend", - NextAction::array(0, new NextAction("rend", ACTION_HIGH + 8), nullptr))); - - triggers.push_back(new TriggerNode("rend on attacker", - NextAction::array(0, new NextAction("rend on attacker", ACTION_HIGH + 8), nullptr))); - - triggers.push_back(new TriggerNode("mortal strike", - NextAction::array(0, new NextAction("mortal strike", ACTION_HIGH + 3), nullptr))); - - triggers.push_back(new TriggerNode("target critical health", - NextAction::array(0, new NextAction("execute", ACTION_HIGH + 5), nullptr))); - - triggers.push_back(new TriggerNode("sudden death", - NextAction::array(0, new NextAction("execute", ACTION_HIGH + 5), nullptr))); - - triggers.push_back(new TriggerNode("hamstring", - NextAction::array(0, new NextAction("piercing howl", ACTION_HIGH), nullptr))); - - triggers.push_back(new TriggerNode("overpower", - NextAction::array(0, new NextAction("overpower", ACTION_HIGH + 4), nullptr))); - - triggers.push_back(new TriggerNode("taste for blood", - NextAction::array(0, new NextAction("overpower", ACTION_HIGH + 4), nullptr))); - - triggers.push_back(new TriggerNode("victory rush", - NextAction::array(0, new NextAction("victory rush", ACTION_INTERRUPT), nullptr))); - - triggers.push_back(new TriggerNode("high rage available", - NextAction::array(0, new NextAction("heroic strike", ACTION_HIGH), - new NextAction("slam", ACTION_HIGH + 1), - nullptr))); - // triggers.push_back(new TriggerNode("medium rage available", - // NextAction::array(0, new NextAction("slam", ACTION_HIGH + 1), - // new NextAction("thunder clap", ACTION_HIGH), - // nullptr))); triggers.push_back( - new TriggerNode("bloodrage", NextAction::array(0, new NextAction("bloodrage", ACTION_HIGH + 2), nullptr))); + new TriggerNode( + "enemy out of melee", + { + NextAction("charge", ACTION_MOVE + 10) + } + ) + ); triggers.push_back( - new TriggerNode("death wish", NextAction::array(0, new NextAction("death wish", ACTION_HIGH + 2), nullptr))); + new TriggerNode( + "battle stance", + { + NextAction("battle stance", ACTION_HIGH + 10) + } + ) + ); - triggers.push_back(new TriggerNode("critical health", - NextAction::array(0, new NextAction("intimidating shout", ACTION_EMERGENCY), nullptr))); + triggers.push_back( + new TriggerNode( + "battle shout", + { + NextAction("battle shout", ACTION_HIGH + 9) + } + ) + ); - triggers.push_back(new TriggerNode("medium health", - NextAction::array(0, new NextAction("enraged regeneration", ACTION_EMERGENCY), nullptr))); + triggers.push_back( + new TriggerNode( + "rend", + { + NextAction("rend", ACTION_HIGH + 8) + } + ) + ); - triggers.push_back(new TriggerNode("almost full health", - NextAction::array(0, new NextAction("retaliation", ACTION_EMERGENCY + 1), nullptr))); + triggers.push_back( + new TriggerNode( + "rend on attacker", + { + NextAction("rend on attacker", ACTION_HIGH + 8) + } + ) + ); - triggers.push_back(new TriggerNode("shattering throw trigger", - NextAction::array(0, new NextAction("shattering throw", ACTION_INTERRUPT + 1), nullptr))); + triggers.push_back( + new TriggerNode( + "mortal strike", + { + NextAction("mortal strike", ACTION_HIGH + 3) + } + ) + ); - // triggers.push_back(new TriggerNode("medium aoe", - // NextAction::array(0, new NextAction("thunder clap", ACTION_HIGH + 2), nullptr))); - /* - triggers.push_back(new TriggerNode("medium aoe", - NextAction::array(0, new NextAction("sweeping strikes", ACTION_HIGH + 7), - new NextAction("bladestorm", ACTION_HIGH + 6), - nullptr))); - */ + triggers.push_back( + new TriggerNode( + "target critical health", + { + NextAction("execute", ACTION_HIGH + 5) + } + ) + ); + + triggers.push_back( + new TriggerNode( + "sudden death", + { + NextAction("execute", ACTION_HIGH + 5) + } + ) + ); + + triggers.push_back( + new TriggerNode( + "hamstring", + { + NextAction("piercing howl", ACTION_HIGH) + } + ) + ); + + triggers.push_back( + new TriggerNode( + "overpower", + { + NextAction("overpower", ACTION_HIGH + 4) + } + ) + ); + + triggers.push_back( + new TriggerNode( + "taste for blood", + { + NextAction("overpower", ACTION_HIGH + 4) + } + ) + ); + + triggers.push_back( + new TriggerNode( + "victory rush", + { + NextAction("victory rush", ACTION_INTERRUPT) + } + ) + ); + + triggers.push_back( + new TriggerNode( + "high rage available", + { + NextAction("heroic strike", ACTION_HIGH), + NextAction("slam", ACTION_HIGH + 1) + } + ) + ); + triggers.push_back( + new TriggerNode( + "bloodrage", + { + NextAction("bloodrage", ACTION_HIGH + 2) + } + ) + ); + + triggers.push_back( + new TriggerNode( + "death wish", + { + NextAction("death wish", ACTION_HIGH + 2) + } + ) + ); + + triggers.push_back( + new TriggerNode( + "critical health", + { + NextAction("intimidating shout", ACTION_EMERGENCY) + } + ) + ); + + triggers.push_back( + new TriggerNode( + "medium health", + { + NextAction("enraged regeneration", ACTION_EMERGENCY) + } + ) + ); + + triggers.push_back( + new TriggerNode( + "almost full health", + { + NextAction("retaliation", ACTION_EMERGENCY + 1) + } + ) + ); + + triggers.push_back( + new TriggerNode( + "shattering throw trigger", + { + NextAction("shattering throw", ACTION_INTERRUPT + 1) + } + ) + ); } diff --git a/src/strategy/warrior/ArmsWarriorStrategy.h b/src/strategy/warrior/ArmsWarriorStrategy.h index 682657be..126d1621 100644 --- a/src/strategy/warrior/ArmsWarriorStrategy.h +++ b/src/strategy/warrior/ArmsWarriorStrategy.h @@ -18,7 +18,7 @@ public: public: void InitTriggers(std::vector& triggers) override; std::string const getName() override { return "arms"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; uint32 GetType() const override { return STRATEGY_TYPE_COMBAT | STRATEGY_TYPE_DPS | STRATEGY_TYPE_MELEE; } }; diff --git a/src/strategy/warrior/FuryWarriorStrategy.cpp b/src/strategy/warrior/FuryWarriorStrategy.cpp index 0ab7f589..6400ee4a 100644 --- a/src/strategy/warrior/FuryWarriorStrategy.cpp +++ b/src/strategy/warrior/FuryWarriorStrategy.cpp @@ -14,27 +14,60 @@ public: { creators["charge"] = &charge; creators["intercept"] = &intercept; - // creators["death wish"] = &death_wish; creators["piercing howl"] = &piercing_howl; - // creators["bloodthirst"] = &bloodthirst; creators["pummel"] = &pummel; creators["enraged regeneration"] = &enraged_regeneration; } private: - ACTION_NODE_A(charge, "charge", "intercept"); - ACTION_NODE_A(intercept, "intercept", "reach melee"); - ACTION_NODE_A(piercing_howl, "piercing howl", "hamstring"); - // ACTION_NODE_A(death_wish, "death wish", "berserker rage"); - // ACTION_NODE_A(bloodthirst, "bloodthirst", "melee"); - ACTION_NODE_A(pummel, "pummel", "intercept"); + static ActionNode* charge(PlayerbotAI* botAI) + { + return new ActionNode( + "charge", + /*P*/ {}, + /*A*/ { NextAction("intercept" )}, + /*C*/ {} + ); + } + + static ActionNode* intercept(PlayerbotAI* botAI) + { + return new ActionNode( + "intercept", + /*P*/ {}, + /*A*/ { NextAction("reach melee" )}, + /*C*/ {} + ); + } + + static ActionNode* piercing_howl(PlayerbotAI* botAI) + { + return new ActionNode( + "piercing howl", + /*P*/ {}, + /*A*/ { NextAction("hamstring" )}, + /*C*/ {} + ); + } + + static ActionNode* pummel(PlayerbotAI* botAI) + { + return new ActionNode( + "pummel", + /*P*/ {}, + /*A*/ { NextAction("intercept" )}, + /*C*/ {} + ); + } static ActionNode* enraged_regeneration(PlayerbotAI* botAI) { - return new ActionNode("enraged regeneration", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "enraged regeneration", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } }; @@ -43,57 +76,131 @@ FuryWarriorStrategy::FuryWarriorStrategy(PlayerbotAI* botAI) : GenericWarriorStr actionNodeFactories.Add(new FuryWarriorStrategyActionNodeFactory()); } -NextAction** FuryWarriorStrategy::getDefaultActions() +std::vector FuryWarriorStrategy::getDefaultActions() { - return NextAction::array( - 0, new NextAction("bloodthirst", ACTION_DEFAULT + 0.5f), new NextAction("whirlwind", ACTION_DEFAULT + 0.4f), - new NextAction("sunder armor", ACTION_DEFAULT + 0.3f), new NextAction("execute", ACTION_DEFAULT + 0.2f), - // new NextAction("overpower", ACTION_DEFAULT + 0.1f), - new NextAction("melee", ACTION_DEFAULT), NULL); + return { + NextAction("bloodthirst", ACTION_DEFAULT + 0.5f), + NextAction("whirlwind", ACTION_DEFAULT + 0.4f), + NextAction("sunder armor", ACTION_DEFAULT + 0.3f), + NextAction("execute", ACTION_DEFAULT + 0.2f), + NextAction("melee", ACTION_DEFAULT) + }; } void FuryWarriorStrategy::InitTriggers(std::vector& triggers) { GenericWarriorStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("enemy out of melee", - NextAction::array(0, new NextAction("charge", ACTION_MOVE + 9), nullptr))); - triggers.push_back(new TriggerNode( - "berserker stance", NextAction::array(0, new NextAction("berserker stance", ACTION_HIGH + 9), nullptr))); - triggers.push_back(new TriggerNode("battle shout", - NextAction::array(0, new NextAction("battle shout", ACTION_HIGH + 8), nullptr))); - // triggers.push_back(new TriggerNode("target critical health", NextAction::array(0, new NextAction("execute", - // ACTION_HIGH + 4), nullptr))); triggers.push_back(new TriggerNode("sudden death", NextAction::array(0, new - // NextAction("execute", ACTION_HIGH + 4), nullptr))); triggers.push_back(new TriggerNode("hamstring", - // NextAction::array(0, new NextAction("piercing howl", ACTION_HIGH + 1), nullptr))); triggers.push_back( - new TriggerNode("pummel on enemy healer", - NextAction::array(0, new NextAction("pummel on enemy healer", ACTION_INTERRUPT), nullptr))); + new TriggerNode( + "enemy out of melee", + { + NextAction("charge", ACTION_MOVE + 9) + } + ) + ); triggers.push_back( - new TriggerNode("pummel", NextAction::array(0, new NextAction("pummel", ACTION_INTERRUPT), nullptr))); - triggers.push_back(new TriggerNode( - "victory rush", NextAction::array(0, new NextAction("victory rush", ACTION_INTERRUPT), nullptr))); - // triggers.push_back(new TriggerNode("intercept on snare target", NextAction::array(0, new NextAction("intercept on - // snare target", ACTION_HIGH), nullptr))); + new TriggerNode( + "berserker stance", { + NextAction("berserker stance", ACTION_HIGH + 9) + } + ) + ); triggers.push_back( - new TriggerNode("bloodthirst", NextAction::array(0, new NextAction("bloodthirst", ACTION_HIGH + 7), nullptr))); + new TriggerNode( + "battle shout", + { + NextAction("battle shout", ACTION_HIGH + 8) + } + ) + ); triggers.push_back( - new TriggerNode("whirlwind", NextAction::array(0, new NextAction("whirlwind", ACTION_HIGH + 6), nullptr))); + new TriggerNode( + "pummel on enemy healer", + { + NextAction("pummel on enemy healer", ACTION_INTERRUPT) + } + ) + ); triggers.push_back( - new TriggerNode("instant slam", NextAction::array(0, new NextAction("slam", ACTION_HIGH + 5), nullptr))); + new TriggerNode( + "pummel", + { + NextAction("pummel", ACTION_INTERRUPT) + } + ) + ); triggers.push_back( - new TriggerNode("bloodrage", NextAction::array(0, new NextAction("bloodrage", ACTION_HIGH + 2), nullptr))); - triggers.push_back(new TriggerNode("medium rage available", - NextAction::array(0, new NextAction("heroic strike", ACTION_DEFAULT + 0.1f), NULL))); - // triggers.push_back(new TriggerNode("berserker rage", NextAction::array(0, new NextAction("berserker rage", - // ACTION_HIGH + 2), nullptr))); triggers.push_back(new TriggerNode("light aoe", NextAction::array(0, - // new NextAction("whirlwind", ACTION_HIGH + 2), - // nullptr))); + new TriggerNode( + "victory rush", + { + NextAction("victory rush", ACTION_INTERRUPT) + } + ) + ); + triggers.push_back( + new TriggerNode( + "bloodthirst", + { + NextAction("bloodthirst", ACTION_HIGH + 7) + } + ) + ); + triggers.push_back( + new TriggerNode( + "whirlwind", + { + NextAction("whirlwind", ACTION_HIGH + 6) + } + ) + ); + triggers.push_back( + new TriggerNode( + "instant slam", + { + NextAction("slam", ACTION_HIGH + 5) + } + ) + ); + triggers.push_back( + new TriggerNode( + "bloodrage", + { + NextAction("bloodrage", ACTION_HIGH + 2) + } + ) + ); + triggers.push_back( + new TriggerNode( + "medium rage available", + { + NextAction("heroic strike", ACTION_DEFAULT + 0.1f) + } + ) + ); triggers.push_back( - new TriggerNode("death wish", NextAction::array(0, new NextAction("death wish", ACTION_HIGH), nullptr))); + new TriggerNode( + "death wish", + { + NextAction("death wish", ACTION_HIGH) + } + ) + ); triggers.push_back( - new TriggerNode("recklessness", NextAction::array(0, new NextAction("recklessness", ACTION_HIGH), nullptr))); - triggers.push_back(new TriggerNode("critical health", - NextAction::array(0, new NextAction("enraged regeneration", ACTION_EMERGENCY), nullptr))); + new TriggerNode( + "recklessness", + { + NextAction("recklessness", ACTION_HIGH) + } + ) + ); + triggers.push_back( + new TriggerNode( + "critical health", + { + NextAction("enraged regeneration", ACTION_EMERGENCY) + } + ) + ); } diff --git a/src/strategy/warrior/FuryWarriorStrategy.h b/src/strategy/warrior/FuryWarriorStrategy.h index 2791379e..79413960 100644 --- a/src/strategy/warrior/FuryWarriorStrategy.h +++ b/src/strategy/warrior/FuryWarriorStrategy.h @@ -17,7 +17,7 @@ public: void InitTriggers(std::vector& triggers) override; std::string const getName() override { return "fury"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; uint32 GetType() const override { return STRATEGY_TYPE_COMBAT | STRATEGY_TYPE_DPS | STRATEGY_TYPE_MELEE; } }; diff --git a/src/strategy/warrior/GenericWarriorNonCombatStrategy.cpp b/src/strategy/warrior/GenericWarriorNonCombatStrategy.cpp index a5525462..091aed2b 100644 --- a/src/strategy/warrior/GenericWarriorNonCombatStrategy.cpp +++ b/src/strategy/warrior/GenericWarriorNonCombatStrategy.cpp @@ -11,7 +11,5 @@ void GenericWarriorNonCombatStrategy::InitTriggers(std::vector& tr { NonCombatStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("apply stone", 1.0f), nullptr))); - // triggers.push_back(new TriggerNode("battle stance", NextAction::array(0, new NextAction("battle stance", 1.0f), - // nullptr))); + triggers.push_back(new TriggerNode("often", { NextAction("apply stone", 1.0f) })); } diff --git a/src/strategy/warrior/GenericWarriorStrategy.cpp b/src/strategy/warrior/GenericWarriorStrategy.cpp index 7cb8bb15..178984de 100644 --- a/src/strategy/warrior/GenericWarriorStrategy.cpp +++ b/src/strategy/warrior/GenericWarriorStrategy.cpp @@ -9,20 +9,14 @@ GenericWarriorStrategy::GenericWarriorStrategy(PlayerbotAI* botAI) : CombatStrategy(botAI) { - // actionNodeFactories.Add(new WarriorStanceRequirementActionNodeFactory()); + } void GenericWarriorStrategy::InitTriggers(std::vector& triggers) { CombatStrategy::InitTriggers(triggers); triggers.push_back(new TriggerNode( - "enemy out of melee", NextAction::array(0, new NextAction("reach melee", ACTION_HIGH + 1), nullptr))); - /*triggers.push_back(new TriggerNode("bloodrage", NextAction::array(0, new NextAction("bloodrage", ACTION_HIGH + 1), - nullptr))); triggers.push_back(new TriggerNode("shield bash", NextAction::array(0, new NextAction("shield bash", - ACTION_INTERRUPT + 4), nullptr))); triggers.push_back(new TriggerNode("shield bash on enemy healer", - NextAction::array(0, new NextAction("shield bash on enemy healer", ACTION_INTERRUPT + 3), nullptr))); - triggers.push_back(new TriggerNode("critical health", NextAction::array(0, new NextAction("intimidating shout", - ACTION_EMERGENCY), nullptr)));*/ + "enemy out of melee", { NextAction("reach melee", ACTION_HIGH + 1) })); } class WarrirorAoeStrategyActionNodeFactory : public NamedObjectFactory @@ -30,11 +24,11 @@ class WarrirorAoeStrategyActionNodeFactory : public NamedObjectFactory& triggers) { - // triggers.push_back(new TriggerNode("thunder clap on snare target", NextAction::array(0, new NextAction("thunder - // clap on snare target", ACTION_HIGH + 3), nullptr))); triggers.push_back(new TriggerNode("thunder clap", - // NextAction::array(0, new NextAction("thunder clap", ACTION_HIGH + 10), nullptr))); - /* triggers.push_back(new TriggerNode( - "medium aoe", NextAction::array(0, new NextAction("sweeping strikes", ACTION_HIGH + 7), - new NextAction("bladestorm", ACTION_HIGH + 6), - nullptr))); - */ triggers.push_back(new TriggerNode( - "light aoe", NextAction::array(0, new NextAction("sweeping strikes", ACTION_HIGH + 7), - new NextAction("bladestorm", ACTION_HIGH + 6), - new NextAction("thunder clap", ACTION_HIGH + 5), - new NextAction("shockwave", ACTION_HIGH + 4), - // new NextAction("whirlwind", ACTION_HIGH + 2), - new NextAction("demoralizing shout without life time check", ACTION_HIGH + 1), - new NextAction("cleave", ACTION_HIGH), nullptr))); + "light aoe", { NextAction("sweeping strikes", ACTION_HIGH + 7), + NextAction("bladestorm", ACTION_HIGH + 6), + NextAction("thunder clap", ACTION_HIGH + 5), + NextAction("shockwave", ACTION_HIGH + 4), + NextAction("demoralizing shout without life time check", ACTION_HIGH + 1), + NextAction("cleave", ACTION_HIGH) })); triggers.push_back( new TriggerNode("shockwave on snare target", - NextAction::array(0, new NextAction("shockwave on snare target", ACTION_HIGH + 5), nullptr))); - // triggers.push_back(new TriggerNode("high rage available", NextAction::array(0, new NextAction("whirlwind", - // ACTION_HIGH + 10), nullptr))); + { NextAction("shockwave on snare target", ACTION_HIGH + 5) })); } diff --git a/src/strategy/warrior/GenericWarriorStrategy.h b/src/strategy/warrior/GenericWarriorStrategy.h index afd14a59..5a336be2 100644 --- a/src/strategy/warrior/GenericWarriorStrategy.h +++ b/src/strategy/warrior/GenericWarriorStrategy.h @@ -43,24 +43,176 @@ public: } private: - ACTION_NODE_P(charge, "charge", "battle stance"); - ACTION_NODE_P(mocking_blow, "mocking blow", "battle stance"); - ACTION_NODE_P(overpower, "overpower", "battle stance"); - ACTION_NODE_P(berserker_rage, "berserker rage", "berserker stance"); - ACTION_NODE_P(recklessness, "recklessness", "berserker stance"); - ACTION_NODE_P(whirlwind, "whirlwind", "berserker stance"); - ACTION_NODE_P(pummel, "pummel", "berserker stance"); - ACTION_NODE_P(intercept, "intercept", "berserker stance"); - ACTION_NODE_P(taunt, "taunt", "defensive stance"); - ACTION_NODE_P(revenge, "revenge", "defensive stance"); - ACTION_NODE_P(shield_block, "shield block", "defensive stance"); - ACTION_NODE_P(disarm, "disarm", "defensive stance"); - ACTION_NODE_P(shield_wall, "shield wall", "defensive stance"); - ACTION_NODE_P(intervene, "intervene", "defensive stance"); - // temp - ACTION_NODE_P(mortal_strike, "mortal strike", "battle stance"); - ACTION_NODE_P(retaliation, "retaliation", "battle stance"); - ACTION_NODE_P(shattering_throw, "shattering throw", "battle stance"); + + static ActionNode* charge([[maybe_unused]] PlayerbotAI* botAI) + { + return new ActionNode( + "charge", + /*P*/ { NextAction("battle stance") }, + /*A*/ {}, + /*C*/ {} + ); + } + + static ActionNode* mocking_blow([[maybe_unused]] PlayerbotAI* botAI) + { + return new ActionNode( + "mocking blow", + /*P*/ { NextAction("battle stance") }, + /*A*/ {}, + /*C*/ {} + ); + } + + static ActionNode* overpower([[maybe_unused]] PlayerbotAI* botAI) + { + return new ActionNode( + "overpower", + /*P*/ { NextAction("battle stance") }, + /*A*/ {}, + /*C*/ {} + ); + } + + static ActionNode* berserker_rage([[maybe_unused]] PlayerbotAI* botAI) + { + return new ActionNode( + "berserker rage", + /*P*/ { NextAction("berserker stance") }, + /*A*/ {}, + /*C*/ {} + ); + } + + static ActionNode* recklessness([[maybe_unused]] PlayerbotAI* botAI) + { + return new ActionNode( + "recklessness", + /*P*/ { NextAction("berserker stance") }, + /*A*/ {}, + /*C*/ {} + ); + } + + static ActionNode* whirlwind([[maybe_unused]] PlayerbotAI* botAI) + { + return new ActionNode( + "whirlwind", + /*P*/ { NextAction("berserker stance") }, + /*A*/ {}, + /*C*/ {} + ); + } + + static ActionNode* pummel([[maybe_unused]] PlayerbotAI* botAI) + { + return new ActionNode( + "pummel", + /*P*/ { NextAction("berserker stance") }, + /*A*/ {}, + /*C*/ {} + ); + } + + static ActionNode* intercept([[maybe_unused]] PlayerbotAI* botAI) + { + return new ActionNode( + "intercept", + /*P*/ { NextAction("berserker stance") }, + /*A*/ {}, + /*C*/ {} + ); + } + + static ActionNode* taunt([[maybe_unused]] PlayerbotAI* botAI) + { + return new ActionNode( + "taunt", + /*P*/ { NextAction("defensive stance") }, + /*A*/ {}, + /*C*/ {} + ); + } + + static ActionNode* revenge([[maybe_unused]] PlayerbotAI* botAI) + { + return new ActionNode( + "revenge", + /*P*/ { NextAction("defensive stance") }, + /*A*/ {}, + /*C*/ {} + ); + } + + static ActionNode* shield_block([[maybe_unused]] PlayerbotAI* botAI) + { + return new ActionNode( + "shield block", + /*P*/ { NextAction("defensive stance") }, + /*A*/ {}, + /*C*/ {} + ); + } + + static ActionNode* disarm([[maybe_unused]] PlayerbotAI* botAI) + { + return new ActionNode( + "disarm", + /*P*/ { NextAction("defensive stance") }, + /*A*/ {}, + /*C*/ {} + ); + } + + static ActionNode* shield_wall([[maybe_unused]] PlayerbotAI* botAI) + { + return new ActionNode( + "shield wall", + /*P*/ { NextAction("defensive stance") }, + /*A*/ {}, + /*C*/ {} + ); + } + + static ActionNode* intervene([[maybe_unused]] PlayerbotAI* botAI) + { + return new ActionNode( + "intervene", + /*P*/ { NextAction("defensive stance") }, + /*A*/ {}, + /*C*/ {} + ); + } + + static ActionNode* mortal_strike([[maybe_unused]] PlayerbotAI* botAI) + { + return new ActionNode( + "mortal strike", + /*P*/ { NextAction("battle stance") }, + /*A*/ {}, + /*C*/ {} + ); + } + + static ActionNode* retaliation([[maybe_unused]] PlayerbotAI* botAI) + { + return new ActionNode( + "retaliation", + /*P*/ { NextAction("battle stance") }, + /*A*/ {}, + /*C*/ {} + ); + } + + static ActionNode* shattering_throw([[maybe_unused]] PlayerbotAI* botAI) + { + return new ActionNode( + "shattering throw", + /*P*/ { NextAction("battle stance") }, + /*A*/ {}, + /*C*/ {} + ); + } }; class GenericWarriorStrategy : public CombatStrategy diff --git a/src/strategy/warrior/TankWarriorStrategy.cpp b/src/strategy/warrior/TankWarriorStrategy.cpp index cbb712c1..05f732c3 100644 --- a/src/strategy/warrior/TankWarriorStrategy.cpp +++ b/src/strategy/warrior/TankWarriorStrategy.cpp @@ -15,7 +15,6 @@ public: creators["charge"] = &charge; creators["sunder armor"] = &sunder_armor; creators["commanding shout"] = &commanding_shout; - // creators["shield slam"] = &shield_slam; creators["devastate"] = &devastate; creators["last stand"] = &last_stand; creators["heroic throw on snare target"] = &heroic_throw_on_snare_target; @@ -27,37 +26,104 @@ public: } private: - // ACTION_NODE_A(charge, "charge", "intercept with stance"); - ACTION_NODE_A(charge, "charge", "reach melee"); - ACTION_NODE_A(sunder_armor, "sunder armor", "melee"); - ACTION_NODE_A(commanding_shout, "commanding shout", "battle shout"); - // ACTION_NODE_A(shield_slam, "shield slam", "heroic strike"); - ACTION_NODE_A(devastate, "devastate", "sunder armor"); - ACTION_NODE_A(last_stand, "last stand", "intimidating shout"); - ACTION_NODE_A(heroic_throw_on_snare_target, "heroic throw on snare target", "taunt on snare target"); - ACTION_NODE_A(heroic_throw_taunt, "heroic throw", "shield slam"); + static ActionNode* heroic_throw_taunt(PlayerbotAI* botAI) + { + return new ActionNode( + "heroic throw", + /*P*/ {}, + /*A*/ { NextAction("shield slam") }, + /*C*/ {} + ); + } + + static ActionNode* heroic_throw_on_snare_target(PlayerbotAI* botAI) + { + return new ActionNode( + "heroic throw on snare target", + /*P*/ {}, + /*A*/ { NextAction("taunt on snare target") }, + /*C*/ {} + ); + } + + static ActionNode* last_stand(PlayerbotAI* botAI) + { + return new ActionNode( + "last stand", + /*P*/ {}, + /*A*/ { NextAction("intimidating shout") }, + /*C*/ {} + ); + } + + static ActionNode* devastate(PlayerbotAI* botAI) + { + return new ActionNode( + "devastate", + /*P*/ {}, + /*A*/ { NextAction("sunder armor") }, + /*C*/ {} + ); + } + + static ActionNode* commanding_shout(PlayerbotAI* botAI) + { + return new ActionNode( + "commanding shout", + /*P*/ {}, + /*A*/ { NextAction("battle shout") }, + /*C*/ {} + ); + } + + static ActionNode* sunder_armor(PlayerbotAI* botAI) + { + return new ActionNode( + "sunder armor", + /*P*/ {}, + /*A*/ { NextAction("melee") }, + /*C*/ {} + ); + } + + static ActionNode* charge(PlayerbotAI* botAI) + { + return new ActionNode( + "charge", + /*P*/ {}, + /*A*/ { NextAction("reach melee") }, + /*C*/ {} + ); + } + static ActionNode* taunt(PlayerbotAI* botAI) { - return new ActionNode("taunt", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("heroic throw taunt"), nullptr), - /*C*/ nullptr); + return new ActionNode( + "taunt", + /*P*/ {}, + /*A*/ { NextAction("heroic throw taunt") }, + /*C*/ {} + ); } static ActionNode* vigilance(PlayerbotAI* botAI) { - return new ActionNode("vigilance", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "vigilance", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } static ActionNode* enraged_regeneration(PlayerbotAI* botAI) { - return new ActionNode("enraged regeneration", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + return new ActionNode( + "enraged regeneration", + /*P*/ {}, + /*A*/ {}, + /*C*/ {} + ); } }; @@ -66,83 +132,238 @@ TankWarriorStrategy::TankWarriorStrategy(PlayerbotAI* botAI) : GenericWarriorStr actionNodeFactories.Add(new TankWarriorStrategyActionNodeFactory()); } -NextAction** TankWarriorStrategy::getDefaultActions() +std::vector TankWarriorStrategy::getDefaultActions() { - return NextAction::array( - 0, new NextAction("devastate", ACTION_DEFAULT + 0.3f), new NextAction("revenge", ACTION_DEFAULT + 0.2f), - new NextAction("demoralizing shout", ACTION_DEFAULT + 0.1f), new NextAction("melee", ACTION_DEFAULT), NULL); + return { + NextAction("devastate", ACTION_DEFAULT + 0.3f), + NextAction("revenge", ACTION_DEFAULT + 0.2f), + NextAction("demoralizing shout", ACTION_DEFAULT + 0.1f), + NextAction("melee", ACTION_DEFAULT) + }; } void TankWarriorStrategy::InitTriggers(std::vector& triggers) { GenericWarriorStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode( - "vigilance", - NextAction::array(0, new NextAction("vigilance", ACTION_HIGH + 7), nullptr))); triggers.push_back( - new TriggerNode("enemy out of melee", NextAction::array(0, new NextAction("heroic throw", ACTION_MOVE + 11), - new NextAction("charge", ACTION_MOVE + 10), nullptr))); - // triggers.push_back(new TriggerNode("intercept and rage", NextAction::array(0, new NextAction("berserker stance", - // ACTION_MOVE + 14), nullptr))); triggers.push_back(new TriggerNode("intercept and rage", NextAction::array(0, new - // NextAction("intercept", ACTION_MOVE + 13), nullptr))); triggers.push_back(new TriggerNode("thunder clap and - // rage", NextAction::array(0, new NextAction("battle stance", ACTION_MOVE + 12), nullptr))); - triggers.push_back(new TriggerNode( - "thunder clap and rage", NextAction::array(0, new NextAction("thunder clap", ACTION_MOVE + 11), nullptr))); - triggers.push_back(new TriggerNode( - "defensive stance", NextAction::array(0, new NextAction("defensive stance", ACTION_HIGH + 9), nullptr))); - triggers.push_back(new TriggerNode( - "commanding shout", NextAction::array(0, new NextAction("commanding shout", ACTION_HIGH + 8), nullptr))); + new TriggerNode( + "vigilance", + { + NextAction("vigilance", ACTION_HIGH + 7) + } + ) + ); triggers.push_back( - new TriggerNode("bloodrage", NextAction::array(0, new NextAction("bloodrage", ACTION_HIGH + 2), nullptr))); + new TriggerNode( + "enemy out of melee", + { + NextAction("heroic throw", ACTION_MOVE + 11), + NextAction("charge", ACTION_MOVE + 10) + } + ) + ); + triggers.push_back( - new TriggerNode("sunder armor", NextAction::array(0, new NextAction("devastate", ACTION_HIGH + 2), nullptr))); - triggers.push_back(new TriggerNode("medium rage available", - NextAction::array(0, new NextAction("shield slam", ACTION_HIGH + 2), - new NextAction("devastate", ACTION_HIGH + 1), - nullptr))); - triggers.push_back(new TriggerNode( - "shield block", NextAction::array(0, new NextAction("shield block", ACTION_INTERRUPT + 1), nullptr))); + new TriggerNode( + "thunder clap and rage", + { + NextAction("thunder clap", ACTION_MOVE + 11) + } + ) + ); triggers.push_back( - new TriggerNode("revenge", NextAction::array(0, new NextAction("revenge", ACTION_HIGH + 2), nullptr))); + new TriggerNode( + "defensive stance", + { + NextAction("defensive stance", ACTION_HIGH + 9) + } + ) + ); triggers.push_back( - new TriggerNode("disarm", NextAction::array(0, new NextAction("disarm", ACTION_HIGH + 1), nullptr))); + new TriggerNode( + "commanding shout", + { + NextAction("commanding shout", ACTION_HIGH + 8) + } + ) + ); triggers.push_back( - new TriggerNode("lose aggro", NextAction::array(0, new NextAction("taunt", ACTION_INTERRUPT + 1), nullptr))); - triggers.push_back(new TriggerNode( - "taunt on snare target", - NextAction::array(0, new NextAction("heroic throw on snare target", ACTION_INTERRUPT), nullptr))); - triggers.push_back(new TriggerNode( - "low health", NextAction::array(0, new NextAction("shield wall", ACTION_MEDIUM_HEAL), nullptr))); - triggers.push_back(new TriggerNode("critical health", - NextAction::array(0, new NextAction("last stand", ACTION_EMERGENCY + 3), - new NextAction("enraged regeneration", ACTION_EMERGENCY + 2), - nullptr))); - // triggers.push_back(new TriggerNode("medium aoe", NextAction::array(0, new NextAction("battle shout taunt", - // ACTION_HIGH + 1), nullptr))); - triggers.push_back(new TriggerNode( - "high aoe", NextAction::array(0, new NextAction("challenging shout", ACTION_HIGH + 3), nullptr))); - triggers.push_back(new TriggerNode( - "concussion blow", NextAction::array(0, new NextAction("concussion blow", ACTION_INTERRUPT), nullptr))); + new TriggerNode( + "bloodrage", + { + NextAction("bloodrage", ACTION_HIGH + 2) + } + ) + ); triggers.push_back( - new TriggerNode("shield bash", NextAction::array(0, new NextAction("shield bash", ACTION_INTERRUPT), nullptr))); - triggers.push_back(new TriggerNode( - "shield bash on enemy healer", - NextAction::array(0, new NextAction("shield bash on enemy healer", ACTION_INTERRUPT), nullptr))); - triggers.push_back(new TriggerNode( - "spell reflection", NextAction::array(0, new NextAction("spell reflection", ACTION_INTERRUPT + 1), nullptr))); - triggers.push_back(new TriggerNode( - "victory rush", NextAction::array(0, new NextAction("victory rush", ACTION_INTERRUPT), nullptr))); - triggers.push_back(new TriggerNode("sword and board", - NextAction::array(0, new NextAction("shield slam", ACTION_INTERRUPT), nullptr))); + new TriggerNode( + "sunder armor", + { + NextAction("devastate", ACTION_HIGH + 2) + } + ) + ); triggers.push_back( - new TriggerNode("rend", NextAction::array(0, new NextAction("rend", ACTION_NORMAL + 1), nullptr))); - triggers.push_back(new TriggerNode( - "rend on attacker", NextAction::array(0, new NextAction("rend on attacker", ACTION_NORMAL + 1), nullptr))); - triggers.push_back(new TriggerNode("protect party member", - NextAction::array(0, new NextAction("intervene", ACTION_EMERGENCY), nullptr))); - triggers.push_back(new TriggerNode( - "high rage available", NextAction::array(0, new NextAction("heroic strike", ACTION_HIGH), nullptr))); - triggers.push_back(new TriggerNode("medium rage available", - NextAction::array(0, new NextAction("thunder clap", ACTION_HIGH + 1), nullptr))); + new TriggerNode( + "medium rage available", + { + NextAction("shield slam", ACTION_HIGH + 2), + NextAction("devastate", ACTION_HIGH + 1) + } + ) + ); + triggers.push_back( + new TriggerNode( + "shield block", + { + NextAction("shield block", ACTION_INTERRUPT + 1) + } + ) + ); + triggers.push_back( + new TriggerNode( + "revenge", + { + NextAction("revenge", ACTION_HIGH + 2) + } + ) + ); + triggers.push_back( + new TriggerNode( + "disarm", + { + NextAction("disarm", ACTION_HIGH + 1) + } + ) + ); + triggers.push_back( + new TriggerNode( + "lose aggro", + { + NextAction("taunt", ACTION_INTERRUPT + 1) + } + ) + ); + triggers.push_back( + new TriggerNode( + "taunt on snare target", + { + NextAction("heroic throw on snare target", ACTION_INTERRUPT) + } + ) + ); + triggers.push_back( + new TriggerNode( + "low health", + { + NextAction("shield wall", ACTION_MEDIUM_HEAL) + } + ) + ); + triggers.push_back( + new TriggerNode( + "critical health", + { + NextAction("last stand", ACTION_EMERGENCY + 3), + NextAction("enraged regeneration", ACTION_EMERGENCY + 2) + } + ) + ); + triggers.push_back( + new TriggerNode( + "high aoe", + { + NextAction("challenging shout", ACTION_HIGH + 3) + } + ) + ); + triggers.push_back( + new TriggerNode( + "concussion blow", + { + NextAction("concussion blow", ACTION_INTERRUPT) + } + ) + ); + triggers.push_back( + new TriggerNode( + "shield bash", + { + NextAction("shield bash", ACTION_INTERRUPT) + } + ) + ); + triggers.push_back( + new TriggerNode( + "shield bash on enemy healer", + { + NextAction("shield bash on enemy healer", ACTION_INTERRUPT) + } + ) + ); + triggers.push_back( + new TriggerNode( + "spell reflection", + { + NextAction("spell reflection", ACTION_INTERRUPT + 1) + } + ) + ); + triggers.push_back( + new TriggerNode( + "victory rush", + { + NextAction("victory rush", ACTION_INTERRUPT) + } + ) + ); + triggers.push_back( + new TriggerNode( + "sword and board", + { + NextAction("shield slam", ACTION_INTERRUPT) + } + ) + ); + triggers.push_back( + new TriggerNode( + "rend", + { + NextAction("rend", ACTION_NORMAL + 1) + } + ) + ); + triggers.push_back( + new TriggerNode( + "rend on attacker", + { + NextAction("rend on attacker", ACTION_NORMAL + 1) + } + ) + ); + triggers.push_back( + new TriggerNode( + "protect party member", + { + NextAction("intervene", ACTION_EMERGENCY) + } + ) + ); + triggers.push_back( + new TriggerNode( + "high rage available", + { + NextAction("heroic strike", ACTION_HIGH) + } + ) + ); + triggers.push_back( + new TriggerNode( + "medium rage available", + { + NextAction("thunder clap", ACTION_HIGH + 1) + } + ) + ); } diff --git a/src/strategy/warrior/TankWarriorStrategy.h b/src/strategy/warrior/TankWarriorStrategy.h index 54e11108..b5282429 100644 --- a/src/strategy/warrior/TankWarriorStrategy.h +++ b/src/strategy/warrior/TankWarriorStrategy.h @@ -18,7 +18,7 @@ public: void InitTriggers(std::vector& triggers) override; std::string const getName() override { return "tank"; } - NextAction** getDefaultActions() override; + std::vector getDefaultActions() override; uint32 GetType() const override { return STRATEGY_TYPE_TANK | STRATEGY_TYPE_MELEE; } };