diff --git a/src/ui/pokedex-page-ui-handler.ts b/src/ui/pokedex-page-ui-handler.ts index 062b4c3797c..1cb0963d25c 100644 --- a/src/ui/pokedex-page-ui-handler.ts +++ b/src/ui/pokedex-page-ui-handler.ts @@ -921,16 +921,22 @@ export default class PokedexPageUiHandler extends MessageUiHandler { return biomes; } + /** + * Return the caughtAttr of a given species, sanitized. + * + * @param otherSpecies The species to check; defaults to current species + * @returns caught DexAttr for the species + */ isCaught(otherSpecies?: PokemonSpecies): bigint { + const species = otherSpecies ? otherSpecies : this.species; + if (globalScene.dexForDevs) { - return 255n; + species.getFullUnlocksData(); } - const species = otherSpecies ? otherSpecies : this.species; const dexEntry = globalScene.gameData.dexData[species.speciesId]; - const starterDexEntry = globalScene.gameData.dexData[this.getStarterSpeciesId(species.speciesId)]; - return (dexEntry?.caughtAttr ?? 0n) & (starterDexEntry?.caughtAttr ?? 0n) & species.getFullUnlocksData(); + return (dexEntry?.caughtAttr ?? 0n) & species.getFullUnlocksData(); } /** @@ -939,7 +945,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { * * @param otherSpecies The species to check; defaults to current species * @param otherFormIndex The form index of the form to check; defaults to current form - * @returns StarterAttributes for the species + * @returns boolean */ isFormCaught(otherSpecies?: PokemonSpecies, otherFormIndex?: number | undefined): boolean { if (globalScene.dexForDevs) { @@ -954,6 +960,8 @@ export default class PokedexPageUiHandler extends MessageUiHandler { } const isFormCaught = (caughtAttr & globalScene.gameData.getFormAttr(formIndex ?? 0)) > 0n; + + console.log(caughtAttr.toString(2), species.getFullUnlocksData().toString(2)); return isFormCaught; } @@ -2459,6 +2467,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { const isFormCaught = this.isFormCaught(); const isFormSeen = this.isSeen(); + console.log("isCaught:", isFormCaught, "isSeen:", isFormSeen); this.shinyOverlay.setVisible(shiny ?? false); // TODO: is false the correct default? this.pokemonNumberText.setColor(this.getTextColor(shiny ? TextStyle.SUMMARY_GOLD : TextStyle.SUMMARY, false));