From 65a3bf481ce91be4e62225f8537ed73bf6f7618d Mon Sep 17 00:00:00 2001 From: kadeshar Date: Fri, 1 Aug 2025 15:31:44 +0200 Subject: [PATCH] - Added generic boss shadow aura trigger and action (#1480) - Added automatic aura for General Vezax and Yogg-Saron - Added support for all rank for boss aura triggers --- src/strategy/actions/BossAuraActions.cpp | 13 +++ src/strategy/actions/BossAuraActions.h | 14 +++ .../raids/ulduar/RaidUlduarStrategy.cpp | 15 ++++ src/strategy/triggers/BossAuraTriggers.cpp | 87 +++++++++++++++++-- src/strategy/triggers/BossAuraTriggers.h | 37 +++++++- 5 files changed, 154 insertions(+), 12 deletions(-) diff --git a/src/strategy/actions/BossAuraActions.cpp b/src/strategy/actions/BossAuraActions.cpp index ca77d634..9e42698e 100644 --- a/src/strategy/actions/BossAuraActions.cpp +++ b/src/strategy/actions/BossAuraActions.cpp @@ -50,3 +50,16 @@ bool BossNatureResistanceAction::Execute(Event event) botAI->ChangeStrategy(ADD_STRATEGY_CHAR + hunterNatureResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT); return true; } + +bool BossShadowResistanceAction::isUseful() +{ + BossShadowResistanceTrigger bossShadowResistanceTrigger(botAI, bossName); + return bossShadowResistanceTrigger.IsActive(); +} + +bool BossShadowResistanceAction::Execute(Event event) +{ + PaladinShadowResistanceStrategy paladinShadowResistanceStrategy(botAI); + botAI->ChangeStrategy(ADD_STRATEGY_CHAR + paladinShadowResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT); + return true; +} diff --git a/src/strategy/actions/BossAuraActions.h b/src/strategy/actions/BossAuraActions.h index b1bc0dd9..d40b3c76 100644 --- a/src/strategy/actions/BossAuraActions.h +++ b/src/strategy/actions/BossAuraActions.h @@ -54,4 +54,18 @@ private: std::string bossName; }; +class BossShadowResistanceAction : public Action +{ +public: + BossShadowResistanceAction(PlayerbotAI* botAI, std::string const bossName) + : Action(botAI, bossName + " shadow resistance action"), bossName(bossName) + { + } + bool Execute(Event event) override; + bool isUseful() override; + +private: + std::string bossName; +}; + #endif diff --git a/src/strategy/raids/ulduar/RaidUlduarStrategy.cpp b/src/strategy/raids/ulduar/RaidUlduarStrategy.cpp index b7f0ba41..1b08fa7a 100644 --- a/src/strategy/raids/ulduar/RaidUlduarStrategy.cpp +++ b/src/strategy/raids/ulduar/RaidUlduarStrategy.cpp @@ -240,6 +240,21 @@ void RaidUlduarStrategy::InitTriggers(std::vector& triggers) 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))); + + triggers.push_back(new TriggerNode( + "vezax shadow resistance trigger", + NextAction::array(0, new NextAction("vezax shadow resistance action", ACTION_RAID), nullptr))); + + // + // Yogg-Saron + // + triggers.push_back(new TriggerNode( + "sara shadow resistance trigger", + NextAction::array(0, new NextAction("sara shadow resistance action", ACTION_RAID), nullptr))); + + triggers.push_back(new TriggerNode( + "yogg-saron shadow resistance trigger", + NextAction::array(0, new NextAction("yogg-saron shadow resistance action", ACTION_RAID), nullptr))); } void RaidUlduarStrategy::InitMultipliers(std::vector& multipliers) diff --git a/src/strategy/triggers/BossAuraTriggers.cpp b/src/strategy/triggers/BossAuraTriggers.cpp index f9e705f8..a91976d7 100644 --- a/src/strategy/triggers/BossAuraTriggers.cpp +++ b/src/strategy/triggers/BossAuraTriggers.cpp @@ -23,7 +23,9 @@ bool BossFireResistanceTrigger::IsActive() return false; // Check if bot have fire resistance aura - if (bot->HasAura(SPELL_FIRE_RESISTANCE_AURA)) + if (bot->HasAura(SPELL_FIRE_RESISTANCE_AURA_RANK_5) || bot->HasAura(SPELL_FIRE_RESISTANCE_AURA_RANK_4) || + bot->HasAura(SPELL_FIRE_RESISTANCE_AURA_RANK_3) || bot->HasAura(SPELL_FIRE_RESISTANCE_AURA_RANK_2) || + bot->HasAura(SPELL_FIRE_RESISTANCE_AURA_RANK_1)) return false; // Check if bot dont have already have fire resistance strategy @@ -32,7 +34,11 @@ bool BossFireResistanceTrigger::IsActive() return false; // Check that the bot actually knows the spell - if (!bot->HasActiveSpell(SPELL_FIRE_RESISTANCE_AURA)) + if (!bot->HasActiveSpell(SPELL_FIRE_RESISTANCE_AURA_RANK_5) && + !bot->HasActiveSpell(SPELL_FIRE_RESISTANCE_AURA_RANK_4) && + !bot->HasActiveSpell(SPELL_FIRE_RESISTANCE_AURA_RANK_3) && + !bot->HasActiveSpell(SPELL_FIRE_RESISTANCE_AURA_RANK_2) && + !bot->HasActiveSpell(SPELL_FIRE_RESISTANCE_AURA_RANK_1)) return false; // Get the group and ensure it's a raid group @@ -47,7 +53,7 @@ bool BossFireResistanceTrigger::IsActive() if (!member || !member->IsAlive()) continue; - // Check if the member is a hunter + // Check if the member is a paladin if (member->getClass() == CLASS_PALADIN) { // Return true only if the current bot is the first alive paladin @@ -70,7 +76,9 @@ bool BossFrostResistanceTrigger::IsActive() return false; // Check if bot have frost resistance aura - if (bot->HasAura(SPELL_FROST_RESISTANCE_AURA)) + if (bot->HasAura(SPELL_FROST_RESISTANCE_AURA_RANK_5) || bot->HasAura(SPELL_FROST_RESISTANCE_AURA_RANK_4) || + bot->HasAura(SPELL_FROST_RESISTANCE_AURA_RANK_3) || bot->HasAura(SPELL_FROST_RESISTANCE_AURA_RANK_2) || + bot->HasAura(SPELL_FROST_RESISTANCE_AURA_RANK_1)) return false; // Check if bot dont have already have frost resistance strategy @@ -79,7 +87,11 @@ bool BossFrostResistanceTrigger::IsActive() return false; // Check that the bot actually knows the spell - if (!bot->HasActiveSpell(SPELL_FROST_RESISTANCE_AURA)) + if (!bot->HasActiveSpell(SPELL_FROST_RESISTANCE_AURA_RANK_5) && + !bot->HasActiveSpell(SPELL_FROST_RESISTANCE_AURA_RANK_4) && + !bot->HasActiveSpell(SPELL_FROST_RESISTANCE_AURA_RANK_3) && + !bot->HasActiveSpell(SPELL_FROST_RESISTANCE_AURA_RANK_2) && + !bot->HasActiveSpell(SPELL_FROST_RESISTANCE_AURA_RANK_1)) return false; // Get the group and ensure it's a raid group @@ -94,7 +106,7 @@ bool BossFrostResistanceTrigger::IsActive() if (!member || !member->IsAlive()) continue; - // Check if the member is a hunter + // Check if the member is a paladin if (member->getClass() == CLASS_PALADIN) { // Return true only if the current bot is the first alive paladin @@ -121,7 +133,8 @@ bool BossNatureResistanceTrigger::IsActive() return false; // Check if bot have nature resistance aura - if (bot->HasAura(SPELL_ASPECT_OF_THE_WILD)) + if (bot->HasAura(SPELL_ASPECT_OF_THE_WILD_RANK_4) || bot->HasAura(SPELL_ASPECT_OF_THE_WILD_RANK_3) || + bot->HasAura(SPELL_ASPECT_OF_THE_WILD_RANK_2) || bot->HasAura(SPELL_ASPECT_OF_THE_WILD_RANK_1)) return false; // Check if bot dont have already setted nature resistance aura @@ -130,7 +143,10 @@ bool BossNatureResistanceTrigger::IsActive() return false; // Check that the bot actually knows Aspect of the Wild - if (!bot->HasActiveSpell(SPELL_ASPECT_OF_THE_WILD)) + if (!bot->HasActiveSpell(SPELL_ASPECT_OF_THE_WILD_RANK_4) && + !bot->HasActiveSpell(SPELL_ASPECT_OF_THE_WILD_RANK_3) && + !bot->HasActiveSpell(SPELL_ASPECT_OF_THE_WILD_RANK_2) && + !bot->HasActiveSpell(SPELL_ASPECT_OF_THE_WILD_RANK_1)) return false; // Get the group and ensure it's a raid group @@ -155,3 +171,58 @@ bool BossNatureResistanceTrigger::IsActive() return false; } + +bool BossShadowResistanceTrigger::IsActive() +{ + // Check boss and it is alive + Unit* boss = AI_VALUE2(Unit*, "find target", bossName); + if (!boss || !boss->IsAlive()) + return false; + + // Check if bot is paladin + if (bot->getClass() != CLASS_PALADIN) + return false; + + // Check if bot have shadow resistance aura + if (bot->HasAura(SPELL_SHADOW_RESISTANCE_AURA_RANK_5) || + bot->HasAura(SPELL_SHADOW_RESISTANCE_AURA_RANK_4) || + bot->HasAura(SPELL_SHADOW_RESISTANCE_AURA_RANK_3) || + bot->HasAura(SPELL_SHADOW_RESISTANCE_AURA_RANK_2) || + bot->HasAura(SPELL_SHADOW_RESISTANCE_AURA_RANK_1)) + return false; + + // Check if bot dont have already have shadow resistance strategy + PaladinShadowResistanceStrategy paladinShadowResistanceStrategy(botAI); + if (botAI->HasStrategy(paladinShadowResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT)) + return false; + + // Check that the bot actually knows the spell + if (!bot->HasActiveSpell(SPELL_SHADOW_RESISTANCE_AURA_RANK_5) && + !bot->HasActiveSpell(SPELL_SHADOW_RESISTANCE_AURA_RANK_4) && + !bot->HasActiveSpell(SPELL_SHADOW_RESISTANCE_AURA_RANK_3) && + !bot->HasActiveSpell(SPELL_SHADOW_RESISTANCE_AURA_RANK_2) && + !bot->HasActiveSpell(SPELL_SHADOW_RESISTANCE_AURA_RANK_1)) + return false; + + // Get the group and ensure it's a raid group + Group* group = bot->GetGroup(); + if (!group || !group->isRaidGroup()) + return false; + + // Iterate through group members to find the first alive paladin + for (GroupReference* gref = group->GetFirstMember(); gref; gref = gref->next()) + { + Player* member = gref->GetSource(); + if (!member || !member->IsAlive()) + continue; + + // Check if the member is a paladin + if (member->getClass() == CLASS_PALADIN) + { + // Return true only if the current bot is the first alive paladin + return member == bot; + } + } + + return false; +} diff --git a/src/strategy/triggers/BossAuraTriggers.h b/src/strategy/triggers/BossAuraTriggers.h index e88b37a5..63e4002f 100644 --- a/src/strategy/triggers/BossAuraTriggers.h +++ b/src/strategy/triggers/BossAuraTriggers.h @@ -12,9 +12,25 @@ class PlayerbotAI; enum BossAuraIDs { - SPELL_FROST_RESISTANCE_AURA = 48945, - SPELL_FIRE_RESISTANCE_AURA = 48947, - SPELL_ASPECT_OF_THE_WILD = 49071, + SPELL_SHADOW_RESISTANCE_AURA_RANK_1 = 19876, + SPELL_FROST_RESISTANCE_AURA_RANK_1 = 19888, + SPELL_FIRE_RESISTANCE_AURA_RANK_1 = 19891, + SPELL_SHADOW_RESISTANCE_AURA_RANK_2 = 19895, + SPELL_SHADOW_RESISTANCE_AURA_RANK_3 = 19896, + SPELL_FROST_RESISTANCE_AURA_RANK_2 = 19897, + SPELL_FROST_RESISTANCE_AURA_RANK_3 = 19898, + SPELL_FIRE_RESISTANCE_AURA_RANK_2 = 19899, + SPELL_FIRE_RESISTANCE_AURA_RANK_3 = 19900, + SPELL_ASPECT_OF_THE_WILD_RANK_1 = 20043, + SPELL_ASPECT_OF_THE_WILD_RANK_2 = 20190, + SPELL_ASPECT_OF_THE_WILD_RANK_3 = 27045, + SPELL_SHADOW_RESISTANCE_AURA_RANK_4 = 27151, + SPELL_FROST_RESISTANCE_AURA_RANK_4 = 27152, + SPELL_FIRE_RESISTANCE_AURA_RANK_4 = 27153, + SPELL_SHADOW_RESISTANCE_AURA_RANK_5 = 48943, + SPELL_FROST_RESISTANCE_AURA_RANK_5 = 48945, + SPELL_FIRE_RESISTANCE_AURA_RANK_5 = 48947, + SPELL_ASPECT_OF_THE_WILD_RANK_4 = 49071 }; class BossFireResistanceTrigger : public Trigger @@ -47,7 +63,20 @@ class BossNatureResistanceTrigger : public Trigger { public: BossNatureResistanceTrigger(PlayerbotAI* ai, std::string const bossName) - : Trigger(ai, "kologarn nature resistance trigger"), bossName(bossName) + : Trigger(ai, " nature resistance trigger"), bossName(bossName) + { + } + bool IsActive() override; + +private: + std::string bossName; +}; + +class BossShadowResistanceTrigger : public Trigger +{ +public: + BossShadowResistanceTrigger(PlayerbotAI* ai, std::string const bossName) + : Trigger(ai, " shadow resistance trigger"), bossName(bossName) { } bool IsActive() override;