40Cakes / pokebot-gen3

PokéBot Gen3 is a shiny hunting bot, written in Python that runs libmgba + mGBA Python bindings under the hood. Pokémon Ruby, Sapphire, Emerald, FireRed and LeafGreen are supported.
https://www.youtube.com/@40_Cakes/streams
GNU General Public License v3.0
178 stars 54 forks source link

Fix player running one additional tile before re-applying Repel #330

Closed hanzi closed 4 months ago

hanzi commented 4 months ago

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