Skip to content

Commit

Permalink
Bug: PRZ and BRN stat reductions don't apply to switched Pokémon (#1021)
Browse files Browse the repository at this point in the history
Co-authored-by: Rangi <[email protected]>
  • Loading branch information
vulcandth and Rangi42 authored Dec 1, 2022
1 parent c4e3f2b commit b232b4b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/bugs_and_glitches.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions engine/battle/core.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit b232b4b

Please sign in to comment.