diff --git a/src/strategy/AiObjectContext.cpp b/src/strategy/AiObjectContext.cpp index 92ad0351..fc791244 100644 --- a/src/strategy/AiObjectContext.cpp +++ b/src/strategy/AiObjectContext.cpp @@ -62,7 +62,7 @@ AiObjectContext::AiObjectContext(PlayerbotAI* botAI) : PlayerbotAIAware(botAI) actionContexts.Add(new WotlkDungeonOccActionContext()); actionContexts.Add(new WotlkDungeonUPActionContext()); actionContexts.Add(new WotlkDungeonCoSActionContext()); - actionContexts.Add(new WotlkDungeonFosActionContext()); + actionContexts.Add(new WotlkDungeonFoSActionContext()); triggerContexts.Add(new TriggerContext()); triggerContexts.Add(new ChatTriggerContext()); diff --git a/src/strategy/dungeons/DungeonStrategyContext.h b/src/strategy/dungeons/DungeonStrategyContext.h index 296fc2ff..aa266f66 100644 --- a/src/strategy/dungeons/DungeonStrategyContext.h +++ b/src/strategy/dungeons/DungeonStrategyContext.h @@ -14,7 +14,7 @@ #include "wotlk/oculus/OculusStrategy.h" #include "wotlk/utgardepinnacle/UtgardePinnacleStrategy.h" #include "wotlk/cullingofstratholme/CullingOfStratholmeStrategy.h" -#include "wotlk/forgeofsouls/FosStrategy.h" +#include "wotlk/forgeofsouls/ForgeOfSoulsStrategy.h" /* Full list/TODO: @@ -77,7 +77,7 @@ class DungeonStrategyContext : public NamedObjectContext static Strategy* wotlk_occ(PlayerbotAI* botAI) { return new WotlkDungeonOccStrategy(botAI); } static Strategy* wotlk_up(PlayerbotAI* botAI) { return new WotlkDungeonUPStrategy(botAI); } static Strategy* wotlk_cos(PlayerbotAI* botAI) { return new WotlkDungeonCoSStrategy(botAI); } - static Strategy* wotlk_fos(PlayerbotAI* botAI) { return new WotlkDungeonFosStrategy(botAI); } + static Strategy* wotlk_fos(PlayerbotAI* botAI) { return new WotlkDungeonFoSStrategy(botAI); } // NYI from here down static Strategy* wotlk_toc(PlayerbotAI* botAI) { return new WotlkDungeonUKStrategy(botAI); } static Strategy* wotlk_hor(PlayerbotAI* botAI) { return new WotlkDungeonUKStrategy(botAI); } diff --git a/src/strategy/dungeons/DungeonStrategyUtils.h b/src/strategy/dungeons/DungeonStrategyUtils.h index e5391f4b..3f67f4b4 100644 --- a/src/strategy/dungeons/DungeonStrategyUtils.h +++ b/src/strategy/dungeons/DungeonStrategyUtils.h @@ -1,6 +1,5 @@ #ifndef _PLAYERBOT_DUNGEONUTILS_H #define _PLAYERBOT_DUNGEONUTILS_H -#include "Player.h" template inline const T& DUNGEON_MODE(Player* bot, const T& normal5, const T& heroic10) diff --git a/src/strategy/dungeons/wotlk/WotlkDungeonActionContext.h b/src/strategy/dungeons/wotlk/WotlkDungeonActionContext.h index 06ca0381..75769739 100644 --- a/src/strategy/dungeons/wotlk/WotlkDungeonActionContext.h +++ b/src/strategy/dungeons/wotlk/WotlkDungeonActionContext.h @@ -13,7 +13,7 @@ #include "oculus/OculusActionContext.h" #include "utgardepinnacle/UtgardePinnacleActionContext.h" #include "cullingofstratholme/CullingOfStratholmeActionContext.h" -#include "forgeofsouls/FosActionContext.h" +#include "forgeofsouls/ForgeOfSoulsActionContext.h" // #include "trialofthechampion/TrialOfTheChampionActionContext.h" // #include "hallsofreflection/HallsOfReflectionActionContext.h" // #include "pitofsaron/PitOfSaronActionContext.h" diff --git a/src/strategy/dungeons/wotlk/WotlkDungeonTriggerContext.h b/src/strategy/dungeons/wotlk/WotlkDungeonTriggerContext.h index d7e1e169..8b4e979e 100644 --- a/src/strategy/dungeons/wotlk/WotlkDungeonTriggerContext.h +++ b/src/strategy/dungeons/wotlk/WotlkDungeonTriggerContext.h @@ -13,7 +13,7 @@ #include "oculus/OculusTriggerContext.h" #include "utgardepinnacle/UtgardePinnacleTriggerContext.h" #include "cullingofstratholme/CullingOfStratholmeTriggerContext.h" -#include "forgeofsouls/FosTriggerContext.h" +#include "forgeofsouls/ForgeOfSoulsTriggerContext.h" // #include "trialofthechampion/TrialOfTheChampionTriggerContext.h" // #include "hallsofreflection/HallsOfReflectionTriggerContext.h" // #include "pitofsaron/PitOfSaronTriggerContext.h" diff --git a/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsActionContext.h b/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsActionContext.h new file mode 100644 index 00000000..0ba0b1d2 --- /dev/null +++ b/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsActionContext.h @@ -0,0 +1,23 @@ +#ifndef _PLAYERBOT_WOTLKDUNGEONFOSACTIONCONTEXT_H +#define _PLAYERBOT_WOTLKDUNGEONFOSACTIONCONTEXT_H + +#include "Action.h" +#include "NamedObjectContext.h" +#include "ForgeOfSoulsActions.h" + +class WotlkDungeonFoSActionContext : public NamedObjectContext +{ + public: + WotlkDungeonFoSActionContext() + { + creators["move from bronjahm"] = &WotlkDungeonFoSActionContext::move_from_bronjahm; + creators["attack corrupted soul fragment"] = &WotlkDungeonFoSActionContext::attack_corrupted_soul_fragment; + creators["bronjahm group position"] = &WotlkDungeonFoSActionContext::bronjahm_group_position; + } + private: + static Action* move_from_bronjahm(PlayerbotAI* ai) { return new MoveFromBronjahmAction(ai); } + static Action* attack_corrupted_soul_fragment(PlayerbotAI* ai) { return new AttackCorruptedSoulFragmentAction(ai); } + static Action* bronjahm_group_position(PlayerbotAI* ai) { return new BronjahmGroupPositionAction(ai); } +}; + +#endif diff --git a/src/strategy/dungeons/wotlk/forgeofsouls/FosActions.cpp b/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsActions.cpp similarity index 57% rename from src/strategy/dungeons/wotlk/forgeofsouls/FosActions.cpp rename to src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsActions.cpp index 42270190..31b477ff 100644 --- a/src/strategy/dungeons/wotlk/forgeofsouls/FosActions.cpp +++ b/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsActions.cpp @@ -1,11 +1,10 @@ #include "Playerbots.h" -#include "FosActions.h" -#include "FosStrategy.h" +#include "ForgeOfSoulsActions.h" +#include "ForgeOfSoulsStrategy.h" bool MoveFromBronjahmAction::Execute(Event event) -{ - Unit* boss = nullptr; - boss = AI_VALUE2(Unit*, "find target", "bronjahm"); +{ + Unit* boss = AI_VALUE2(Unit*, "find target", "bronjahm"); if (!boss) return false; @@ -17,7 +16,6 @@ bool MoveFromBronjahmAction::Execute(Event event) return MoveAway(boss, targetDis - distance); } -bool MoveFromBronjahmAction::isUseful() { return bot->HasAura(SPELL_CORRUPT_SOUL); } bool AttackCorruptedSoulFragmentAction::Execute(Event event) { @@ -25,9 +23,9 @@ bool AttackCorruptedSoulFragmentAction::Execute(Event event) GuidVector targets = AI_VALUE(GuidVector, "possible targets no los"); - for (auto i = targets.begin(); i != targets.end(); ++i) + for (auto &target : targets) { - Unit* unit = botAI->GetUnit(*i); + Unit* unit = botAI->GetUnit(target); if (unit && unit->GetEntry() == NPC_CORRUPTED_SOUL_FRAGMENT) { fragment = unit; @@ -35,40 +33,45 @@ bool AttackCorruptedSoulFragmentAction::Execute(Event event) } } - if (!fragment) - return false; - - if (botAI->IsDps(bot)) - { - if (AI_VALUE(Unit*, "current target") == fragment) - return false; - + if (fragment && AI_VALUE(Unit*, "current target") != fragment) return Attack(fragment); - } - else - return false; + + return false; } -bool AttackCorruptedSoulFragmentAction::isUseful() { return botAI->IsDps(bot); } -bool BronjahmTankPositionAction::Execute(Event event) +bool BronjahmGroupPositionAction::Execute(Event event) { - return MoveTo(bot->GetMapId(), BRONJAHM_TANK_POSITION.GetPositionX(), BRONJAHM_TANK_POSITION.GetPositionY(), - BRONJAHM_TANK_POSITION.GetPositionZ(), false, false, false, true, MovementPriority::MOVEMENT_COMBAT); + if (botAI->IsTank(bot)) + if (bot->GetExactDist2d(BRONJAHM_TANK_POSITION) > 5.0f) + return MoveTo(bot->GetMapId(), BRONJAHM_TANK_POSITION.GetPositionX(), BRONJAHM_TANK_POSITION.GetPositionY(), + BRONJAHM_TANK_POSITION.GetPositionZ(), false, false, false, true, + MovementPriority::MOVEMENT_COMBAT); + else + return false; + else + { + Unit* boss = AI_VALUE2(Unit*, "find target", "bronjahm"); + + if (boss) + { + + } + } } -bool BronjahmTankPositionAction::isUseful() { return bot->GetExactDist2d(BRONJAHM_TANK_POSITION) > 5.0f; } +bool BronjahmGroupPositionAction::isUseful() { return bot->GetExactDist2d(BRONJAHM_TANK_POSITION) > 5.0f; } bool BronjahmTankTargetAction::Execute(Event event) { if (botAI->IsTank(bot)) { Unit* boss = AI_VALUE2(Unit*, "find target", "bronjahm"); - if (AI_VALUE(Unit*, "current target") == boss) + if (boss && AI_VALUE(Unit*, "current target") != boss) + return Attack(boss); + else return false; - - return Attack(boss); } else return false; diff --git a/src/strategy/dungeons/wotlk/forgeofsouls/FosActions.h b/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsActions.h similarity index 83% rename from src/strategy/dungeons/wotlk/forgeofsouls/FosActions.h rename to src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsActions.h index e3227019..227a6fbe 100644 --- a/src/strategy/dungeons/wotlk/forgeofsouls/FosActions.h +++ b/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsActions.h @@ -5,7 +5,7 @@ #include "AttackAction.h" #include "PlayerbotAI.h" #include "Playerbots.h" -#include "FosTriggers.h" +#include "ForgeOfSoulsTriggers.h" const Position BRONJAHM_TANK_POSITION = Position(5297.9204f, 2506.698f, 686.06793f); @@ -14,7 +14,6 @@ class MoveFromBronjahmAction : public MovementAction public: MoveFromBronjahmAction(PlayerbotAI* ai) : MovementAction(ai, "move from bronjahm") {} bool Execute(Event event) override; - bool isUseful() override; }; class AttackCorruptedSoulFragmentAction : public AttackAction @@ -22,13 +21,12 @@ class AttackCorruptedSoulFragmentAction : public AttackAction public: AttackCorruptedSoulFragmentAction(PlayerbotAI* ai) : AttackAction(ai, "attack corrupted soul fragment") {} bool Execute(Event event) override; - bool isUseful() override; }; -class BronjahmTankPositionAction : public MovementAction +class BronjahmGroupPositionAction : public MovementAction { public: - BronjahmTankPositionAction(PlayerbotAI* ai) : MovementAction(ai, "bronjahm tank position") {} + BronjahmGroupPositionAction(PlayerbotAI* ai) : MovementAction(ai, "bronjahm group position") {} bool Execute(Event event) override; diff --git a/src/strategy/dungeons/wotlk/forgeofsouls/FosMultipliers.cpp b/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsMultipliers.cpp similarity index 85% rename from src/strategy/dungeons/wotlk/forgeofsouls/FosMultipliers.cpp rename to src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsMultipliers.cpp index 5eadea27..4e41de27 100644 --- a/src/strategy/dungeons/wotlk/forgeofsouls/FosMultipliers.cpp +++ b/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsMultipliers.cpp @@ -1,10 +1,10 @@ -#include "FosMultipliers.h" -#include "FosActions.h" +#include "ForgeOfSoulsMultipliers.h" +#include "ForgeOfSoulsActions.h" #include "GenericSpellActions.h" #include "ChooseTargetActions.h" #include "MovementActions.h" -#include "FosTriggers.h" -#include "FosActions.h" +#include "ForgeOfSoulsTriggers.h" +#include "ForgeOfSoulsActions.h" float BronjahmMultiplier::GetValue(Action* action) { @@ -35,9 +35,9 @@ float AttackFragmentMultiplier::GetValue(Action* action) GuidVector targets = AI_VALUE(GuidVector, "possible targets no los"); - for (auto i = targets.begin(); i != targets.end(); ++i) + for (auto& target : targets) { - Unit* unit = botAI->GetUnit(*i); + Unit* unit = botAI->GetUnit(target); if (unit && unit->GetEntry() == NPC_CORRUPTED_SOUL_FRAGMENT) { fragment = unit; diff --git a/src/strategy/dungeons/wotlk/forgeofsouls/FosMultipliers.h b/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsMultipliers.h similarity index 100% rename from src/strategy/dungeons/wotlk/forgeofsouls/FosMultipliers.h rename to src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsMultipliers.h diff --git a/src/strategy/dungeons/wotlk/forgeofsouls/FosStrategy.cpp b/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsStrategy.cpp similarity index 55% rename from src/strategy/dungeons/wotlk/forgeofsouls/FosStrategy.cpp rename to src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsStrategy.cpp index ba8d591a..1cc522f8 100644 --- a/src/strategy/dungeons/wotlk/forgeofsouls/FosStrategy.cpp +++ b/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsStrategy.cpp @@ -1,20 +1,17 @@ -#include "FosStrategy.h" -#include "FosMultipliers.h" +#include "ForgeOfSoulsStrategy.h" +#include "ForgeOfSoulsMultipliers.h" -void WotlkDungeonFosStrategy::InitTriggers(std::vector& triggers) { +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))); triggers.push_back(new TriggerNode( "switch to soul fragment", NextAction::array(0, new NextAction("attack corrupted soul fragment", ACTION_RAID + 1), nullptr))); triggers.push_back(new TriggerNode("bronjahm position", - NextAction::array(0, new NextAction("bronjahm tank position", ACTION_RAID + 1), - new NextAction("bronjahm tank target", ACTION_RAID), - new NextAction("bronjahm dps position", ACTION_RAID + 2), - nullptr))); + NextAction::array(0, new NextAction("bronjahm position", ACTION_RAID + 1), nullptr))); } -void WotlkDungeonFosStrategy::InitMultipliers(std::vector& multipliers) +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/forgeofsouls/FosStrategy.h b/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsStrategy.h similarity index 65% rename from src/strategy/dungeons/wotlk/forgeofsouls/FosStrategy.h rename to src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsStrategy.h index 5ecf3493..79d58334 100644 --- a/src/strategy/dungeons/wotlk/forgeofsouls/FosStrategy.h +++ b/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsStrategy.h @@ -3,11 +3,11 @@ #include "Multiplier.h" #include "Strategy.h" -class WotlkDungeonFosStrategy : public Strategy +class WotlkDungeonFoSStrategy : public Strategy { public: - WotlkDungeonFosStrategy(PlayerbotAI* ai) : Strategy(ai) {} - std::string const getName() override { return "fos"; } + WotlkDungeonFoSStrategy(PlayerbotAI* ai) : Strategy(ai) {} + std::string const getName() override { return "forge of souls"; } void InitTriggers(std::vector &triggers) override; void InitMultipliers(std::vector &multipliers) override; diff --git a/src/strategy/dungeons/wotlk/forgeofsouls/FosTriggerContext.h b/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsTriggerContext.h similarity index 96% rename from src/strategy/dungeons/wotlk/forgeofsouls/FosTriggerContext.h rename to src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsTriggerContext.h index a310db11..9cef6373 100644 --- a/src/strategy/dungeons/wotlk/forgeofsouls/FosTriggerContext.h +++ b/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsTriggerContext.h @@ -3,7 +3,7 @@ #include "NamedObjectContext.h" #include "AiObjectContext.h" -#include "FosTriggers.h" +#include "ForgeOfSoulsTriggers.h" class WotlkDungeonFosTriggerContext : public NamedObjectContext { diff --git a/src/strategy/dungeons/wotlk/forgeofsouls/FosTriggers.cpp b/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsTriggers.cpp similarity index 66% rename from src/strategy/dungeons/wotlk/forgeofsouls/FosTriggers.cpp rename to src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsTriggers.cpp index 33e2a3fd..a5e4c169 100644 --- a/src/strategy/dungeons/wotlk/forgeofsouls/FosTriggers.cpp +++ b/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsTriggers.cpp @@ -1,15 +1,14 @@ -#include "FosTriggers.h" +#include "ForgeOfSoulsTriggers.h" #include "Playerbots.h" #include "AiObject.h" #include "AiObjectContext.h" bool MoveFromBronjahmTrigger::IsActive() { - Unit* boss = nullptr; - boss = AI_VALUE2(Unit*, "find target", "bronjahm"); + Unit* boss = AI_VALUE2(Unit*, "find target", "bronjahm"); if (boss && boss->HasUnitState(UNIT_STATE_CASTING)) { - if (boss->FindCurrentSpellBySpellId(SPELL_CORRUPT_SOUL)) + if (boss->FindCurrentSpellBySpellId(SPELL_CORRUPT_SOUL) && bot->HasAura(SPELL_CORRUPT_SOUL)) return true; } return false; @@ -20,12 +19,13 @@ bool SwitchToSoulFragment::IsActive() Unit* fragment = nullptr; GuidVector targets = AI_VALUE(GuidVector, "possible targets no los"); - for (auto i = targets.begin(); i != targets.end(); ++i) + for (auto& target : targets) { - Unit* unit = botAI->GetUnit(*i); + Unit* unit = botAI->GetUnit(target); if (unit && unit->GetEntry() == NPC_CORRUPTED_SOUL_FRAGMENT) { - return true; + if (botAI->IsDps(bot)) + return true; } } diff --git a/src/strategy/dungeons/wotlk/forgeofsouls/FosTriggers.h b/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsTriggers.h similarity index 100% rename from src/strategy/dungeons/wotlk/forgeofsouls/FosTriggers.h rename to src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsTriggers.h diff --git a/src/strategy/dungeons/wotlk/forgeofsouls/FosActionContext.h b/src/strategy/dungeons/wotlk/forgeofsouls/FosActionContext.h deleted file mode 100644 index 8d8438c2..00000000 --- a/src/strategy/dungeons/wotlk/forgeofsouls/FosActionContext.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef _PLAYERBOT_WOTLKDUNGEONFOSACTIONCONTEXT_H -#define _PLAYERBOT_WOTLKDUNGEONFOSACTIONCONTEXT_H - -#include "Action.h" -#include "NamedObjectContext.h" -#include "FosActions.h" - -class WotlkDungeonFosActionContext : public NamedObjectContext -{ - public: - WotlkDungeonFosActionContext() { - creators["move from bronjahm"] = &WotlkDungeonFosActionContext::move_from_bronjahm; - creators["attack corrupted soul fragment"] = &WotlkDungeonFosActionContext::attack_corrupted_soul_fragment; - creators["bronjahm tank position"] = &WotlkDungeonFosActionContext::bronjahm_tank_position; - creators["bronjahm tank target"] = &WotlkDungeonFosActionContext::bronjahm_tank_target; - creators["bronjahm dps position"] = &WotlkDungeonFosActionContext::bronjahm_dps_position; - } - private: - static Action* move_from_bronjahm(PlayerbotAI* ai) { return new MoveFromBronjahmAction(ai); } - static Action* attack_corrupted_soul_fragment(PlayerbotAI* ai) { return new AttackCorruptedSoulFragmentAction(ai); } - static Action* bronjahm_tank_position(PlayerbotAI* ai) { return new BronjahmTankPositionAction(ai); } - static Action* bronjahm_tank_target(PlayerbotAI* ai) { return new BronjahmTankTargetAction(ai); } - static Action* bronjahm_dps_position(PlayerbotAI* ai) { return new BronjahmDpsPositionAction(ai); } -}; - -#endif