From 1c6949029036c6cbb4094dbb40b599794cdb1889 Mon Sep 17 00:00:00 2001 From: ThePenguinMan96 Date: Fri, 4 Jul 2025 11:33:46 -0700 Subject: [PATCH] Added range checks for running away if too close Added range checks for running away if too close - The warlocks were happily standing in cleave range and dieing. Now, they will backpedal if too close to an enemy. I also added custom logic to check if in demonology form before backpedaling. I also removed shadow cleave, as the dps increase with negligible (0.1%) and it was causing errors in the actions, resulting in the warlock standing idle in combat. --- src/strategy/warlock/AfflictionWarlockStrategy.cpp | 2 ++ src/strategy/warlock/DemonologyWarlockStrategy.cpp | 7 +++---- .../warlock/DestructionWarlockStrategy.cpp | 2 ++ src/strategy/warlock/WarlockAiObjectContext.cpp | 4 ++++ src/strategy/warlock/WarlockTriggers.h | 14 ++++++++++++++ 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/strategy/warlock/AfflictionWarlockStrategy.cpp b/src/strategy/warlock/AfflictionWarlockStrategy.cpp index eaeef3be..968bb445 100644 --- a/src/strategy/warlock/AfflictionWarlockStrategy.cpp +++ b/src/strategy/warlock/AfflictionWarlockStrategy.cpp @@ -84,6 +84,8 @@ void AfflictionWarlockStrategy::InitTriggers(std::vector& triggers // Life Tap glyph buff, and Life Tap as filler triggers.push_back(new TriggerNode("life tap glyph buff", NextAction::array(0, new NextAction("life tap", 29.0f), nullptr))); triggers.push_back(new TriggerNode("life tap", NextAction::array(0, new NextAction("life tap", 5.1f), nullptr))); + + triggers.push_back(new TriggerNode("enemy too close for spell", NextAction::array(0, new NextAction("flee", 39.0f), nullptr))); } // ===== AoE Strategy, 3+ enemies ===== diff --git a/src/strategy/warlock/DemonologyWarlockStrategy.cpp b/src/strategy/warlock/DemonologyWarlockStrategy.cpp index 2cfdfac7..1062d015 100644 --- a/src/strategy/warlock/DemonologyWarlockStrategy.cpp +++ b/src/strategy/warlock/DemonologyWarlockStrategy.cpp @@ -30,7 +30,6 @@ public: creators["seed of corruption"] = &seed_of_corruption; creators["rain of fire"] = &rain_of_fire; creators["demon charge"] = &demon_charge; - creators["shadow cleave"] = &shadow_cleave; } private: @@ -52,7 +51,6 @@ private: static ActionNode* seed_of_corruption(PlayerbotAI*) { return new ActionNode("seed of corruption", nullptr, nullptr, nullptr); } static ActionNode* rain_of_fire(PlayerbotAI*) { return new ActionNode("rain of fire", nullptr, nullptr, nullptr); } static ActionNode* demon_charge(PlayerbotAI*) { return new ActionNode("demon charge", nullptr, nullptr, nullptr); } - static ActionNode* shadow_cleave(PlayerbotAI*) { return new ActionNode("shadow cleave", nullptr, nullptr, nullptr); } }; // ===== Single Target Strategy ===== @@ -97,6 +95,8 @@ void DemonologyWarlockStrategy::InitTriggers(std::vector& triggers // Life Tap glyph buff, and Life Tap as filler triggers.push_back(new TriggerNode("life tap glyph buff", NextAction::array(0, new NextAction("life tap", 29.0f), nullptr))); triggers.push_back(new TriggerNode("life tap", NextAction::array(0, new NextAction("life tap", 5.1f), nullptr))); + + triggers.push_back(new TriggerNode("meta melee flee check", NextAction::array(0, new NextAction("flee", 39.0f), nullptr))); } // ===== AoE Strategy, 3+ enemies ===== @@ -122,6 +122,5 @@ void MetaMeleeAoeStrategy::InitTriggers(std::vector& triggers) { triggers.push_back(new TriggerNode("immolation aura active", NextAction::array(0, new NextAction("reach melee", 25.5f), - new NextAction("demon charge", 25.0f), - new NextAction("shadow cleave", 24.5f), nullptr))); + new NextAction("demon charge", 25.0f), nullptr))); } diff --git a/src/strategy/warlock/DestructionWarlockStrategy.cpp b/src/strategy/warlock/DestructionWarlockStrategy.cpp index 42498bde..2ecc6467 100644 --- a/src/strategy/warlock/DestructionWarlockStrategy.cpp +++ b/src/strategy/warlock/DestructionWarlockStrategy.cpp @@ -91,6 +91,8 @@ void DestructionWarlockStrategy::InitTriggers(std::vector& trigger // Life Tap glyph buff, and Life Tap as filler triggers.push_back(new TriggerNode("life tap glyph buff", NextAction::array(0, new NextAction("life tap", 29.0f), nullptr))); triggers.push_back(new TriggerNode("life tap", NextAction::array(0, new NextAction("life tap", 5.1f), nullptr))); + + triggers.push_back(new TriggerNode("enemy too close for spell", NextAction::array(0, new NextAction("flee", 39.0f), nullptr))); } // ===== AoE Strategy, 3+ enemies ===== diff --git a/src/strategy/warlock/WarlockAiObjectContext.cpp b/src/strategy/warlock/WarlockAiObjectContext.cpp index 1de0d00f..e8463fe8 100644 --- a/src/strategy/warlock/WarlockAiObjectContext.cpp +++ b/src/strategy/warlock/WarlockAiObjectContext.cpp @@ -122,6 +122,8 @@ public: creators["metamorphosis"] = &WarlockTriggerFactoryInternal::metamorphosis; creators["demonic empowerment"] = &WarlockTriggerFactoryInternal::demonic_empowerment; creators["immolation aura active"] = &WarlockTriggerFactoryInternal::immolation_aura_active; + creators["metamorphosis not active"] = &WarlockTriggerFactoryInternal::metamorphosis_not_active; + creators["meta melee flee check"] = &WarlockTriggerFactoryInternal::meta_melee_flee_check; } private: @@ -158,6 +160,8 @@ private: static Trigger* metamorphosis(PlayerbotAI* ai) { return new MetamorphosisTrigger(ai); } static Trigger* demonic_empowerment(PlayerbotAI* ai) { return new DemonicEmpowermentTrigger(ai); } static Trigger* immolation_aura_active(PlayerbotAI* ai) { return new ImmolationAuraActiveTrigger(ai); } + static Trigger* metamorphosis_not_active(PlayerbotAI* ai) { return new MetamorphosisNotActiveTrigger(ai); } + static Trigger* meta_melee_flee_check(PlayerbotAI* ai) { return new MetaMeleeEnemyTooCloseForSpellTrigger(ai); } }; class WarlockAiObjectContextInternal : public NamedObjectContext diff --git a/src/strategy/warlock/WarlockTriggers.h b/src/strategy/warlock/WarlockTriggers.h index da12c697..40f72e6a 100644 --- a/src/strategy/warlock/WarlockTriggers.h +++ b/src/strategy/warlock/WarlockTriggers.h @@ -271,4 +271,18 @@ class MoltenCoreTrigger : public HasAuraTrigger public: MoltenCoreTrigger(PlayerbotAI* ai) : HasAuraTrigger(ai, "molten core") {} }; + +class MetamorphosisNotActiveTrigger : public HasNoAuraTrigger +{ +public: + MetamorphosisNotActiveTrigger(PlayerbotAI* ai) : HasNoAuraTrigger(ai, "metamorphosis") {} +}; + +class MetaMeleeEnemyTooCloseForSpellTrigger : public TwoTriggers +{ +public: + MetaMeleeEnemyTooCloseForSpellTrigger(PlayerbotAI* ai) + : TwoTriggers(ai, "enemy too close for spell", "metamorphosis not active") {} +}; + #endif