diff options
author | Bryan Bishop <kanzure@gmail.com> | 2013-11-14 01:44:40 -0600 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2013-11-14 01:44:40 -0600 |
commit | 038a9d8ec093e7c73f0a596d0cc996e3971d7d0f (patch) | |
tree | 3b35233cf9d17d5ebcb2877bd3746e8051f8f920 /pokemontools/vba/battle.py | |
parent | 1bbfb2869fd011416d4ca4883105d7308a562655 (diff) |
a quick method to detect the "is evolving" message
Diffstat (limited to 'pokemontools/vba/battle.py')
-rw-r--r-- | pokemontools/vba/battle.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/pokemontools/vba/battle.py b/pokemontools/vba/battle.py index 8ba534c..b800df0 100644 --- a/pokemontools/vba/battle.py +++ b/pokemontools/vba/battle.py @@ -236,6 +236,27 @@ class Battle(EmulatorController): else: return True + def is_evolution_screen(self): + """ + What? MEW is evolving! + """ + address = 0xc5e4 + + values = [164, 181, 174, 171, 181, 168, 173, 166, 231] + + for (index, value) in enumerate(values): + if self.emulator.vba.read_memory_at(address + index) != value: + return False + else: + # also check "What?" + what_address = 0xc5b9 + what_values = [150, 167, 160, 179, 230] + for (index, value) in enumerate(what_values): + if self.emulator.vba.read_memory_at(what_address + index) != value: + return False + else: + return True + def skip_start_text(self, max_loops=20): """ Skip any initial conversation until the player can select an action. @@ -283,6 +304,9 @@ class Battle(EmulatorController): # but also, jump out if it's the stats screen result = result or self.is_levelup_screen() + # stay in text_wait if it's the evolution screen + result = result and not self.is_evolution_screen() + return result while not self.is_input_required() and self.is_in_battle(): |