summaryrefslogtreecommitdiff
path: root/engine/battle/effect_commands.asm
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2020-07-05 15:14:07 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2020-07-05 15:14:07 -0400
commit7324c1d11a97c9ff7bc9cf16ca525f9f66c5db3e (patch)
tree4a5be1a45e90f4c9808ec29ee4a94d104123754c /engine/battle/effect_commands.asm
parenta33e8713bd9ae2a4e517e434d25fc3c4a4819065 (diff)
Use MAX_NEUTRAL_DAMAGE in BattleCommand_DamageCalc
Also make .gitignore consistent with pokered
Diffstat (limited to 'engine/battle/effect_commands.asm')
-rw-r--r--engine/battle/effect_commands.asm50
1 files changed, 26 insertions, 24 deletions
diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm
index 054eeaca..4ecd8d44 100644
--- a/engine/battle/effect_commands.asm
+++ b/engine/battle/effect_commands.asm
@@ -3061,72 +3061,73 @@ BattleCommand_DamageCalc:
; Critical hits
call .CriticalMultiplier
-; Update wCurDamage (capped at 997).
+; Update wCurDamage.
+; Capped at MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE: 999 - 2 = 997.
ld hl, wCurDamage
ld b, [hl]
- ldh a, [hProduct + 3]
+ ldh a, [hQuotient + 3]
add b
- ldh [hProduct + 3], a
+ ldh [hQuotient + 3], a
jr nc, .dont_cap_1
- ldh a, [hProduct + 2]
+ ldh a, [hQuotient + 2]
inc a
- ldh [hProduct + 2], a
+ ldh [hQuotient + 2], a
and a
jr z, .Cap
.dont_cap_1
- ldh a, [hProduct]
+ ldh a, [hQuotient]
ld b, a
- ldh a, [hProduct + 1]
+ ldh a, [hQuotient + 1]
or a
jr nz, .Cap
- ldh a, [hProduct + 2]
- cp HIGH(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1)
+ ldh a, [hQuotient + 2]
+ cp HIGH(MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE + 1)
jr c, .dont_cap_2
- cp HIGH(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1) + 1
+ cp HIGH(MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE + 1) + 1
jr nc, .Cap
- ldh a, [hProduct + 3]
- cp LOW(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1)
+ ldh a, [hQuotient + 3]
+ cp LOW(MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE + 1)
jr nc, .Cap
.dont_cap_2
inc hl
- ldh a, [hProduct + 3]
+ ldh a, [hQuotient + 3]
ld b, [hl]
add b
ld [hld], a
- ldh a, [hProduct + 2]
+ ldh a, [hQuotient + 2]
ld b, [hl]
adc b
ld [hl], a
jr c, .Cap
ld a, [hl]
- cp HIGH(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1)
+ cp HIGH(MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE + 1)
jr c, .dont_cap_3
- cp HIGH(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1) + 1
+ cp HIGH(MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE + 1) + 1
jr nc, .Cap
inc hl
ld a, [hld]
- cp LOW(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1)
+ cp LOW(MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE + 1)
jr c, .dont_cap_3
.Cap:
- ld a, HIGH(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE)
+ ld a, HIGH(MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE)
ld [hli], a
- ld a, LOW(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE)
+ ld a, LOW(MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE)
ld [hld], a
.dont_cap_3
-; Minimum neutral damage is 2 (bringing the cap to 999).
+; Add back MIN_NEUTRAL_DAMAGE (capping at 999).
inc hl
ld a, [hl]
add MIN_NEUTRAL_DAMAGE
@@ -3135,6 +3136,7 @@ BattleCommand_DamageCalc:
inc [hl]
.dont_floor
+; Returns nz and nc.
ld a, 1
and a
ret
@@ -3147,18 +3149,18 @@ BattleCommand_DamageCalc:
; x2
ldh a, [hQuotient + 3]
sla a
- ldh [hProduct + 3], a
+ ldh [hQuotient + 3], a
ldh a, [hQuotient + 2]
rl a
- ldh [hProduct + 2], a
+ ldh [hQuotient + 2], a
; Cap at $ffff.
ret nc
ld a, $ff
- ldh [hProduct + 2], a
- ldh [hProduct + 3], a
+ ldh [hQuotient + 2], a
+ ldh [hQuotient + 3], a
ret