ref: 8aebc7ba56746b19d3338ab548ad0ab59d2012aa
parent: 2d73d040d16a7836f935a7a6cb2a311aed2ca5a2
parent: 57fc81d44e1f26b8895d37c9d847400851a8f8b4
author: IIMarckus <iimarckus@gmail.com>
date: Fri Jul 20 20:41:56 EDT 2018
Merge branch 'master' of hyperdriveguy/pokecrystal
--- a/docs/bugs_and_glitches.md
+++ b/docs/bugs_and_glitches.md
@@ -246,7 +246,35 @@
([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
--- a/engine/battle/move_effects/counter.asm
+++ b/engine/battle/move_effects/counter.asm
@@ -36,6 +36,7 @@
cp SPECIAL
ret nc
+ ; BUG: Move should fail with all non-damaging battle actions
ld hl, wCurDamage
ld a, [hli]
or [hl]
--- a/engine/battle/move_effects/mirror_coat.asm
+++ b/engine/battle/move_effects/mirror_coat.asm
@@ -37,6 +37,7 @@
cp SPECIAL
ret c
+ ; BUG: Move should fail with all non-damaging battle actions
ld hl, wCurDamage
ld a, [hli]
or [hl]