mirror of
https://github.com/thornAvery/kep-hack.git
synced 2025-12-29 13:43:17 +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
|
DecrementPP: ; 0x68000
|
||||||
; after using a move, decrement pp in battle and (if not transformed?) in party
|
; after using a move, decrement pp in battle and (if not transformed?) in party
|
||||||
ld a,[de]
|
ld a, [de]
|
||||||
cp a,STRUGGLE
|
cp a, STRUGGLE
|
||||||
ret z
|
ret z ; if the pokemon is using "struggle", there's nothing to do
|
||||||
ld hl,$D062
|
; we don't decrement PP for "struggle"
|
||||||
ld a,[hli]
|
ld hl, $D062
|
||||||
and a,7
|
ld a, [hli] ; load the $D062 pokemon status flags and increment hl to load the
|
||||||
ret nz
|
; $D063 status flags later
|
||||||
bit 6,[hl]
|
and a, 7 ; check to see if bits 0, 1, or 2 are set
|
||||||
ret nz
|
ret nz ; if any of these statuses are true, don't decrement PP
|
||||||
ld hl,$D02D ; PP of first move (in battle)
|
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\@
|
call .DecrementPP\@
|
||||||
|
|
||||||
ld a,[$D064]
|
ld a, [$D064] ; load pokemon status bits?
|
||||||
bit 3,a ; XXX transform status?
|
bit 3, a ; XXX transform status?
|
||||||
ret nz
|
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 hl, $D188 ; PP of first move (in party)
|
||||||
ld a,[$CC2F] ; which mon in party is active
|
ld a, [$CC2F] ; which mon in party is active
|
||||||
ld bc,$2C
|
ld bc, $2C ; XXX probably size of party pokemon's data structure
|
||||||
call AddNTimes
|
call AddNTimes ; calculate address of the mon to modify
|
||||||
.DecrementPP\@
|
.DecrementPP\@
|
||||||
ld a,[$CC2E] ; which move (0, 1, 2, 3) did we use?
|
ld a, [$CC2E] ; which move (0, 1, 2, 3) did we use?
|
||||||
ld c,a
|
ld c, a
|
||||||
ld b,0
|
ld b, 0
|
||||||
add hl,bc
|
add hl ,bc ; calculate the address in memory of the PP we need to decrement
|
||||||
dec [hl] ; Decrement PP
|
; based on the move chosen.
|
||||||
|
dec [hl] ; Decrement PP
|
||||||
ret
|
ret
|
||||||
; 0x6802f
|
; 0x6802f
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue