diff options
-rw-r--r-- | docs/bugs_and_glitches.md | 30 | ||||
-rw-r--r-- | engine/battle/move_effects/counter.asm | 1 | ||||
-rw-r--r-- | engine/battle/move_effects/mirror_coat.asm | 1 | ||||
-rw-r--r-- | tools/free_space.awk | 13 |
4 files changed, 44 insertions, 1 deletions
diff --git a/docs/bugs_and_glitches.md b/docs/bugs_and_glitches.md index 699988da4..52c0ac665 100644 --- a/docs/bugs_and_glitches.md +++ b/docs/bugs_and_glitches.md @@ -246,7 +246,35 @@ DefenseDownHit: ([Video](https://www.youtube.com/watch?v=uRYyzKRatFk)) -*To do:* Identify specific code causing this bug and fix it. +This is a bug with `BattleCommand_Counter` in [engine/battle/move_effects/counter.asm](/engine/battle/move_effects/counter.asm) and `BattleCommand_MirrorCoat` in [engine/battle/move_effects/mirror_coat.asm](/engine/battle/move_effects/mirror_coat.asm): + +```asm + ; BUG: Move should fail with all non-damaging battle actions + ld hl, wCurDamage + ld a, [hli] + or [hl] + ret z +``` + +**Fix:** + +```diff + ld hl, wCurDamage + ld a, [hli] + or [hl] +- ret z ++ jp z, .failed +``` + +Add this to the end of each file: + +```diff ++.failed ++ ld a, 1 ++ ld [wEffectFailed], a ++ and a ++ ret +``` ## A Disabled but PP Up–enhanced move may not trigger Struggle diff --git a/engine/battle/move_effects/counter.asm b/engine/battle/move_effects/counter.asm index f92e1b3ac..031c399a6 100644 --- a/engine/battle/move_effects/counter.asm +++ b/engine/battle/move_effects/counter.asm @@ -36,6 +36,7 @@ BattleCommand_Counter: cp SPECIAL ret nc + ; BUG: Move should fail with all non-damaging battle actions ld hl, wCurDamage ld a, [hli] or [hl] diff --git a/engine/battle/move_effects/mirror_coat.asm b/engine/battle/move_effects/mirror_coat.asm index 8743c389d..fb3a30d58 100644 --- a/engine/battle/move_effects/mirror_coat.asm +++ b/engine/battle/move_effects/mirror_coat.asm @@ -37,6 +37,7 @@ BattleCommand_MirrorCoat: cp SPECIAL ret c + ; BUG: Move should fail with all non-damaging battle actions ld hl, wCurDamage ld a, [hli] or [hl] diff --git a/tools/free_space.awk b/tools/free_space.awk new file mode 100644 index 000000000..1f2b04415 --- /dev/null +++ b/tools/free_space.awk @@ -0,0 +1,13 @@ +#!/usr/bin/awk -f + +# Usage: tools/free_space.awk pokecrystal.map + +BEGIN { + total = free = 16384 * 128 +} +/^ SECTION: \$[0-7]/ { + free -= strtonum("0x" substr($3, 3)) +} +END { + printf "Free space: %d/%d (%.2f%%)\n", free, total, free * 100 / total +} |