mirror of
https://github.com/thornAvery/kep-hack.git
synced 2026-01-17 14:13:19 +13:00
Document move effects
Document mist effect Document recoil effect Document heal effect Update conversion_effect.asm Update haze_effect.asm Update leech_seed_effect.asm Update pay_day_effect.asm Update reflect_light_screen_effect.asm Update substitute_effect.asm Update transform_effect.asm
This commit is contained in:
parent
c2efe700ac
commit
b2dc57576d
|
|
@ -4,15 +4,16 @@ ConversionEffect_: ; 139a3 (4:79a3)
|
||||||
ld a, [H_WHOSETURN]
|
ld a, [H_WHOSETURN]
|
||||||
and a
|
and a
|
||||||
ld a, [W_ENEMYBATTSTATUS1]
|
ld a, [W_ENEMYBATTSTATUS1]
|
||||||
jr z, .asm_139b8
|
jr z, .conversionEffect
|
||||||
push hl
|
push hl
|
||||||
ld h, d
|
ld h, d
|
||||||
ld l, e
|
ld l, e
|
||||||
pop de
|
pop de
|
||||||
ld a, [W_PLAYERBATTSTATUS1]
|
ld a, [W_PLAYERBATTSTATUS1]
|
||||||
.asm_139b8
|
.conversionEffect
|
||||||
bit Invulnerable, a ; is mon immune to typical attacks (dig/fly)
|
bit Invulnerable, a ; is mon immune to typical attacks (dig/fly)
|
||||||
jr nz, PrintButItFailedText
|
jr nz, PrintButItFailedText
|
||||||
|
; copy target's types to user
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
ld [de], a
|
ld [de], a
|
||||||
inc de
|
inc de
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
HazeEffect_: ; 139da (4:79da)
|
HazeEffect_: ; 139da (4:79da)
|
||||||
ld a, $7
|
ld a, $7
|
||||||
|
; store 7 on every stat mod
|
||||||
ld hl, wPlayerMonAttackMod
|
ld hl, wPlayerMonAttackMod
|
||||||
call ResetStatMods
|
call ResetStatMods
|
||||||
ld hl, wEnemyMonAttackMod
|
ld hl, wEnemyMonAttackMod
|
||||||
call ResetStatMods
|
call ResetStatMods
|
||||||
|
; copy unmodified stats to battle stats
|
||||||
ld hl, wPlayerMonUnmodifiedAttack
|
ld hl, wPlayerMonUnmodifiedAttack
|
||||||
ld de, wBattleMonAttack
|
ld de, wBattleMonAttack
|
||||||
call ResetStats
|
call ResetStats
|
||||||
|
|
@ -14,19 +16,20 @@ HazeEffect_: ; 139da (4:79da)
|
||||||
ld de, wEnemySelectedMove
|
ld de, wEnemySelectedMove
|
||||||
ld a, [H_WHOSETURN]
|
ld a, [H_WHOSETURN]
|
||||||
and a
|
and a
|
||||||
jr z, .asm_13a09
|
jr z, .cureStatuses
|
||||||
ld hl, wBattleMonStatus
|
ld hl, wBattleMonStatus
|
||||||
dec de
|
dec de ; wPlayerSelectedMove
|
||||||
|
|
||||||
.asm_13a09
|
.cureStatuses
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
ld [hl], $0
|
ld [hl], $0
|
||||||
and $27
|
and SLP | (1 << FRZ)
|
||||||
jr z, .asm_13a13
|
jr z, .cureVolatileStatuses
|
||||||
|
; prevent the Pokemon from executing a move if it was asleep or frozen
|
||||||
ld a, $ff
|
ld a, $ff
|
||||||
ld [de], a
|
ld [de], a
|
||||||
|
|
||||||
.asm_13a13
|
.cureVolatileStatuses
|
||||||
xor a
|
xor a
|
||||||
ld [W_PLAYERDISABLEDMOVE], a
|
ld [W_PLAYERDISABLEDMOVE], a
|
||||||
ld [W_ENEMYDISABLEDMOVE], a
|
ld [W_ENEMYDISABLEDMOVE], a
|
||||||
|
|
@ -34,19 +37,21 @@ HazeEffect_: ; 139da (4:79da)
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld hl, W_PLAYERBATTSTATUS1
|
ld hl, W_PLAYERBATTSTATUS1
|
||||||
call CureStatuses
|
call CureVolatileStatuses
|
||||||
ld hl, W_ENEMYBATTSTATUS1
|
ld hl, W_ENEMYBATTSTATUS1
|
||||||
call CureStatuses
|
call CureVolatileStatuses
|
||||||
ld hl, PlayCurrentMoveAnimation
|
ld hl, PlayCurrentMoveAnimation
|
||||||
call CallBankF
|
call CallBankF
|
||||||
ld hl, StatusChangesEliminatedText
|
ld hl, StatusChangesEliminatedText
|
||||||
jp PrintText
|
jp PrintText
|
||||||
|
|
||||||
CureStatuses: ; 13a37 (4:7a37)
|
CureVolatileStatuses: ; 13a37 (4:7a37)
|
||||||
|
; only cures statuses of the Pokemon not using Haze
|
||||||
res Confused, [hl]
|
res Confused, [hl]
|
||||||
inc hl ; BATTSTATUS2
|
inc hl ; BATTSTATUS2
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
and (1 << UsingRage) | (1 << NeedsToRecharge) | (1 << HasSubstituteUp) | (1 << 3) ; clear all but these from BATTSTATUS2
|
; clear UsingXAccuracy, ProtectedByMist, GettingPumped, and Seeded statuses
|
||||||
|
and (1 << UsingRage) | (1 << NeedsToRecharge) | (1 << HasSubstituteUp) | (1 << 3)
|
||||||
ld [hli], a ; BATTSTATUS3
|
ld [hli], a ; BATTSTATUS3
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
and %11110000 | (1 << Transformed) ; clear Bad Poison, Reflect and Light Screen statuses
|
and %11110000 | (1 << Transformed) ; clear Bad Poison, Reflect and Light Screen statuses
|
||||||
|
|
@ -56,7 +61,7 @@ CureStatuses: ; 13a37 (4:7a37)
|
||||||
ResetStatMods: ; 13a43 (4:7a43)
|
ResetStatMods: ; 13a43 (4:7a43)
|
||||||
ld b, $8
|
ld b, $8
|
||||||
.loop
|
.loop
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
dec b
|
dec b
|
||||||
jr nz, .loop
|
jr nz, .loop
|
||||||
ret
|
ret
|
||||||
|
|
|
||||||
|
|
@ -4,22 +4,23 @@ HealEffect_: ; 3b9ec (e:79ec)
|
||||||
ld de, wBattleMonHP
|
ld de, wBattleMonHP
|
||||||
ld hl, wBattleMonMaxHP
|
ld hl, wBattleMonMaxHP
|
||||||
ld a, [W_PLAYERMOVENUM]
|
ld a, [W_PLAYERMOVENUM]
|
||||||
jr z, .asm_3ba03
|
jr z, .healEffect
|
||||||
ld de, wEnemyMonHP
|
ld de, wEnemyMonHP
|
||||||
ld hl, wEnemyMonMaxHP
|
ld hl, wEnemyMonMaxHP
|
||||||
ld a, [W_ENEMYMOVENUM]
|
ld a, [W_ENEMYMOVENUM]
|
||||||
.asm_3ba03
|
.healEffect
|
||||||
ld b, a
|
ld b, a
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
cp [hl]
|
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 de
|
||||||
inc hl
|
inc hl
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
sbc [hl]
|
sbc [hl]
|
||||||
jp z, .failed
|
jp z, .failed ; no effect if user's HP is already at its maximum
|
||||||
ld a, b
|
ld a, b
|
||||||
cp REST
|
cp REST
|
||||||
jr nz, .asm_3ba37
|
jr nz, .healHP
|
||||||
push hl
|
push hl
|
||||||
push de
|
push de
|
||||||
push af
|
push af
|
||||||
|
|
@ -28,31 +29,33 @@ HealEffect_: ; 3b9ec (e:79ec)
|
||||||
ld hl, wBattleMonStatus
|
ld hl, wBattleMonStatus
|
||||||
ld a, [H_WHOSETURN]
|
ld a, [H_WHOSETURN]
|
||||||
and a
|
and a
|
||||||
jr z, .asm_3ba25
|
jr z, .restEffect
|
||||||
ld hl, wEnemyMonStatus
|
ld hl, wEnemyMonStatus
|
||||||
.asm_3ba25
|
.restEffect
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
and a
|
and a
|
||||||
ld [hl], 2 ; Number of turns from Rest
|
ld [hl], 2 ; clear status and set number of turns asleep to 2
|
||||||
ld hl, StartedSleepingEffect
|
ld hl, StartedSleepingEffect ; if mon didn't have an status
|
||||||
jr z, .asm_3ba31
|
jr z, .printRestText
|
||||||
ld hl, FellAsleepBecameHealthyText
|
ld hl, FellAsleepBecameHealthyText ; if mon had an status
|
||||||
.asm_3ba31
|
.printRestText
|
||||||
call PrintText
|
call PrintText
|
||||||
pop af
|
pop af
|
||||||
pop de
|
pop de
|
||||||
pop hl
|
pop hl
|
||||||
.asm_3ba37
|
.healHP
|
||||||
ld a, [hld]
|
ld a, [hld]
|
||||||
ld [wHPBarMaxHP], a
|
ld [wHPBarMaxHP], a
|
||||||
ld c, a
|
ld c, a
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
ld [wHPBarMaxHP+1], a
|
ld [wHPBarMaxHP+1], a
|
||||||
ld b, a
|
ld b, a
|
||||||
jr z, .asm_3ba47
|
jr z, .gotHPAmountToHeal
|
||||||
|
; Recover and Softboiled only heal for half the mon's max HP
|
||||||
srl b
|
srl b
|
||||||
rr c
|
rr c
|
||||||
.asm_3ba47
|
.gotHPAmountToHeal
|
||||||
|
; update HP
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
ld [wHPBarOldHP], a
|
ld [wHPBarOldHP], a
|
||||||
add c
|
add c
|
||||||
|
|
@ -72,7 +75,8 @@ HealEffect_: ; 3b9ec (e:79ec)
|
||||||
dec hl
|
dec hl
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
sbc [hl]
|
sbc [hl]
|
||||||
jr c, .asm_3ba6f
|
jr c, .playAnim
|
||||||
|
; copy max HP to current HP if an overflow ocurred
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
ld [de], a
|
ld [de], a
|
||||||
ld [wHPBarNewHP+1], a
|
ld [wHPBarNewHP+1], a
|
||||||
|
|
@ -80,17 +84,17 @@ HealEffect_: ; 3b9ec (e:79ec)
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
ld [de], a
|
ld [de], a
|
||||||
ld [wHPBarNewHP], a
|
ld [wHPBarNewHP], a
|
||||||
.asm_3ba6f
|
.playAnim
|
||||||
ld hl, PlayCurrentMoveAnimation
|
ld hl, PlayCurrentMoveAnimation
|
||||||
call BankswitchEtoF
|
call BankswitchEtoF
|
||||||
ld a, [H_WHOSETURN]
|
ld a, [H_WHOSETURN]
|
||||||
and a
|
and a
|
||||||
hlCoord 10, 9
|
hlCoord 10, 9
|
||||||
ld a, $1
|
ld a, $1
|
||||||
jr z, .asm_3ba83
|
jr z, .updateHPBar
|
||||||
hlCoord 2, 2
|
hlCoord 2, 2
|
||||||
xor a
|
xor a
|
||||||
.asm_3ba83
|
.updateHPBar
|
||||||
ld [wHPBarType], a
|
ld [wHPBarType], a
|
||||||
predef UpdateHPBar2
|
predef UpdateHPBar2
|
||||||
ld hl, DrawHUDsAndHPBars
|
ld hl, DrawHUDsAndHPBars
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,31 @@
|
||||||
LeechSeedEffect_: ; 2bea9 (a:7ea9)
|
LeechSeedEffect_: ; 2bea9 (a:7ea9)
|
||||||
callab MoveHitTest
|
callab MoveHitTest
|
||||||
ld a, [W_MOVEMISSED] ; W_MOVEMISSED
|
ld a, [W_MOVEMISSED]
|
||||||
and a
|
and a
|
||||||
jr nz, .asm_2bee7
|
jr nz, .moveMissed
|
||||||
ld hl, W_ENEMYBATTSTATUS2 ; W_ENEMYBATTSTATUS2
|
ld hl, W_ENEMYBATTSTATUS2
|
||||||
ld de, wEnemyMonType1 ; wcfea (aliases: wEnemyMonType)
|
ld de, wEnemyMonType1
|
||||||
ld a, [H_WHOSETURN] ; $fff3
|
ld a, [H_WHOSETURN]
|
||||||
and a
|
and a
|
||||||
jr z, .asm_2bec8
|
jr z, .leechSeedEffect
|
||||||
ld hl, W_PLAYERBATTSTATUS2 ; W_PLAYERBATTSTATUS2
|
ld hl, W_PLAYERBATTSTATUS2
|
||||||
ld de, wBattleMonType1 ; wd019 (aliases: wBattleMonType)
|
ld de, wBattleMonType1
|
||||||
.asm_2bec8
|
.leechSeedEffect
|
||||||
|
; miss if the target is grass-type or already seeded
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
cp GRASS
|
cp GRASS
|
||||||
jr z, .asm_2bee7
|
jr z, .moveMissed
|
||||||
inc de
|
inc de
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
cp GRASS
|
cp GRASS
|
||||||
jr z, .asm_2bee7
|
jr z, .moveMissed
|
||||||
bit Seeded, [hl]
|
bit Seeded, [hl]
|
||||||
jr nz, .asm_2bee7
|
jr nz, .moveMissed
|
||||||
set Seeded, [hl]
|
set Seeded, [hl]
|
||||||
callab PlayCurrentMoveAnimation
|
callab PlayCurrentMoveAnimation
|
||||||
ld hl, WasSeededText ; $7ef2
|
ld hl, WasSeededText ; $7ef2
|
||||||
jp PrintText
|
jp PrintText
|
||||||
.asm_2bee7
|
.moveMissed
|
||||||
ld c, $32
|
ld c, $32
|
||||||
call DelayFrames
|
call DelayFrames
|
||||||
ld hl, EvadedAttackText ; $7ef7
|
ld hl, EvadedAttackText ; $7ef7
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,17 @@
|
||||||
MistEffect_: ; 33f2b (c:7f2b)
|
MistEffect_: ; 33f2b (c:7f2b)
|
||||||
ld hl, W_PLAYERBATTSTATUS2
|
ld hl, W_PLAYERBATTSTATUS2
|
||||||
ld a, [$fff3]
|
ld a, [H_WHOSETURN]
|
||||||
and a
|
and a
|
||||||
jr z, .asm_33f36
|
jr z, .mistEffect
|
||||||
ld hl, W_ENEMYBATTSTATUS2
|
ld hl, W_ENEMYBATTSTATUS2
|
||||||
.asm_33f36
|
.mistEffect
|
||||||
bit ProtectedByMist, [hl] ; is mon protected by mist?
|
bit ProtectedByMist, [hl] ; is mon protected by mist?
|
||||||
jr nz, .asm_33f4a
|
jr nz, .mistAlreadyInUse
|
||||||
set ProtectedByMist, [hl] ; mon is now protected by mist
|
set ProtectedByMist, [hl] ; mon is now protected by mist
|
||||||
callab PlayCurrentMoveAnimation
|
callab PlayCurrentMoveAnimation
|
||||||
ld hl, ShroudedInMistText
|
ld hl, ShroudedInMistText
|
||||||
jp PrintText
|
jp PrintText
|
||||||
.asm_33f4a
|
.mistAlreadyInUse
|
||||||
ld hl, PrintButItFailedText_
|
ld hl, PrintButItFailedText_
|
||||||
ld b, BANK(PrintButItFailedText_)
|
ld b, BANK(PrintButItFailedText_)
|
||||||
jp Bankswitch
|
jp Bankswitch
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,13 @@ OneHitKOEffect_: ; 33f57 (c:7f57)
|
||||||
ld [wCriticalHitOrOHKO], a
|
ld [wCriticalHitOrOHKO], a
|
||||||
ld hl, wBattleMonSpeed + 1
|
ld hl, wBattleMonSpeed + 1
|
||||||
ld de, wEnemyMonSpeed + 1
|
ld de, wEnemyMonSpeed + 1
|
||||||
ld a, [H_WHOSETURN] ; $fff3
|
ld a, [H_WHOSETURN]
|
||||||
and a
|
and a
|
||||||
jr z, .asm_33f72
|
jr z, .compareSpeed
|
||||||
ld hl, wEnemyMonSpeed + 1
|
ld hl, wEnemyMonSpeed + 1
|
||||||
ld de, wBattleMonSpeed + 1
|
ld de, wBattleMonSpeed + 1
|
||||||
.asm_33f72
|
.compareSpeed
|
||||||
|
; set damage to 65535 and OHKO flag is the user's current speed is higher than the target's
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
dec de
|
dec de
|
||||||
ld b, a
|
ld b, a
|
||||||
|
|
@ -22,7 +23,7 @@ OneHitKOEffect_: ; 33f57 (c:7f57)
|
||||||
ld b, a
|
ld b, a
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
sbc b
|
sbc b
|
||||||
jr c, .asm_33f8a
|
jr c, .userIsSlower
|
||||||
ld hl, W_DAMAGE
|
ld hl, W_DAMAGE
|
||||||
ld a, $ff
|
ld a, $ff
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
|
|
@ -30,7 +31,8 @@ OneHitKOEffect_: ; 33f57 (c:7f57)
|
||||||
ld a, $2
|
ld a, $2
|
||||||
ld [wCriticalHitOrOHKO], a
|
ld [wCriticalHitOrOHKO], a
|
||||||
ret
|
ret
|
||||||
.asm_33f8a
|
.userIsSlower
|
||||||
|
; keep damage at 0 and set move missed flag if target's current speed is higher instead
|
||||||
ld a, $1
|
ld a, $1
|
||||||
ld [W_MOVEMISSED], a
|
ld [W_MOVEMISSED], a
|
||||||
ret
|
ret
|
||||||
|
|
|
||||||
|
|
@ -5,24 +5,26 @@ PayDayEffect_ ; 2feb8 (b:7eb8)
|
||||||
ld a, [H_WHOSETURN]
|
ld a, [H_WHOSETURN]
|
||||||
and a
|
and a
|
||||||
ld a, [wBattleMonLevel]
|
ld a, [wBattleMonLevel]
|
||||||
jr z, .asm_2fec8
|
jr z, .payDayEffect
|
||||||
ld a, [wEnemyMonLevel]
|
ld a, [wEnemyMonLevel]
|
||||||
.asm_2fec8
|
.payDayEffect
|
||||||
add a
|
; level * 2
|
||||||
|
add a
|
||||||
ld [H_DIVIDEND + 3], a
|
ld [H_DIVIDEND + 3], a
|
||||||
xor a
|
xor a
|
||||||
ld [H_DIVIDEND], a
|
ld [H_DIVIDEND], a
|
||||||
ld [H_DIVIDEND + 1], a
|
ld [H_DIVIDEND + 1], a
|
||||||
ld [H_DIVIDEND + 2], a
|
ld [H_DIVIDEND + 2], a
|
||||||
ld a, $64
|
; convert to BCD
|
||||||
|
ld a, 100
|
||||||
ld [H_DIVISOR], a
|
ld [H_DIVISOR], a
|
||||||
ld b, $4
|
ld b, $4
|
||||||
call Divide
|
call Divide
|
||||||
ld a, [H_QUOTIENT + 3]
|
ld a, [H_QUOTIENT + 3]
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
ld a, [H_REMAINDER]
|
ld a, [H_REMAINDER]
|
||||||
ld [H_DIVIDEND + 3], a
|
ld [H_DIVIDEND + 3], a
|
||||||
ld a, $a
|
ld a, 10
|
||||||
ld [H_DIVISOR], a
|
ld [H_DIVISOR], a
|
||||||
ld b, $4
|
ld b, $4
|
||||||
call Divide
|
call Divide
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@ RecoilEffect_: ; 1392c (4:792c)
|
||||||
and a
|
and a
|
||||||
ld a, [W_PLAYERMOVENUM]
|
ld a, [W_PLAYERMOVENUM]
|
||||||
ld hl, wBattleMonMaxHP
|
ld hl, wBattleMonMaxHP
|
||||||
jr z, .asm_1393d
|
jr z, .recoilEffect
|
||||||
ld a, [W_ENEMYMOVENUM]
|
ld a, [W_ENEMYMOVENUM]
|
||||||
ld hl, wEnemyMonMaxHP
|
ld hl, wEnemyMonMaxHP
|
||||||
.asm_1393d
|
.recoilEffect
|
||||||
ld d, a
|
ld d, a
|
||||||
ld a, [W_DAMAGE]
|
ld a, [W_DAMAGE]
|
||||||
ld b, a
|
ld b, a
|
||||||
|
|
@ -15,22 +15,23 @@ RecoilEffect_: ; 1392c (4:792c)
|
||||||
srl b
|
srl b
|
||||||
rr c
|
rr c
|
||||||
ld a, d
|
ld a, d
|
||||||
cp STRUGGLE
|
cp STRUGGLE ; struggle deals 50% recoil damage
|
||||||
jr z, .asm_13953
|
jr z, .gotRecoilDamage
|
||||||
srl b
|
srl b
|
||||||
rr c
|
rr c
|
||||||
.asm_13953
|
.gotRecoilDamage
|
||||||
ld a, b
|
ld a, b
|
||||||
or c
|
or c
|
||||||
jr nz, .asm_13958
|
jr nz, .updateHP
|
||||||
inc c
|
inc c ; minimum recoil damage is 1
|
||||||
.asm_13958
|
.updateHP
|
||||||
|
; substract HP from user due to the recoil damage
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
ld [wHPBarMaxHP+1], a
|
ld [wHPBarMaxHP+1], a
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
ld [wHPBarMaxHP], a
|
ld [wHPBarMaxHP], a
|
||||||
push bc
|
push bc
|
||||||
ld bc, $fff2
|
ld bc, wBattleMonHP - wBattleMonMaxHP
|
||||||
add hl, bc
|
add hl, bc
|
||||||
pop bc
|
pop bc
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
|
|
@ -43,22 +44,23 @@ RecoilEffect_: ; 1392c (4:792c)
|
||||||
sbc b
|
sbc b
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld [wHPBarNewHP+1], a
|
ld [wHPBarNewHP+1], a
|
||||||
jr nc, .asm_13982
|
jr nc, .getHPBarCoords
|
||||||
xor a
|
; if recoil damage is higher than the Pokemon's HP, set its HP to 0
|
||||||
|
xor a
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld hl, wHPBarNewHP
|
ld hl, wHPBarNewHP
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
.asm_13982
|
.getHPBarCoords
|
||||||
hlCoord 10, 9
|
hlCoord 10, 9
|
||||||
ld a, [H_WHOSETURN]
|
ld a, [H_WHOSETURN]
|
||||||
and a
|
and a
|
||||||
ld a, $1
|
ld a, $1
|
||||||
jr z, .asm_13990
|
jr z, .updateHPBar
|
||||||
hlCoord 2, 2
|
hlCoord 2, 2
|
||||||
xor a
|
xor a
|
||||||
.asm_13990
|
.updateHPBar
|
||||||
ld [wHPBarType], a
|
ld [wHPBarType], a
|
||||||
predef UpdateHPBar2
|
predef UpdateHPBar2
|
||||||
ld hl, HitWithRecoilText
|
ld hl, HitWithRecoilText
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@ ReflectLightScreenEffect_: ; 3bb97 (e:7b97)
|
||||||
ld de, W_PLAYERMOVEEFFECT
|
ld de, W_PLAYERMOVEEFFECT
|
||||||
ld a, [H_WHOSETURN]
|
ld a, [H_WHOSETURN]
|
||||||
and a
|
and a
|
||||||
jr z, .asm_3bba8
|
jr z, .reflectLightScreenEffect
|
||||||
ld hl, W_ENEMYBATTSTATUS3
|
ld hl, W_ENEMYBATTSTATUS3
|
||||||
ld de, W_ENEMYMOVEEFFECT
|
ld de, W_ENEMYMOVEEFFECT
|
||||||
.asm_3bba8
|
.reflectLightScreenEffect
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
cp LIGHT_SCREEN_EFFECT
|
cp LIGHT_SCREEN_EFFECT
|
||||||
jr nz, .reflect
|
jr nz, .reflect
|
||||||
|
|
@ -14,13 +14,13 @@ ReflectLightScreenEffect_: ; 3bb97 (e:7b97)
|
||||||
jr nz, .moveFailed
|
jr nz, .moveFailed
|
||||||
set HasLightScreenUp, [hl] ; mon is now protected by light screen
|
set HasLightScreenUp, [hl] ; mon is now protected by light screen
|
||||||
ld hl, LightScreenProtectedText
|
ld hl, LightScreenProtectedText
|
||||||
jr .asm_3bbc1
|
jr .playAnim
|
||||||
.reflect
|
.reflect
|
||||||
bit HasReflectUp, [hl] ; is mon already protected by reflect?
|
bit HasReflectUp, [hl] ; is mon already protected by reflect?
|
||||||
jr nz, .moveFailed
|
jr nz, .moveFailed
|
||||||
set HasReflectUp, [hl] ; mon is now protected by reflect
|
set HasReflectUp, [hl] ; mon is now protected by reflect
|
||||||
ld hl, ReflectGainedArmorText
|
ld hl, ReflectGainedArmorText
|
||||||
.asm_3bbc1
|
.playAnim
|
||||||
push hl
|
push hl
|
||||||
ld hl, PlayCurrentMoveAnimation
|
ld hl, PlayCurrentMoveAnimation
|
||||||
call BankswitchEtoF
|
call BankswitchEtoF
|
||||||
|
|
|
||||||
|
|
@ -11,46 +11,48 @@ SubstituteEffect_: ; 17dad (5:7dad)
|
||||||
ld de, wEnemySubstituteHP
|
ld de, wEnemySubstituteHP
|
||||||
ld bc, W_ENEMYBATTSTATUS2
|
ld bc, W_ENEMYBATTSTATUS2
|
||||||
.notEnemy
|
.notEnemy
|
||||||
ld a, [bc] ;load flags
|
ld a, [bc]
|
||||||
bit HasSubstituteUp, a ;user already has substitute?
|
bit HasSubstituteUp, a ; user already has substitute?
|
||||||
jr nz, .alreadyHasSubstitute ;skip this code if so
|
jr nz, .alreadyHasSubstitute
|
||||||
;user doesn't have a substitute [yet]
|
; quarter health to remove from user
|
||||||
|
; assumes max HP is 1023 or lower
|
||||||
push bc
|
push bc
|
||||||
ld a, [hli] ;load max hp
|
ld a, [hli]
|
||||||
ld b, [hl]
|
ld b, [hl]
|
||||||
srl a ;max hp / 4, [quarter health to remove from user]
|
srl a
|
||||||
rr b
|
rr b
|
||||||
srl a
|
srl a
|
||||||
rr b
|
rr b ; max hp / 4
|
||||||
push de
|
push de
|
||||||
ld de, wBattleMonHP - wBattleMonMaxHP
|
ld de, wBattleMonHP - wBattleMonMaxHP
|
||||||
add hl, de ; point hl to current HP
|
add hl, de ; point hl to current HP low byte
|
||||||
pop de
|
pop de
|
||||||
ld a, b
|
ld a, b
|
||||||
ld [de], a ;save copy of HP to subtract in ccd7/ccd8 [how much HP substitute has]
|
ld [de], a ; save copy of HP to subtract in ccd7/ccd8 [how much HP substitute has]
|
||||||
ld a, [hld] ;load current hp
|
ld a, [hld]
|
||||||
sub b ;subtract [max hp / 4]
|
; subtract [max hp / 4] to current HP
|
||||||
ld d, a ;save low byte result in D
|
sub b
|
||||||
|
ld d, a
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
sbc a, 0 ;borrow from high byte if needed
|
sbc 0
|
||||||
pop bc
|
pop bc
|
||||||
jr c, .notEnoughHP ;underflow means user would be left with negative health
|
jr c, .notEnoughHP ; underflow means user would be left with negative health
|
||||||
;bug: note since it only brances on carry, it will possibly leave user with 0HP
|
; bug: since it only brances on carry, it will possibly leave user with 0 HP
|
||||||
.userHasZeroOrMoreHP
|
.userHasZeroOrMoreHP
|
||||||
ldi [hl], a ;store high byte HP
|
ldi [hl], a ; save resulting HP after substraction into current HP
|
||||||
ld [hl], d ;store low byte HP
|
ld [hl], d
|
||||||
ld h, b
|
ld h, b
|
||||||
ld l, c
|
ld l, c
|
||||||
set HasSubstituteUp, [hl] ;set bit 4 of flags, user now has substitute
|
set HasSubstituteUp, [hl]
|
||||||
ld a, [W_OPTIONS] ;load options
|
ld a, [W_OPTIONS]
|
||||||
bit 7, a ;battle animation is enabled?
|
bit 7, a ; battle animation is enabled?
|
||||||
ld hl, PlayCurrentMoveAnimation ;animation enabled: 0F:7BA8
|
ld hl, PlayCurrentMoveAnimation
|
||||||
ld b, BANK(PlayCurrentMoveAnimation)
|
ld b, BANK(PlayCurrentMoveAnimation)
|
||||||
jr z, .animationEnabled
|
jr z, .animationEnabled
|
||||||
ld hl, AnimationSubstitute ;animation disabled: 1E:56E0
|
ld hl, AnimationSubstitute
|
||||||
ld b, BANK(AnimationSubstitute)
|
ld b, BANK(AnimationSubstitute)
|
||||||
.animationEnabled
|
.animationEnabled
|
||||||
call Bankswitch ;jump to routine depending on animation setting
|
call Bankswitch ; jump to routine depending on animation setting
|
||||||
ld hl, SubstituteText
|
ld hl, SubstituteText
|
||||||
call PrintText
|
call PrintText
|
||||||
ld hl, DrawHUDsAndHPBars
|
ld hl, DrawHUDsAndHPBars
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@ TransformEffect_: ; 3bab1 (e:7ab1)
|
||||||
ld a, [W_ENEMYBATTSTATUS1]
|
ld a, [W_ENEMYBATTSTATUS1]
|
||||||
ld a, [H_WHOSETURN]
|
ld a, [H_WHOSETURN]
|
||||||
and a
|
and a
|
||||||
jr nz, .asm_3bad1
|
jr nz, .hitTest
|
||||||
ld hl, wEnemyMonSpecies
|
ld hl, wEnemyMonSpecies
|
||||||
ld de, wBattleMonSpecies
|
ld de, wBattleMonSpecies
|
||||||
ld bc, W_PLAYERBATTSTATUS3
|
ld bc, W_PLAYERBATTSTATUS3
|
||||||
ld [wPlayerMoveListIndex], a
|
ld [wPlayerMoveListIndex], a
|
||||||
ld a, [W_PLAYERBATTSTATUS1]
|
ld a, [W_PLAYERBATTSTATUS1]
|
||||||
.asm_3bad1
|
.hitTest
|
||||||
bit Invulnerable, a ; is mon invulnerable to typical attacks? (fly/dig)
|
bit Invulnerable, a ; is mon invulnerable to typical attacks? (fly/dig)
|
||||||
jp nz, .failed
|
jp nz, .failed
|
||||||
push hl
|
push hl
|
||||||
|
|
@ -20,10 +20,11 @@ TransformEffect_: ; 3bab1 (e:7ab1)
|
||||||
ld hl, W_PLAYERBATTSTATUS2
|
ld hl, W_PLAYERBATTSTATUS2
|
||||||
ld a, [H_WHOSETURN]
|
ld a, [H_WHOSETURN]
|
||||||
and a
|
and a
|
||||||
jr z, .asm_3bae4
|
jr z, .transformEffect
|
||||||
ld hl, W_ENEMYBATTSTATUS2
|
ld hl, W_ENEMYBATTSTATUS2
|
||||||
.asm_3bae4
|
.transformEffect
|
||||||
bit HasSubstituteUp, [hl]
|
; animation(s) played are different if target has Substitute up
|
||||||
|
bit HasSubstituteUp, [hl]
|
||||||
push af
|
push af
|
||||||
ld hl, Func_79747
|
ld hl, Func_79747
|
||||||
ld b, BANK(Func_79747)
|
ld b, BANK(Func_79747)
|
||||||
|
|
@ -32,10 +33,10 @@ TransformEffect_: ; 3bab1 (e:7ab1)
|
||||||
add a
|
add a
|
||||||
ld hl, PlayCurrentMoveAnimation
|
ld hl, PlayCurrentMoveAnimation
|
||||||
ld b, BANK(PlayCurrentMoveAnimation)
|
ld b, BANK(PlayCurrentMoveAnimation)
|
||||||
jr nc, .asm_3baff
|
jr nc, .gotAnimToPlay
|
||||||
ld hl, AnimationTransformMon
|
ld hl, AnimationTransformMon
|
||||||
ld b, BANK(AnimationTransformMon)
|
ld b, BANK(AnimationTransformMon)
|
||||||
.asm_3baff
|
.gotAnimToPlay
|
||||||
call Bankswitch
|
call Bankswitch
|
||||||
ld hl, Func_79771
|
ld hl, Func_79771
|
||||||
ld b, BANK(Func_79771)
|
ld b, BANK(Func_79771)
|
||||||
|
|
@ -43,15 +44,18 @@ TransformEffect_: ; 3bab1 (e:7ab1)
|
||||||
call nz, Bankswitch
|
call nz, Bankswitch
|
||||||
pop bc
|
pop bc
|
||||||
ld a, [bc]
|
ld a, [bc]
|
||||||
set Transformed, a
|
set Transformed, a ; mon is now Transformed
|
||||||
ld [bc], a
|
ld [bc], a
|
||||||
pop de
|
pop de
|
||||||
pop hl
|
pop hl
|
||||||
push hl
|
push hl
|
||||||
ld a, [hl]
|
; transform user into opposing Pokemon
|
||||||
|
; species
|
||||||
|
ld a, [hl]
|
||||||
ld [de], a
|
ld [de], a
|
||||||
|
; type 1, type 2, catch rate, and moves
|
||||||
ld bc, $5
|
ld bc, $5
|
||||||
add hl, bc
|
add hl, bc
|
||||||
inc de
|
inc de
|
||||||
inc de
|
inc de
|
||||||
inc de
|
inc de
|
||||||
|
|
@ -62,20 +66,23 @@ TransformEffect_: ; 3bab1 (e:7ab1)
|
||||||
call CopyData
|
call CopyData
|
||||||
ld a, [H_WHOSETURN]
|
ld a, [H_WHOSETURN]
|
||||||
and a
|
and a
|
||||||
jr z, .asm_3bb32
|
jr z, .next
|
||||||
|
; save enemy mon DVs in wcceb/wccec (enemy turn only)
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
ld [wcceb], a
|
ld [wcceb], a
|
||||||
inc de
|
inc de
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
ld [wccec], a
|
ld [wccec], a
|
||||||
dec de
|
dec de
|
||||||
.asm_3bb32
|
.next
|
||||||
|
; DVs
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
ld [de], a
|
ld [de], a
|
||||||
inc de
|
inc de
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
ld [de], a
|
ld [de], a
|
||||||
inc de
|
inc de
|
||||||
|
; Attack, Defense, Speed, and Special stats
|
||||||
inc hl
|
inc hl
|
||||||
inc hl
|
inc hl
|
||||||
inc hl
|
inc hl
|
||||||
|
|
@ -84,48 +91,51 @@ TransformEffect_: ; 3bab1 (e:7ab1)
|
||||||
inc de
|
inc de
|
||||||
ld bc, $8
|
ld bc, $8
|
||||||
call CopyData
|
call CopyData
|
||||||
ld bc, $ffef
|
ld bc, wBattleMonMoves - wBattleMonPP
|
||||||
add hl, bc
|
add hl, bc ; ld hl, wBattleMonMoves
|
||||||
ld b, $4
|
ld b, NUM_MOVES
|
||||||
.asm_3bb4a
|
.copyPPLoop
|
||||||
|
; 5 PP for all moves
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
and a
|
and a
|
||||||
jr z, .asm_3bb57
|
jr z, .lessThanFourMoves
|
||||||
ld a, $5
|
ld a, $5
|
||||||
ld [de], a
|
ld [de], a
|
||||||
inc de
|
inc de
|
||||||
dec b
|
dec b
|
||||||
jr nz, .asm_3bb4a
|
jr nz, .copyPPLoop
|
||||||
jr .asm_3bb5d
|
jr .copyStats
|
||||||
.asm_3bb57
|
.lessThanFourMoves
|
||||||
|
; 0 PP for blank moves
|
||||||
xor a
|
xor a
|
||||||
ld [de], a
|
ld [de], a
|
||||||
inc de
|
inc de
|
||||||
dec b
|
dec b
|
||||||
jr nz, .asm_3bb57
|
jr nz, .lessThanFourMoves
|
||||||
.asm_3bb5d
|
.copyStats
|
||||||
|
; original (unmodified) stats and stat mods
|
||||||
pop hl
|
pop hl
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
ld [wd11e], a
|
ld [wd11e], a
|
||||||
call GetMonName
|
call GetMonName
|
||||||
ld hl, wEnemyMonUnmodifiedAttack
|
ld hl, wEnemyMonUnmodifiedAttack
|
||||||
ld de, wPlayerMonUnmodifiedAttack
|
ld de, wPlayerMonUnmodifiedAttack
|
||||||
call .copyBasedOnTurn
|
call .copyBasedOnTurn ; original (unmodified) stats
|
||||||
ld hl, wEnemyMonStatMods
|
ld hl, wEnemyMonStatMods
|
||||||
ld de, wPlayerMonStatMods
|
ld de, wPlayerMonStatMods
|
||||||
call .copyBasedOnTurn
|
call .copyBasedOnTurn ; stat mods
|
||||||
ld hl, TransformedText
|
ld hl, TransformedText
|
||||||
jp PrintText
|
jp PrintText
|
||||||
|
|
||||||
.copyBasedOnTurn
|
.copyBasedOnTurn
|
||||||
ld a, [H_WHOSETURN]
|
ld a, [H_WHOSETURN]
|
||||||
and a
|
and a
|
||||||
jr z, .asm_3bb86
|
jr z, .gotStatsOrModsToCopy
|
||||||
push hl
|
push hl
|
||||||
ld h, d
|
ld h, d
|
||||||
ld l, e
|
ld l, e
|
||||||
pop de
|
pop de
|
||||||
.asm_3bb86
|
.gotStatsOrModsToCopy
|
||||||
ld bc, $8
|
ld bc, $8
|
||||||
jp CopyData
|
jp CopyData
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue