summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2013-09-22 17:26:56 -0500
committerBryan Bishop <kanzure@gmail.com>2013-09-22 17:26:56 -0500
commit3c4207d777a31914eeb76fb19e9ddd4ac34575f0 (patch)
tree2653eda3686385e751b6b9f9563844c955b284ff
parent0b7ed30a33fb9775b2b5e1f3245a2e28608c9fc6 (diff)
basic level-up stats screen detection
-rw-r--r--pokemontools/vba/vba.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/pokemontools/vba/vba.py b/pokemontools/vba/vba.py
index 654292e..ce4bef2 100644
--- a/pokemontools/vba/vba.py
+++ b/pokemontools/vba/vba.py
@@ -424,6 +424,39 @@ class crystal(object):
return output
+ def is_showing_stats_screen(self):
+ """
+ This is meant to detect whether or not the stats screen is showing.
+ This is the menu that pops up after leveling up.
+ """
+ # These words must be on the screen if the stats screen is currently
+ # displayed.
+ parts = [
+ "ATTACK",
+ "DEFENSE",
+ "SPCL.ATK",
+ "SPCL.DEF",
+ "SPEED",
+ ]
+
+ # get the current text on the screen
+ text = self.get_text()
+
+ if all([part in text for part in parts]):
+ return True
+ else:
+ return False
+
+ def handle_stats_screen(self, force=False):
+ """
+ Attempts to bypass a stats screen. Set force=True if you want to make
+ the attempt regardless of whether or not the system thinks a stats
+ screen is showing.
+ """
+ if self.is_showing_stats_screen() or force:
+ self.vba.press("a")
+ self.vba.step(count=20)
+
def keyboard_apply(self, button_sequence):
"""
Applies a sequence of buttons to the on-screen keyboard.