-
Notifications
You must be signed in to change notification settings - Fork 1k
/
heal_party.asm
99 lines (83 loc) · 1.11 KB
/
heal_party.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
HealParty:
; 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, MOVE_LENGTH
call AddNTimes
ld de, wMoveData
ld a, BANK(Moves)
call FarCopyData
ld a, [wMoveData + MOVE_PP]
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 [wUsingPPUp], 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