From 14bd80f639d4bfc4c805595a6f4f31d4379b1ae7 Mon Sep 17 00:00:00 2001 From: Wlowscha <54003515+Wlowscha@users.noreply.github.com> Date: Thu, 21 Aug 2025 03:47:22 +0200 Subject: [PATCH] [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> --- src/ui/game-stats-ui-handler.ts | 9 ++++++++- src/ui/pokedex-ui-handler.ts | 27 ++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/ui/game-stats-ui-handler.ts b/src/ui/game-stats-ui-handler.ts index 4ddb80fcc00..be41e4d21b9 100644 --- a/src/ui/game-stats-ui-handler.ts +++ b/src/ui/game-stats-ui-handler.ts @@ -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}%)`; }, }, diff --git a/src/ui/pokedex-ui-handler.ts b/src/ui/pokedex-ui-handler.ts index 034f4f8e615..01046bfef9c 100644 --- a/src/ui/pokedex-ui-handler.ts +++ b/src/ui/pokedex-ui-handler.ts @@ -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 ) {