Fix: Prevent bots from eating and drinking while mounted

This change modifies the `DrinkAction::Execute()` and `EatAction::Execute()` functions in `src/strategy/actions/NonCombatActions.cpp`.

Previously, playerbots could attempt to eat food or drink water while mounted, which is not possible in the game and creates unrealistic behavior.

This fix adds mount state checks to both actions:
1. `DrinkAction::Execute()` now checks `bot->IsMounted()` and returns false if mounted
2. `EatAction::Execute()` now checks `bot->IsMounted()` and returns false if mounted

This prevents bots from attempting to consume food or drinks while mounted, improving bot behavior realism and preventing unnecessary action attempts that would fail anyway.
This commit is contained in:
Gonzalo
2025-09-25 18:26:28 -03:00
committed by GitHub
parent fc69dd5ddd
commit f26c4e99f6

View File

@@ -13,6 +13,10 @@ bool DrinkAction::Execute(Event event)
if (bot->IsInCombat())
return false;
// Don't drink while mounted
if (bot->IsMounted())
return false;
bool hasMana = AI_VALUE2(bool, "has mana", "self target");
if (!hasMana)
return false;
@@ -66,6 +70,10 @@ bool EatAction::Execute(Event event)
if (bot->IsInCombat())
return false;
// Don't eat while mounted
if (bot->IsMounted())
return false;
if (botAI->HasCheat(BotCheatMask::food))
{
// if (bot->IsNonMeleeSpellCast(true))