-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Level Grind : Fix leader leveling when it doesn't have any damaging moves #499
Level Grind : Fix leader leveling when it doesn't have any damaging moves #499
Conversation
modules/battle_strategies/_util.py
Outdated
strongest_move = move_strengths.index(max(move_strengths)) | ||
max_strength = max(move_strengths) | ||
if max_strength <= 0: | ||
raise BotModeError("No valid moves available! Check move setup or disable restrictions.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'valid moves' might be a bit of a confusing phrase to users who don't know what we're checking for.
Maybe say "{pokemon.species.name} does not know any damage-dealing moves, or they are forbidden to use by bot configuration" instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
modules/modes/_asserts.py
Outdated
@@ -176,3 +176,17 @@ def assert_player_has_poke_balls() -> None: | |||
else: | |||
if get_item_bag().number_of_balls_except_master_ball == 0: | |||
raise BotModeError("Out of Pokéballs! Better grab more before the next shiny slips away...") | |||
|
|||
|
|||
def assert_leader_can_fight(pokemon: Pokemon) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't that naming a bit inaccurate, if you have to pass the Pokémon-to-check yourself? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
b5df19d
to
df53b25
Compare
df53b25
to
d96aea0
Compare
Description
Fixes for Level Grind Mode
This PR addresses two issues with leader leveling in level grind mode:
Starting with Unusable Moves: The mode would previously start even if the leader’s only moves were banned or had zero power, which made leveling ineffective because it couldn't kill opponent.
Incorrect Move Selection in
get_strongest_move_against
: Previously, banned moves were excluded from the move pool usingcontinue
, causing issues where a banned move might be selected if no other valid moves were available. For instance, if the first move was "False Swipe" (banned) and the other three moves were non-damaging, the bot would incorrectly default to using the banned move. Now, if all moves are either banned or non-damaging, an error is raised, preventing unintended behavior.Here is a Pokémon example that was causing the issue
(btw yes you can level grind a lvl 100 Pokémon)
Changes
Added an assert of level grind when chosing leveling leader only
Raising an error on
get_strongest_move_against
when no damaging move are availableNotes
Checklist
--line-length 120
argument