Replace flawed Metal Powder bugfix (#890)

This commit is contained in:
Idain 2022-03-14 22:53:38 -04:00 committed by GitHub
parent 61faca1f91
commit 91fa3dd9b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 64 additions and 14 deletions

View File

@ -182,23 +182,33 @@ Fixes in the [multi-player battle engine](#multi-player-battle-engine) category
([Video](https://www.youtube.com/watch?v=rGqu3d3pdok&t=450))
**Fix:** Edit `DittoMetalPowder` in [engine/battle/effect_commands.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/effect_commands.asm):
**Fix:** Edit [engine/battle/effect_commands.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/effect_commands.asm):
```diff
ld a, c
srl a
add c
ld c, a
ret nc
DittoMetalPowder:
...
srl b
ld a, b
and a
jr nz, .done
inc b
.done
scf
rr c
- ld a, c
- srl a
- add c
- ld c, a
- ret nc
-
- srl b
- ld a, b
- and a
- jr nz, .done
- inc b
-.done
- scf
- rr c
+ ld h, b
+ ld l, c
+ srl b
+ rr c
+ add hl, bc
+ ld b, h
+ ld c, l
+
+ ld a, HIGH(MAX_STAT_VALUE)
+ cp b
@ -213,6 +223,46 @@ Fixes in the [multi-player battle engine](#multi-player-battle-engine) category
ret
```
```diff
PlayerAttackDamage:
...
.done
+ push hl
+ call DittoMetalPowder
+ pop hl
call TruncateHL_BC
ld a, [wBattleMonLevel]
ld e, a
- call DittoMetalPowder
ld a, 1
and a
ret
```
```diff
EnemyAttackDamage:
...
.done
+ push hl
+ call DittoMetalPowder
+ pop hl
call TruncateHL_BC
ld a, [wBattleMonLevel]
ld e, a
- call DittoMetalPowder
ld a, 1
and a
ret
```
### Reflect and Light Screen can make (Special) Defense wrap around above 1024