mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-07 08:52:17 +02:00
isCaught function in Dex now returns the correct result
This commit is contained in:
parent
fdf8c1a695
commit
9bbad183b5
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user