diff options
author | Bryan Bishop <kanzure@gmail.com> | 2013-11-14 20:16:35 -0600 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2013-11-14 20:16:35 -0600 |
commit | 1b9212a7e47a8eca382249bd7bb116c69fc789d3 (patch) | |
tree | 27e2b93ec1cfbe9c5f112c9c4eefa6d0ea0849b2 /pokemontools/vba/battle.py | |
parent | b2785948d16acd06197db5fcffea45d54778bdba (diff) |
never learn a new move
Diffstat (limited to 'pokemontools/vba/battle.py')
-rw-r--r-- | pokemontools/vba/battle.py | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/pokemontools/vba/battle.py b/pokemontools/vba/battle.py index f8457c9..39d7047 100644 --- a/pokemontools/vba/battle.py +++ b/pokemontools/vba/battle.py @@ -38,7 +38,7 @@ class Battle(EmulatorController): """ Detects if the battle is waiting for player input. """ - return self.is_player_turn() or self.is_mandatory_switch() or self.is_switch_prompt() or self.is_levelup_screen() + return self.is_player_turn() or self.is_mandatory_switch() or self.is_switch_prompt() or self.is_levelup_screen() or self.is_make_room_for_move_prompt() def is_fight_pack_run_menu(self): """ @@ -340,6 +340,9 @@ class Battle(EmulatorController): # but also, jump out if it's the stats screen result = result or self.is_levelup_screen() + # jump out if it's the "make room for a new move" screen + result = result or self.is_make_room_for_move_prompt() + # stay in text_wait if it's the evolution screen result = result and not self.is_evolution_screen() @@ -361,6 +364,9 @@ class Battle(EmulatorController): # xyz wants to battle, a wild foobar appeared self.skip_start_text() + # skip a few hundred frames + self.emulator.vba.step(count=100) + wild = (self.emulator.vba.read_memory_at(0xd22d) == 1) while self.is_in_battle(): @@ -383,6 +389,8 @@ class Battle(EmulatorController): self.emulator.vba.press("a", hold=5, after=30) elif self.is_evolved_screen(): self.emulator.vba.step(count=30) + elif self.is_make_room_for_move_prompt(): + self.handle_make_room_for_move() else: raise BattleException("unknown state, aborting") @@ -450,6 +458,12 @@ class BattleStrategy(Battle): """ raise NotImplementedError + def handle_make_room_for_move(self): + """ + Choose yes/no then handle learning the move. + """ + raise NotImplementedError + class SpamBattleStrategy(BattleStrategy): """ A really simple battle strategy that always picks the first move of the @@ -493,3 +507,15 @@ class SpamBattleStrategy(BattleStrategy): # select this mon self.emulator.vba.press("a", hold=5, after=30) + + def handle_make_room_for_move(self): + """ + Choose yes/no then handle learning the move. + """ + # make room? no + self.emulator.vba.press("b", hold=5, after=100) + + # stop learning? yes + self.emulator.vba.press("a", hold=5, after=20) + + self.emulator.text_wait() |