From 9eb9fd3a7d7d8a2500042c4b66f89d9d6eca2c2c Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Wed, 10 Apr 2024 19:10:47 +0800 Subject: [PATCH] Unholy DK --- .../deathknight/DKAiObjectContext.cpp | 3 +++ src/strategy/deathknight/DKTriggers.cpp | 8 +++++++ src/strategy/deathknight/DKTriggers.h | 7 ++++++ src/strategy/deathknight/UnholyDKStrategy.cpp | 23 +++++++++++-------- 4 files changed, 31 insertions(+), 10 deletions(-) diff --git a/src/strategy/deathknight/DKAiObjectContext.cpp b/src/strategy/deathknight/DKAiObjectContext.cpp index 90e738ca..bc260c2d 100644 --- a/src/strategy/deathknight/DKAiObjectContext.cpp +++ b/src/strategy/deathknight/DKAiObjectContext.cpp @@ -88,6 +88,7 @@ class DeathKnightTriggerFactoryInternal : public NamedObjectContext creators["high blood rune"] = &DeathKnightTriggerFactoryInternal::high_blood_rune; creators["freezing fog"] = &DeathKnightTriggerFactoryInternal::freezing_fog; creators["no desolation"] = &DeathKnightTriggerFactoryInternal::no_desolation; + creators["death and decay cooldown"] = &DeathKnightTriggerFactoryInternal::death_and_decay_cooldown; } private: @@ -112,6 +113,8 @@ class DeathKnightTriggerFactoryInternal : public NamedObjectContext 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); } + static Trigger* death_and_decay_cooldown(PlayerbotAI* botAI) { return new DeathAndDecayCooldownTrigger(botAI); } + }; class DeathKnightAiObjectContextInternal : public NamedObjectContext diff --git a/src/strategy/deathknight/DKTriggers.cpp b/src/strategy/deathknight/DKTriggers.cpp index 84d6350a..8eee1045 100644 --- a/src/strategy/deathknight/DKTriggers.cpp +++ b/src/strategy/deathknight/DKTriggers.cpp @@ -37,4 +37,12 @@ bool HighBloodRuneTrigger::IsActive() { bool DesolationTrigger::IsActive() { return bot->HasAura(66817) && !botAI->HasAura("desolation", GetTarget(), false, true, -1, true); +} + +bool DeathAndDecayCooldownTrigger::IsActive() { + uint32 spellId = AI_VALUE2(uint32, "spell id", name); + if (!spellId) + return true; + + return bot->HasSpellCooldown(spellId); } \ No newline at end of file diff --git a/src/strategy/deathknight/DKTriggers.h b/src/strategy/deathknight/DKTriggers.h index 515f8358..8edc6bf4 100644 --- a/src/strategy/deathknight/DKTriggers.h +++ b/src/strategy/deathknight/DKTriggers.h @@ -146,4 +146,11 @@ class DesolationTrigger : public BuffTrigger bool IsActive() override; }; +class DeathAndDecayCooldownTrigger : public SpellCooldownTrigger +{ + public: + DeathAndDecayCooldownTrigger(PlayerbotAI* botAI) : SpellCooldownTrigger(botAI, "death and decay") { } + bool IsActive() override; +}; + #endif diff --git a/src/strategy/deathknight/UnholyDKStrategy.cpp b/src/strategy/deathknight/UnholyDKStrategy.cpp index 647df234..7fff5fba 100644 --- a/src/strategy/deathknight/UnholyDKStrategy.cpp +++ b/src/strategy/deathknight/UnholyDKStrategy.cpp @@ -72,16 +72,11 @@ UnholyDKStrategy::UnholyDKStrategy(PlayerbotAI* botAI) : GenericDKStrategy(botAI NextAction** UnholyDKStrategy::getDefaultActions() { return NextAction::array(0, - // new NextAction("scourge strike", ACTION_DEFAULT + 0.8f), - new NextAction("death and decay", ACTION_DEFAULT + 0.9f), - new NextAction("ghoul frenzy", ACTION_DEFAULT + 0.8f), - new NextAction("icy touch", ACTION_DEFAULT + 0.7f), - new NextAction("blood boil", ACTION_DEFAULT + 0.6f), - new NextAction("blood strike", ACTION_DEFAULT + 0.5f), - new NextAction("plague strike", ACTION_DEFAULT + 0.4f), - new NextAction("horn of winter", ACTION_DEFAULT + 0.3f), - new NextAction("summon gargoyle", ACTION_DEFAULT + 0.2f), - new NextAction("death coil", ACTION_DEFAULT + 0.1f), + new NextAction("death and decay", ACTION_DEFAULT + 1.0f), + new NextAction("scourge strike", ACTION_DEFAULT + 0.8f), + new NextAction("horn of winter", ACTION_DEFAULT + 0.6f), + new NextAction("summon gargoyle", ACTION_DEFAULT + 0.4f), + new NextAction("death coil", ACTION_DEFAULT + 0.2f), new NextAction("melee", ACTION_DEFAULT), nullptr); } @@ -93,6 +88,14 @@ void UnholyDKStrategy::InitTriggers(std::vector& 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_HIGH + 5), nullptr))); triggers.push_back(new TriggerNode("no desolation", NextAction::array(0, new NextAction("blood strike", ACTION_HIGH + 4), nullptr))); + triggers.push_back(new TriggerNode("death and decay cooldown", + NextAction::array(0, + new NextAction("ghoul frenzy", ACTION_DEFAULT + 5.0f), + new NextAction("scourge strike", ACTION_DEFAULT + 4.0f), + new NextAction("blood boil", ACTION_NORMAL + 3.0f), + new NextAction("icy touch", ACTION_NORMAL + 2.0f), + new NextAction("plague strike", ACTION_NORMAL + 1.0f), + nullptr))); } void UnholyDKAoeStrategy::InitTriggers(std::vector& triggers)