ref: 82ffb584c8fefc04e1bad4895cdc2d9222100b4c
parent: b57bafd3b7ca771a51596207105a54784175cb7b
author: i0brendan0 <i0brendan0@github.com>
date: Wed Feb 28 23:08:54 EST 2018
Add Protect Bug and Fix Moves 'miss' when opponent uses Protect.
--- a/docs/bugs_and_glitches.md
+++ b/docs/bugs_and_glitches.md
@@ -53,6 +53,7 @@
- [`TryObjectEvent` arbitrary code execution](#tryobjectevent-arbitrary-code-execution)
- [`Special_CheckBugContestContestantFlag` can read beyond its data table](#special_checkbugcontestcontestantflag-can-read-beyond-its-data-table)
- [`ClearWRAM` only clears WRAM bank 1](#clearwram-only-clears-wram-bank-1)
+- [Moves erroneously say they have missed when the opponent uses Protect or Detect](#moves-erroneously-say-they-have-missed-when-the-opponent-uses-protect-or-detect)
## Thick Club and Light Ball can decrease damage done with boosted (Special) Attack
@@ -1486,3 +1487,29 @@
```
**Fix:** Change `jr nc, .bank_loop` to `jr c, .bank_loop`.
+
+## Moves erroneously say they have missed when the opponent uses Protect or Detect
+
+In [battle/effect_commands.asm](battle/effect_commands.asm):
+
+```asm
+BattleCommand_CheckHit: ; 34d32
+; checkhit
+
+ call .DreamEater
+ jp z, .Miss
+
+ call .Protect
+ jp nz, .Miss
+```
+
+**Fix:** Change `jp nz, .Miss` to `jp nz, .Failed` and add
+
+```asm
+.Failed:
+ ld a, 1
+ ld [wEffectFailed], a
+ ret
+```
+
+at [line 1781](battle/effect_commands.asm#L1718).