From d5eafd574792ac685da209c5803c6a5d30d46154 Mon Sep 17 00:00:00 2001 From: Wlowscha <54003515+Wlowscha@users.noreply.github.com> Date: Sat, 25 Jan 2025 10:50:29 +0100 Subject: [PATCH] Displaying uncaught forms for Dudunsparce and Maushold properly --- src/ui/pokedex-page-ui-handler.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ui/pokedex-page-ui-handler.ts b/src/ui/pokedex-page-ui-handler.ts index d302cd0d540..123d60556e8 100644 --- a/src/ui/pokedex-page-ui-handler.ts +++ b/src/ui/pokedex-page-ui-handler.ts @@ -573,7 +573,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { this.menuContainer.setVisible(true); this.speciesStarterDexEntry = this.species ? globalScene.gameData.dexData[this.species.speciesId] : null; - this.setSpecies(this.species); + this.setSpecies(); this.updateInstructions(); this.setCursor(0); @@ -1902,7 +1902,8 @@ export default class PokedexPageUiHandler extends MessageUiHandler { return { currentFriendship, friendshipCap }; } - setSpecies(species: PokemonSpecies | null) { + setSpecies() { + const species = this.species; const starterAttributes : StarterAttributes | null = species ? { ...this.starterAttributes } : null; if (!species && globalScene.ui.getTooltip().visible) { @@ -1920,8 +1921,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler { } } - this.species = species!; // TODO: is this bang correct? - if (species && (this.speciesStarterDexEntry?.seenAttr || this.speciesStarterDexEntry?.caughtAttr)) { this.pokemonNumberText.setText(padInt(species.speciesId, 4)); if (starterAttributes?.nickname) { @@ -2006,7 +2005,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { } - // load default nature from stater save data, if set + // Set default attributes if for some reason starterAttributes does not exist or attributes missing const props: StarterAttributes = globalScene.gameData.getSpeciesDexAttrProps(species, defaultDexAttr); if (starterAttributes?.variant && !isNaN(starterAttributes.variant)) { if (props.shiny) { @@ -2023,10 +2022,11 @@ export default class PokedexPageUiHandler extends MessageUiHandler { variant: props.variant ?? 0, }); - const speciesForm = getPokemonSpeciesForm(species.speciesId, props.form ?? 0); - this.setTypeIcons(speciesForm.type1, speciesForm.type2); - - this.pokemonSprite.clearTint(); + if (this.isFormCaught(this.species, props.form)) { + const speciesForm = getPokemonSpeciesForm(species.speciesId, props.form ?? 0); + this.setTypeIcons(speciesForm.type1, speciesForm.type2); + this.pokemonSprite.clearTint(); + } } else { this.pokemonGrowthRateText.setText(""); this.pokemonGrowthRateLabelText.setVisible(false);