[Enhancement] Separate encountered stat from seen stat (#6315)

* Using seenCount in pokedex and game stats

* Species seen now also include caught data

---------

Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
This commit is contained in:
Wlowscha 2025-08-21 03:47:22 +02:00 committed by GitHub
parent c59a2013b9
commit 14bd80f639
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 34 additions and 2 deletions

View File

@ -48,10 +48,17 @@ const displayStats: DisplayStats = {
return `${starterCount} (${Math.floor((starterCount / Object.keys(speciesStarterCosts).length) * 1000) / 10}%)`;
},
},
dexEncountered: {
label_key: "speciesEncountered",
sourceFunc: gameData => {
const seenCount = gameData.getSpeciesCount(d => !!d.seenCount);
return `${seenCount} (${Math.floor((seenCount / Object.keys(gameData.dexData).length) * 1000) / 10}%)`;
},
},
dexSeen: {
label_key: "speciesSeen",
sourceFunc: gameData => {
const seenCount = gameData.getSpeciesCount(d => !!d.seenAttr);
const seenCount = gameData.getSpeciesCount(d => !!d.seenAttr || !!d.caughtAttr);
return `${seenCount} (${Math.floor((seenCount / Object.keys(gameData.dexData).length) * 1000) / 10}%)`;
},
},

View File

@ -416,6 +416,11 @@ export class PokedexUiHandler extends MessageUiHandler {
new DropDownLabel(i18next.t("filterBar:isSeen"), undefined, DropDownState.ON),
new DropDownLabel(i18next.t("filterBar:isUnseen"), undefined, DropDownState.EXCLUDE),
];
const encounteredSpeciesLabels = [
new DropDownLabel(i18next.t("filterBar:encounteredSpecies"), undefined, DropDownState.OFF),
new DropDownLabel(i18next.t("filterBar:isEncountered"), undefined, DropDownState.ON),
new DropDownLabel(i18next.t("filterBar:isNotEncountered"), undefined, DropDownState.EXCLUDE),
];
const eggLabels = [
new DropDownLabel(i18next.t("filterBar:egg"), undefined, DropDownState.OFF),
new DropDownLabel(i18next.t("filterBar:eggPurchasable"), undefined, DropDownState.ON),
@ -430,6 +435,7 @@ export class PokedexUiHandler extends MessageUiHandler {
new DropDownOption("WIN", winLabels),
new DropDownOption("HIDDEN_ABILITY", hiddenAbilityLabels),
new DropDownOption("SEEN_SPECIES", seenSpeciesLabels),
new DropDownOption("ENCOUNTERED_SPECIES", encounteredSpeciesLabels),
new DropDownOption("EGG", eggLabels),
new DropDownOption("POKERUS", pokerusLabels),
];
@ -810,6 +816,10 @@ export class PokedexUiHandler extends MessageUiHandler {
return false;
}
isEncountered(_species: PokemonSpecies, dexEntry: DexEntry, _seenFilter?: boolean): boolean {
return !!dexEntry.seenCount;
}
/**
* Determines if 'Icon' based upgrade notifications should be shown
* @returns true if upgrade notifications are enabled and set to display an 'Icon'
@ -1628,7 +1638,7 @@ export class PokedexUiHandler extends MessageUiHandler {
// Seen Filter
const dexEntry = globalScene.gameData.dexData[species.speciesId];
const isItSeen = this.isSeen(species, dexEntry, true);
const isItSeen = this.isSeen(species, dexEntry, true) || !!dexEntry.caughtAttr;
const fitsSeen = this.filterBar.getVals(DropDownColumn.MISC).some(misc => {
if (misc.val === "SEEN_SPECIES" && misc.state === DropDownState.ON) {
return isItSeen;
@ -1641,6 +1651,20 @@ export class PokedexUiHandler extends MessageUiHandler {
}
});
// Encountered Filter
const isItEncountered = this.isEncountered(species, dexEntry, true);
const fitsEncountered = this.filterBar.getVals(DropDownColumn.MISC).some(misc => {
if (misc.val === "ENCOUNTERED_SPECIES" && misc.state === DropDownState.ON) {
return isItEncountered;
}
if (misc.val === "ENCOUNTERED_SPECIES" && misc.state === DropDownState.EXCLUDE) {
return !isItEncountered;
}
if (misc.val === "ENCOUNTERED_SPECIES" && misc.state === DropDownState.OFF) {
return true;
}
});
// Egg Purchasable Filter
const isEggPurchasable = this.isSameSpeciesEggAvailable(species.speciesId);
const fitsEgg = this.filterBar.getVals(DropDownColumn.MISC).some(misc => {
@ -1683,6 +1707,7 @@ export class PokedexUiHandler extends MessageUiHandler {
fitsWin &&
fitsHA &&
fitsSeen &&
fitsEncountered &&
fitsEgg &&
fitsPokerus
) {