2018-06-24 07:09:41 -07:00
|
|
|
HealParty:
|
2016-03-27 09:47:28 -07:00
|
|
|
xor a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartyMon], a
|
|
|
|
ld hl, wPartySpecies
|
2016-03-27 09:47:28 -07:00
|
|
|
.loop
|
|
|
|
ld a, [hli]
|
|
|
|
cp -1
|
|
|
|
jr z, .done
|
|
|
|
cp EGG
|
|
|
|
jr z, .next
|
|
|
|
|
|
|
|
push hl
|
|
|
|
call HealPartyMon
|
|
|
|
pop hl
|
|
|
|
|
|
|
|
.next
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartyMon]
|
2016-03-27 09:47:28 -07:00
|
|
|
inc a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartyMon], a
|
2016-03-27 09:47:28 -07:00
|
|
|
jr .loop
|
|
|
|
|
|
|
|
.done
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
HealPartyMon:
|
2016-03-27 09:47:28 -07:00
|
|
|
ld a, MON_SPECIES
|
|
|
|
call GetPartyParamLocation
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
|
|
|
|
ld hl, MON_STATUS
|
|
|
|
add hl, de
|
|
|
|
xor a
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], a
|
|
|
|
|
|
|
|
ld hl, MON_MAXHP
|
|
|
|
add hl, de
|
|
|
|
|
|
|
|
; bc = MON_HP
|
|
|
|
ld b, h
|
|
|
|
ld c, l
|
|
|
|
dec bc
|
|
|
|
dec bc
|
|
|
|
|
|
|
|
ld a, [hli]
|
|
|
|
ld [bc], a
|
|
|
|
inc bc
|
|
|
|
ld a, [hl]
|
|
|
|
ld [bc], a
|
|
|
|
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall RestoreAllPP
|
2016-03-27 09:47:28 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
ComputeHPBarPixels:
|
2016-03-27 09:47:28 -07:00
|
|
|
; e = bc * (6 * 8) / de
|
|
|
|
ld a, b
|
|
|
|
or c
|
|
|
|
jr z, .zero
|
|
|
|
push hl
|
|
|
|
xor a
|
|
|
|
ld [hMultiplicand + 0], a
|
|
|
|
ld a, b
|
|
|
|
ld [hMultiplicand + 1], a
|
|
|
|
ld a, c
|
|
|
|
ld [hMultiplicand + 2], a
|
|
|
|
ld a, 6 * 8
|
|
|
|
ld [hMultiplier], a
|
|
|
|
call Multiply
|
|
|
|
; We need de to be under 256 because hDivisor is only 1 byte.
|
|
|
|
ld a, d
|
|
|
|
and a
|
|
|
|
jr z, .divide
|
|
|
|
; divide de and hProduct by 4
|
|
|
|
srl d
|
|
|
|
rr e
|
|
|
|
srl d
|
|
|
|
rr e
|
|
|
|
ld a, [hProduct + 2]
|
|
|
|
ld b, a
|
|
|
|
ld a, [hProduct + 3]
|
|
|
|
srl b
|
|
|
|
rr a
|
|
|
|
srl b
|
|
|
|
rr a
|
|
|
|
ld [hDividend + 3], a
|
|
|
|
ld a, b
|
|
|
|
ld [hDividend + 2], a
|
|
|
|
.divide
|
|
|
|
ld a, e
|
|
|
|
ld [hDivisor], a
|
|
|
|
ld b, 4
|
|
|
|
call Divide
|
|
|
|
ld a, [hQuotient + 2]
|
|
|
|
ld e, a
|
|
|
|
pop hl
|
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
ld e, 1
|
|
|
|
ret
|
|
|
|
|
|
|
|
.zero
|
|
|
|
ld e, 0
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
AnimateHPBar:
|
2016-03-27 09:47:28 -07:00
|
|
|
call WaitBGMap
|
|
|
|
call _AnimateHPBar
|
|
|
|
call WaitBGMap
|
|
|
|
ret
|