From aab51a8182e7a3b1c0edd2035f72232033e7e1e8 Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Tue, 12 Mar 2024 18:39:23 +0800 Subject: [PATCH] Spell casting --- src/strategy/druid/BearTankDruidStrategy.cpp | 3 ++- src/strategy/druid/DruidActions.h | 7 +++++++ src/strategy/druid/DruidAiObjectContext.cpp | 2 ++ src/strategy/hunter/DpsHunterStrategy.cpp | 2 +- src/strategy/hunter/GenericHunterNonCombatStrategy.cpp | 2 +- src/strategy/hunter/GenericHunterStrategy.cpp | 2 +- src/strategy/hunter/HunterAiObjectContext.cpp | 2 ++ src/strategy/hunter/HunterTriggers.cpp | 7 +++++++ src/strategy/hunter/HunterTriggers.h | 3 +++ src/strategy/paladin/DpsPaladinStrategy.cpp | 5 +++-- .../paladin/GenericPaladinStrategyActionNodeFactory.h | 10 +++++++++- src/strategy/paladin/TankPaladinStrategy.cpp | 2 +- src/strategy/shaman/HealShamanStrategy.cpp | 4 ++-- src/strategy/shaman/ShamanNonCombatStrategy.cpp | 2 +- src/strategy/triggers/TriggerContext.h | 3 +++ .../warlock/GenericWarlockNonCombatStrategy.cpp | 7 +++++-- 16 files changed, 50 insertions(+), 13 deletions(-) diff --git a/src/strategy/druid/BearTankDruidStrategy.cpp b/src/strategy/druid/BearTankDruidStrategy.cpp index d3d49ce5f..2ddee32dc 100644 --- a/src/strategy/druid/BearTankDruidStrategy.cpp +++ b/src/strategy/druid/BearTankDruidStrategy.cpp @@ -153,8 +153,9 @@ void BearTankDruidStrategy::InitTriggers(std::vector &triggers) { FeralDruidStrategy::InitTriggers(triggers); triggers.push_back(new TriggerNode("enemy out of melee", NextAction::array(0, new NextAction("feral charge - bear", ACTION_NORMAL + 8), nullptr))); - triggers.push_back(new TriggerNode("thorns", NextAction::array(0, new NextAction("thorns", ACTION_HIGH + 9), nullptr))); + // triggers.push_back(new TriggerNode("thorns", NextAction::array(0, new NextAction("thorns", ACTION_HIGH + 9), nullptr))); triggers.push_back(new TriggerNode("bear form", NextAction::array(0, new NextAction("dire bear form", ACTION_HIGH + 8), nullptr))); + triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("frenzied regeneration", ACTION_HIGH + 7), nullptr))); triggers.push_back(new TriggerNode("faerie fire (feral)", NextAction::array(0, new NextAction("faerie fire (feral)", ACTION_HIGH + 7), nullptr))); triggers.push_back(new TriggerNode("lose aggro", NextAction::array(0, new NextAction("growl", ACTION_HIGH + 8), nullptr))); triggers.push_back(new TriggerNode("medium aoe", NextAction::array(0, new NextAction("demoralizing roar", ACTION_HIGH + 6), new NextAction("swipe (bear)", ACTION_HIGH + 6), nullptr))); diff --git a/src/strategy/druid/DruidActions.h b/src/strategy/druid/DruidActions.h index d17d148e7..92a11069f 100644 --- a/src/strategy/druid/DruidActions.h +++ b/src/strategy/druid/DruidActions.h @@ -96,6 +96,13 @@ class CastSurvivalInstinctsAction : public CastBuffSpellAction CastSurvivalInstinctsAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "survival instincts") { } }; +class CastFrenziedRegenerationAction : public CastBuffSpellAction +{ + public: + CastFrenziedRegenerationAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "frenzied regeneration") { } +}; + + class CastThornsAction : public CastBuffSpellAction { public: diff --git a/src/strategy/druid/DruidAiObjectContext.cpp b/src/strategy/druid/DruidAiObjectContext.cpp index 5cf79b743..593481b19 100644 --- a/src/strategy/druid/DruidAiObjectContext.cpp +++ b/src/strategy/druid/DruidAiObjectContext.cpp @@ -176,6 +176,7 @@ class DruidAiObjectContextInternal : public NamedObjectContext creators["rip"] = &DruidAiObjectContextInternal::rip; creators["cower"] = &DruidAiObjectContextInternal::cower; creators["survival instincts"] = &DruidAiObjectContextInternal::survival_instincts; + creators["frenzied regeneration"] = &DruidAiObjectContextInternal::frenzied_regeneration; creators["thorns"] = &DruidAiObjectContextInternal::thorns; creators["thorns on party"] = &DruidAiObjectContextInternal::thorns_on_party; creators["thorns on main tank"] = &DruidAiObjectContextInternal::thorns_on_main_tank; @@ -258,6 +259,7 @@ class DruidAiObjectContextInternal : public NamedObjectContext static Action* rip(PlayerbotAI* botAI) { return new CastRipAction(botAI); } static Action* cower(PlayerbotAI* botAI) { return new CastCowerAction(botAI); } static Action* survival_instincts(PlayerbotAI* botAI) { return new CastSurvivalInstinctsAction(botAI); } + static Action* frenzied_regeneration(PlayerbotAI* botAI) { return new CastFrenziedRegenerationAction(botAI); } static Action* thorns(PlayerbotAI* botAI) { return new CastThornsAction(botAI); } static Action* thorns_on_party(PlayerbotAI* botAI) { return new CastThornsOnPartyAction(botAI); } static Action* thorns_on_main_tank(PlayerbotAI* botAI) { return new CastThornsOnMainTankAction(botAI); } diff --git a/src/strategy/hunter/DpsHunterStrategy.cpp b/src/strategy/hunter/DpsHunterStrategy.cpp index 5e7c7aac5..881c5263c 100644 --- a/src/strategy/hunter/DpsHunterStrategy.cpp +++ b/src/strategy/hunter/DpsHunterStrategy.cpp @@ -51,7 +51,7 @@ void DpsHunterStrategy::InitTriggers(std::vector& triggers) triggers.push_back(new TriggerNode("hunter's mark", NextAction::array(0, new NextAction("hunter's mark", 31.0f), nullptr))); triggers.push_back(new TriggerNode("concussive shot on snare target", NextAction::array(0, new NextAction("concussive shot", 20.0f), nullptr))); // triggers.push_back(new TriggerNode("no pet", NextAction::array(0, new NextAction("call pet", 21.0f), NULL))); - triggers.push_back(new TriggerNode("hunters pet low health", NextAction::array(0, new NextAction("mend pet", 21.0f), NULL))); + // triggers.push_back(new TriggerNode("hunters pet low health", NextAction::array(0, new NextAction("mend pet", 21.0f), NULL))); triggers.push_back(new TriggerNode("has aggro", NextAction::array(0, new NextAction("concussive shot", 20.0f), nullptr))); } diff --git a/src/strategy/hunter/GenericHunterNonCombatStrategy.cpp b/src/strategy/hunter/GenericHunterNonCombatStrategy.cpp index 5e8eb6eff..4a42bcff2 100644 --- a/src/strategy/hunter/GenericHunterNonCombatStrategy.cpp +++ b/src/strategy/hunter/GenericHunterNonCombatStrategy.cpp @@ -54,6 +54,6 @@ void HunterPetStrategy::InitTriggers(std::vector& triggers) triggers.push_back(new TriggerNode("no pet", NextAction::array(0, new NextAction("call pet", 60.0f), nullptr))); triggers.push_back(new TriggerNode("has pet", NextAction::array(0, new NextAction("toggle pet spell", 60.0f), nullptr))); triggers.push_back(new TriggerNode("pet not happy", NextAction::array(0, new NextAction("feed pet", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("hunters pet low health", NextAction::array(0, new NextAction("mend pet", 60.0f), nullptr))); + triggers.push_back(new TriggerNode("hunters pet medium health", NextAction::array(0, new NextAction("mend pet", 60.0f), nullptr))); triggers.push_back(new TriggerNode("hunters pet dead", NextAction::array(0, new NextAction("revive pet", 60.0f), nullptr))); } diff --git a/src/strategy/hunter/GenericHunterStrategy.cpp b/src/strategy/hunter/GenericHunterStrategy.cpp index cb8afa7df..914ef2106 100644 --- a/src/strategy/hunter/GenericHunterStrategy.cpp +++ b/src/strategy/hunter/GenericHunterStrategy.cpp @@ -85,7 +85,7 @@ void GenericHunterStrategy::InitTriggers(std::vector& triggers) new NextAction("mongoose bite", ACTION_HIGH), nullptr))); triggers.push_back(new TriggerNode("medium threat", NextAction::array(0, new NextAction("feign death", 35.0f), nullptr))); - triggers.push_back(new TriggerNode("hunters pet low health", NextAction::array(0, new NextAction("mend pet", ACTION_HIGH + 2), nullptr))); + triggers.push_back(new TriggerNode("hunters pet medium health", NextAction::array(0, new NextAction("mend pet", ACTION_HIGH + 2), nullptr))); // triggers.push_back(new TriggerNode("no ammo", NextAction::array(0, new NextAction("switch to melee", ACTION_HIGH + 1), new NextAction("say::no ammo", ACTION_HIGH), nullptr))); triggers.push_back(new TriggerNode("aspect of the viper", NextAction::array(0, new NextAction("aspect of the viper", ACTION_HIGH), NULL))); triggers.push_back(new TriggerNode("enemy too close for shoot", NextAction::array(0, new NextAction("flee", ACTION_MOVE + 9), nullptr))); diff --git a/src/strategy/hunter/HunterAiObjectContext.cpp b/src/strategy/hunter/HunterAiObjectContext.cpp index 8de9e6e3e..94677212f 100644 --- a/src/strategy/hunter/HunterAiObjectContext.cpp +++ b/src/strategy/hunter/HunterAiObjectContext.cpp @@ -63,6 +63,7 @@ class HunterTriggerFactoryInternal : public NamedObjectContext creators["no stings"] = &HunterTriggerFactoryInternal::NoStings; creators["hunters pet dead"] = &HunterTriggerFactoryInternal::hunters_pet_dead; creators["hunters pet low health"] = &HunterTriggerFactoryInternal::hunters_pet_low_health; + creators["hunters pet medium health"] = &HunterTriggerFactoryInternal::hunters_pet_medium_health; creators["hunter's mark"] = &HunterTriggerFactoryInternal::hunters_mark; creators["freezing trap"] = &HunterTriggerFactoryInternal::freezing_trap; creators["aspect of the pack"] = &HunterTriggerFactoryInternal::aspect_of_the_pack; @@ -97,6 +98,7 @@ class HunterTriggerFactoryInternal : public NamedObjectContext static Trigger* NoStings(PlayerbotAI* botAI) { return new HunterNoStingsActiveTrigger(botAI); } static Trigger* hunters_pet_dead(PlayerbotAI* botAI) { return new HuntersPetDeadTrigger(botAI); } static Trigger* hunters_pet_low_health(PlayerbotAI* botAI) { return new HuntersPetLowHealthTrigger(botAI); } + static Trigger* hunters_pet_medium_health(PlayerbotAI* botAI) { return new HuntersPetMediumHealthTrigger(botAI); } static Trigger* hunters_mark(PlayerbotAI* botAI) { return new HuntersMarkTrigger(botAI); } static Trigger* freezing_trap(PlayerbotAI* botAI) { return new FreezingTrapTrigger(botAI); } static Trigger* aspect_of_the_pack(PlayerbotAI* botAI) { return new HunterAspectOfThePackTrigger(botAI); } diff --git a/src/strategy/hunter/HunterTriggers.cpp b/src/strategy/hunter/HunterTriggers.cpp index f56065b1c..a8dbaa702 100644 --- a/src/strategy/hunter/HunterTriggers.cpp +++ b/src/strategy/hunter/HunterTriggers.cpp @@ -5,6 +5,7 @@ #include "HunterTriggers.h" #include "GenericTriggers.h" #include "HunterActions.h" +#include "PlayerbotAIConfig.h" #include "Playerbots.h" #include "ServerFacade.h" #include "SharedDefines.h" @@ -39,6 +40,12 @@ bool HuntersPetLowHealthTrigger::IsActive() return pet && AI_VALUE2(uint8, "health", "pet target") < 40 && !AI_VALUE2(bool, "dead", "pet target") && !AI_VALUE2(bool, "mounted", "self target"); } +bool HuntersPetMediumHealthTrigger::IsActive() +{ + Unit* pet = AI_VALUE(Unit*, "pet target"); + return pet && AI_VALUE2(uint8, "health", "pet target") < sPlayerbotAIConfig->mediumHealth && !AI_VALUE2(bool, "dead", "pet target") && !AI_VALUE2(bool, "mounted", "self target"); +} + bool HunterPetNotHappy::IsActive() { return !AI_VALUE(bool, "pet happy") && !AI_VALUE2(bool, "mounted", "self target"); diff --git a/src/strategy/hunter/HunterTriggers.h b/src/strategy/hunter/HunterTriggers.h index 308b3f003..b64c4b650 100644 --- a/src/strategy/hunter/HunterTriggers.h +++ b/src/strategy/hunter/HunterTriggers.h @@ -67,6 +67,9 @@ END_TRIGGER() BEGIN_TRIGGER(HuntersPetLowHealthTrigger, Trigger) END_TRIGGER() +BEGIN_TRIGGER(HuntersPetMediumHealthTrigger, Trigger) +END_TRIGGER() + class BlackArrowTrigger : public DebuffTrigger { public: diff --git a/src/strategy/paladin/DpsPaladinStrategy.cpp b/src/strategy/paladin/DpsPaladinStrategy.cpp index dd609e50f..4b2d7b06c 100644 --- a/src/strategy/paladin/DpsPaladinStrategy.cpp +++ b/src/strategy/paladin/DpsPaladinStrategy.cpp @@ -64,6 +64,7 @@ class DpsPaladinStrategyActionNodeFactory : public NamedObjectFactory& triggers) // triggers.push_back(new TriggerNode("repentance on enemy healer", NextAction::array(0, new NextAction("repentance on enemy healer", ACTION_INTERRUPT + 2), nullptr))); // triggers.push_back(new TriggerNode("repentance on snare target", NextAction::array(0, new NextAction("repentance on snare target", ACTION_INTERRUPT + 2), nullptr))); // triggers.push_back(new TriggerNode("repentance", NextAction::array(0, new NextAction("repentance", ACTION_INTERRUPT + 2), nullptr))); - triggers.push_back(new TriggerNode("medium aoe", NextAction::array(0, new NextAction("consecration", ACTION_HIGH + 3), nullptr))); + triggers.push_back(new TriggerNode("medium aoe", NextAction::array(0, new NextAction("melee consecration", ACTION_HIGH + 3), nullptr))); triggers.push_back(new TriggerNode("art of war", NextAction::array(0, new NextAction("exorcism", ACTION_HIGH + 2), nullptr))); triggers.push_back(new TriggerNode("target critical health", NextAction::array(0, new NextAction("hammer of wrath", ACTION_HIGH), nullptr))); // triggers.push_back(new TriggerNode( diff --git a/src/strategy/paladin/GenericPaladinStrategyActionNodeFactory.h b/src/strategy/paladin/GenericPaladinStrategyActionNodeFactory.h index 91866b606..4ea2f20b9 100644 --- a/src/strategy/paladin/GenericPaladinStrategyActionNodeFactory.h +++ b/src/strategy/paladin/GenericPaladinStrategyActionNodeFactory.h @@ -43,6 +43,7 @@ class GenericPaladinStrategyActionNodeFactory : public NamedObjectFactory& triggers) triggers.push_back(new TriggerNode("light aoe", NextAction::array(0, new NextAction("avenger's shield", ACTION_HIGH + 5), nullptr))); triggers.push_back(new TriggerNode("medium aoe", NextAction::array(0, - new NextAction("consecration", ACTION_HIGH + 7), + new NextAction("melee consecration", ACTION_HIGH + 7), new NextAction("avenger's shield", ACTION_HIGH + 6), nullptr))); // triggers.push_back(new TriggerNode("avenger's shield", NextAction::array(0, new NextAction("avenger's shield", ACTION_HIGH + 7), nullptr))); triggers.push_back(new TriggerNode("lose aggro", NextAction::array(0, new NextAction("hand of reckoning", ACTION_HIGH + 7), nullptr))); diff --git a/src/strategy/shaman/HealShamanStrategy.cpp b/src/strategy/shaman/HealShamanStrategy.cpp index 665147388..6917cc890 100644 --- a/src/strategy/shaman/HealShamanStrategy.cpp +++ b/src/strategy/shaman/HealShamanStrategy.cpp @@ -49,11 +49,11 @@ void HealShamanStrategy::InitTriggers(std::vector& triggers) triggers.push_back(new TriggerNode( "party member critical health", - NextAction::array(0, new NextAction("riptide on party", 24.0f), new NextAction("lesser healing wave on party", 23.0f), NULL))); + NextAction::array(0, new NextAction("riptide on party", 24.0f), new NextAction("healing wave on party", 23.0f), NULL))); triggers.push_back(new TriggerNode( "party member low health", - NextAction::array(0, new NextAction("riptide on party", 18.0f), new NextAction("lesser healing wave on party", 17.0f), NULL))); + NextAction::array(0, new NextAction("riptide on party", 18.0f), new NextAction("healing wave on party", 17.0f), NULL))); triggers.push_back(new TriggerNode( "party member medium health", diff --git a/src/strategy/shaman/ShamanNonCombatStrategy.cpp b/src/strategy/shaman/ShamanNonCombatStrategy.cpp index 3f5c1ee13..449733477 100644 --- a/src/strategy/shaman/ShamanNonCombatStrategy.cpp +++ b/src/strategy/shaman/ShamanNonCombatStrategy.cpp @@ -28,7 +28,7 @@ void ShamanNonCombatStrategy::InitTriggers(std::vector& triggers) triggers.push_back(new TriggerNode( "party member almost full health", - NextAction::array(0, new NextAction("healing wave on party", 24.0f), NULL))); + NextAction::array(0, new NextAction("lesser healing wave on party", 24.0f), NULL))); triggers.push_back(new TriggerNode( "medium aoe heal", diff --git a/src/strategy/triggers/TriggerContext.h b/src/strategy/triggers/TriggerContext.h index 6f689e68f..1abed1600 100644 --- a/src/strategy/triggers/TriggerContext.h +++ b/src/strategy/triggers/TriggerContext.h @@ -124,6 +124,8 @@ class TriggerContext : public NamedObjectContext creators["critical aoe heal"] = &TriggerContext::critical_aoe_heal; creators["low aoe heal"] = &TriggerContext::low_aoe_heal; creators["medium aoe heal"] = &TriggerContext::medium_aoe_heal; + creators["almost full aoe heal"] = &TriggerContext::almost_full_aoe_heal; + creators["group heal occasion"] = &TriggerContext::group_heal_occasion; creators["medium group heal occasion"] = &TriggerContext::medium_group_heal_occasion; creators["invalid target"] = &TriggerContext::invalid_target; @@ -219,6 +221,7 @@ class TriggerContext : public NamedObjectContext static Trigger* critical_aoe_heal(PlayerbotAI* botAI) { return new AoeHealTrigger(botAI, "critical aoe heal", "critical", 2); } static Trigger* low_aoe_heal(PlayerbotAI* botAI) { return new AoeHealTrigger(botAI, "low aoe heal", "low", 2); } static Trigger* medium_aoe_heal(PlayerbotAI* botAI) { return new AoeHealTrigger(botAI, "medium aoe heal", "medium", 2); } + static Trigger* almost_full_aoe_heal(PlayerbotAI* botAI) { return new AoeHealTrigger(botAI, "almost full aoe heal", "almost full", 2); } static Trigger* group_heal_occasion(PlayerbotAI* ai) { return new AoeInGroupTrigger(ai, "group heal occasion", "almost full", 0.6); } static Trigger* medium_group_heal_occasion(PlayerbotAI* ai) { return new AoeInGroupTrigger(ai, "group heal occasion", "medium", 0.4); } static Trigger* target_changed(PlayerbotAI* botAI) { return new TargetChangedTrigger(botAI); } diff --git a/src/strategy/warlock/GenericWarlockNonCombatStrategy.cpp b/src/strategy/warlock/GenericWarlockNonCombatStrategy.cpp index 1f55c9aed..808f8e6e1 100644 --- a/src/strategy/warlock/GenericWarlockNonCombatStrategy.cpp +++ b/src/strategy/warlock/GenericWarlockNonCombatStrategy.cpp @@ -75,13 +75,16 @@ void GenericWarlockNonCombatStrategy::InitTriggers(std::vector& tr NonCombatStrategy::InitTriggers(triggers); triggers.push_back(new TriggerNode("demon armor", NextAction::array(0, new NextAction("fel armor", 21.0f), nullptr))); - triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("apply oil", 1.0f), nullptr))); + // triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("apply oil", 1.0f), nullptr))); triggers.push_back(new TriggerNode("has pet", NextAction::array(0, new NextAction("toggle pet spell", 60.0f), nullptr))); + triggers.push_back(new TriggerNode("no healthstone", NextAction::array(0, new NextAction("create healthstone", 15.0f), nullptr))); + triggers.push_back(new TriggerNode("no spellstone", NextAction::array(0, new NextAction("create spellstone", 13.0f), nullptr))); + triggers.push_back(new TriggerNode("spellstone", NextAction::array(0, new NextAction("spellstone", 13.0f), nullptr))); } void WarlockPetStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("no pet", NextAction::array(0, new NextAction("summon felguard", 60.0f), nullptr))); + // triggers.push_back(new TriggerNode("no pet", NextAction::array(0, new NextAction("summon felguard", 60.0f), nullptr))); // TODO Warlock pets }