Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes bot aura/buff checks so they recognize buffs that exist in multiple spell ranks (different spell IDs) by falling back to aura name matching when an exact spell-id match isn’t found, preventing repeated re-buffing loops (e.g., two mage bots with different Arcane Intellect ranks).
Changes:
- Update
PlayerbotAI::HasAura(string, Unit*)to only early-return on a spell-id lookup when the exact spell-id aura is present. - Allow the function to continue to the name-based aura scan when the spell-id rank is not found.
💡 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.
| uint32 spellId = aiObjectContext->GetValue<uint32>("spell id", name)->Get(); | ||
| if (spellId) | ||
| if (spellId && HasAura(spellId, unit)) | ||
| { | ||
| return HasAura(spellId, unit); | ||
| return true; | ||
| } |
There was a problem hiding this comment.
I had no idea that was even a thing- dang. Yea, if that actually exists, it would be better.
There was a problem hiding this comment.
OK, after thinking about it -- I will have to stand by my original commit and just let the maintainers decide, but here's what I think:
First off, this was a bug fix to enable behavior that was already clearly intended, due to the entire rest of the method handling the name-search. So, this commit is a minimal fix and less risky than Copilot's suggestion.
Second, while Copilot's solution WOULD speed up my weird use-case, it would not matter in all other cases, including the most common case of all: an aura missing entirely. When the aura is missing entirely, it would STILL fall back to the name search in Copilot's code. So, on net: the speed benefit is likely to be very minor.
So, my humble suggestion: take this bug fix in that spirit, and consider Copilot's change as a minor optimization later.
This fixes a bug where the code wants to know if a spell has already been cast on someone, but doesn't consider that many buffs come in multiple ranks with different ids. The fix is to fall back to the spells string name, which will cover all the ranks.
In particular, this fixed an infinite buffing contest between two mage playerbots with different ranks of Intellect.
This change is