aboutsummaryrefslogtreecommitdiffstats
path: root/engine/heal_party.asm
diff options
context:
space:
mode:
authorluckytyphlosion <alan.rj.huang@gmail.com>2016-03-17 18:00:47 -0400
committerluckytyphlosion <alan.rj.huang@gmail.com>2016-03-17 18:00:54 -0400
commitb6d2115df4b4f9d86be898292fca473222941f1d (patch)
tree530796fd3f2b356d6af8442d6f6b1352b08012e1 /engine/heal_party.asm
parentSplit bank1 up. (diff)
downloadpokeyellow-b6d2115df4b4f9d86be898292fca473222941f1d.tar.gz
pokeyellow-b6d2115df4b4f9d86be898292fca473222941f1d.tar.xz
pokeyellow-b6d2115df4b4f9d86be898292fca473222941f1d.zip
Split bank3 up.
Diffstat (limited to 'engine/heal_party.asm')
-rw-r--r--engine/heal_party.asm99
1 files changed, 99 insertions, 0 deletions
diff --git a/engine/heal_party.asm b/engine/heal_party.asm
new file mode 100644
index 00000000..4ef200a9
--- /dev/null
+++ b/engine/heal_party.asm
@@ -0,0 +1,99 @@
+HealParty: ; f52b (3:752b)
+; Restore HP and PP.
+
+ ld hl, wPartySpecies
+ ld de, wPartyMon1HP
+.healmon
+ ld a, [hli]
+ cp $ff
+ jr z, .done
+
+ push hl
+ push de
+
+ ld hl, wPartyMon1Status - wPartyMon1HP
+ add hl, de
+ xor a
+ ld [hl], a
+
+ push de
+ ld b, NUM_MOVES ; A Pokémon has 4 moves
+.pp
+ ld hl, wPartyMon1Moves - wPartyMon1HP
+ add hl, de
+
+ ld a, [hl]
+ and a
+ jr z, .nextmove
+
+ dec a
+ ld hl, wPartyMon1PP - wPartyMon1HP
+ add hl, de
+
+ push hl
+ push de
+ push bc
+
+ ld hl, Moves
+ ld bc, MoveEnd - Moves
+ call AddNTimes
+ ld de, wcd6d
+ ld a, BANK(Moves)
+ call FarCopyData
+ ld a, [wcd6d + 5] ; PP is byte 5 of move data
+
+ pop bc
+ pop de
+ pop hl
+
+ inc de
+ push bc
+ ld b, a
+ ld a, [hl]
+ and $c0
+ add b
+ ld [hl], a
+ pop bc
+
+.nextmove
+ dec b
+ jr nz, .pp
+ pop de
+
+ ld hl, wPartyMon1MaxHP - wPartyMon1HP
+ add hl, de
+ ld a, [hli]
+ ld [de], a
+ inc de
+ ld a, [hl]
+ ld [de], a
+
+ pop de
+ pop hl
+
+ push hl
+ ld bc, wPartyMon2 - wPartyMon1
+ ld h, d
+ ld l, e
+ add hl, bc
+ ld d, h
+ ld e, l
+ pop hl
+ jr .healmon
+
+.done
+ xor a
+ ld [wWhichPokemon], a
+ ld [wd11e], a
+
+ ld a, [wPartyCount]
+ ld b, a
+.ppup
+ push bc
+ call RestoreBonusPP
+ pop bc
+ ld hl, wWhichPokemon
+ inc [hl]
+ dec b
+ jr nz, .ppup
+ ret \ No newline at end of file