Remove all code from main.asm (some labeled INCBINs, like out-of-context graphics, are still present)
engine/routines/ stores isolated out-of-context routines as individual files. It might be preferable later to append them to their related engine/ files in unique little SECTIONs, relying on the linkerscript to place them appropriately; or some other organization method. In the meantime, they're now easily findable apart from main.asm's other content.
This commit is contained in:
26
engine/routines/applypokerustick.asm
Normal file
26
engine/routines/applypokerustick.asm
Normal file
@@ -0,0 +1,26 @@
|
||||
ApplyPokerusTick: ; 13988
|
||||
; decreases all pokemon's pokerus counter by b. if the lower nybble reaches zero, the pokerus is cured.
|
||||
ld hl, PartyMon1PokerusStatus ; PartyMon1 + MON_PKRS
|
||||
ld a, [PartyCount]
|
||||
and a
|
||||
ret z ; make sure it's not wasting time on an empty party
|
||||
ld c, a
|
||||
.loop
|
||||
ld a, [hl]
|
||||
and $f ; lower nybble is the number of days remaining
|
||||
jr z, .next ; if already 0, skip
|
||||
sub b ; subtract the number of days
|
||||
jr nc, .ok ; max(result, 0)
|
||||
xor a
|
||||
.ok
|
||||
ld d, a ; back up this value because we need to preserve the strain (upper nybble)
|
||||
ld a, [hl]
|
||||
and $f0
|
||||
add d
|
||||
ld [hl], a ; this prevents a cured pokemon from recontracting pokerus
|
||||
.next
|
||||
ld de, PARTYMON_STRUCT_LENGTH
|
||||
add hl, de
|
||||
dec c
|
||||
jr nz, .loop
|
||||
ret
|
Reference in New Issue
Block a user