diff options
author | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-07-05 15:14:07 -0400 |
---|---|---|
committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-07-05 15:14:07 -0400 |
commit | 7324c1d11a97c9ff7bc9cf16ca525f9f66c5db3e (patch) | |
tree | 4a5be1a45e90f4c9808ec29ee4a94d104123754c | |
parent | a33e8713bd9ae2a4e517e434d25fc3c4a4819065 (diff) |
Use MAX_NEUTRAL_DAMAGE in BattleCommand_DamageCalc
Also make .gitignore consistent with pokered
-rw-r--r-- | .gitignore | 15 | ||||
-rw-r--r-- | constants/battle_constants.asm | 3 | ||||
-rw-r--r-- | engine/battle/effect_commands.asm | 50 |
3 files changed, 35 insertions, 33 deletions
@@ -13,7 +13,7 @@ *.gbc *.gb -# for any of the poor souls with save game files in their working directory +# save game files *.sgm *.sav *.rtc @@ -34,16 +34,15 @@ pokesilver.txt # used_space.py used_space.png -# for vim configuration -# url: http://www.vim.org/scripts/script.php?script_id=441 +# vim configuration +# http://www.vim.org/scripts/script.php?script_id=441 .lvimrc -# swap files for vim + +# swap files for vim and gedit .*.swp -# swap files for gedit *~ -# for vscode -.vscode -# osx files + +# macos files .DS_STORE # compiled graphics diff --git a/constants/battle_constants.asm b/constants/battle_constants.asm index 636d917a..63128b34 100644 --- a/constants/battle_constants.asm +++ b/constants/battle_constants.asm @@ -10,8 +10,9 @@ NUM_MOVES EQU 4 BASE_STAT_LEVEL EQU 7 MAX_STAT_LEVEL EQU 13 -; minimum damage before type effectiveness +; damage limits before type effectiveness MIN_NEUTRAL_DAMAGE EQU 2 +MAX_NEUTRAL_DAMAGE EQU 999 ; turns that sleep lasts REST_SLEEP_TURNS EQU 2 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 |