Skip to content

Commit

Permalink
Fix hunter autoshot getting stuck after fleeing
Browse files Browse the repository at this point in the history
  • Loading branch information
davidonete committed Sep 8, 2023
1 parent e5c8079 commit 3addef9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
11 changes: 5 additions & 6 deletions playerbot/strategy/hunter/GenericHunterStrategy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,6 @@ void GenericHunterStrategy::InitCombatTriggers(std::list<TriggerNode*> &triggers
"often",
NextAction::array(0, new NextAction("immolation trap on target", ACTION_INTERRUPT + 1), NULL)));

// MOVE THIS TO PVP
// Traps must be on ACTION_INTERRUPT or higher due to its movements and chained actions
triggers.push_back(new TriggerNode(
"enemy is close",
NextAction::array(0, new NextAction("freezing trap in place", ACTION_INTERRUPT), NULL)));

triggers.push_back(new TriggerNode(
"high threat",
NextAction::array(0, new NextAction("feign death", ACTION_EMERGENCY + 1),
Expand Down Expand Up @@ -164,4 +158,9 @@ void HunterCcStrategy::InitCombatTriggers(std::list<TriggerNode*> &triggers)
triggers.push_back(new TriggerNode(
"frost trap",
NextAction::array(0, new NextAction("frost trap on target", ACTION_INTERRUPT + 2), NULL)));

// MOVE THIS TO PVP
triggers.push_back(new TriggerNode(
"enemy is close",
NextAction::array(0, new NextAction("freezing trap in place", ACTION_INTERRUPT), NULL)));
}
12 changes: 11 additions & 1 deletion playerbot/strategy/hunter/HunterActions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,14 @@ bool CastAutoShotAction::isUseful()
return false;

return ai->HasStrategy("ranged", BotState::BOT_STATE_COMBAT) && AI_VALUE(uint32, "active spell") != AI_VALUE2(uint32, "spell id", getName());
}
}

bool CastAutoShotAction::Execute(Event& event)
{
if (!bot->IsStopped())
{
ai->StopMoving();
}

return CastSpellAction::Execute(event);
}
3 changes: 2 additions & 1 deletion playerbot/strategy/hunter/HunterActions.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ namespace ai
{
public:
CastAutoShotAction(PlayerbotAI* ai) : CastSpellAction(ai, "auto shot") {}
virtual bool isUseful();
bool Execute(Event& event) override;
bool isUseful() override;
};

BEGIN_RANGED_SPELL_ACTION(CastTranquilizingShotAction, "tranquilizing shot")
Expand Down

0 comments on commit 3addef9

Please sign in to comment.