mirror of
https://github.com/thornAvery/kep-hack.git
synced 2025-10-22 14:57:57 +13:00
commenting for DecrementPP from DarkShikari
hg-commit-id: 4fc5d67d4912
This commit is contained in:
parent
2d2d187399
commit
e51029c125
55
common.asm
55
common.asm
|
@ -44432,32 +44432,43 @@ SECTION "bank1A",DATA,BANK[$1A]
|
|||
|
||||
DecrementPP: ; 0x68000
|
||||
; after using a move, decrement pp in battle and (if not transformed?) in party
|
||||
ld a,[de]
|
||||
cp a,STRUGGLE
|
||||
ret z
|
||||
ld hl,$D062
|
||||
ld a,[hli]
|
||||
and a,7
|
||||
ret nz
|
||||
bit 6,[hl]
|
||||
ret nz
|
||||
ld hl,$D02D ; PP of first move (in battle)
|
||||
ld a, [de]
|
||||
cp a, STRUGGLE
|
||||
ret z ; if the pokemon is using "struggle", there's nothing to do
|
||||
; we don't decrement PP for "struggle"
|
||||
ld hl, $D062
|
||||
ld a, [hli] ; load the $D062 pokemon status flags and increment hl to load the
|
||||
; $D063 status flags later
|
||||
and a, 7 ; check to see if bits 0, 1, or 2 are set
|
||||
ret nz ; if any of these statuses are true, don't decrement PP
|
||||
bit 6, [hl] ; check 6th bit status flag on $D063
|
||||
ret nz ; and return if it is set
|
||||
ld hl, $D02D ; PP of first move (in battle)
|
||||
call .DecrementPP\@
|
||||
|
||||
ld a,[$D064]
|
||||
bit 3,a ; XXX transform status?
|
||||
ret nz
|
||||
ld a, [$D064] ; load pokemon status bits?
|
||||
bit 3, a ; XXX transform status?
|
||||
ret nz ; If it is, return. Pokemon Red stores the "current pokemon's" PP
|
||||
; separately from the "Pokemon in your party's" PP. This is
|
||||
; duplication -- in all cases *other* than Pokemon with Transform.
|
||||
; Normally, this means we have to go on and make the same
|
||||
; modification to the "party's pokemon" PP that we made to the
|
||||
; "current pokemon's" PP. But, if we're dealing with a Transformed
|
||||
; Pokemon, it has separate PP for the move set that it copied from
|
||||
; its opponent, which is *not* the same as its real PP as part of your
|
||||
; party. So we return, and don't do that part.
|
||||
|
||||
ld hl,$D188 ; PP of first move (in party)
|
||||
ld a,[$CC2F] ; which mon in party is active
|
||||
ld bc,$2C
|
||||
call AddNTimes
|
||||
ld hl, $D188 ; PP of first move (in party)
|
||||
ld a, [$CC2F] ; which mon in party is active
|
||||
ld bc, $2C ; XXX probably size of party pokemon's data structure
|
||||
call AddNTimes ; calculate address of the mon to modify
|
||||
.DecrementPP\@
|
||||
ld a,[$CC2E] ; which move (0, 1, 2, 3) did we use?
|
||||
ld c,a
|
||||
ld b,0
|
||||
add hl,bc
|
||||
dec [hl] ; Decrement PP
|
||||
ld a, [$CC2E] ; which move (0, 1, 2, 3) did we use?
|
||||
ld c, a
|
||||
ld b, 0
|
||||
add hl ,bc ; calculate the address in memory of the PP we need to decrement
|
||||
; based on the move chosen.
|
||||
dec [hl] ; Decrement PP
|
||||
ret
|
||||
; 0x6802f
|
||||
|
||||
|
|
Loading…
Reference in a new issue