Movement tweaks

This commit is contained in:
郑佩茹
2023-03-21 13:49:14 -06:00
parent 0c09ba2b2e
commit be5c2ef7d9
5 changed files with 11 additions and 8 deletions

View File

@@ -981,7 +981,7 @@ bool MovementAction::ChaseTo(WorldObject* obj, float distance, float angle)
UpdateMovementState(); UpdateMovementState();
if (bot->IsSitState()) if (!bot->IsStandState())
bot->SetStandState(UNIT_STAND_STATE_STAND); bot->SetStandState(UNIT_STAND_STATE_STAND);
if (bot->IsNonMeleeSpellCast(true)) if (bot->IsNonMeleeSpellCast(true))
@@ -1288,11 +1288,13 @@ bool SetBehindTargetAction::Execute(Event event)
float angle = GetFollowAngle() / 3 + target->GetOrientation() + M_PI; float angle = GetFollowAngle() / 3 + target->GetOrientation() + M_PI;
//return ChaseTo(target, 0.f, angle);
float distance = sPlayerbotAIConfig->contactDistance; float distance = sPlayerbotAIConfig->contactDistance;
float x = target->GetPositionX() + cos(angle) * distance; float x = target->GetPositionX() + cos(angle) * distance;
float y = target->GetPositionY() + sin(angle) * distance; float y = target->GetPositionY() + sin(angle) * distance;
float z = target->GetPositionZ(); float z = target->GetPositionZ();
//bot->UpdateGroundPositionZ(x, y, z); bot->UpdateGroundPositionZ(x, y, z);
return MoveTo(bot->GetMapId(), x, y, z); return MoveTo(bot->GetMapId(), x, y, z);
} }

View File

@@ -84,10 +84,10 @@ class MoveOutOfEnemyContactAction : public MovementAction
bool isUseful() override; bool isUseful() override;
}; };
class SetFacingTargetAction : public MovementAction class SetFacingTargetAction : public Action
{ {
public: public:
SetFacingTargetAction(PlayerbotAI* botAI) : MovementAction(botAI, "set facing") { } SetFacingTargetAction(PlayerbotAI* botAI) : Action(botAI, "set facing") { }
bool Execute(Event event) override; bool Execute(Event event) override;
bool isUseful() override; bool isUseful() override;

View File

@@ -7,8 +7,8 @@
void CombatStrategy::InitTriggers(std::vector<TriggerNode*> &triggers) void CombatStrategy::InitTriggers(std::vector<TriggerNode*> &triggers)
{ {
triggers.push_back(new TriggerNode("enemy out of spell", NextAction::array(0, new NextAction("reach spell", ACTION_NORMAL + 9), nullptr))); triggers.push_back(new TriggerNode("enemy out of spell", NextAction::array(0, new NextAction("reach spell", ACTION_MOVE + 11), nullptr)));
triggers.push_back(new TriggerNode("invalid target", NextAction::array(0, new NextAction("drop target", 55), nullptr))); triggers.push_back(new TriggerNode("invalid target", NextAction::array(0, new NextAction("drop target", 100), nullptr)));
triggers.push_back(new TriggerNode("mounted", NextAction::array(0, new NextAction("check mount state", 54), nullptr))); triggers.push_back(new TriggerNode("mounted", NextAction::array(0, new NextAction("check mount state", 54), nullptr)));
triggers.push_back(new TriggerNode("out of react range", NextAction::array(0, new NextAction("flee to master", 55), nullptr))); triggers.push_back(new TriggerNode("out of react range", NextAction::array(0, new NextAction("flee to master", 55), nullptr)));
triggers.push_back(new TriggerNode("combat stuck", NextAction::array(0, new NextAction("reset", 1.0f), nullptr))); triggers.push_back(new TriggerNode("combat stuck", NextAction::array(0, new NextAction("reset", 1.0f), nullptr)));

View File

@@ -18,5 +18,5 @@ void SetBehindCombatStrategy::InitTriggers(std::vector<TriggerNode*> &triggers)
{ {
CombatStrategy::InitTriggers(triggers); CombatStrategy::InitTriggers(triggers);
triggers.push_back(new TriggerNode("not behind target", NextAction::array(0, new NextAction("set behind", ACTION_NORMAL + 9), nullptr))); triggers.push_back(new TriggerNode("not behind target", NextAction::array(0, new NextAction("set behind", ACTION_MOVE + 7), nullptr)));
} }

View File

@@ -9,5 +9,6 @@ void RangedCombatStrategy::InitTriggers(std::vector<TriggerNode*> &triggers)
{ {
CombatStrategy::InitTriggers(triggers); CombatStrategy::InitTriggers(triggers);
triggers.push_back(new TriggerNode("enemy out of spell", NextAction::array(0, new NextAction("reach spell", ACTION_HIGH), nullptr))); triggers.push_back(new TriggerNode("enemy too close for spell", NextAction::array(0, new NextAction("flee", ACTION_HIGH), nullptr)));
triggers.push_back(new TriggerNode("not facing target", NextAction::array(0, new NextAction("set facing", ACTION_MOVE + 7), nullptr)));
} }