Skip to content

Commit

Permalink
-Internal: The free move range now properly returns interaction_dista…
Browse files Browse the repository at this point in the history
…nce for stay strategy.
  • Loading branch information
mostlikely4r committed Oct 7, 2024
1 parent d53691b commit a003946
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions playerbot/strategy/values/FreeMoveValues.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ GuidPosition FreeMoveCenterValue::Calculate()

float FreeMoveRangeValue::Calculate()
{
if (ai->HasStrategy("stay", BotState::BOT_STATE_NON_COMBAT))
return INTERACTION_DISTANCE;

Unit* followTarget = AI_VALUE(Unit*, "follow target");

if (!followTarget || followTarget == bot)
Expand All @@ -74,8 +77,7 @@ float FreeMoveRangeValue::Calculate()

bool hasFollow = ai->HasStrategy("follow", BotState::BOT_STATE_NON_COMBAT);
bool hasGuard = ai->HasStrategy("guard", BotState::BOT_STATE_NON_COMBAT);
bool hasStay = ai->HasStrategy("stay", BotState::BOT_STATE_NON_COMBAT);
bool hasFree = !hasFollow && !hasGuard && !hasStay;
bool hasFree = !hasFollow && !hasGuard;

//When far away from master stop trying to limit the bot.
if (!hasFollow && (ai->HasStrategy("travel once", BotState::BOT_STATE_NON_COMBAT) || (WorldPosition(followTarget).fDist(bot) > (hasFree ? sPlayerbotAIConfig.sightDistance : sPlayerbotAIConfig.maxFreeMoveDistance))))
Expand Down Expand Up @@ -104,7 +106,6 @@ float FreeMoveRangeValue::Calculate()
return maxDist;
}


bool CanFreeMoveToValue::Calculate()
{
if (!GetRange())
Expand Down
2 changes: 1 addition & 1 deletion playerbot/strategy/values/FreeMoveValues.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace ai
CanFreeMoveToValue(PlayerbotAI* ai, std::string name = "can free move to", int checkInterval = 2) : BoolCalculatedValue(ai, name, checkInterval), Qualified() {};
virtual bool Calculate() override;
protected:
virtual float GetRange() { return ai->HasStrategy("stay", BotState::BOT_STATE_NON_COMBAT) ? INTERACTION_DISTANCE : AI_VALUE(float, "free move range"); }
virtual float GetRange() { return AI_VALUE(float, "free move range"); }
};

class CanFreeTargetValue : public CanFreeMoveToValue
Expand Down

0 comments on commit a003946

Please sign in to comment.