From e087fb6533b607a757e836accab8671c8e8b06a9 Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Wed, 5 Jul 2023 15:12:23 +0800 Subject: [PATCH] feat(strategy): druid aoe strategy optimize --- src/strategy/druid/CasterDruidStrategy.cpp | 14 +++++++++++--- src/strategy/druid/DruidActions.h | 12 ++++++++++++ src/strategy/druid/DruidAiObjectContext.cpp | 4 ++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/strategy/druid/CasterDruidStrategy.cpp b/src/strategy/druid/CasterDruidStrategy.cpp index 09f0256f..e6e24b9c 100644 --- a/src/strategy/druid/CasterDruidStrategy.cpp +++ b/src/strategy/druid/CasterDruidStrategy.cpp @@ -106,8 +106,9 @@ NextAction** CasterDruidStrategy::getDefaultActions() { return NextAction::array(0, new NextAction("starfall", ACTION_NORMAL + 3), - new NextAction("starfire", ACTION_NORMAL + 2), - new NextAction("wrath", ACTION_NORMAL + 1), nullptr); + new NextAction("wrath", ACTION_NORMAL + 1), + new NextAction("starfire", ACTION_NORMAL), + nullptr); } void CasterDruidStrategy::InitTriggers(std::vector& triggers) @@ -129,7 +130,14 @@ void CasterDruidStrategy::InitTriggers(std::vector& triggers) void CasterDruidAoeStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("high aoe", NextAction::array(0, new NextAction("starfall", ACTION_HIGH + 1), nullptr))); + triggers.push_back(new TriggerNode("high aoe", NextAction::array(0, new NextAction("hurricane", ACTION_HIGH + 1), nullptr))); + triggers.push_back(new TriggerNode( + "light aoe", + NextAction::array(0, + new NextAction("starfall", ACTION_NORMAL + 4), + new NextAction("insect swarm on attacker", ACTION_NORMAL + 3), + new NextAction("moonfire on attacker", ACTION_NORMAL + 2), + NULL))); } void CasterDruidDebuffStrategy::InitTriggers(std::vector& triggers) diff --git a/src/strategy/druid/DruidActions.h b/src/strategy/druid/DruidActions.h index e5ae6a90..dd32081a 100644 --- a/src/strategy/druid/DruidActions.h +++ b/src/strategy/druid/DruidActions.h @@ -259,4 +259,16 @@ class CastDruidRemoveCurseOnPartyAction : public CurePartyMemberAction public: CastDruidRemoveCurseOnPartyAction(PlayerbotAI* ai) : CurePartyMemberAction(ai, "remove curse", DISPEL_CURSE) {} }; + +class CastInsectSwarmOnAttackerAction : public CastDebuffSpellOnAttackerAction +{ +public: + CastInsectSwarmOnAttackerAction(PlayerbotAI* ai) : CastDebuffSpellOnAttackerAction(ai, "insect swarm") {} +}; + +class CastMoonfireOnAttackerAction : public CastDebuffSpellOnAttackerAction +{ +public: + CastMoonfireOnAttackerAction(PlayerbotAI* ai) : CastDebuffSpellOnAttackerAction(ai, "moonfire") {} +}; #endif diff --git a/src/strategy/druid/DruidAiObjectContext.cpp b/src/strategy/druid/DruidAiObjectContext.cpp index 3377d394..a498be25 100644 --- a/src/strategy/druid/DruidAiObjectContext.cpp +++ b/src/strategy/druid/DruidAiObjectContext.cpp @@ -205,6 +205,8 @@ class DruidAiObjectContextInternal : public NamedObjectContext creators["swiftmend on party"] = &DruidAiObjectContextInternal::swiftmend_on_party; creators["nourish on party"] = &DruidAiObjectContextInternal::nourish_on_party; creators["remove curse on party"] = &DruidAiObjectContextInternal::remove_curse_on_party; + creators["insect swarm on attacker"] = &DruidAiObjectContextInternal::insect_swarm_on_attacker; + creators["moonfire on attacker"] = &DruidAiObjectContextInternal::moonfire_on_attacker; } private: @@ -280,6 +282,8 @@ class DruidAiObjectContextInternal : public NamedObjectContext static Action* swiftmend_on_party(PlayerbotAI *ai) { return new CastPartySwiftmendAction(ai); } static Action* nourish_on_party(PlayerbotAI *ai) { return new CastPartyNourishAction(ai); } static Action* remove_curse_on_party(PlayerbotAI *ai) { return new CastDruidRemoveCurseOnPartyAction(ai); } + static Action* insect_swarm_on_attacker(PlayerbotAI* ai) { return new CastInsectSwarmOnAttackerAction(ai); } + static Action* moonfire_on_attacker(PlayerbotAI* ai) { return new CastMoonfireOnAttackerAction(ai); } }; DruidAiObjectContext::DruidAiObjectContext(PlayerbotAI* botAI) : AiObjectContext(botAI)