pokebot-gen3
pokebot-gen3 copied to clipboard
Fix player running one additional tile before re-applying Repel
Description
The repel listener had an issue where it would close the notification message about repel expiring, but then yield control back to the bot mode for one extra frame before attempting to re-apply another repel.
If that happened in or right next to tall grass, that would mean that the player moved inside the grass and might lead to an unexpected encounter.
The bot would then hang because it would keep spamming Start
to open the menu.
Changes
Rather than having to modify the context.controller_stack
list, the on_repel_effect_ended()
callback of a bot mode can just yield further actions, just like the run()
method does. This avoids the 1-frame gap, but also allows using that callback in a more intuitive way as it behaves like the rest of the bot.
Checklist
- [x] Black Linter has been ran, using
--line-length 120
argument - [x] Wiki has been updated (if relevant)