Level Grind: Go heal if lead Pokémon ran out of PP #659
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
In Level-balancing mode, once the lead Pokémon ran out of PP the bot would keep spinning for encounters but run away from them immediately.
That's because it was set up to only go heal once the entire party was unable to battle (since we're not just focussing on the lead) which wasn't the case, but it also wouldn't switch in other Pokémon.
On second thought, that didn't make all that much sense anyway. In Level-balancing mode, we want to get as much Exp. for the weakest Pokémon as possible, which is guaranteed to be the lead by the battle strategy's rotation logic.
So it makes sense to go and heal once the lead cannot fight anymore.
I've added an exception for the special case where the lead is not able to battle on its own anyway (Magikarp, Abra, ...) because in that case we want to switch in another Pokémon anyway.
This also fixes some bugs with
debug_create_pokemon()
that cause theEdit Party
menu to (a) not set the remaining PP correctly, and (b) crash if creating a Pokémon with less than 4 moves.Fixes #656
Checklist
--line-length 120
argument