Skip to content

Commit

Permalink
Fix rotating party lead after battle (#617)
Browse files Browse the repository at this point in the history
The default battle handler's `choose_new_lead_after_battle()` method tried to use an instance of `BattleStrategyUtil` that was never initialised.
  • Loading branch information
hanzi authored Jan 13, 2025
1 parent 7dc9be7 commit 905530a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/battle_strategies/default.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Optional

from modules.battle_state import BattleState, BattlePokemon
from modules.battle_state import BattleState, BattlePokemon, get_battle_state
from modules.context import context
from modules.modes._interface import BotModeError
from modules.pokemon import Pokemon, Move, LearnedMove
Expand Down Expand Up @@ -140,6 +140,7 @@ def choose_new_lead_after_faint(self, battle_state: BattleState) -> int:
def choose_new_lead_after_battle(self) -> int | None:
party = get_party()
if not self.pokemon_can_battle(party[self._first_non_fainted_party_index_before_battle]):
util = BattleStrategyUtil(get_battle_state())
return util.select_rotation_target()

return None
Expand Down

0 comments on commit 905530a

Please sign in to comment.