summaryrefslogtreecommitdiff
path: root/engine/battle
diff options
context:
space:
mode:
Diffstat (limited to 'engine/battle')
-rw-r--r--engine/battle/ai/items.asm2
-rw-r--r--engine/battle/ai/switch.asm16
-rw-r--r--engine/battle/effect_commands.asm38
-rw-r--r--engine/battle/move_effects/mirror_coat.asm4
4 files changed, 30 insertions, 30 deletions
diff --git a/engine/battle/ai/items.asm b/engine/battle/ai/items.asm
index 4eead5fd3..28dfb1010 100644
--- a/engine/battle/ai/items.asm
+++ b/engine/battle/ai/items.asm
@@ -806,7 +806,7 @@ EnemyUsedXItem:
push bc
call PrintText_UsedItemOn
pop bc
- farcall CheckIfStatCanBeRaised
+ farcall RaiseStat
jp AIUpdateHUD
; Parameter
diff --git a/engine/battle/ai/switch.asm b/engine/battle/ai/switch.asm
index b9bd2ea60..b12087e23 100644
--- a/engine/battle/ai/switch.asm
+++ b/engine/battle/ai/switch.asm
@@ -30,11 +30,11 @@ CheckPlayerMoveTypeMatchups:
ld hl, wEnemyMonType
call CheckTypeMatchup
ld a, [wTypeMatchup]
- cp 10 + 1 ; 1.0 + 0.1
+ cp EFFECTIVE + 1 ; 1.0 + 0.1
jr nc, .super_effective
and a
jr z, .next
- cp 10 ; 1.0
+ cp EFFECTIVE ; 1.0
jr nc, .neutral
.not_very_effective
@@ -75,7 +75,7 @@ CheckPlayerMoveTypeMatchups:
ld hl, wEnemyMonType1
call CheckTypeMatchup
ld a, [wTypeMatchup]
- cp 10 + 1 ; 1.0 + 0.1
+ cp EFFECTIVE + 1 ; 1.0 + 0.1
jr c, .ok
call .DecreaseScore
.ok
@@ -84,7 +84,7 @@ CheckPlayerMoveTypeMatchups:
jr z, .ok2
call CheckTypeMatchup
ld a, [wTypeMatchup]
- cp 10 + 1 ; 1.0 + 0.1
+ cp EFFECTIVE + 1 ; 1.0 + 0.1
jr c, .ok2
call .DecreaseScore
.ok2
@@ -130,7 +130,7 @@ CheckPlayerMoveTypeMatchups:
; not very effective
inc c
- cp 10
+ cp EFFECTIVE
jr c, .loop2
; neutral
@@ -139,7 +139,7 @@ CheckPlayerMoveTypeMatchups:
inc c
inc c
inc c
- cp 10
+ cp EFFECTIVE
jr z, .loop2
; super effective
@@ -481,7 +481,7 @@ FindEnemyMonsWithASuperEffectiveMove:
; if neutral: load 1 and continue
ld e, 1
- cp 10 + 1
+ cp EFFECTIVE + 1
jr c, .nope
; if super-effective: load 2 and break
@@ -584,7 +584,7 @@ FindEnemyMonsThatResistPlayer:
ld hl, wBaseType
call CheckTypeMatchup
ld a, [wTypeMatchup]
- cp 10 + 1
+ cp EFFECTIVE + 1
jr nc, .dont_choose_mon
ld a, b
diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm
index 32cc65e35..91c021a72 100644
--- a/engine/battle/effect_commands.asm
+++ b/engine/battle/effect_commands.asm
@@ -2363,10 +2363,12 @@ BattleCommand_SuperEffectiveText:
.print
jp StdBattleTextBox
-BattleCommand_CheckDestinyBond:
-; checkdestinybond
+BattleCommand_CheckFaint:
+; checkfaint
-; Faint the user if it fainted an opponent using Destiny Bond.
+; Faint the opponent if its HP reached zero
+; and faint the user along with it if it used Destiny Bond.
+; Ends the move effect if the opponent faints.
ld hl, wEnemyMonHP
ld a, [hBattleTurn]
@@ -2594,7 +2596,7 @@ PlayerAttackDamage:
.physicalcrit
ld hl, wBattleMonAttack
- call GetDamageStatsCritical
+ call CheckDamageStatsCritical
jr c, .thickclub
ld hl, wEnemyDefense
@@ -2618,7 +2620,7 @@ PlayerAttackDamage:
.specialcrit
ld hl, wBattleMonSpclAtk
- call GetDamageStatsCritical
+ call CheckDamageStatsCritical
jr c, .lightball
ld hl, wEnemySpDef
@@ -2692,20 +2694,16 @@ TruncateHL_BC:
ld b, l
ret
-GetDamageStatsCritical:
-; Return carry if non-critical.
+CheckDamageStatsCritical:
+; Return carry if boosted stats should be used in damage calculations.
+; Unboosted stats should be used if the attack is a critical hit,
+; and the stage of the opponent's defense is higher than the user's attack.
ld a, [wCriticalHit]
and a
scf
ret z
- ; fallthrough
-
-GetDamageStats:
-; Return the attacker's offensive stat and the defender's defensive
-; stat based on whether the attacking type is physical or special.
-
push hl
push bc
ld a, [hBattleTurn]
@@ -2840,7 +2838,7 @@ EnemyAttackDamage:
.physicalcrit
ld hl, wEnemyMonAttack
- call GetDamageStatsCritical
+ call CheckDamageStatsCritical
jr c, .thickclub
ld hl, wPlayerDefense
@@ -2864,7 +2862,7 @@ EnemyAttackDamage:
.specialcrit
ld hl, wEnemyMonSpclAtk
- call GetDamageStatsCritical
+ call CheckDamageStatsCritical
jr c, .lightball
ld hl, wPlayerSpDef
ld a, [hli]
@@ -4185,13 +4183,13 @@ BattleCommand_EvasionUp2:
BattleCommand_StatUp:
; statup
- call CheckIfStatCanBeRaised
+ call RaiseStat
ld a, [wFailedMessage]
and a
ret nz
- jp StatUpAnimation
+ jp MinimizeDropSub
-CheckIfStatCanBeRaised:
+RaiseStat:
ld a, b
ld [wLoweredStat], a
ld hl, wPlayerStatLevels
@@ -4287,7 +4285,9 @@ CheckIfStatCanBeRaised:
ld [wFailedMessage], a
ret
-StatUpAnimation:
+MinimizeDropSub:
+; Lower the substitute if we're minimizing
+
ld bc, wPlayerMinimized
ld hl, DropPlayerSub
ld a, [hBattleTurn]
diff --git a/engine/battle/move_effects/mirror_coat.asm b/engine/battle/move_effects/mirror_coat.asm
index fb3a30d58..96afa3175 100644
--- a/engine/battle/move_effects/mirror_coat.asm
+++ b/engine/battle/move_effects/mirror_coat.asm
@@ -29,11 +29,11 @@ BattleCommand_MirrorCoat:
ld de, wStringBuffer1
call GetMoveData
- ld a, [wStringBuffer1 + 2]
+ ld a, [wStringBuffer1 + MOVE_POWER]
and a
ret z
- ld a, [wStringBuffer1 + 3]
+ ld a, [wStringBuffer1 + MOVE_TYPE]
cp SPECIAL
ret c