From a9c3236e35ca47bd9c6a6068e4784625c632b2fd Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Mon, 8 Apr 2024 22:09:26 +0800 Subject: [PATCH] Unholy DK --- src/strategy/deathknight/DKActions.h | 4 +-- .../deathknight/DKAiObjectContext.cpp | 3 ++- src/strategy/deathknight/DKTriggers.cpp | 5 ++++ src/strategy/deathknight/DKTriggers.h | 7 +++++ src/strategy/deathknight/UnholyDKStrategy.cpp | 26 ++++++++++--------- 5 files changed, 30 insertions(+), 15 deletions(-) diff --git a/src/strategy/deathknight/DKActions.h b/src/strategy/deathknight/DKActions.h index 2c6d384b..e4907ac8 100644 --- a/src/strategy/deathknight/DKActions.h +++ b/src/strategy/deathknight/DKActions.h @@ -224,10 +224,10 @@ class CastDeathCoilAction : public CastSpellAction CastDeathCoilAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "death coil") { } }; -class CastBloodBoilAction : public CastBuffSpellAction +class CastBloodBoilAction : public CastSpellAction { public: - CastBloodBoilAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "blood boil") { } + CastBloodBoilAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "blood boil") { } }; class CastDeathAndDecayAction : public CastSpellAction diff --git a/src/strategy/deathknight/DKAiObjectContext.cpp b/src/strategy/deathknight/DKAiObjectContext.cpp index b01d8a6d..83682fa6 100644 --- a/src/strategy/deathknight/DKAiObjectContext.cpp +++ b/src/strategy/deathknight/DKAiObjectContext.cpp @@ -87,6 +87,7 @@ class DeathKnightTriggerFactoryInternal : public NamedObjectContext creators["unbreakable armor"] = &DeathKnightTriggerFactoryInternal::unbreakable_armor; creators["high blood rune"] = &DeathKnightTriggerFactoryInternal::high_blood_rune; creators["freezing fog"] = &DeathKnightTriggerFactoryInternal::freezing_fog; + creators["no desolation"] = &DeathKnightTriggerFactoryInternal::no_desolation; } private: @@ -110,7 +111,7 @@ class DeathKnightTriggerFactoryInternal : public NamedObjectContext static Trigger* unbreakable_armor(PlayerbotAI* botAI) { return new UnbreakableArmorTrigger(botAI); } static Trigger* high_blood_rune(PlayerbotAI* botAI) { return new HighBloodRuneTrigger(botAI); } static Trigger* freezing_fog(PlayerbotAI* botAI) { return new FreezingFogTrigger(botAI); } - + static Trigger* no_desolation(PlayerbotAI* botAI) { return new DesolationTrigger(botAI); } }; class DeathKnightAiObjectContextInternal : public NamedObjectContext diff --git a/src/strategy/deathknight/DKTriggers.cpp b/src/strategy/deathknight/DKTriggers.cpp index 07cf2364..12b05a3f 100644 --- a/src/strategy/deathknight/DKTriggers.cpp +++ b/src/strategy/deathknight/DKTriggers.cpp @@ -3,6 +3,7 @@ */ #include "DKTriggers.h" +#include "GenericTriggers.h" #include "Playerbots.h" #include "SharedDefines.h" #include @@ -32,4 +33,8 @@ bool PestilenceTrigger::IsActive() { bool HighBloodRuneTrigger::IsActive() { // bot->Say(std::to_string(bot->GetBaseRune(0)) + "_" + std::to_string(bot->GetRuneCooldown(0)) + " " + std::to_string(bot->GetBaseRune(1)) + "_" + std::to_string(bot->GetRuneCooldown(1)), LANG_UNIVERSAL); return !bot->GetRuneCooldown(0) && !bot->GetRuneCooldown(1); +} + +bool DesolationTrigger::IsActive() { + return bot->HasAura(66817) && HasAuraTrigger::IsActive(); } \ No newline at end of file diff --git a/src/strategy/deathknight/DKTriggers.h b/src/strategy/deathknight/DKTriggers.h index bcf138b7..f615053c 100644 --- a/src/strategy/deathknight/DKTriggers.h +++ b/src/strategy/deathknight/DKTriggers.h @@ -139,4 +139,11 @@ class FreezingFogTrigger : public HasAuraTrigger FreezingFogTrigger(PlayerbotAI* botAI) : HasAuraTrigger(botAI, "freezing fog") { } }; +class DesolationTrigger : public HasAuraTrigger +{ + public: + DesolationTrigger(PlayerbotAI* botAI) : HasAuraTrigger(botAI, "desolation") { } + bool IsActive() override; +}; + #endif diff --git a/src/strategy/deathknight/UnholyDKStrategy.cpp b/src/strategy/deathknight/UnholyDKStrategy.cpp index 638a9967..ad3d030a 100644 --- a/src/strategy/deathknight/UnholyDKStrategy.cpp +++ b/src/strategy/deathknight/UnholyDKStrategy.cpp @@ -34,7 +34,7 @@ class UnholyDKStrategyActionNodeFactory : public NamedObjectFactory static ActionNode* death_strike([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("death strike", - /*P*/ NextAction::array(0, new NextAction("blood presence"), nullptr), + /*P*/ NextAction::array(0, new NextAction("unholy presence"), nullptr), /*A*/ nullptr, /*C*/ nullptr); } @@ -42,7 +42,7 @@ class UnholyDKStrategyActionNodeFactory : public NamedObjectFactory static ActionNode* corpse_explosion([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("corpse explosion", - /*P*/ NextAction::array(0, new NextAction("blood presence"), nullptr), + /*P*/ NextAction::array(0, new NextAction("unholy presence"), nullptr), /*A*/ nullptr, /*C*/ nullptr); } @@ -50,14 +50,14 @@ class UnholyDKStrategyActionNodeFactory : public NamedObjectFactory static ActionNode* scourge_strike([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("scourge strike", - /*P*/ NextAction::array(0, new NextAction("blood presence"), nullptr), + /*P*/ NextAction::array(0, new NextAction("unholy presence"), nullptr), /*A*/ nullptr, /*C*/ nullptr); } static ActionNode* icy_touch([[maybe_unused]] PlayerbotAI* botAI) { return new ActionNode("icy touch", - /*P*/ NextAction::array(0, new NextAction("blood presence"), nullptr), + /*P*/ NextAction::array(0, new NextAction("unholy presence"), nullptr), /*A*/ nullptr, /*C*/ nullptr); } @@ -72,13 +72,14 @@ UnholyDKStrategy::UnholyDKStrategy(PlayerbotAI* botAI) : GenericDKStrategy(botAI NextAction** UnholyDKStrategy::getDefaultActions() { return NextAction::array(0, - new NextAction("scourge strike", ACTION_DEFAULT + 0.8f), - new NextAction("blood strike", ACTION_DEFAULT + 0.7f), - new NextAction("ghoul frenzy", ACTION_DEFAULT + 0.6f), - new NextAction("summon gargoyle", ACTION_DEFAULT + 0.5f), - new NextAction("death coil", ACTION_DEFAULT + 0.4f), - new NextAction("plague strike", ACTION_DEFAULT + 0.3f), - new NextAction("icy touch", ACTION_DEFAULT + 0.2f), + // new NextAction("scourge strike", ACTION_DEFAULT + 0.8f), + new NextAction("death and decay", ACTION_DEFAULT + 0.8), + new NextAction("ghoul frenzy", ACTION_DEFAULT + 0.7f), + new NextAction("blood boil", ACTION_DEFAULT + 0.6f), + new NextAction("icy touch", ACTION_DEFAULT + 0.5f), + new NextAction("plague strike", ACTION_DEFAULT + 0.4f), + new NextAction("summon gargoyle", ACTION_DEFAULT + 0.3f), + new NextAction("death coil", ACTION_DEFAULT + 0.2f), new NextAction("horn of winter", ACTION_DEFAULT + 0.1f), new NextAction("melee", ACTION_DEFAULT), nullptr); @@ -89,7 +90,8 @@ void UnholyDKStrategy::InitTriggers(std::vector& triggers) GenericDKStrategy::InitTriggers(triggers); // triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction(, ACTION_NORMAL + 2), nullptr))); - triggers.push_back(new TriggerNode("critical health", NextAction::array(0, new NextAction("death pact", ACTION_EMERGENCY + 1), nullptr))); + triggers.push_back(new TriggerNode("critical health", NextAction::array(0, new NextAction("death pact", ACTION_HIGH + 5), nullptr))); + triggers.push_back(new TriggerNode("no desolation", NextAction::array(0, new NextAction("blood strike", ACTION_HIGH + 4), nullptr))); } void UnholyDKAoeStrategy::InitTriggers(std::vector& triggers)