diff options
author | Bryan Bishop <kanzure@gmail.com> | 2013-11-11 21:27:28 -0600 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2013-11-11 21:27:28 -0600 |
commit | 18449eea21096cf8b90e21ee7bcdc6da5e047df4 (patch) | |
tree | 78aeb36943d131b6572f08c58831ffecbe9b218e /pokemontools/vba/vba.py | |
parent | 4c6a904db191c182c3b9cecdcbc0d5ea3b5c2173 (diff) |
function to check if it's the yes/no prompt
This is the prompt that appears during battles for whether or not to
switch pokemon when the other trainer is sending something else out.
Diffstat (limited to 'pokemontools/vba/vba.py')
-rw-r--r-- | pokemontools/vba/vba.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/pokemontools/vba/vba.py b/pokemontools/vba/vba.py index 47cadd7..79eb77e 100644 --- a/pokemontools/vba/vba.py +++ b/pokemontools/vba/vba.py @@ -599,6 +599,23 @@ class crystal(object): def is_in_link_battle(self): return self.vba.read_memory_at(0xc2dc) != 0 + def is_battle_switch_prompt(self): + """ + Checks if the game is currently displaying the yes/no prompt for + whether or not to switch pokemon. + """ + # get on-screen text + text = self.get_text() + + requirements = [ + "YES", + "NO", + "Will ", + "change POKMON?", + ] + + return all([requirement in text for requirement in requirements]) + def unlock_flypoints(self): """ Unlocks different destinations for flying. |