From 8ff016a67ec628ceb86554b0785aab35807b8cce Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Fri, 5 Jul 2024 18:41:20 +0800 Subject: [PATCH] [Class spell] Seed of corruption --- src/strategy/warlock/DpsWarlockStrategy.cpp | 5 ++++- src/strategy/warlock/WarlockActions.h | 20 +++++++++++++++++++ .../warlock/WarlockAiObjectContext.cpp | 2 ++ src/strategy/warlock/WarlockTriggers.h | 14 ++++++++++++- 4 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src/strategy/warlock/DpsWarlockStrategy.cpp b/src/strategy/warlock/DpsWarlockStrategy.cpp index f5247c3f..3e79dfa8 100644 --- a/src/strategy/warlock/DpsWarlockStrategy.cpp +++ b/src/strategy/warlock/DpsWarlockStrategy.cpp @@ -87,7 +87,10 @@ void DpsWarlockStrategy::InitTriggers(std::vector& triggers) void DpsAoeWarlockStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("medium aoe", NextAction::array(0, new NextAction("rain of fire", 37.0f), nullptr))); + triggers.push_back(new TriggerNode("medium aoe", NextAction::array(0, + new NextAction("seed of corruption", 39.0f), + new NextAction("seed of corruption on attacker", 38.0f), + new NextAction("rain of fire", 37.0f), nullptr))); triggers.push_back(new TriggerNode("corruption on attacker", NextAction::array(0, new NextAction("corruption on attacker", 27.0f), nullptr))); triggers.push_back(new TriggerNode("unstable affliction on attacker", NextAction::array(0, new NextAction("unstable affliction on attacker", 26.0f), NULL))); triggers.push_back(new TriggerNode("curse of agony on attacker", NextAction::array(0, new NextAction("curse of agony on attacker", 25.0f), nullptr))); diff --git a/src/strategy/warlock/WarlockActions.h b/src/strategy/warlock/WarlockActions.h index 0ec8cfbb..813374a0 100644 --- a/src/strategy/warlock/WarlockActions.h +++ b/src/strategy/warlock/WarlockActions.h @@ -67,12 +67,20 @@ class CastCorruptionAction : public CastDebuffSpellAction { public: CastCorruptionAction(PlayerbotAI* botAI) : CastDebuffSpellAction(botAI, "corruption", true) { } + bool isUseful() override { + return CastDebuffSpellAction::isUseful() && !botAI->HasAura("seed of corruption", GetTarget(), false, true) ; + } + ActionThreatType getThreatType() override { return ActionThreatType::Aoe; } }; class CastCorruptionOnAttackerAction : public CastDebuffSpellOnAttackerAction { public: CastCorruptionOnAttackerAction(PlayerbotAI* botAI) : CastDebuffSpellOnAttackerAction(botAI, "corruption", true) { } + bool isUseful() override { + return CastDebuffSpellOnAttackerAction::isUseful() && !botAI->HasAura("seed of corruption", GetTarget(), false, true) ; + } + ActionThreatType getThreatType() override { return ActionThreatType::Aoe; } }; class CastCurseOfAgonyOnAttackerAction : public CastDebuffSpellOnAttackerAction @@ -142,6 +150,18 @@ class CastSeedOfCorruptionAction : public CastDebuffSpellAction { public: CastSeedOfCorruptionAction(PlayerbotAI* botAI) : CastDebuffSpellAction(botAI, "seed of corruption", true, 0) { } + bool isUseful() override { + return CastDebuffSpellAction::isUseful() && !botAI->HasAura("corruption", GetTarget(), false, true) ; + } +}; + +class CastSeedOfCorruptionOnAttackerAction : public CastDebuffSpellOnAttackerAction +{ + public: + CastSeedOfCorruptionOnAttackerAction(PlayerbotAI* botAI) : CastDebuffSpellOnAttackerAction(botAI, "seed of corruption", true, 0) { } + bool isUseful() override { + return CastDebuffSpellOnAttackerAction::isUseful() && !botAI->HasAura("corruption", GetTarget(), false, true) ; + } }; class CastRainOfFireAction : public CastSpellAction diff --git a/src/strategy/warlock/WarlockAiObjectContext.cpp b/src/strategy/warlock/WarlockAiObjectContext.cpp index 52e3a414..486c2cc2 100644 --- a/src/strategy/warlock/WarlockAiObjectContext.cpp +++ b/src/strategy/warlock/WarlockAiObjectContext.cpp @@ -158,6 +158,7 @@ class WarlockAiObjectContextInternal : public NamedObjectContext creators["banish"] = &WarlockAiObjectContextInternal::banish; creators["banish on cc"] = &WarlockAiObjectContextInternal::banish_on_cc; creators["seed of corruption"] = &WarlockAiObjectContextInternal::seed_of_corruption; + creators["seed of corruption on attacker"] = &WarlockAiObjectContextInternal::seed_of_corruption_on_attacker; creators["rain of fire"] = &WarlockAiObjectContextInternal::rain_of_fire; creators["shadowfury"] = &WarlockAiObjectContextInternal::shadowfury; creators["life tap"] = &WarlockAiObjectContextInternal::life_tap; @@ -209,6 +210,7 @@ class WarlockAiObjectContextInternal : public NamedObjectContext static Action* banish(PlayerbotAI* botAI) { return new CastBanishAction(botAI); } static Action* banish_on_cc(PlayerbotAI* botAI) { return new CastBanishAction(botAI); } static Action* seed_of_corruption(PlayerbotAI* botAI) { return new CastSeedOfCorruptionAction(botAI); } + static Action* seed_of_corruption_on_attacker(PlayerbotAI* botAI) { return new CastSeedOfCorruptionOnAttackerAction(botAI); } static Action* rain_of_fire(PlayerbotAI* botAI) { return new CastRainOfFireAction(botAI); } static Action* shadowfury(PlayerbotAI* botAI) { return new CastShadowfuryAction(botAI); } static Action* life_tap(PlayerbotAI* botAI) { return new CastLifeTapAction(botAI); } diff --git a/src/strategy/warlock/WarlockTriggers.h b/src/strategy/warlock/WarlockTriggers.h index 8578e43a..42c773f7 100644 --- a/src/strategy/warlock/WarlockTriggers.h +++ b/src/strategy/warlock/WarlockTriggers.h @@ -6,6 +6,7 @@ #define _PLAYERBOT_WARLOCKTRIGGERS_H #include "GenericTriggers.h" +#include "PlayerbotAI.h" class PlayerbotAI; @@ -32,13 +33,24 @@ class CurseOfAgonyTrigger : public DebuffTrigger CurseOfAgonyTrigger(PlayerbotAI* botAI) : DebuffTrigger(botAI, "curse of agony", 1, true, 20.0f) { } }; -DEBUFF_CHECKISOWNER_TRIGGER(CorruptionTrigger, "corruption"); +class CorruptionTrigger : public DebuffTrigger +{ + public: + CorruptionTrigger(PlayerbotAI* botAI) : DebuffTrigger(botAI, "corruption", 1, true) { } \ + bool IsActive() override { + return DebuffTrigger::IsActive() && !botAI->HasAura("seed of corruption", GetTarget(), false, true) ; + } +}; + DEBUFF_CHECKISOWNER_TRIGGER(SiphonLifeTrigger, "siphon life"); class CorruptionOnAttackerTrigger : public DebuffOnAttackerTrigger { public: CorruptionOnAttackerTrigger(PlayerbotAI* botAI) : DebuffOnAttackerTrigger(botAI, "corruption", true) { } + bool IsActive() override { + return DebuffOnAttackerTrigger::IsActive() && !botAI->HasAura("seed of corruption", GetTarget(), false, true) ; + } }; class CastCurseOfAgonyOnAttackerTrigger : public DebuffOnAttackerTrigger