From 07da4ad9591030a39ef0634039644f889b048158 Mon Sep 17 00:00:00 2001 From: chris Date: Wed, 30 Oct 2024 17:03:46 +0800 Subject: [PATCH] date: 2024-10-30 fos bronjahm v1 --- .../wotlk/forgeofsouls/FosActionContext.h | 25 ++++++++++++++++ .../wotlk/forgeofsouls/FosActions.cpp | 30 +++++++++++++++++++ .../dungeons/wotlk/forgeofsouls/FosActions.h | 26 ++++++++++++++++ .../wotlk/forgeofsouls/FosMultipliers.cpp | 26 ++++++++++++++++ .../wotlk/forgeofsouls/FosMultipliers.h | 24 +++++++++++++++ .../wotlk/forgeofsouls/FosStrategy.cpp | 5 ++++ .../dungeons/wotlk/forgeofsouls/FosStrategy.h | 16 ++++++++++ .../wotlk/forgeofsouls/FosTriggerContext.h | 7 +++++ .../forgeofsouls/{TODO => FosTriggers.cpp} | 0 .../dungeons/wotlk/forgeofsouls/FosTriggers.h | 11 +++++++ 10 files changed, 170 insertions(+) create mode 100644 src/strategy/dungeons/wotlk/forgeofsouls/FosActionContext.h create mode 100644 src/strategy/dungeons/wotlk/forgeofsouls/FosActions.cpp create mode 100644 src/strategy/dungeons/wotlk/forgeofsouls/FosActions.h create mode 100644 src/strategy/dungeons/wotlk/forgeofsouls/FosMultipliers.cpp create mode 100644 src/strategy/dungeons/wotlk/forgeofsouls/FosMultipliers.h create mode 100644 src/strategy/dungeons/wotlk/forgeofsouls/FosStrategy.cpp create mode 100644 src/strategy/dungeons/wotlk/forgeofsouls/FosStrategy.h create mode 100644 src/strategy/dungeons/wotlk/forgeofsouls/FosTriggerContext.h rename src/strategy/dungeons/wotlk/forgeofsouls/{TODO => FosTriggers.cpp} (100%) create mode 100644 src/strategy/dungeons/wotlk/forgeofsouls/FosTriggers.h diff --git a/src/strategy/dungeons/wotlk/forgeofsouls/FosActionContext.h b/src/strategy/dungeons/wotlk/forgeofsouls/FosActionContext.h new file mode 100644 index 00000000..33e66aab --- /dev/null +++ b/src/strategy/dungeons/wotlk/forgeofsouls/FosActionContext.h @@ -0,0 +1,25 @@ +#ifndef _PLAYERBOT_WOTLKDUNGEONNEXACTIONCONTEXT_H +#define _PLAYERBOT_WOTLKDUNGEONNEXACTIONCONTEXT_H + +#include "Action.h" +#include "NamedObjectContext.h" +#include "FosActions.h" + +class WotlkDungeonFosActionContext : public NamedObjectContext +{ + public: + WotlkDungeonFosActionContext() { + creators["csf target"] = &WotlkDungeonFosActionContext::move_from_whirlwind; + creators["firebomb spread"] = &WotlkDungeonNexActionContext::firebomb_spread; + } + 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); } +}; + +#endif diff --git a/src/strategy/dungeons/wotlk/forgeofsouls/FosActions.cpp b/src/strategy/dungeons/wotlk/forgeofsouls/FosActions.cpp new file mode 100644 index 00000000..b68e22d6 --- /dev/null +++ b/src/strategy/dungeons/wotlk/forgeofsouls/FosActions.cpp @@ -0,0 +1,30 @@ +#include "Playerbots.h" +#include "FosActions.h" +#include "FosStrategy.h" + +bool MoveFromBronjahmAction::Execute(Event event) +{ + Unit* boss = nullptr; + boss = AI_VALUE2(Unit*, "find target", "bronjahm"); + if (!boss) + return false; + + float distance = bot->GetExactDist2d(boss->GetPosition()); + float targetDis = 30.0f; + if (distance >= targetDis) + return false; + return MoveAway(boss, targetDis - distance); +} + +bool AttackCorruptedSoulFragmentAction::Execute(Event event) +{ + Unit* fragment = nullptr; + fragment = AI_VALUE2(Unit*, "find target", "corrupted soul fragment"); + if (!fragment) + return false; + + if (AI_VALUE(Unit*, "current target") == fragment) + return false; + + return Attack(fragment); +} diff --git a/src/strategy/dungeons/wotlk/forgeofsouls/FosActions.h b/src/strategy/dungeons/wotlk/forgeofsouls/FosActions.h new file mode 100644 index 00000000..11e9fde6 --- /dev/null +++ b/src/strategy/dungeons/wotlk/forgeofsouls/FosActions.h @@ -0,0 +1,26 @@ +#ifndef _PLAYERBOT_WOTLKDUNGEONFOSACTIONS_H +#define _PLAYERBOT_WOTLKDUNGEONFOSACTIONS_H + +#include "Action.h" +#include "AttackAction.h" +#include "PlayerbotAI.h" +#include "Playerbots.h" +#include "FosTriggers.h" + +class MoveFromBronjahmAction : public MovementAction +{ +public: + MoveFromBronjahmAction(PlayerbotAI* ai) : MovementAction(ai, "move from bronjahm") {} + bool Execute(Event event) override; +}; + +class AttackCorruptedSoulFragmentAction : public AttackAction +{ +public: + AttackCorruptedSoulFragmentAction(PlayerbotAI* ai) : AttackAction(ai, "attack corrupted soul fragment") {} + bool Execute(Event event) override; + bool isUseful() override; +}; + + +#endif diff --git a/src/strategy/dungeons/wotlk/forgeofsouls/FosMultipliers.cpp b/src/strategy/dungeons/wotlk/forgeofsouls/FosMultipliers.cpp new file mode 100644 index 00000000..a078c69c --- /dev/null +++ b/src/strategy/dungeons/wotlk/forgeofsouls/FosMultipliers.cpp @@ -0,0 +1,26 @@ +#include "FosMultipliers.h" +#include "FosActions.h" +#include "GenericSpellActions.h" +#include "ChooseTargetActions.h" +#include "MovementActions.h" +#include "FosTriggers.h" + + +float BronjahmMultiplier::GetValue(Action* action) { + Unit* boss = nullptr; + boss = AI_VALUE2(Unit *, "find target", "bronjahm"); + if (boss && boss->HasUnitState(UNIT_STATE_CASTING) && boss->FindCurrentSpellBySpellId(SPELL_CORRUPT_SOUL)) + { + if (dynamic_cast(action) && !dynamic_cast(action)) + { + return 0.0f; + } + } + return 1.0f; } + +float AttackFragmentMultiplier::GetValue(Action* action) +{ + auto isTank = botAI->IsTank(); + if (isTank && dynamic_cast(action)) + return 0.0f; + return 1.0f; } diff --git a/src/strategy/dungeons/wotlk/forgeofsouls/FosMultipliers.h b/src/strategy/dungeons/wotlk/forgeofsouls/FosMultipliers.h new file mode 100644 index 00000000..99d7e47b --- /dev/null +++ b/src/strategy/dungeons/wotlk/forgeofsouls/FosMultipliers.h @@ -0,0 +1,24 @@ +#ifndef _PLAYERBOT_WOTLKDUNGEONFOSMULTIPLIERS_H +#define _PLAYERBOT_WOTLKDUNGEONFOSMULTIPLIERS_H + +#include "Multiplier.h" + +class BronjahmMultiplier : public Multiplier +{ + public: + BronjahmMultiplier(PlayerbotAI* ai) : Multiplier(ai, "bronjahm") {} + + public: + virtual float GetValue(Action* action); +}; + +class AttackFragmentMultiplier : public Multiplier +{ +public: + AttackFragmentMultiplier(PlayerbotAI* ai) : Multiplier(ai, "attack fragment") { } + + float GetValue(Action* action) override; +}; + + +#endif diff --git a/src/strategy/dungeons/wotlk/forgeofsouls/FosStrategy.cpp b/src/strategy/dungeons/wotlk/forgeofsouls/FosStrategy.cpp new file mode 100644 index 00000000..2617b228 --- /dev/null +++ b/src/strategy/dungeons/wotlk/forgeofsouls/FosStrategy.cpp @@ -0,0 +1,5 @@ +#include "FosStrategy.h" + +void WotlkDungeonFosStrategy::InitTriggers(std::vector& triggers) {} + +void WotlkDungeonFosStrategy::InitMultipliers(std::vector& multipliers) {} diff --git a/src/strategy/dungeons/wotlk/forgeofsouls/FosStrategy.h b/src/strategy/dungeons/wotlk/forgeofsouls/FosStrategy.h new file mode 100644 index 00000000..5ecf3493 --- /dev/null +++ b/src/strategy/dungeons/wotlk/forgeofsouls/FosStrategy.h @@ -0,0 +1,16 @@ +#ifndef _PLAYERBOT_WOTLKDUNGEONFOSSTRATEGY_H +#define _PLAYERBOT_WOTLKDUNGEONFOSSTRATEGY_H +#include "Multiplier.h" +#include "Strategy.h" + +class WotlkDungeonFosStrategy : public Strategy +{ +public: + WotlkDungeonFosStrategy(PlayerbotAI* ai) : Strategy(ai) {} + std::string const getName() override { return "fos"; } + void InitTriggers(std::vector &triggers) override; + void InitMultipliers(std::vector &multipliers) override; + +}; + +#endif // !_PLAYERBOT_WOTLKDUNGEONFOSSTRATEGY_H diff --git a/src/strategy/dungeons/wotlk/forgeofsouls/FosTriggerContext.h b/src/strategy/dungeons/wotlk/forgeofsouls/FosTriggerContext.h new file mode 100644 index 00000000..89ae9b61 --- /dev/null +++ b/src/strategy/dungeons/wotlk/forgeofsouls/FosTriggerContext.h @@ -0,0 +1,7 @@ +#ifndef _PLAYERBOT_WOTLKDUNGEONFOSTRIGGERCONTEXT_H +#define _PLAYERBOT_WOTLKDUNGEONFOSTRIGGERCONTEXT_H + +#include "NamedObjectContext.h" +#include "AiObjectContext.h" +#include "FosTriggers.h" +#endif // !_PLAYERBOT_WOTLKDUNGEONFOSTRIGGERCONTEXT_H diff --git a/src/strategy/dungeons/wotlk/forgeofsouls/TODO b/src/strategy/dungeons/wotlk/forgeofsouls/FosTriggers.cpp similarity index 100% rename from src/strategy/dungeons/wotlk/forgeofsouls/TODO rename to src/strategy/dungeons/wotlk/forgeofsouls/FosTriggers.cpp diff --git a/src/strategy/dungeons/wotlk/forgeofsouls/FosTriggers.h b/src/strategy/dungeons/wotlk/forgeofsouls/FosTriggers.h new file mode 100644 index 00000000..dc53d973 --- /dev/null +++ b/src/strategy/dungeons/wotlk/forgeofsouls/FosTriggers.h @@ -0,0 +1,11 @@ +#include "Trigger.h" +#include "PlayerbotAIConfig.h" +#include "GenericTriggers.h" +#include "DungeonStrategyUtils.h" + +enum FosIDs +{ + //Boss1 + + SPELL_CORRUPT_SOUL = 68839 +};