From 9dab10a5dfe97fbe99f46a95fb0b3227b6988193 Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Tue, 19 Dec 2023 20:10:43 +0800 Subject: [PATCH] Hunter melee --- src/strategy/hunter/GenericHunterStrategy.cpp | 18 ++++++++++++++++-- src/strategy/hunter/HunterActions.cpp | 10 +++++----- src/strategy/hunter/HunterActions.h | 14 +++++++++----- src/strategy/hunter/HunterAiObjectContext.cpp | 2 ++ 4 files changed, 32 insertions(+), 12 deletions(-) diff --git a/src/strategy/hunter/GenericHunterStrategy.cpp b/src/strategy/hunter/GenericHunterStrategy.cpp index 2d07c741..848d843c 100644 --- a/src/strategy/hunter/GenericHunterStrategy.cpp +++ b/src/strategy/hunter/GenericHunterStrategy.cpp @@ -15,6 +15,7 @@ class GenericHunterStrategyActionNodeFactory : public NamedObjectFactory& triggers) CombatStrategy::InitTriggers(triggers); // triggers.push_back(new TriggerNode("enemy too close for auto shot", NextAction::array(0, new NextAction("switch to melee", ACTION_HIGH), nullptr))); - triggers.push_back(new TriggerNode("enemy is close", NextAction::array(0, new NextAction("wing clip", ACTION_HIGH), nullptr))); + triggers.push_back(new TriggerNode("enemy is close", + NextAction::array(0, + new NextAction("wing clip", ACTION_HIGH + 1), + 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("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_HIGH + 3), NULL))); + triggers.push_back(new TriggerNode("enemy too close for shoot", NextAction::array(0, new NextAction("flee", ACTION_HIGH + 3), nullptr))); triggers.push_back(new TriggerNode("misdirection on main tank", NextAction::array(0, new NextAction("misdirection on main tank", ACTION_HIGH + 7), NULL))); triggers.push_back(new TriggerNode("tranquilizing shot", NextAction::array(0, new NextAction("tranquilizing shot", 61.0f), NULL))); diff --git a/src/strategy/hunter/HunterActions.cpp b/src/strategy/hunter/HunterActions.cpp index 10ef0a31..d322ef57 100644 --- a/src/strategy/hunter/HunterActions.cpp +++ b/src/strategy/hunter/HunterActions.cpp @@ -59,7 +59,7 @@ bool CastScareBeastCcAction::Execute(Event event) bool CastWingClipAction::isUseful() { - return CastMeleeSpellAction::isUseful() && !botAI->HasAura(spell, GetTarget()); + return CastSpellAction::isUseful() && !botAI->HasAura(spell, GetTarget()); } NextAction** CastWingClipAction::getPrerequisites() @@ -67,7 +67,7 @@ NextAction** CastWingClipAction::getPrerequisites() return nullptr; } -bool CastRaptorStrikeAction::isUseful() -{ - return CastMeleeSpellAction::isUseful() && botAI->HasStrategy("close", BOT_STATE_COMBAT); -} +// bool CastRaptorStrikeAction::isUseful() +// { +// return CastMeleeSpellAction::isUseful() && botAI->HasStrategy("close", BOT_STATE_COMBAT); +// } diff --git a/src/strategy/hunter/HunterActions.h b/src/strategy/hunter/HunterActions.h index 9c841710..3f06d0f1 100644 --- a/src/strategy/hunter/HunterActions.h +++ b/src/strategy/hunter/HunterActions.h @@ -179,21 +179,25 @@ class CastFreezingTrap : public CastDebuffSpellAction Value* GetTargetValue() override; }; -class CastWingClipAction : public CastMeleeSpellAction +class CastWingClipAction : public CastSpellAction { public: - CastWingClipAction(PlayerbotAI* botAI) : CastMeleeSpellAction(botAI, "wing clip") { } + CastWingClipAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "wing clip") { } bool isUseful() override; NextAction** getPrerequisites() override; }; -class CastRaptorStrikeAction : public CastMeleeSpellAction +class CastRaptorStrikeAction : public CastSpellAction { public: - CastRaptorStrikeAction(PlayerbotAI* botAI) : CastMeleeSpellAction(botAI, "raptor strike") { } + CastRaptorStrikeAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "raptor strike") { } +}; - bool isUseful() override; +class CastMongooseBiteAction : public CastSpellAction +{ + public: + CastMongooseBiteAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "mongoose bite") { } }; class CastSerpentStingOnAttackerAction : public CastDebuffSpellOnAttackerAction diff --git a/src/strategy/hunter/HunterAiObjectContext.cpp b/src/strategy/hunter/HunterAiObjectContext.cpp index 22357e30..8de9e6e3 100644 --- a/src/strategy/hunter/HunterAiObjectContext.cpp +++ b/src/strategy/hunter/HunterAiObjectContext.cpp @@ -151,6 +151,7 @@ class HunterAiObjectContextInternal : public NamedObjectContext creators["feign death"] = &HunterAiObjectContextInternal::feign_death; creators["wing clip"] = &HunterAiObjectContextInternal::wing_clip; creators["raptor strike"] = &HunterAiObjectContextInternal::raptor_strike; + creators["mongoose bite"] = &HunterAiObjectContextInternal::mongoose_bite; creators["feed pet"] = &HunterAiObjectContextInternal::feed_pet; creators["bestial wrath"] = &HunterAiObjectContextInternal::bestial_wrath; creators["scare beast"] = &HunterAiObjectContextInternal::scare_beast; @@ -199,6 +200,7 @@ class HunterAiObjectContextInternal : public NamedObjectContext static Action* aspect_of_the_cheetah(PlayerbotAI* botAI) { return new CastAspectOfTheCheetahAction(botAI); } static Action* wing_clip(PlayerbotAI* botAI) { return new CastWingClipAction(botAI); } static Action* raptor_strike(PlayerbotAI* botAI) { return new CastRaptorStrikeAction(botAI); } + static Action* mongoose_bite(PlayerbotAI* botAI) { return new CastMongooseBiteAction(botAI); } static Action* aspect_of_the_dragonhawk(PlayerbotAI* ai) { return new CastAspectOfTheDragonhawkAction(ai); } static Action* tranquilizing_shot(PlayerbotAI* ai) { return new CastTranquilizingShotAction(ai); } static Action* steady_shot(PlayerbotAI* ai) { return new CastSteadyShotAction(ai); }