From 91fa3dd9b94845b512fae799ecbc0d187c948289 Mon Sep 17 00:00:00 2001 From: Idain Date: Mon, 14 Mar 2022 22:53:38 -0400 Subject: [PATCH] Replace flawed Metal Powder bugfix (#890) --- docs/bugs_and_glitches.md | 78 ++++++++++++++++++++++++++++++++------- 1 file changed, 64 insertions(+), 14 deletions(-) diff --git a/docs/bugs_and_glitches.md b/docs/bugs_and_glitches.md index 078a86d9b..d95c85100 100644 --- a/docs/bugs_and_glitches.md +++ b/docs/bugs_and_glitches.md @@ -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