Skip to content

Bots prefer buff food#278

Open
bozimmerman wants to merge 1 commit intomangoszero:masterfrom
bozimmerman:bot_buff_food
Open

Bots prefer buff food#278
bozimmerman wants to merge 1 commit intomangoszero:masterfrom
bozimmerman:bot_buff_food

Conversation

@bozimmerman
Copy link
Contributor

@bozimmerman bozimmerman commented Mar 18, 2026

Allows bots to prefer buff food when available, and regular food when not.


This change is Reviewable

Copilot AI review requested due to automatic review settings March 18, 2026 00:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the playerbot item-selection logic so bots will prefer consuming “buff food” (Well Fed-style foods) when available, and fall back to regular food otherwise.

Changes:

  • Add a new "buff food" inventory query and visitor to find buff foods in bags.
  • Update EatAction to try buff food first (when not already buffed), then fall back to existing food behavior.
  • Add helper logic to detect buff-food items and whether the bot already has a relevant food buff.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/modules/Bots/playerbot/strategy/actions/NonCombatActions.h Tries buff food before normal food during eating.
src/modules/Bots/playerbot/strategy/actions/InventoryAction.cpp Adds parsing support for "buff food" inventory queries.
src/modules/Bots/playerbot/strategy/ItemVisitors.h Introduces buff-food detection helpers and a FindBuffFoodVisitor.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +291 to +292
SpellEntry const* sp = sSpellStore.LookupEntry(proto->Spells[0].SpellId);
return sp && ((sp->AttributesEx2 & SPELL_ATTR_EX2_FOOD_BUFF) || sp->Effect[1] != 0 || sp->Effect[2] != 0);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those effect indexes were what I found used in the actual game with actual buff food, and which does not match non-buff food. I think Copilot is off here, but shrug.

Comment on lines +330 to +336
if (bot->HasAura(sp->Id))
return true;
for (int i = 1; i < MAX_EFFECT_INDEX; ++i)
{
uint32 triggerSpell = sp->EffectTriggerSpell[i];
if (triggerSpell && bot->HasAura(triggerSpell))
return true;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as before.

Comment on lines +3 to +5
#include "DBCStore.h"
#include "DBCStores.h"

Comment on lines +59 to +62
bool result = false;
list<Item*> buffFoods = AI_VALUE2(list<Item*>, "inventory items", "buff food");
if (!buffFoods.empty() && !HasFoodBuff(bot, buffFoods))
result = UseItemAuto(*buffFoods.begin());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If Copilot is not hallucinating here, then this is a good change. It's true that I did not make any assumptions about what might be listed as a buff spell for buff food like Copilot is here. This means that I'm ONLY preventing a bot from re-applying the same buff food spell as it currently knows about from its own inventory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants