diff --git a/src/strategy/AiObjectContext.cpp b/src/strategy/AiObjectContext.cpp index b2ede465..92ad0351 100644 --- a/src/strategy/AiObjectContext.cpp +++ b/src/strategy/AiObjectContext.cpp @@ -62,6 +62,7 @@ AiObjectContext::AiObjectContext(PlayerbotAI* botAI) : PlayerbotAIAware(botAI) actionContexts.Add(new WotlkDungeonOccActionContext()); actionContexts.Add(new WotlkDungeonUPActionContext()); actionContexts.Add(new WotlkDungeonCoSActionContext()); + actionContexts.Add(new WotlkDungeonFosActionContext()); triggerContexts.Add(new TriggerContext()); triggerContexts.Add(new ChatTriggerContext()); @@ -84,6 +85,7 @@ AiObjectContext::AiObjectContext(PlayerbotAI* botAI) : PlayerbotAIAware(botAI) triggerContexts.Add(new WotlkDungeonOccTriggerContext()); triggerContexts.Add(new WotlkDungeonUPTriggerContext()); triggerContexts.Add(new WotlkDungeonCoSTriggerContext()); + triggerContexts.Add(new WotlkDungeonFosTriggerContext()); valueContexts.Add(new ValueContext()); diff --git a/src/strategy/dungeons/DungeonStrategyContext.h b/src/strategy/dungeons/DungeonStrategyContext.h index 5b1914a2..296fc2ff 100644 --- a/src/strategy/dungeons/DungeonStrategyContext.h +++ b/src/strategy/dungeons/DungeonStrategyContext.h @@ -14,6 +14,7 @@ #include "wotlk/oculus/OculusStrategy.h" #include "wotlk/utgardepinnacle/UtgardePinnacleStrategy.h" #include "wotlk/cullingofstratholme/CullingOfStratholmeStrategy.h" +#include "wotlk/forgeofsouls/FosStrategy.h" /* Full list/TODO: @@ -76,11 +77,12 @@ 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); } // NYI from here down static Strategy* wotlk_toc(PlayerbotAI* botAI) { return new WotlkDungeonUKStrategy(botAI); } static Strategy* wotlk_hor(PlayerbotAI* botAI) { return new WotlkDungeonUKStrategy(botAI); } static Strategy* wotlk_pos(PlayerbotAI* botAI) { return new WotlkDungeonUKStrategy(botAI); } - static Strategy* wotlk_fos(PlayerbotAI* botAI) { return new WotlkDungeonUKStrategy(botAI); } + }; #endif diff --git a/src/strategy/dungeons/DungeonStrategyUtils.h b/src/strategy/dungeons/DungeonStrategyUtils.h index 2b738360..e5391f4b 100644 --- a/src/strategy/dungeons/DungeonStrategyUtils.h +++ b/src/strategy/dungeons/DungeonStrategyUtils.h @@ -1,6 +1,6 @@ #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 e6f2e00a..06ca0381 100644 --- a/src/strategy/dungeons/wotlk/WotlkDungeonActionContext.h +++ b/src/strategy/dungeons/wotlk/WotlkDungeonActionContext.h @@ -13,9 +13,9 @@ #include "oculus/OculusActionContext.h" #include "utgardepinnacle/UtgardePinnacleActionContext.h" #include "cullingofstratholme/CullingOfStratholmeActionContext.h" +#include "forgeofsouls/FosActionContext.h" // #include "trialofthechampion/TrialOfTheChampionActionContext.h" // #include "hallsofreflection/HallsOfReflectionActionContext.h" // #include "pitofsaron/PitOfSaronActionContext.h" -// #include "forgeofsouls/ForgeOfSoulsActionContext.h" #endif diff --git a/src/strategy/dungeons/wotlk/WotlkDungeonTriggerContext.h b/src/strategy/dungeons/wotlk/WotlkDungeonTriggerContext.h index 455239ab..d7e1e169 100644 --- a/src/strategy/dungeons/wotlk/WotlkDungeonTriggerContext.h +++ b/src/strategy/dungeons/wotlk/WotlkDungeonTriggerContext.h @@ -13,9 +13,9 @@ #include "oculus/OculusTriggerContext.h" #include "utgardepinnacle/UtgardePinnacleTriggerContext.h" #include "cullingofstratholme/CullingOfStratholmeTriggerContext.h" +#include "forgeofsouls/FosTriggerContext.h" // #include "trialofthechampion/TrialOfTheChampionTriggerContext.h" // #include "hallsofreflection/HallsOfReflectionTriggerContext.h" // #include "pitofsaron/PitOfSaronTriggerContext.h" -// #include "forgeofsouls/ForgeOfSoulsTriggerContext.h" #endif diff --git a/src/strategy/dungeons/wotlk/forgeofsouls/FosActionContext.h b/src/strategy/dungeons/wotlk/forgeofsouls/FosActionContext.h index 33e66aab..8d8438c2 100644 --- a/src/strategy/dungeons/wotlk/forgeofsouls/FosActionContext.h +++ b/src/strategy/dungeons/wotlk/forgeofsouls/FosActionContext.h @@ -1,5 +1,5 @@ -#ifndef _PLAYERBOT_WOTLKDUNGEONNEXACTIONCONTEXT_H -#define _PLAYERBOT_WOTLKDUNGEONNEXACTIONCONTEXT_H +#ifndef _PLAYERBOT_WOTLKDUNGEONFOSACTIONCONTEXT_H +#define _PLAYERBOT_WOTLKDUNGEONFOSACTIONCONTEXT_H #include "Action.h" #include "NamedObjectContext.h" @@ -9,17 +9,18 @@ class WotlkDungeonFosActionContext : public NamedObjectContext { public: WotlkDungeonFosActionContext() { - creators["csf target"] = &WotlkDungeonFosActionContext::move_from_whirlwind; - creators["firebomb spread"] = &WotlkDungeonNexActionContext::firebomb_spread; + 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_whirlwind(PlayerbotAI* ai) { return new MoveFromWhirlwindAction(ai); } - static Action* firebomb_spread(PlayerbotAI* ai) { return new FirebombSpreadAction(ai); } - static Action* telestra_split_target(PlayerbotAI* ai) { return new TelestraSplitTargetAction(ai); } - static Action* csf_target(PlayerbotAI* ai) { return new } - static Action* chaotic_rift_target(PlayerbotAI* ai) { return new ChaoticRiftTargetAction(ai); } - static Action* dodge_spikes(PlayerbotAI* ai) { return new DodgeSpikesAction(ai); } - static Action* intense_cold_jump(PlayerbotAI* ai) { return new IntenseColdJumpAction(ai); } + 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 diff --git a/src/strategy/dungeons/wotlk/forgeofsouls/FosActions.cpp b/src/strategy/dungeons/wotlk/forgeofsouls/FosActions.cpp index b68e22d6..42270190 100644 --- a/src/strategy/dungeons/wotlk/forgeofsouls/FosActions.cpp +++ b/src/strategy/dungeons/wotlk/forgeofsouls/FosActions.cpp @@ -9,22 +9,91 @@ bool MoveFromBronjahmAction::Execute(Event event) if (!boss) return false; + float distance = bot->GetExactDist2d(boss->GetPosition()); - float targetDis = 30.0f; + float targetDis = 20.0f; if (distance >= targetDis) return false; return MoveAway(boss, targetDis - distance); } +bool MoveFromBronjahmAction::isUseful() { return bot->HasAura(SPELL_CORRUPT_SOUL); } + bool AttackCorruptedSoulFragmentAction::Execute(Event event) { Unit* fragment = nullptr; - fragment = AI_VALUE2(Unit*, "find target", "corrupted soul fragment"); + + GuidVector targets = AI_VALUE(GuidVector, "possible targets no los"); + + for (auto i = targets.begin(); i != targets.end(); ++i) + { + Unit* unit = botAI->GetUnit(*i); + if (unit && unit->GetEntry() == NPC_CORRUPTED_SOUL_FRAGMENT) + { + fragment = unit; + break; + } + } + if (!fragment) return false; - if (AI_VALUE(Unit*, "current target") == fragment) + if (botAI->IsDps(bot)) + { + if (AI_VALUE(Unit*, "current target") == fragment) + return false; + + return Attack(fragment); + } + else + return false; + +} + +bool AttackCorruptedSoulFragmentAction::isUseful() { return botAI->IsDps(bot); } + +bool BronjahmTankPositionAction::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); +} + +bool BronjahmTankPositionAction::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) + return false; + + return Attack(boss); + } + else + return false; +} + +bool BronjahmDpsPositionAction::Execute(Event event) +{ + Unit* boss = AI_VALUE2(Unit*, "find target", "bronjahm"); + if (!boss) return false; - return Attack(fragment); + if (bot->getClass() == CLASS_HUNTER) + { + return Move(bot->GetAngle(boss), 8.0f); + } + else + { + return Move(bot->GetAngle(boss), 5.0f); + } +} + +bool BronjahmDpsPositionAction::isUseful() +{ + if (bot->GetExactDist2d(BRONJAHM_TANK_POSITION) <= 10.0f) + return false; + + return botAI->IsDps(bot) || botAI->IsHeal(bot); } diff --git a/src/strategy/dungeons/wotlk/forgeofsouls/FosActions.h b/src/strategy/dungeons/wotlk/forgeofsouls/FosActions.h index 11e9fde6..e3227019 100644 --- a/src/strategy/dungeons/wotlk/forgeofsouls/FosActions.h +++ b/src/strategy/dungeons/wotlk/forgeofsouls/FosActions.h @@ -7,11 +7,14 @@ #include "Playerbots.h" #include "FosTriggers.h" +const Position BRONJAHM_TANK_POSITION = Position(5297.9204f, 2506.698f, 686.06793f); + 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,5 +25,31 @@ public: bool isUseful() override; }; +class BronjahmTankPositionAction : public MovementAction +{ +public: + BronjahmTankPositionAction(PlayerbotAI* ai) : MovementAction(ai, "bronjahm tank position") {} + + bool Execute(Event event) override; + + bool isUseful() override; +}; + +class BronjahmDpsPositionAction : public MovementAction +{ +public: + BronjahmDpsPositionAction(PlayerbotAI* ai) : MovementAction(ai, "bronjahm dps position") {} + + bool Execute(Event event) override; + + bool isUseful() override; +}; + +class BronjahmTankTargetAction : public AttackAction +{ +public: + BronjahmTankTargetAction(PlayerbotAI* ai) : AttackAction(ai, "bronjahm tank target") {} + bool Execute(Event event) override; +}; #endif diff --git a/src/strategy/dungeons/wotlk/forgeofsouls/FosMultipliers.cpp b/src/strategy/dungeons/wotlk/forgeofsouls/FosMultipliers.cpp index a078c69c..0666bdba 100644 --- a/src/strategy/dungeons/wotlk/forgeofsouls/FosMultipliers.cpp +++ b/src/strategy/dungeons/wotlk/forgeofsouls/FosMultipliers.cpp @@ -4,11 +4,18 @@ #include "ChooseTargetActions.h" #include "MovementActions.h" #include "FosTriggers.h" +#include "FosActions.h" float BronjahmMultiplier::GetValue(Action* action) { Unit* boss = nullptr; - boss = AI_VALUE2(Unit *, "find target", "bronjahm"); + boss = AI_VALUE2(Unit *, "find target", "bronjahm"); + if (!boss) + return 1.0f; + if (botAI->IsTank(bot)) + if (dynamic_cast(action)) + return 0.0f; + if (boss && boss->HasUnitState(UNIT_STATE_CASTING) && boss->FindCurrentSpellBySpellId(SPELL_CORRUPT_SOUL)) { if (dynamic_cast(action) && !dynamic_cast(action)) @@ -16,11 +23,30 @@ float BronjahmMultiplier::GetValue(Action* action) { return 0.0f; } } - return 1.0f; } + return 1.0f; +} float AttackFragmentMultiplier::GetValue(Action* action) { - auto isTank = botAI->IsTank(); - if (isTank && dynamic_cast(action)) + if (botAI->IsHeal(bot) && dynamic_cast(action)) return 0.0f; - return 1.0f; } + + Unit* fragment = nullptr; + + GuidVector targets = AI_VALUE(GuidVector, "possible targets no los"); + + for (auto i = targets.begin(); i != targets.end(); ++i) + { + Unit* unit = botAI->GetUnit(*i); + if (unit && unit->GetEntry() == NPC_CORRUPTED_SOUL_FRAGMENT) + { + fragment = unit; + break; + } + } + + if (fragment && dynamic_cast(action)) + return 0.0f; + + return 1.0f; +} diff --git a/src/strategy/dungeons/wotlk/forgeofsouls/FosStrategy.cpp b/src/strategy/dungeons/wotlk/forgeofsouls/FosStrategy.cpp index 2617b228..ba8d591a 100644 --- a/src/strategy/dungeons/wotlk/forgeofsouls/FosStrategy.cpp +++ b/src/strategy/dungeons/wotlk/forgeofsouls/FosStrategy.cpp @@ -1,5 +1,21 @@ #include "FosStrategy.h" +#include "FosMultipliers.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))); +} -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/FosTriggerContext.h b/src/strategy/dungeons/wotlk/forgeofsouls/FosTriggerContext.h index 89ae9b61..a310db11 100644 --- a/src/strategy/dungeons/wotlk/forgeofsouls/FosTriggerContext.h +++ b/src/strategy/dungeons/wotlk/forgeofsouls/FosTriggerContext.h @@ -4,4 +4,21 @@ #include "NamedObjectContext.h" #include "AiObjectContext.h" #include "FosTriggers.h" + +class WotlkDungeonFosTriggerContext : public NamedObjectContext +{ +public: + WotlkDungeonFosTriggerContext() + { + creators["bronjahm position"] = &WotlkDungeonFosTriggerContext::bronjahm_position; + creators["move from bronjahm"] = &WotlkDungeonFosTriggerContext::move_from_bronjahm; + creators["switch to soul fragment"] = &WotlkDungeonFosTriggerContext::switch_to_soul_fragment; + } + +private: + static Trigger* move_from_bronjahm(PlayerbotAI* ai) { return new MoveFromBronjahmTrigger(ai); } + static Trigger* switch_to_soul_fragment(PlayerbotAI* ai) { return new SwitchToSoulFragment(ai); } + static Trigger* bronjahm_position(PlayerbotAI* ai) { return new BronjahmPositionTrigger(ai); } +}; + #endif // !_PLAYERBOT_WOTLKDUNGEONFOSTRIGGERCONTEXT_H diff --git a/src/strategy/dungeons/wotlk/forgeofsouls/FosTriggers.cpp b/src/strategy/dungeons/wotlk/forgeofsouls/FosTriggers.cpp index e69de29b..33e2a3fd 100644 --- a/src/strategy/dungeons/wotlk/forgeofsouls/FosTriggers.cpp +++ b/src/strategy/dungeons/wotlk/forgeofsouls/FosTriggers.cpp @@ -0,0 +1,44 @@ +#include "FosTriggers.h" +#include "Playerbots.h" +#include "AiObject.h" +#include "AiObjectContext.h" + +bool MoveFromBronjahmTrigger::IsActive() +{ + Unit* boss = nullptr; + boss = AI_VALUE2(Unit*, "find target", "bronjahm"); + if (boss && boss->HasUnitState(UNIT_STATE_CASTING)) + { + if (boss->FindCurrentSpellBySpellId(SPELL_CORRUPT_SOUL)) + return true; + } + return false; +} + +bool SwitchToSoulFragment::IsActive() +{ + Unit* fragment = nullptr; + GuidVector targets = AI_VALUE(GuidVector, "possible targets no los"); + + for (auto i = targets.begin(); i != targets.end(); ++i) + { + Unit* unit = botAI->GetUnit(*i); + if (unit && unit->GetEntry() == NPC_CORRUPTED_SOUL_FRAGMENT) + { + return true; + } + } + + return false; + +} + +bool BronjahmPositionTrigger::IsActive() +{ + + Unit* boss = AI_VALUE2(Unit*, "find target", "bronjahm"); + if (boss) + return true; + + return false; +} diff --git a/src/strategy/dungeons/wotlk/forgeofsouls/FosTriggers.h b/src/strategy/dungeons/wotlk/forgeofsouls/FosTriggers.h index dc53d973..d52c3f37 100644 --- a/src/strategy/dungeons/wotlk/forgeofsouls/FosTriggers.h +++ b/src/strategy/dungeons/wotlk/forgeofsouls/FosTriggers.h @@ -1,3 +1,6 @@ +#ifndef _PLAYERBOT_WOTLKDUNGEONFOSTRIGGERS_H +#define _PLAYERBOT_WOTLKDUNGEONFOSTRIGGERS_H + #include "Trigger.h" #include "PlayerbotAIConfig.h" #include "GenericTriggers.h" @@ -5,7 +8,33 @@ enum FosIDs { - //Boss1 + // Boss1 + NPC_CORRUPTED_SOUL_FRAGMENT = 36535, SPELL_CORRUPT_SOUL = 68839 }; + +class MoveFromBronjahmTrigger : public Trigger +{ +public: + MoveFromBronjahmTrigger(PlayerbotAI* ai) : Trigger(ai, "move from bronjahm") {} + + bool IsActive() override; +}; + +class SwitchToSoulFragment : public Trigger +{ +public: + SwitchToSoulFragment(PlayerbotAI* ai) : Trigger(ai, "switch to soul fragment") {} + + bool IsActive() override; +}; + +class BronjahmPositionTrigger : public Trigger +{ +public: + BronjahmPositionTrigger(PlayerbotAI* ai) : Trigger(ai, "bronjahm position") {} + bool IsActive() override; +}; + +#endif