From 4c77f71bd4fea2d991a1d24a22c09fd74b85f312 Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Mon, 2 Sep 2024 00:30:10 +0800 Subject: [PATCH] Cat druid energy control --- src/strategy/druid/CatDpsDruidStrategy.cpp | 15 +++++++++++---- src/strategy/druid/DruidTriggers.h | 4 ++-- src/strategy/triggers/GenericTriggers.cpp | 2 ++ src/strategy/triggers/GenericTriggers.h | 11 +++++++++++ src/strategy/triggers/TriggerContext.h | 6 ++++++ 5 files changed, 32 insertions(+), 6 deletions(-) diff --git a/src/strategy/druid/CatDpsDruidStrategy.cpp b/src/strategy/druid/CatDpsDruidStrategy.cpp index 0ae00e28..e640cebd 100644 --- a/src/strategy/druid/CatDpsDruidStrategy.cpp +++ b/src/strategy/druid/CatDpsDruidStrategy.cpp @@ -122,8 +122,7 @@ CatDpsDruidStrategy::CatDpsDruidStrategy(PlayerbotAI* botAI) : FeralDruidStrateg NextAction** CatDpsDruidStrategy::getDefaultActions() { - return NextAction::array(0, new NextAction("shred", ACTION_DEFAULT + 0.4f), - new NextAction("tiger's fury", ACTION_DEFAULT + 0.1f), nullptr); + return NextAction::array(0, new NextAction("tiger's fury", ACTION_DEFAULT + 0.1f), nullptr); } void CatDpsDruidStrategy::InitTriggers(std::vector& triggers) @@ -131,9 +130,17 @@ void CatDpsDruidStrategy::InitTriggers(std::vector& triggers) FeralDruidStrategy::InitTriggers(triggers); // Default priority - triggers.push_back(new TriggerNode("high energy available", + triggers.push_back(new TriggerNode("almost full energy available", + NextAction::array(0, new NextAction("shred", ACTION_DEFAULT + 0.4f), nullptr))); + triggers.push_back(new TriggerNode("combo points not full", + NextAction::array(0, new NextAction("shred", ACTION_DEFAULT + 0.4f), nullptr))); + triggers.push_back(new TriggerNode("almost full energy available", NextAction::array(0, new NextAction("mangle (cat)", ACTION_DEFAULT + 0.3f), nullptr))); - triggers.push_back(new TriggerNode("high energy available", + triggers.push_back(new TriggerNode("combo points not full and high energy", + NextAction::array(0, new NextAction("mangle (cat)", ACTION_DEFAULT + 0.3f), nullptr))); + triggers.push_back(new TriggerNode("almost full energy available", + NextAction::array(0, new NextAction("claw", ACTION_DEFAULT + 0.2f), nullptr))); + triggers.push_back(new TriggerNode("combo points not full and high energy", NextAction::array(0, new NextAction("claw", ACTION_DEFAULT + 0.2f), nullptr))); triggers.push_back( new TriggerNode("faerie fire (feral)", diff --git a/src/strategy/druid/DruidTriggers.h b/src/strategy/druid/DruidTriggers.h index bb8725f0..50020835 100644 --- a/src/strategy/druid/DruidTriggers.h +++ b/src/strategy/druid/DruidTriggers.h @@ -250,12 +250,12 @@ public: return false; Aura* roar = botAI->GetAura("savage roar", bot); - bool roarCheck = !roar || roar->GetDuration() > 8000; + bool roarCheck = !roar || roar->GetDuration() > 10000; if (!roarCheck) return false; Aura* rip = botAI->GetAura("rip", target, true); - bool ripCheck = !rip || rip->GetDuration() > 8000; + bool ripCheck = !rip || rip->GetDuration() > 10000; if (!ripCheck) return false; diff --git a/src/strategy/triggers/GenericTriggers.cpp b/src/strategy/triggers/GenericTriggers.cpp index 32253186..014530bc 100644 --- a/src/strategy/triggers/GenericTriggers.cpp +++ b/src/strategy/triggers/GenericTriggers.cpp @@ -83,6 +83,8 @@ bool EnergyAvailable::IsActive() { return AI_VALUE2(uint8, "energy", "self targe bool ComboPointsAvailableTrigger::IsActive() { return AI_VALUE2(uint8, "combo", "current target") >= amount; } +bool ComboPointsNotFullTrigger::IsActive() { return AI_VALUE2(uint8, "combo", "current target") < amount; } + bool TargetWithComboPointsLowerHealTrigger::IsActive() { Unit* target = AI_VALUE(Unit*, "current target"); diff --git a/src/strategy/triggers/GenericTriggers.h b/src/strategy/triggers/GenericTriggers.h index 674b514d..132e6b66 100644 --- a/src/strategy/triggers/GenericTriggers.h +++ b/src/strategy/triggers/GenericTriggers.h @@ -126,6 +126,17 @@ private: float lifeTime; }; +class ComboPointsNotFullTrigger : public StatAvailable +{ +public: + ComboPointsNotFullTrigger(PlayerbotAI* botAI, int32 amount = 5, std::string const name = "combo points not full") + : StatAvailable(botAI, amount, name) + { + } + + bool IsActive() override; +}; + class LoseAggroTrigger : public Trigger { public: diff --git a/src/strategy/triggers/TriggerContext.h b/src/strategy/triggers/TriggerContext.h index acad38f0..e1c4ec7d 100644 --- a/src/strategy/triggers/TriggerContext.h +++ b/src/strategy/triggers/TriggerContext.h @@ -64,6 +64,7 @@ public: creators["light energy available"] = &TriggerContext::LightEnergyAvailable; creators["medium energy available"] = &TriggerContext::MediumEnergyAvailable; creators["high energy available"] = &TriggerContext::HighEnergyAvailable; + creators["almost full energy available"] = &TriggerContext::AlmostFullEnergyAvailable; creators["loot available"] = &TriggerContext::LootAvailable; creators["no attackers"] = &TriggerContext::NoAttackers; @@ -97,6 +98,8 @@ public: creators["combo points available"] = &TriggerContext::ComboPointsAvailable; creators["combo points 3 available"] = &TriggerContext::ComboPoints3Available; creators["target with combo points almost dead"] = &TriggerContext::target_with_combo_points_almost_dead; + creators["combo points not full"] = &TriggerContext::ComboPointsNotFull; + creators["combo points not full and high energy"] = &TriggerContext::ComboPointsNotFullAndHighEnergy; creators["medium threat"] = &TriggerContext::MediumThreat; @@ -280,6 +283,7 @@ private: static Trigger* LightEnergyAvailable(PlayerbotAI* botAI) { return new LightEnergyAvailableTrigger(botAI); } static Trigger* MediumEnergyAvailable(PlayerbotAI* botAI) { return new MediumEnergyAvailableTrigger(botAI); } static Trigger* HighEnergyAvailable(PlayerbotAI* botAI) { return new HighEnergyAvailableTrigger(botAI); } + static Trigger* AlmostFullEnergyAvailable(PlayerbotAI* botAI) { return new EnergyAvailable(botAI, 90); } static Trigger* LootAvailable(PlayerbotAI* botAI) { return new LootAvailableTrigger(botAI); } static Trigger* NoAttackers(PlayerbotAI* botAI) { return new NoAttackersTrigger(botAI); } static Trigger* TankAssist(PlayerbotAI* botAI) { return new TankAssistTrigger(botAI); } @@ -314,6 +318,8 @@ private: { return new TargetWithComboPointsLowerHealTrigger(ai, 3, 3.0f); } + static Trigger* ComboPointsNotFull(PlayerbotAI* botAI) { return new ComboPointsNotFullTrigger(botAI); } + static Trigger* ComboPointsNotFullAndHighEnergy(PlayerbotAI* botAI) { return new TwoTriggers(botAI, "combo points not full", "high energy available"); } static Trigger* MediumThreat(PlayerbotAI* botAI) { return new MediumThreatTrigger(botAI); } static Trigger* Dead(PlayerbotAI* botAI) { return new DeadTrigger(botAI); } static Trigger* corpse_near(PlayerbotAI* botAI) { return new CorpseNearTrigger(botAI); }