mirror of
https://github.com/thornAvery/kep-hack.git
synced 2026-02-22 07:02:17 +13:00
Rename battle files and split move effects Part 5
15.asm, 16.asm, 1a.asm, 1c.asm
This commit is contained in:
parent
2fe782b11a
commit
10211cc461
6 changed files with 94 additions and 94 deletions
43
engine/battle/decrement_pp.asm
Normal file
43
engine/battle/decrement_pp.asm
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
DecrementPP: ; 68000 (1a:4000)
|
||||
; after using a move, decrement pp in battle and (if not transformed?) in party
|
||||
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, W_PLAYERBATTSTATUS1
|
||||
ld a, [hli] ; load the W_PLAYERBATTSTATUS1 pokemon status flags and increment hl to load the
|
||||
; W_PLAYERBATTSTATUS2 status flags later
|
||||
and a, (1 << StoringEnergy) | (1 << ThrashingAbout) | (1 << AttackingMultipleTimes)
|
||||
ret nz ; if any of these statuses are true, don't decrement PP
|
||||
bit UsingRage, [hl]
|
||||
ret nz ; don't decrement PP either if Pokemon is using Rage
|
||||
ld hl, wBattleMonPP ; PP of first move (in battle)
|
||||
|
||||
; decrement PP in the battle struct
|
||||
call .DecrementPP
|
||||
|
||||
; decrement PP in the party struct
|
||||
ld a, [W_PLAYERBATTSTATUS3]
|
||||
bit Transformed, a
|
||||
ret nz ; Return if transformed. 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, wPartyMon1PP ; PP of first move (in party)
|
||||
ld a, [wPlayerMonNumber] ; which mon in party is active
|
||||
ld bc, wPartyMon2 - wPartyMon1
|
||||
call AddNTimes ; calculate address of the mon to modify
|
||||
.DecrementPP
|
||||
ld a, [wPlayerMoveListIndex] ; 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue