From 68173ce9696d71b7b0a807225b869651e3d53df0 Mon Sep 17 00:00:00 2001 From: Wlowscha <54003515+Wlowscha@users.noreply.github.com> Date: Thu, 27 Mar 2025 00:48:42 +0100 Subject: [PATCH] =?UTF-8?q?Changing=20display=20of=20seen=20Pok=C3=A9mon?= =?UTF-8?q?=20in=20the=20dex?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ui/pokedex-page-ui-handler.ts | 49 ++++++++++++++++++------------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/src/ui/pokedex-page-ui-handler.ts b/src/ui/pokedex-page-ui-handler.ts index 992a6fb5222..3cf6d3db31f 100644 --- a/src/ui/pokedex-page-ui-handler.ts +++ b/src/ui/pokedex-page-ui-handler.ts @@ -704,23 +704,23 @@ export default class PokedexPageUiHandler extends MessageUiHandler { } getMenuText(): string { - const isFormCaught = this.isFormCaught(); - const isSeen = this.speciesStarterDexEntry?.seenAttr; - if (this.species.speciesId === Species.ODDISH) { - console.log(isFormCaught, isSeen); - } + const isSeen = this.isSeen(); + const isStarterCaught = !!this.isCaught(this.getStarterSpecies(this.species)); return this.menuOptions .map(o => { const label = `${i18next.t(`pokedexUiHandler:${MenuOptions[o]}`)}`; - const isWhite = isFormCaught || (isSeen && o === MenuOptions.BIOMES); + const isDark = + !isSeen || + (!isStarterCaught && (o === MenuOptions.TOGGLE_IVS || o === MenuOptions.NATURES)) || + (this.tmMoves.length < 1 && o === MenuOptions.TM_MOVES); const color = getTextColor( - isWhite ? TextStyle.SETTINGS_VALUE : TextStyle.SHADOW_TEXT, + isDark ? TextStyle.SHADOW_TEXT : TextStyle.SETTINGS_VALUE, false, globalScene.uiTheme, ); const shadow = getTextColor( - isWhite ? TextStyle.SETTINGS_VALUE : TextStyle.SHADOW_TEXT, + isDark ? TextStyle.SHADOW_TEXT : TextStyle.SETTINGS_VALUE, true, globalScene.uiTheme, ); @@ -924,6 +924,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { return (dexEntry?.caughtAttr ?? 0n) & (starterDexEntry?.caughtAttr ?? 0n) & species.getFullUnlocksData(); } + /** * Check whether a given form is caught for a given species. * All forms that can be reached through a form change during battle are considered caught and show up in the dex as such. @@ -948,6 +949,14 @@ export default class PokedexPageUiHandler extends MessageUiHandler { return isFormCaught; } + isSeen(): boolean { + if (this.speciesStarterDexEntry?.seenAttr) { + return true; + } + const starterCaughtAttr = this.isCaught(this.getStarterSpecies(this.species)); + return !!starterCaughtAttr; + } + /** * Get the starter attributes for the given PokemonSpecies, after sanitizing them. * If somehow a preference is set for a form, variant, gender, ability or nature @@ -1096,6 +1105,8 @@ export default class PokedexPageUiHandler extends MessageUiHandler { const isCaught = this.isCaught(); const isFormCaught = this.isFormCaught(); + const isSeen = this.isSeen(); + const isStarterCaught = !!this.isCaught(this.getStarterSpecies(this.species)); if (this.blockInputOverlay) { if (button === Button.CANCEL || button === Button.ACTION) { @@ -1131,7 +1142,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { if (button === Button.ACTION) { switch (this.cursor) { case MenuOptions.BASE_STATS: - if (!isCaught || !isFormCaught) { + if (!isSeen) { error = true; } else { this.blockInput = true; @@ -1151,7 +1162,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { break; case MenuOptions.LEVEL_MOVES: - if (!isCaught || !isFormCaught) { + if (!isSeen) { error = true; } else { this.blockInput = true; @@ -1209,7 +1220,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { break; case MenuOptions.EGG_MOVES: - if (!isCaught || !isFormCaught) { + if (!isSeen) { error = true; } else { this.blockInput = true; @@ -1276,7 +1287,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { break; case MenuOptions.TM_MOVES: - if (!isCaught || !isFormCaught) { + if (!isSeen) { error = true; } else if (this.tmMoves.length < 1) { ui.showText(i18next.t("pokedexUiHandler:noTmMoves")); @@ -1327,7 +1338,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { break; case MenuOptions.ABILITIES: - if (!isCaught || !isFormCaught) { + if (!isSeen) { error = true; } else { this.blockInput = true; @@ -1415,7 +1426,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { break; case MenuOptions.BIOMES: - if (!(isCaught || this.speciesStarterDexEntry?.seenAttr)) { + if (!isSeen) { error = true; } else { this.blockInput = true; @@ -1494,7 +1505,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { break; case MenuOptions.EVOLUTIONS: - if (!isCaught || !isFormCaught) { + if (!isSeen) { error = true; } else { this.blockInput = true; @@ -1673,7 +1684,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { break; case MenuOptions.TOGGLE_IVS: - if (!isCaught || !isFormCaught) { + if (!isStarterCaught) { error = true; } else { this.toggleStatsMode(); @@ -1683,7 +1694,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { break; case MenuOptions.NATURES: - if (!isCaught || !isFormCaught) { + if (!isStarterCaught) { error = true; } else { this.blockInput = true; @@ -2396,8 +2407,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler { } if (species) { - const dexEntry = globalScene.gameData.dexData[species.speciesId]; - const caughtAttr = this.isCaught(species); if (!caughtAttr) { @@ -2418,7 +2427,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { } const isFormCaught = this.isFormCaught(); - const isFormSeen = dexEntry ? (dexEntry.seenAttr & globalScene.gameData.getFormAttr(formIndex ?? 0)) > 0n : false; + const isFormSeen = this.isSeen(); this.shinyOverlay.setVisible(shiny ?? false); // TODO: is false the correct default? this.pokemonNumberText.setColor(this.getTextColor(shiny ? TextStyle.SUMMARY_GOLD : TextStyle.SUMMARY, false));