mirror of
https://github.com/thornAvery/kep-hack.git
synced 2026-02-07 16:15:23 +13:00
Add subdirectories to engine/ similar to pokecrystal
This commit is contained in:
parent
5559d51c86
commit
f275790aec
124 changed files with 342 additions and 346 deletions
120
engine/battle/move_effects/heal.asm
Normal file
120
engine/battle/move_effects/heal.asm
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
HealEffect_:
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
ld de, wBattleMonHP
|
||||
ld hl, wBattleMonMaxHP
|
||||
ld a, [wPlayerMoveNum]
|
||||
jr z, .healEffect
|
||||
ld de, wEnemyMonHP
|
||||
ld hl, wEnemyMonMaxHP
|
||||
ld a, [wEnemyMoveNum]
|
||||
.healEffect
|
||||
ld b, a
|
||||
ld a, [de]
|
||||
cp [hl] ; most significant bytes comparison is ignored
|
||||
; causes the move to miss if max HP is 255 or 511 points higher than the current HP
|
||||
inc de
|
||||
inc hl
|
||||
ld a, [de]
|
||||
sbc [hl]
|
||||
jp z, .failed ; no effect if user's HP is already at its maximum
|
||||
ld a, b
|
||||
cp REST
|
||||
jr nz, .healHP
|
||||
push hl
|
||||
push de
|
||||
push af
|
||||
ld c, 50
|
||||
call DelayFrames
|
||||
ld hl, wBattleMonStatus
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
jr z, .restEffect
|
||||
ld hl, wEnemyMonStatus
|
||||
.restEffect
|
||||
ld a, [hl]
|
||||
and a
|
||||
ld [hl], 2 ; clear status and set number of turns asleep to 2
|
||||
ld hl, StartedSleepingEffect ; if mon didn't have an status
|
||||
jr z, .printRestText
|
||||
ld hl, FellAsleepBecameHealthyText ; if mon had an status
|
||||
.printRestText
|
||||
call PrintText
|
||||
pop af
|
||||
pop de
|
||||
pop hl
|
||||
.healHP
|
||||
ld a, [hld]
|
||||
ld [wHPBarMaxHP], a
|
||||
ld c, a
|
||||
ld a, [hl]
|
||||
ld [wHPBarMaxHP+1], a
|
||||
ld b, a
|
||||
jr z, .gotHPAmountToHeal
|
||||
; Recover and Softboiled only heal for half the mon's max HP
|
||||
srl b
|
||||
rr c
|
||||
.gotHPAmountToHeal
|
||||
; update HP
|
||||
ld a, [de]
|
||||
ld [wHPBarOldHP], a
|
||||
add c
|
||||
ld [de], a
|
||||
ld [wHPBarNewHP], a
|
||||
dec de
|
||||
ld a, [de]
|
||||
ld [wHPBarOldHP+1], a
|
||||
adc b
|
||||
ld [de], a
|
||||
ld [wHPBarNewHP+1], a
|
||||
inc hl
|
||||
inc de
|
||||
ld a, [de]
|
||||
dec de
|
||||
sub [hl]
|
||||
dec hl
|
||||
ld a, [de]
|
||||
sbc [hl]
|
||||
jr c, .playAnim
|
||||
; copy max HP to current HP if an overflow occurred
|
||||
ld a, [hli]
|
||||
ld [de], a
|
||||
ld [wHPBarNewHP+1], a
|
||||
inc de
|
||||
ld a, [hl]
|
||||
ld [de], a
|
||||
ld [wHPBarNewHP], a
|
||||
.playAnim
|
||||
ld hl, PlayCurrentMoveAnimation
|
||||
call BankswitchEtoF
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
coord hl, 10, 9
|
||||
ld a, $1
|
||||
jr z, .updateHPBar
|
||||
coord hl, 2, 2
|
||||
xor a
|
||||
.updateHPBar
|
||||
ld [wHPBarType], a
|
||||
predef UpdateHPBar2
|
||||
ld hl, DrawHUDsAndHPBars
|
||||
call BankswitchEtoF
|
||||
ld hl, RegainedHealthText
|
||||
jp PrintText
|
||||
.failed
|
||||
ld c, 50
|
||||
call DelayFrames
|
||||
ld hl, PrintButItFailedText_
|
||||
jp BankswitchEtoF
|
||||
|
||||
StartedSleepingEffect:
|
||||
TX_FAR _StartedSleepingEffect
|
||||
db "@"
|
||||
|
||||
FellAsleepBecameHealthyText:
|
||||
TX_FAR _FellAsleepBecameHealthyText
|
||||
db "@"
|
||||
|
||||
RegainedHealthText:
|
||||
TX_FAR _RegainedHealthText
|
||||
db "@"
|
||||
Loading…
Add table
Add a link
Reference in a new issue