From 05691970e2683fe2353b7ac0f7f4d0070ae29bf4 Mon Sep 17 00:00:00 2001 From: Wlowscha <54003515+Wlowscha@users.noreply.github.com> Date: Sun, 30 Mar 2025 08:14:19 +0200 Subject: [PATCH] [Bug] Fix pokedex option after catching (#5574) * Fix pokedex entry after catching * Allow turning pages * Using isSeen in more places * Evolutions show up as seen after catching * Apply suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Showing battle forms correctly for seen mons --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --- src/phases/attempt-capture-phase.ts | 17 +++++------------ src/ui/pokedex-page-ui-handler.ts | 18 +++++++++++++----- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/phases/attempt-capture-phase.ts b/src/phases/attempt-capture-phase.ts index 6e2a2d29af4..78021da4066 100644 --- a/src/phases/attempt-capture-phase.ts +++ b/src/phases/attempt-capture-phase.ts @@ -329,18 +329,11 @@ export class AttemptCapturePhase extends PokemonPhase { form: pokemon.formIndex, female: pokemon.gender === Gender.FEMALE, }; - globalScene.ui.setOverlayMode( - Mode.POKEDEX_PAGE, - pokemon.species, - pokemon.formIndex, - attributes, - null, - () => { - globalScene.ui.setMode(Mode.MESSAGE).then(() => { - promptRelease(); - }); - }, - ); + globalScene.ui.setOverlayMode(Mode.POKEDEX_PAGE, pokemon.species, attributes, null, null, () => { + globalScene.ui.setMode(Mode.MESSAGE).then(() => { + promptRelease(); + }); + }); }, () => { globalScene.ui.setMode( diff --git a/src/ui/pokedex-page-ui-handler.ts b/src/ui/pokedex-page-ui-handler.ts index 24812f62044..062b4c3797c 100644 --- a/src/ui/pokedex-page-ui-handler.ts +++ b/src/ui/pokedex-page-ui-handler.ts @@ -978,7 +978,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { const caughtAttr = this.isCaught(); // no preferences or Pokemon wasn't caught, return empty attribute - if (!starterAttributes || !caughtAttr) { + if (!starterAttributes || !this.isSeen()) { return {}; } @@ -2026,6 +2026,11 @@ export default class PokedexPageUiHandler extends MessageUiHandler { } break; case Button.LEFT: + if (this.filteredIndices && this.filteredIndices.length <= 1) { + ui.playError(); + this.blockInput = false; + return true; + } this.blockInput = true; ui.setModeWithoutClear(Mode.OPTION_SELECT).then(() => { // Always go back to first selection after scrolling around @@ -2061,6 +2066,11 @@ export default class PokedexPageUiHandler extends MessageUiHandler { this.blockInput = false; break; case Button.RIGHT: + if (this.filteredIndices && this.filteredIndices.length <= 1) { + ui.playError(); + this.blockInput = false; + return true; + } ui.setModeWithoutClear(Mode.OPTION_SELECT).then(() => { // Always go back to first selection after scrolling around if (this.previousSpecies.length === 0) { @@ -2220,9 +2230,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { const ui = this.getUi(); - const isFormCaught = this.isFormCaught(); - - if ((this.isCaught() && isFormCaught) || (this.speciesStarterDexEntry?.seenAttr && cursor === 5)) { + if ((this.isCaught() && this.isFormCaught()) || this.isSeen()) { ui.showText(this.menuDescriptions[cursor]); } else { ui.showText(""); @@ -2301,7 +2309,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { } } - if (species && (this.speciesStarterDexEntry?.seenAttr || this.isCaught())) { + if (species && (this.isSeen() || this.isCaught())) { this.pokemonNumberText.setText(padInt(species.speciesId, 4)); if (this.isCaught()) {