From b232b4be5fd614fdb9b1c420ca260964b258ac33 Mon Sep 17 00:00:00 2001 From: vulcandth Date: Thu, 1 Dec 2022 15:54:01 -0600 Subject: [PATCH] =?UTF-8?q?Bug:=20PRZ=20and=20BRN=20stat=20reductions=20do?= =?UTF-8?q?n't=20apply=20to=20switched=20Pok=C3=A9mon=20(#1021)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Rangi <35663410+Rangi42@users.noreply.github.com> --- docs/bugs_and_glitches.md | 19 +++++++++++++++++++ engine/battle/core.asm | 1 + 2 files changed, 20 insertions(+) diff --git a/docs/bugs_and_glitches.md b/docs/bugs_and_glitches.md index 1547290f1..fcdac9111 100644 --- a/docs/bugs_and_glitches.md +++ b/docs/bugs_and_glitches.md @@ -50,6 +50,7 @@ Fixes in the [multi-player battle engine](#multi-player-battle-engine) category - [Love Ball boosts catch rate for the wrong gender](#love-ball-boosts-catch-rate-for-the-wrong-gender) - [Fast Ball only boosts catch rate for three Pokémon](#fast-ball-only-boosts-catch-rate-for-three-pok%C3%A9mon) - [Heavy Ball uses wrong weight value for three Pokémon](#heavy-ball-uses-wrong-weight-value-for-three-pok%C3%A9mon) + - [PRZ and BRN stat reductions don't apply to switched Pokémon](#prz-and-brn-stat-reductions-dont-apply-to-switched-pok%C3%A9mon) - [Glacier Badge may not boost Special Defense depending on the value of Special Attack](#glacier-badge-may-not-boost-special-defense-depending-on-the-value-of-special-attack) - ["Smart" AI encourages Mean Look if its own Pokémon is badly poisoned](#smart-ai-encourages-mean-look-if-its-own-pok%C3%A9mon-is-badly-poisoned) - ["Smart" AI discourages Conversion2 after the first turn](#smart-ai-discourages-conversion2-after-the-first-turn) @@ -1251,6 +1252,24 @@ This can occur if your party and current PC box are both full when you start the ``` +### PRZ and BRN stat reductions don't apply to switched Pokémon + +This does not affect link battles or Battle Tower battles because those jump from `LoadEnemyMon` to `InitEnemyMon`, which already calls `ApplyStatusEffectOnEnemyStats`. + +**Fix:** Edit `LoadEnemyMon` in [engine/battle/core.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/core.asm): + +```diff + ld hl, wEnemyMonStats + ld de, wEnemyStats + ld bc, NUM_EXP_STATS * 2 + call CopyBytes + +-; BUG: PRZ and BRN stat reductions don't apply to switched Pokémon (see docs/bugs_and_glitches.md) ++ call ApplyStatusEffectOnEnemyStats + ret +``` + + ### Glacier Badge may not boost Special Defense depending on the value of Special Attack Pryce's dialog ("That BADGE will raise the SPECIAL stats of POKéMON.") implies that Glacier Badge is intended to boost both Special Attack and Special Defense, but the Special Defense boost will not happen unless the unboosted Special Attack stat is 206–432, or 661 or above. diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 4c3990558..739ad4f13 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -6407,6 +6407,7 @@ LoadEnemyMon: ld bc, NUM_EXP_STATS * 2 call CopyBytes +; BUG: PRZ and BRN stat reductions don't apply to switched Pokémon (see docs/bugs_and_glitches.md) ret CheckSleepingTreeMon: