basic level-up stats screen detection

This commit is contained in:
Bryan Bishop
2013-09-22 17:26:56 -05:00
parent 0b7ed30a33
commit 3c4207d777

View File

@@ -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.