Add Counter and Mirror Coat bugfix

This commit is contained in:
Hyperdriveguy 2018-07-20 17:39:53 -07:00
parent 53bcd8f46c
commit 57fc81d44e
3 changed files with 31 additions and 1 deletions

View File

@ -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 Upenhanced move may not trigger Struggle

View File

@ -36,6 +36,7 @@ BattleCommand_Counter: ; 35813
cp SPECIAL
ret nc
; BUG: Move should fail with all non-damaging battle actions
ld hl, wCurDamage
ld a, [hli]
or [hl]

View File

@ -37,6 +37,7 @@ BattleCommand_MirrorCoat: ; 37c95
cp SPECIAL
ret c
; BUG: Move should fail with all non-damaging battle actions
ld hl, wCurDamage
ld a, [hli]
or [hl]