From c2d13dab14153c405657471d44e49d83f36e00e6 Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Sat, 12 Oct 2013 16:17:57 -0500 Subject: write get_enemy_hp to calculate current hp --- pokemontools/vba/vba.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'pokemontools/vba/vba.py') diff --git a/pokemontools/vba/vba.py b/pokemontools/vba/vba.py index ce4bef2..433df40 100644 --- a/pokemontools/vba/vba.py +++ b/pokemontools/vba/vba.py @@ -552,3 +552,10 @@ class crystal(object): #while memory[0xd043] in [0, 1, 2, 3] or memory[0xd042] != 0x3e: self.vba.step(count=10) memory = self.vba.memory + + def get_enemy_hp(self): + """ + Returns the HP of the current enemy. + """ + hp = ((self.cry.vba.memory[0xd218] << 8) | self.cry.vba.memory[0xd217]) + return hp -- cgit v1.2.3