From 6a1fc607718e70a5e8c50309c51d6b2e4bfd54a1 Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Sun, 22 Sep 2013 10:55:44 -0500 Subject: better IsInBattle detection for level grinding --- pokemontools/vba/autoplayer.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pokemontools/vba/autoplayer.py b/pokemontools/vba/autoplayer.py index 5ee2ac1..987395a 100644 --- a/pokemontools/vba/autoplayer.py +++ b/pokemontools/vba/autoplayer.py @@ -343,11 +343,19 @@ class SpeedRunner(Runner): # walk to the grass area self.new_bark_level_grind_walk_to_grass(skip=False) - # TODO: walk around in grass, handle battles - walk = ["d", "d", "u", "d", "u", "d"] - for direction in walk: + last_direction = "u" + + # walk around in the grass until a battle happens + while self.cry.vba.memory[0xd22d] == 0: + if last_direction == "u": + direction = "d" + else: + direction = "u" + self.cry.move(direction) + last_direction = direction + # wait for wild battle to completely start self.cry.text_wait() -- cgit v1.2.3