summaryrefslogtreecommitdiff
path: root/engine/battle/moveEffects
diff options
context:
space:
mode:
Diffstat (limited to 'engine/battle/moveEffects')
-rw-r--r--engine/battle/moveEffects/conversion_effect.asm2
-rw-r--r--engine/battle/moveEffects/drain_hp_effect.asm14
-rw-r--r--engine/battle/moveEffects/focus_energy_effect.asm6
-rw-r--r--engine/battle/moveEffects/haze_effect.asm10
-rw-r--r--engine/battle/moveEffects/heal_effect.asm6
-rw-r--r--engine/battle/moveEffects/leech_seed_effect.asm20
-rw-r--r--engine/battle/moveEffects/mist_effect.asm4
-rw-r--r--engine/battle/moveEffects/one_hit_ko_effect.asm6
-rw-r--r--engine/battle/moveEffects/paralyze_effect.asm16
-rw-r--r--engine/battle/moveEffects/pay_day_effect.asm6
-rw-r--r--engine/battle/moveEffects/recoil_effect.asm6
-rw-r--r--engine/battle/moveEffects/reflect_light_screen_effect.asm2
-rw-r--r--engine/battle/moveEffects/substitute_effect.asm30
-rw-r--r--engine/battle/moveEffects/transform_effect.asm28
14 files changed, 72 insertions, 84 deletions
diff --git a/engine/battle/moveEffects/conversion_effect.asm b/engine/battle/moveEffects/conversion_effect.asm
index 2f05afb3..e4c5b4bd 100644
--- a/engine/battle/moveEffects/conversion_effect.asm
+++ b/engine/battle/moveEffects/conversion_effect.asm
@@ -13,7 +13,7 @@ ConversionEffect_: ; 139a3 (4:79a3)
.conversionEffect
bit Invulnerable, a ; is mon immune to typical attacks (dig/fly)
jr nz, PrintButItFailedText
-; copy target's types to user
+; copy target's types to user
ld a, [hli]
ld [de], a
inc de
diff --git a/engine/battle/moveEffects/drain_hp_effect.asm b/engine/battle/moveEffects/drain_hp_effect.asm
index 517d53d1..1096794f 100644
--- a/engine/battle/moveEffects/drain_hp_effect.asm
+++ b/engine/battle/moveEffects/drain_hp_effect.asm
@@ -1,5 +1,5 @@
DrainHPEffect_: ; 783f (1:783f)
- ld hl, W_DAMAGE
+ ld hl, W_DAMAGE
ld a, [hl]
srl a ; divide damage by 2
ld [hli], a
@@ -17,8 +17,8 @@ DrainHPEffect_: ; 783f (1:783f)
ld a, [H_WHOSETURN]
and a
jp z, .addDamageToAttackerHP
- ld hl, wEnemyMonHP
- ld de, wEnemyMonMaxHP
+ ld hl, wEnemyMonHP
+ ld de, wEnemyMonMaxHP
.addDamageToAttackerHP
ld bc, wHPBarOldHP+1
; copy current HP to wHPBarOldHP
@@ -41,7 +41,7 @@ DrainHPEffect_: ; 783f (1:783f)
add b
ld [hld], a
ld [wHPBarNewHP], a
- ld a, [W_DAMAGE]
+ ld a, [W_DAMAGE]
ld b, [hl]
adc b
ld [hli], a
@@ -71,10 +71,10 @@ DrainHPEffect_: ; 783f (1:783f)
.next
ld a, [H_WHOSETURN]
and a
- hlCoord 10, 9
+ coord hl, 10, 9
ld a, $1
jr z, .next2
- hlCoord 2, 2
+ coord hl, 2, 2
xor a
.next2
ld [wHPBarType], a
@@ -87,7 +87,7 @@ DrainHPEffect_: ; 783f (1:783f)
and a
ld a, [W_PLAYERMOVEEFFECT]
jr z, .next3
- ld a, [W_ENEMYMOVEEFFECT]
+ ld a, [W_ENEMYMOVEEFFECT]
.next3
cp DREAM_EATER_EFFECT
jr nz, .printText
diff --git a/engine/battle/moveEffects/focus_energy_effect.asm b/engine/battle/moveEffects/focus_energy_effect.asm
index 0089c8b1..e88d065a 100644
--- a/engine/battle/moveEffects/focus_energy_effect.asm
+++ b/engine/battle/moveEffects/focus_energy_effect.asm
@@ -12,11 +12,9 @@ FocusEnergyEffect_: ; f628b (3d:628b)
ld hl, GettingPumpedText
jp PrintText
.alreadyUsing
- ld c, $32
+ ld c, 50
call DelayFrames
- ld hl, PrintButItFailedText_
- ld b, BANK(PrintButItFailedText_)
- jp Bankswitch
+ jpab PrintButItFailedText_
GettingPumpedText: ; f62b5 (3d:62b5)
db $0a
diff --git a/engine/battle/moveEffects/haze_effect.asm b/engine/battle/moveEffects/haze_effect.asm
index 14b5f5dd..5c5443c0 100644
--- a/engine/battle/moveEffects/haze_effect.asm
+++ b/engine/battle/moveEffects/haze_effect.asm
@@ -1,11 +1,11 @@
HazeEffect_: ; 139da (4:79da)
ld a, $7
-; store 7 on every stat mod
+; store 7 on every stat mod
ld hl, wPlayerMonAttackMod
call ResetStatMods
ld hl, wEnemyMonAttackMod
call ResetStatMods
-; copy unmodified stats to battle stats
+; copy unmodified stats to battle stats
ld hl, wPlayerMonUnmodifiedAttack
ld de, wBattleMonAttack
call ResetStats
@@ -25,7 +25,7 @@ HazeEffect_: ; 139da (4:79da)
ld [hl], $0
and SLP | (1 << FRZ)
jr z, .cureVolatileStatuses
-; prevent the Pokemon from executing a move if it was asleep or frozen
+; prevent the Pokemon from executing a move if it was asleep or frozen
ld a, $ff
ld [de], a
@@ -51,7 +51,7 @@ CureVolatileStatuses: ; 13a37 (4:7a37)
inc hl ; BATTSTATUS2
ld a, [hl]
; clear UsingXAccuracy, ProtectedByMist, GettingPumped, and Seeded statuses
- and $ff ^((1 << UsingXAccuracy) | (1 << ProtectedByMist) | (1 << GettingPumped) | (1 << Seeded))
+ and $ff ^((1 << UsingXAccuracy) | (1 << ProtectedByMist) | (1 << GettingPumped) | (1 << Seeded))
ld [hli], a ; BATTSTATUS3
ld a, [hl]
and %11110000 | (1 << Transformed) ; clear Bad Poison, Reflect and Light Screen statuses
@@ -61,7 +61,7 @@ CureVolatileStatuses: ; 13a37 (4:7a37)
ResetStatMods: ; 13a43 (4:7a43)
ld b, $8
.loop
- ld [hli], a
+ ld [hli], a
dec b
jr nz, .loop
ret
diff --git a/engine/battle/moveEffects/heal_effect.asm b/engine/battle/moveEffects/heal_effect.asm
index d6d4e183..dbce6ebb 100644
--- a/engine/battle/moveEffects/heal_effect.asm
+++ b/engine/battle/moveEffects/heal_effect.asm
@@ -76,7 +76,7 @@ HealEffect_: ; f62ba (3d:62ba)
ld a, [de]
sbc [hl]
jr c, .playAnim
-; copy max HP to current HP if an overflow ocurred
+; copy max HP to current HP if an overflow ocurred
ld a, [hli]
ld [de], a
ld [wHPBarNewHP+1], a
@@ -89,10 +89,10 @@ HealEffect_: ; f62ba (3d:62ba)
call Bankswitch3DtoF
ld a, [H_WHOSETURN]
and a
- hlCoord 10, 9
+ coord hl, 10, 9
ld a, $1
jr z, .updateHPBar
- hlCoord 2, 2
+ coord hl, 2, 2
xor a
.updateHPBar
ld [wHPBarType], a
diff --git a/engine/battle/moveEffects/leech_seed_effect.asm b/engine/battle/moveEffects/leech_seed_effect.asm
index e29fd7c2..1b0afe4b 100644
--- a/engine/battle/moveEffects/leech_seed_effect.asm
+++ b/engine/battle/moveEffects/leech_seed_effect.asm
@@ -1,20 +1,20 @@
LeechSeedEffect_: ; 2bea9 (a:7ea9)
callab MoveHitTest
- ld a, [W_MOVEMISSED]
+ ld a, [W_MOVEMISSED]
and a
jr nz, .moveMissed
- ld hl, W_ENEMYBATTSTATUS2
- ld de, wEnemyMonType1
- ld a, [H_WHOSETURN]
+ ld hl, W_ENEMYBATTSTATUS2
+ ld de, wEnemyMonType1
+ ld a, [H_WHOSETURN]
and a
jr z, .leechSeedEffect
- ld hl, W_PLAYERBATTSTATUS2
- ld de, wBattleMonType1
+ ld hl, W_PLAYERBATTSTATUS2
+ ld de, wBattleMonType1
.leechSeedEffect
; miss if the target is grass-type or already seeded
ld a, [de]
cp GRASS
- jr z, .moveMissed
+ jr z, .moveMissed
inc de
ld a, [de]
cp GRASS
@@ -23,12 +23,12 @@ LeechSeedEffect_: ; 2bea9 (a:7ea9)
jr nz, .moveMissed
set Seeded, [hl]
callab PlayCurrentMoveAnimation
- ld hl, WasSeededText ; $7ef2
+ ld hl, WasSeededText
jp PrintText
.moveMissed
- ld c, $32
+ ld c, 50
call DelayFrames
- ld hl, EvadedAttackText ; $7ef7
+ ld hl, EvadedAttackText
jp PrintText
WasSeededText: ; 2bef2 (a:7ef2)
diff --git a/engine/battle/moveEffects/mist_effect.asm b/engine/battle/moveEffects/mist_effect.asm
index ed06d16c..5d7669f8 100644
--- a/engine/battle/moveEffects/mist_effect.asm
+++ b/engine/battle/moveEffects/mist_effect.asm
@@ -12,9 +12,7 @@ MistEffect_: ; f64ac (3d:64ac)
ld hl, ShroudedInMistText
jp PrintText
.mistAlreadyInUse
- ld hl, PrintButItFailedText_
- ld b, BANK(PrintButItFailedText_)
- jp Bankswitch
+ jpab PrintButItFailedText_
ShroudedInMistText: ; f64d3 (3d:64d3)
TX_FAR _ShroudedInMistText
diff --git a/engine/battle/moveEffects/one_hit_ko_effect.asm b/engine/battle/moveEffects/one_hit_ko_effect.asm
index f859f9c4..c1dde6ff 100644
--- a/engine/battle/moveEffects/one_hit_ko_effect.asm
+++ b/engine/battle/moveEffects/one_hit_ko_effect.asm
@@ -7,7 +7,7 @@ OneHitKOEffect_: ; f64db (3d:64db)
ld [wCriticalHitOrOHKO], a
ld hl, wBattleMonSpeed + 1
ld de, wEnemyMonSpeed + 1
- ld a, [H_WHOSETURN]
+ ld a, [H_WHOSETURN]
and a
jr z, .compareSpeed
ld hl, wEnemyMonSpeed + 1
@@ -24,7 +24,7 @@ OneHitKOEffect_: ; f64db (3d:64db)
ld a, [hl]
sbc b
jr c, .userIsSlower
- ld hl, W_DAMAGE
+ ld hl, W_DAMAGE
ld a, $ff
ld [hli], a
ld [hl], a
@@ -34,5 +34,5 @@ OneHitKOEffect_: ; f64db (3d:64db)
.userIsSlower
; keep damage at 0 and set move missed flag if target's current speed is higher instead
ld a, $1
- ld [W_MOVEMISSED], a
+ ld [W_MOVEMISSED], a
ret
diff --git a/engine/battle/moveEffects/paralyze_effect.asm b/engine/battle/moveEffects/paralyze_effect.asm
index 74a7319d..3e0cf062 100644
--- a/engine/battle/moveEffects/paralyze_effect.asm
+++ b/engine/battle/moveEffects/paralyze_effect.asm
@@ -4,7 +4,7 @@ ParalyzeEffect_: ; f6562 (3d:6562)
ld a, [H_WHOSETURN]
and a
jp z, .next
- ld hl, wBattleMonStatus
+ ld hl, wBattleMonStatus
ld de, W_ENEMYMOVETYPE
.next
ld a, [hl]
@@ -28,7 +28,7 @@ ParalyzeEffect_: ; f6562 (3d:6562)
push hl
callab MoveHitTest
pop hl
- ld a, [W_MOVEMISSED]
+ ld a, [W_MOVEMISSED]
and a
jr nz, .didntAffect
set PAR, [hl]
@@ -36,18 +36,12 @@ ParalyzeEffect_: ; f6562 (3d:6562)
ld c, 30
call DelayFrames
callab PlayCurrentMoveAnimation
- ld hl, PrintMayNotAttackText
- ld b, BANK(PrintMayNotAttackText)
- jp Bankswitch
+ jpab PrintMayNotAttackText
.didntAffect
ld c, 50
call DelayFrames
- ld hl, PrintDidntAffectText
- ld b, BANK(PrintDidntAffectText)
- jp Bankswitch
+ jpab PrintDidntAffectText
.doesntAffect
ld c, 50
call DelayFrames
- ld hl, PrintDoesntAffectText
- ld b, BANK(PrintDoesntAffectText)
- jp Bankswitch
+ jpab PrintDoesntAffectText
diff --git a/engine/battle/moveEffects/pay_day_effect.asm b/engine/battle/moveEffects/pay_day_effect.asm
index 1fab9771..2fa6b53f 100644
--- a/engine/battle/moveEffects/pay_day_effect.asm
+++ b/engine/battle/moveEffects/pay_day_effect.asm
@@ -9,19 +9,19 @@ PayDayEffect_ ; f6511 (3d:6511)
ld a, [wEnemyMonLevel]
.payDayEffect
; level * 2
- add a
+ add a
ld [H_DIVIDEND + 3], a
xor a
ld [H_DIVIDEND], a
ld [H_DIVIDEND + 1], a
ld [H_DIVIDEND + 2], a
-; convert to BCD
+; convert to BCD
ld a, 100
ld [H_DIVISOR], a
ld b, $4
call Divide
ld a, [H_QUOTIENT + 3]
- ld [hli], a
+ ld [hli], a
ld a, [H_REMAINDER]
ld [H_DIVIDEND + 3], a
ld a, 10
diff --git a/engine/battle/moveEffects/recoil_effect.asm b/engine/battle/moveEffects/recoil_effect.asm
index fe516c03..51232af6 100644
--- a/engine/battle/moveEffects/recoil_effect.asm
+++ b/engine/battle/moveEffects/recoil_effect.asm
@@ -46,19 +46,19 @@ RecoilEffect_: ; 1392c (4:792c)
ld [wHPBarNewHP+1], a
jr nc, .getHPBarCoords
; if recoil damage is higher than the Pokemon's HP, set its HP to 0
- xor a
+ xor a
ld [hli], a
ld [hl], a
ld hl, wHPBarNewHP
ld [hli], a
ld [hl], a
.getHPBarCoords
- hlCoord 10, 9
+ coord hl, 10, 9
ld a, [H_WHOSETURN]
and a
ld a, $1
jr z, .updateHPBar
- hlCoord 2, 2
+ coord hl, 2, 2
xor a
.updateHPBar
ld [wHPBarType], a
diff --git a/engine/battle/moveEffects/reflect_light_screen_effect.asm b/engine/battle/moveEffects/reflect_light_screen_effect.asm
index 83a97486..ee053670 100644
--- a/engine/battle/moveEffects/reflect_light_screen_effect.asm
+++ b/engine/battle/moveEffects/reflect_light_screen_effect.asm
@@ -27,7 +27,7 @@ ReflectLightScreenEffect_: ; f645d (3d:645d)
pop hl
jp PrintText
.moveFailed
- ld c, $32
+ ld c, 50
call DelayFrames
ld hl, PrintButItFailedText_
jp Bankswitch3DtoF
diff --git a/engine/battle/moveEffects/substitute_effect.asm b/engine/battle/moveEffects/substitute_effect.asm
index 8412e281..c72fffbe 100644
--- a/engine/battle/moveEffects/substitute_effect.asm
+++ b/engine/battle/moveEffects/substitute_effect.asm
@@ -11,15 +11,15 @@ SubstituteEffect_: ; 17dad (5:7dad)
ld de, wEnemySubstituteHP
ld bc, W_ENEMYBATTSTATUS2
.notEnemy
- ld a, [bc]
+ ld a, [bc]
bit HasSubstituteUp, a ; user already has substitute?
- jr nz, .alreadyHasSubstitute
+ jr nz, .alreadyHasSubstitute
; quarter health to remove from user
-; assumes max HP is 1023 or lower
+; assumes max HP is 1023 or lower
push bc
ld a, [hli]
ld b, [hl]
- srl a
+ srl a
rr b
srl a
rr b ; max hp / 4
@@ -27,37 +27,35 @@ SubstituteEffect_: ; 17dad (5:7dad)
ld de, wBattleMonHP - wBattleMonMaxHP
add hl, de ; point hl to current HP low byte
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 a, [hld]
-; subtract [max hp / 4] to current HP
- sub b
+; subtract [max hp / 4] to current HP
+ sub b
ld d, a
ld a, [hl]
- sbc 0
+ sbc 0
pop bc
jr c, .notEnoughHP ; underflow means user would be left with negative health
; bug: since it only brances on carry, it will possibly leave user with 0 HP
.userHasZeroOrMoreHP
ldi [hl], a ; save resulting HP after substraction into current HP
- ld [hl], d
+ ld [hl], d
ld h, b
ld l, c
- set HasSubstituteUp, [hl]
- ld a, [W_OPTIONS]
+ set HasSubstituteUp, [hl]
+ ld a, [W_OPTIONS]
bit 7, a ; battle animation is enabled?
- ld hl, PlayCurrentMoveAnimation
+ ld hl, PlayCurrentMoveAnimation
ld b, BANK(PlayCurrentMoveAnimation)
jr z, .animationEnabled
- ld hl, AnimationSubstitute
+ ld hl, AnimationSubstitute
ld b, BANK(AnimationSubstitute)
.animationEnabled
call Bankswitch ; jump to routine depending on animation setting
ld hl, SubstituteText
call PrintText
- ld hl, DrawHUDsAndHPBars
- ld b, BANK(DrawHUDsAndHPBars)
- jp Bankswitch
+ jpab DrawHUDsAndHPBars
.alreadyHasSubstitute
ld hl, HasSubstituteText
jr .printText
diff --git a/engine/battle/moveEffects/transform_effect.asm b/engine/battle/moveEffects/transform_effect.asm
index 74b70431..fef6f7aa 100644
--- a/engine/battle/moveEffects/transform_effect.asm
+++ b/engine/battle/moveEffects/transform_effect.asm
@@ -24,10 +24,10 @@ TransformEffect_: ; f637f (3d:637f)
ld hl, W_ENEMYBATTSTATUS2
.transformEffect
; animation(s) played are different if target has Substitute up
- bit HasSubstituteUp, [hl]
+ bit HasSubstituteUp, [hl]
push af
- ld hl, Func_79816
- ld b, BANK(Func_79816)
+ ld hl, HideSubstituteShowMonAnim
+ ld b, BANK(HideSubstituteShowMonAnim)
call nz, Bankswitch
ld a, [W_OPTIONS]
add a
@@ -38,8 +38,8 @@ TransformEffect_: ; f637f (3d:637f)
ld b, BANK(AnimationTransformMon)
.gotAnimToPlay
call Bankswitch
- ld hl, Func_798b2
- ld b, BANK(Func_798b2)
+ ld hl, ReshowSubstituteAnim
+ ld b, BANK(ReshowSubstituteAnim)
pop af
call nz, Bankswitch
pop bc
@@ -49,13 +49,13 @@ TransformEffect_: ; f637f (3d:637f)
pop de
pop hl
push hl
-; transform user into opposing Pokemon
+; transform user into opposing Pokemon
; species
- ld a, [hl]
+ ld a, [hl]
ld [de], a
-; type 1, type 2, catch rate, and moves
+; type 1, type 2, catch rate, and moves
ld bc, $5
- add hl, bc
+ add hl, bc
inc de
inc de
inc de
@@ -67,12 +67,12 @@ TransformEffect_: ; f637f (3d:637f)
ld a, [H_WHOSETURN]
and a
jr z, .next
-; save enemy mon DVs in wcceb/wccec (enemy turn only)
+; save enemy mon DVs at wTransformedEnemyMonOriginalDVs
ld a, [de]
- ld [wcceb], a
+ ld [wTransformedEnemyMonOriginalDVs], a
inc de
ld a, [de]
- ld [wccec], a
+ ld [wTransformedEnemyMonOriginalDVs + 1], a
dec de
.next
; DVs
@@ -82,7 +82,7 @@ TransformEffect_: ; f637f (3d:637f)
ld a, [hli]
ld [de], a
inc de
-; Attack, Defense, Speed, and Special stats
+; Attack, Defense, Speed, and Special stats
inc hl
inc hl
inc hl
@@ -91,7 +91,7 @@ TransformEffect_: ; f637f (3d:637f)
inc de
ld bc, $8
call CopyData
- ld bc, wBattleMonMoves - wBattleMonPP
+ ld bc, wBattleMonMoves - wBattleMonPP
add hl, bc ; ld hl, wBattleMonMoves
ld b, NUM_MOVES
.copyPPLoop