From 4672b3edcfbfdc6a8299a62bff6c0f61e5366afd Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Wed, 4 Oct 2023 22:32:04 +0800 Subject: [PATCH] spell modification --- src/PlayerbotAI.cpp | 5 ++++- src/strategy/druid/BearTankDruidStrategy.cpp | 5 +++-- src/strategy/druid/DruidActions.h | 7 +++++++ src/strategy/druid/DruidAiObjectContext.cpp | 2 ++ src/strategy/druid/DruidTriggers.h | 4 ++-- src/strategy/druid/FeralDruidStrategy.cpp | 2 +- src/strategy/hunter/DpsHunterStrategy.cpp | 2 +- src/strategy/hunter/HunterTriggers.h | 4 ++-- src/strategy/paladin/DpsPaladinStrategy.cpp | 2 +- src/strategy/paladin/TankPaladinStrategy.cpp | 5 ++++- src/strategy/shaman/ShamanActions.h | 4 ++-- 11 files changed, 29 insertions(+), 13 deletions(-) diff --git a/src/PlayerbotAI.cpp b/src/PlayerbotAI.cpp index dd7c318a..347c4d52 100644 --- a/src/PlayerbotAI.cpp +++ b/src/PlayerbotAI.cpp @@ -212,6 +212,9 @@ void PlayerbotAI::UpdateAI(uint32 elapsed, bool minimal) // } return; } + if (!GetMaster() || !GetMaster()->IsInWorld() || !GetMaster()->GetSession() || GetMaster()->GetSession()->isLogingOut()) { + return; + } // if (bot->HasUnitMovementFlag(MOVEMENTFLAG_FALLING)) { // bot->Say("Falling!", LANG_UNIVERSAL); // } @@ -959,7 +962,7 @@ void PlayerbotAI::DoNextAction(bool min) SetNextCheckDelay(sPlayerbotAIConfig->globalCoolDown); return; } - + if (bot->HasUnitState(UNIT_STATE_IN_FLIGHT)) { SetNextCheckDelay(sPlayerbotAIConfig->passiveDelay); diff --git a/src/strategy/druid/BearTankDruidStrategy.cpp b/src/strategy/druid/BearTankDruidStrategy.cpp index ae70c263..ce06a066 100644 --- a/src/strategy/druid/BearTankDruidStrategy.cpp +++ b/src/strategy/druid/BearTankDruidStrategy.cpp @@ -144,6 +144,7 @@ NextAction** BearTankDruidStrategy::getDefaultActions() new NextAction("faerie fire (feral)", ACTION_NORMAL + 4), new NextAction("lacerate", ACTION_NORMAL + 3), new NextAction("maul", ACTION_NORMAL + 2), + new NextAction("enrage", ACTION_NORMAL + 1), new NextAction("melee", ACTION_NORMAL), nullptr); } @@ -151,12 +152,12 @@ NextAction** BearTankDruidStrategy::getDefaultActions() 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_MOVE + 8), 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("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))); + 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))); triggers.push_back(new TriggerNode("light aoe", NextAction::array(0, new NextAction("swipe (bear)", ACTION_HIGH + 5), nullptr))); triggers.push_back(new TriggerNode("bash", NextAction::array(0, new NextAction("bash", ACTION_INTERRUPT + 2), nullptr))); triggers.push_back(new TriggerNode("bash on enemy healer", NextAction::array(0, new NextAction("bash on enemy healer", ACTION_INTERRUPT + 1), nullptr))); diff --git a/src/strategy/druid/DruidActions.h b/src/strategy/druid/DruidActions.h index 1fea0640..d17d148e 100644 --- a/src/strategy/druid/DruidActions.h +++ b/src/strategy/druid/DruidActions.h @@ -279,4 +279,11 @@ class CastMoonfireOnAttackerAction : public CastDebuffSpellOnAttackerAction public: CastMoonfireOnAttackerAction(PlayerbotAI* ai) : CastDebuffSpellOnAttackerAction(ai, "moonfire") {} }; + +class CastEnrageAction : public CastBuffSpellAction +{ +public: + CastEnrageAction(PlayerbotAI* ai) : CastBuffSpellAction(ai, "enrage") {} +}; + #endif diff --git a/src/strategy/druid/DruidAiObjectContext.cpp b/src/strategy/druid/DruidAiObjectContext.cpp index a3e9d1d4..5cf79b74 100644 --- a/src/strategy/druid/DruidAiObjectContext.cpp +++ b/src/strategy/druid/DruidAiObjectContext.cpp @@ -214,6 +214,7 @@ class DruidAiObjectContextInternal : public NamedObjectContext creators["remove curse on party"] = &DruidAiObjectContextInternal::remove_curse_on_party; creators["insect swarm on attacker"] = &DruidAiObjectContextInternal::insect_swarm_on_attacker; creators["moonfire on attacker"] = &DruidAiObjectContextInternal::moonfire_on_attacker; + creators["enrage"] = &DruidAiObjectContextInternal::enrage; } private: @@ -292,6 +293,7 @@ class DruidAiObjectContextInternal : public NamedObjectContext static Action* remove_curse_on_party(PlayerbotAI *ai) { return new CastDruidRemoveCurseOnPartyAction(ai); } static Action* insect_swarm_on_attacker(PlayerbotAI* ai) { return new CastInsectSwarmOnAttackerAction(ai); } static Action* moonfire_on_attacker(PlayerbotAI* ai) { return new CastMoonfireOnAttackerAction(ai); } + static Action* enrage(PlayerbotAI* ai) { return new CastEnrageAction(ai); } }; DruidAiObjectContext::DruidAiObjectContext(PlayerbotAI* botAI) : AiObjectContext(botAI) diff --git a/src/strategy/druid/DruidTriggers.h b/src/strategy/druid/DruidTriggers.h index a08d60f8..bafa9b63 100644 --- a/src/strategy/druid/DruidTriggers.h +++ b/src/strategy/druid/DruidTriggers.h @@ -77,10 +77,10 @@ class MoonfireTrigger : public DebuffTrigger bool IsActive() override; }; -class FaerieFireTrigger : public DebuffOnBossTrigger +class FaerieFireTrigger : public DebuffTrigger { public: - FaerieFireTrigger(PlayerbotAI* botAI) : DebuffOnBossTrigger(botAI, "faerie fire") { } + FaerieFireTrigger(PlayerbotAI* botAI) : DebuffTrigger(botAI, "faerie fire", 1, false, 25.0f) { } }; class FaerieFireFeralTrigger : public DebuffTrigger diff --git a/src/strategy/druid/FeralDruidStrategy.cpp b/src/strategy/druid/FeralDruidStrategy.cpp index c79cb0cf..2b506152 100644 --- a/src/strategy/druid/FeralDruidStrategy.cpp +++ b/src/strategy/druid/FeralDruidStrategy.cpp @@ -96,7 +96,7 @@ void FeralDruidStrategy::InitTriggers(std::vector& triggers) { GenericDruidStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("not facing target", NextAction::array(0, new NextAction("set facing", ACTION_NORMAL + 7), nullptr))); + // triggers.push_back(new TriggerNode("not facing target", NextAction::array(0, new NextAction("set facing", ACTION_NORMAL + 7), nullptr))); triggers.push_back(new TriggerNode("enemy out of melee", NextAction::array(0, new NextAction("reach melee", ACTION_NORMAL + 8), nullptr))); triggers.push_back(new TriggerNode("enemy too close for melee", NextAction::array(0, new NextAction("move out of enemy contact", ACTION_NORMAL + 8), nullptr))); triggers.push_back(new TriggerNode("critical health", NextAction::array(0, new NextAction("survival instincts", ACTION_EMERGENCY + 1), nullptr))); diff --git a/src/strategy/hunter/DpsHunterStrategy.cpp b/src/strategy/hunter/DpsHunterStrategy.cpp index eb76908a..7ec2220a 100644 --- a/src/strategy/hunter/DpsHunterStrategy.cpp +++ b/src/strategy/hunter/DpsHunterStrategy.cpp @@ -50,7 +50,7 @@ void DpsHunterStrategy::InitTriggers(std::vector& triggers) triggers.push_back(new TriggerNode("low mana", NextAction::array(0, new NextAction("viper sting", 23.0f), nullptr))); triggers.push_back(new TriggerNode("hunter's mark", NextAction::array(0, new NextAction("hunter's mark", 11.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("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("has aggro", NextAction::array(0, new NextAction("concussive shot", 20.0f), nullptr)));*/ } diff --git a/src/strategy/hunter/HunterTriggers.h b/src/strategy/hunter/HunterTriggers.h index d1eace38..6096bca7 100644 --- a/src/strategy/hunter/HunterTriggers.h +++ b/src/strategy/hunter/HunterTriggers.h @@ -67,10 +67,10 @@ class BlackArrowTrigger : public DebuffTrigger BlackArrowTrigger(PlayerbotAI* botAI) : DebuffTrigger(botAI, "black arrow", 1, true) { } }; -class HuntersMarkTrigger : public DebuffOnBossTrigger +class HuntersMarkTrigger : public DebuffTrigger { public: - HuntersMarkTrigger(PlayerbotAI* botAI) : DebuffOnBossTrigger(botAI, "hunter's mark") { } + HuntersMarkTrigger(PlayerbotAI* botAI) : DebuffTrigger(botAI, "hunter's mark", 1, false, 25.0f) { } }; class FreezingTrapTrigger : public HasCcTargetTrigger diff --git a/src/strategy/paladin/DpsPaladinStrategy.cpp b/src/strategy/paladin/DpsPaladinStrategy.cpp index 118fc95e..0662660e 100644 --- a/src/strategy/paladin/DpsPaladinStrategy.cpp +++ b/src/strategy/paladin/DpsPaladinStrategy.cpp @@ -105,7 +105,7 @@ void DpsPaladinStrategy::InitTriggers(std::vector& 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("divine storm", ACTION_HIGH + 1), new NextAction("consecration", ACTION_HIGH + 1), nullptr))); + triggers.push_back(new TriggerNode("medium aoe", NextAction::array(0, new NextAction("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/TankPaladinStrategy.cpp b/src/strategy/paladin/TankPaladinStrategy.cpp index f1373617..3c03d7ac 100644 --- a/src/strategy/paladin/TankPaladinStrategy.cpp +++ b/src/strategy/paladin/TankPaladinStrategy.cpp @@ -82,7 +82,10 @@ void TankPaladinStrategy::InitTriggers(std::vector& triggers) 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))); - triggers.push_back(new TriggerNode("holy shield", NextAction::array(0, new NextAction("holy shield", ACTION_HIGH + 4), nullptr))); + // triggers.push_back(new TriggerNode("almost full health", NextAction::array(0, new NextAction("holy shield", ACTION_HIGH + 4), nullptr))); + triggers.push_back(new TriggerNode("medium health", NextAction::array(0, new NextAction("holy shield", ACTION_HIGH + 4), nullptr))); + triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("holy shield", ACTION_HIGH + 4), nullptr))); + triggers.push_back(new TriggerNode("critical health", NextAction::array(0, new NextAction("holy shield", ACTION_HIGH + 4), nullptr))); // triggers.push_back(new TriggerNode("blessing", NextAction::array(0, new NextAction("blessing of sanctuary", ACTION_HIGH + 9), nullptr))); triggers.push_back(new TriggerNode("target critical health", NextAction::array(0, new NextAction("hammer of wrath", ACTION_CRITICAL_HEAL), nullptr))); triggers.push_back(new TriggerNode( diff --git a/src/strategy/shaman/ShamanActions.h b/src/strategy/shaman/ShamanActions.h index 2002a5be..be21e676 100644 --- a/src/strategy/shaman/ShamanActions.h +++ b/src/strategy/shaman/ShamanActions.h @@ -295,10 +295,10 @@ class CastFlameShockAction : public CastDebuffSpellAction CastFlameShockAction(PlayerbotAI* botAI) : CastDebuffSpellAction(botAI, "flame shock", true) { } }; -class CastEarthShockAction : public CastDebuffSpellAction +class CastEarthShockAction : public CastSpellAction { public: - CastEarthShockAction(PlayerbotAI* botAI) : CastDebuffSpellAction(botAI, "earth shock", true) { } + CastEarthShockAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "earth shock") { } }; class CastFrostShockAction : public CastSnareSpellAction