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
147 stars 47 forks source link

Make `handle_encounter()` function a bit safer to use #301

Closed hanzi closed 4 months ago

hanzi commented 4 months ago

Description

This adds a check to handle_encounter() whether the game is actually in a battle.

Before, using handle_encounter() without setting disable_auto_catch=True could lead to accidentally skipping a Shiny/CCF encounter in soft-resetting modes.

While all modes should currently set the parameter correctly, this change will make it less likely for a future mode to have the same issue again.

Apart from that, this fixes the save data class' get_player() method, which previously would return the active player data rather than the one from the saved game.

Checklist