diff options
author | Bryan Bishop <kanzure@gmail.com> | 2013-09-22 10:55:44 -0500 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2013-09-22 10:55:44 -0500 |
commit | 6a1fc607718e70a5e8c50309c51d6b2e4bfd54a1 (patch) | |
tree | c5579727f3a9cdea008e08451cc0d0ef740ec55f /pokemontools/vba/autoplayer.py | |
parent | a4c418bc7a2b99ad3da7f421bba8cf7415f9f021 (diff) |
better IsInBattle detection for level grinding
Diffstat (limited to 'pokemontools/vba/autoplayer.py')
-rw-r--r-- | pokemontools/vba/autoplayer.py | 14 |
1 files 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() |