summaryrefslogtreecommitdiff
path: root/pokemontools/vba/autoplayer.py
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2013-09-22 11:12:38 -0500
committerBryan Bishop <kanzure@gmail.com>2013-09-22 11:12:38 -0500
commitd0b0b9c5f2e0d302b9150e6eeb5be9b2467fb792 (patch)
treeb02bccf6283359b241fcb230d6027a07e99b37e7 /pokemontools/vba/autoplayer.py
parent6a1fc607718e70a5e8c50309c51d6b2e4bfd54a1 (diff)
only heal if HP is low or move1 PP is low
Diffstat (limited to 'pokemontools/vba/autoplayer.py')
-rw-r--r--pokemontools/vba/autoplayer.py21
1 files changed, 19 insertions, 2 deletions
diff --git a/pokemontools/vba/autoplayer.py b/pokemontools/vba/autoplayer.py
index 987395a..b47634e 100644
--- a/pokemontools/vba/autoplayer.py
+++ b/pokemontools/vba/autoplayer.py
@@ -332,7 +332,7 @@ class SpeedRunner(Runner):
return
@skippable
- def new_bark_level_grind(self, level):
+ def new_bark_level_grind(self, level, walk_to_grass=True):
"""
Do level grinding in New Bark.
@@ -341,7 +341,8 @@ class SpeedRunner(Runner):
"""
# walk to the grass area
- self.new_bark_level_grind_walk_to_grass(skip=False)
+ if walk_to_grass:
+ self.new_bark_level_grind_walk_to_grass(skip=False)
last_direction = "u"
@@ -391,8 +392,24 @@ class SpeedRunner(Runner):
# wait for the map to finish loading
self.cry.vba.step(count=50)
+ # This is used to handle any additional textbox that might be up on the
+ # screen. The debug parameter is set to True so that max_wait is
+ # enabled. This might be a textbox that is still waiting around because
+ # of some faint during the battle. I am not completely sure why this
+ # happens.
+ self.cry.text_wait(max_wait=30, debug=True)
+
print "okay, back in the overworld"
+ cur_hp = ((self.cry.vba.memory[0xdd01] << 8) | self.cry.vba.memory[0xdd02])
+ move_pp = self.cry.vba.memory[0xdcf6] # move 1 pp
+
+ # if pokemon health is >20, just continue
+ # if move 1 PP is 0, just continue
+ if cur_hp > 20 and move_pp > 5:
+ self.cry.move("u")
+ return self.new_bark_level_grind(level, walk_to_grass=False, skip=False)
+
# move up
self.cry.move("u")
self.cry.move("u")