Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] add filters for pokerus, HA, cost reduction #3343

Merged
merged 5 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/locales/de/filter-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,18 @@ export const filterBar: SimpleTranslationEntries = {
"passive": "Passive",
"passiveUnlocked": "Passive freigeschaltet",
"passiveLocked": "Passive gesperrt",
"costReduction": "Cost Reduction",
"costReductionUnlocked": "Cost Reduction Unlocked",
"costReductionLocked": "Cost Reduction Locked",
"ribbon": "Band",
"hasWon": "Hat Klassik-Modus gewonnen",
"hasNotWon": "Hat Klassik-Modus nicht gewonnen",
"hiddenAbility": "Hidden Ability",
"hasHiddenAbility": "Hidden Ability - Yes",
"noHiddenAbility": "Hidden Ability - No",
"pokerus": "Pokerus",
"hasPokerus": "Pokerus - Yes",
"noPokerus": "Pokerus - No",
"sortByNumber": "Pokédex-Nummer",
"sortByCost": "Kosten",
"sortByCandies": "Anzahl Bonbons",
Expand Down
9 changes: 9 additions & 0 deletions src/locales/en/filter-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,18 @@ export const filterBar: SimpleTranslationEntries = {
"passive": "Passive",
"passiveUnlocked": "Passive Unlocked",
"passiveLocked": "Passive Locked",
"costReduction": "Cost Reduction",
"costReductionUnlocked": "Cost Reduction Unlocked",
"costReductionLocked": "Cost Reduction Locked",
"ribbon": "Ribbon",
"hasWon": "Ribbon - Yes",
"hasNotWon": "Ribbon - No",
"hiddenAbility": "Hidden Ability",
"hasHiddenAbility": "Hidden Ability - Yes",
"noHiddenAbility": "Hidden Ability - No",
"pokerus": "Pokerus",
"hasPokerus": "Pokerus - Yes",
"noPokerus": "Pokerus - No",
"sortByNumber": "No.",
"sortByCost": "Cost",
"sortByCandies": "Candy Count",
Expand Down
9 changes: 9 additions & 0 deletions src/locales/es/filter-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,18 @@ export const filterBar: SimpleTranslationEntries = {
"passive": "Passive",
"passiveUnlocked": "Pasiva Desbloq.",
"passiveLocked": "Pasiva Bloq.",
"costReduction": "Cost Reduction",
"costReductionUnlocked": "Cost Reduction Unlocked",
"costReductionLocked": "Cost Reduction Locked",
"ribbon": "Ribbon",
"hasWon": "Ya ha ganado",
"hasNotWon": "Aún no ha ganado",
"hiddenAbility": "Hidden Ability",
"hasHiddenAbility": "Hidden Ability - Yes",
"noHiddenAbility": "Hidden Ability - No",
"pokerus": "Pokerus",
"hasPokerus": "Pokerus - Yes",
"noPokerus": "Pokerus - No",
"sortByNumber": "Núm.",
"sortByCost": "Coste",
"sortByCandies": "# Caramelos",
Expand Down
9 changes: 9 additions & 0 deletions src/locales/fr/filter-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,18 @@ export const filterBar: SimpleTranslationEntries = {
"passive": "Passif",
"passiveUnlocked": "Passif débloqué",
"passiveLocked": "Passif verrouillé",
"costReduction": "Cost Reduction",
"costReductionUnlocked": "Cost Reduction Unlocked",
"costReductionLocked": "Cost Reduction Locked",
"ribbon": "Ruban",
"hasWon": "Ruban - Oui",
"hasNotWon": "Ruban - Non",
"hiddenAbility": "Hidden Ability",
"hasHiddenAbility": "Hidden Ability - Yes",
"noHiddenAbility": "Hidden Ability - No",
"pokerus": "Pokerus",
"hasPokerus": "Pokerus - Yes",
"noPokerus": "Pokerus - No",
"sortByNumber": "Par N°",
"sortByCost": "Par cout",
"sortByCandies": "Par bonbons",
Expand Down
9 changes: 9 additions & 0 deletions src/locales/it/filter-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,18 @@ export const filterBar: SimpleTranslationEntries = {
"passive": "Passive",
"passiveUnlocked": "Passiva sbloccata",
"passiveLocked": "Passiva bloccata",
"costReduction": "Cost Reduction",
"costReductionUnlocked": "Cost Reduction Unlocked",
"costReductionLocked": "Cost Reduction Locked",
"ribbon": "Ribbon",
"hasWon": "Ribbon - Yes",
"hasNotWon": "Ribbon - No",
"hiddenAbility": "Hidden Ability",
"hasHiddenAbility": "Hidden Ability - Yes",
"noHiddenAbility": "Hidden Ability - No",
"pokerus": "Pokerus",
"hasPokerus": "Pokerus - Yes",
"noPokerus": "Pokerus - No",
"sortByNumber": "Num. Dex",
"sortByCost": "Costo",
"sortByCandies": "Caramelle",
Expand Down
9 changes: 9 additions & 0 deletions src/locales/ko/filter-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,18 @@ export const filterBar: SimpleTranslationEntries = {
"passive": "패시브",
"passiveUnlocked": "패시브 해금",
"passiveLocked": "패시브 잠김",
"costReduction": "Cost Reduction",
"costReductionUnlocked": "Cost Reduction Unlocked",
"costReductionLocked": "Cost Reduction Locked",
"ribbon": "클리어 여부",
"hasWon": "클리어 함",
"hasNotwon": "클리어 안함",
"hiddenAbility": "Hidden Ability",
"hasHiddenAbility": "Hidden Ability - Yes",
"noHiddenAbility": "Hidden Ability - No",
"pokerus": "Pokerus",
"hasPokerus": "Pokerus - Yes",
"noPokerus": "Pokerus - No",
"sortByNumber": "도감번호",
"sortByCost": "코스트",
"sortByCandies": "사탕 수",
Expand Down
9 changes: 9 additions & 0 deletions src/locales/pt_BR/filter-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,18 @@ export const filterBar: SimpleTranslationEntries = {
"passive": "Passiva",
"passiveUnlocked": "Passiva Desbloq.",
"passiveLocked": "Passiva Bloq.",
"costReduction": "Cost Reduction",
"costReductionUnlocked": "Cost Reduction Unlocked",
"costReductionLocked": "Cost Reduction Locked",
"ribbon": "Fita",
"hasWon": "Fita - Sim",
"hasNotWon": "Fita - Não",
"hiddenAbility": "Hidden Ability",
"hasHiddenAbility": "Hidden Ability - Yes",
"noHiddenAbility": "Hidden Ability - No",
"pokerus": "Pokerus",
"hasPokerus": "Pokerus - Yes",
"noPokerus": "Pokerus - No",
"sortByNumber": "Número",
"sortByCost": "Custo",
"sortByCandies": "# Doces",
Expand Down
9 changes: 9 additions & 0 deletions src/locales/zh_CN/filter-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,18 @@ export const filterBar: SimpleTranslationEntries = {
"passive": "被动",
"passiveUnlocked": "被动解锁",
"passiveLocked": "被动未解锁",
"costReduction": "Cost Reduction",
"costReductionUnlocked": "Cost Reduction Unlocked",
"costReductionLocked": "Cost Reduction Locked",
"ribbon": "缎带",
"hasWon": "有缎带",
"hasNotWon": "无缎带",
"hiddenAbility": "Hidden Ability",
"hasHiddenAbility": "Hidden Ability - Yes",
"noHiddenAbility": "Hidden Ability - No",
"pokerus": "Pokerus",
"hasPokerus": "Pokerus - Yes",
"noPokerus": "Pokerus - No",
"sortByNumber": "编号",
"sortByCost": "费用",
"sortByCandies": "糖果",
Expand Down
9 changes: 9 additions & 0 deletions src/locales/zh_TW/filter-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,18 @@ export const filterBar: SimpleTranslationEntries = {
"passive": "被動",
"passiveUnlocked": "被動解鎖",
"passiveLocked": "被動未解鎖",
"costReduction": "Cost Reduction",
"costReductionUnlocked": "Cost Reduction Unlocked",
"costReductionLocked": "Cost Reduction Locked",
"ribbon": "緞帶",
"hasWon": "有緞帶",
"hasNotWon": "無緞帶",
"hiddenAbility": "Hidden Ability",
"hasHiddenAbility": "Hidden Ability - Yes",
"noHiddenAbility": "Hidden Ability - No",
"pokerus": "Pokerus",
"hasPokerus": "Pokerus - Yes",
"noPokerus": "Pokerus - No",
"sortByNumber": "編號",
"sortByCost": "花費",
"sortByCandies": "糖果",
Expand Down
54 changes: 53 additions & 1 deletion src/ui/starter-select-ui-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,16 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
new DropDownLabel(i18next.t("filterBar:passiveUnlocked"), undefined, DropDownState.ON),
new DropDownLabel(i18next.t("filterBar:passiveLocked"), undefined, DropDownState.EXCLUDE),
];

const costReductionLabels = [
new DropDownLabel(i18next.t("filterBar:costReduction"), undefined, DropDownState.OFF),
new DropDownLabel(i18next.t("filterBar:costReductionUnlocked"), undefined, DropDownState.ON),
new DropDownLabel(i18next.t("filterBar:costReductionLocked"), undefined, DropDownState.EXCLUDE),
];

const unlocksOptions = [
new DropDownOption(this.scene, "PASSIVE", passiveLabels),
new DropDownOption(this.scene, "COST_REDUCTION", costReductionLabels),
];

this.filterBar.addFilter(DropDownColumn.UNLOCKS, i18next.t("filterBar:unlocksFilter"), new DropDown(this.scene, 0, 0, unlocksOptions, this.updateStarters, DropDownType.RADIAL));
Expand All @@ -443,8 +451,20 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
new DropDownLabel(i18next.t("filterBar:hasWon"), undefined, DropDownState.ON),
new DropDownLabel(i18next.t("filterBar:hasNotWon"), undefined, DropDownState.EXCLUDE),
];
const hiddenAbilityLabels = [
new DropDownLabel(i18next.t("filterBar:hiddenAbility"), undefined, DropDownState.OFF),
new DropDownLabel(i18next.t("filterBar:hasHiddenAbility"), undefined, DropDownState.ON),
new DropDownLabel(i18next.t("filterBar:noHiddenAbility"), undefined, DropDownState.EXCLUDE),
];
const pokerusLabels = [
new DropDownLabel(i18next.t("filterBar:pokerus"), undefined, DropDownState.OFF),
new DropDownLabel(i18next.t("filterBar:hasPokerus"), undefined, DropDownState.ON),
new DropDownLabel(i18next.t("filterBar:noPokerus"), undefined, DropDownState.EXCLUDE),
];
const miscOptions = [
new DropDownOption(this.scene, "WIN", winLabels),
new DropDownOption(this.scene, "HIDDEN_ABILITY", hiddenAbilityLabels),
new DropDownOption(this.scene, "POKERUS", pokerusLabels),
];
this.filterBar.addFilter(DropDownColumn.MISC, i18next.t("filterBar:miscFilter"), new DropDown(this.scene, 0, 0, miscOptions, this.updateStarters, DropDownType.RADIAL));

Expand Down Expand Up @@ -2107,9 +2127,11 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
const isCaught = !!(caughtVariants & DexAttr.NON_SHINY);
const isUncaught = !isCaught && !isVariantCaught && !isVariant2Caught && !isVariant3Caught;
const isPassiveUnlocked = this.scene.gameData.starterData[container.species.speciesId].passiveAttr > 0;
const isCostReduced = this.scene.gameData.starterData[container.species.speciesId].valueReduction > 0;
const isWin = this.scene.gameData.starterData[container.species.speciesId].classicWinCount > 0;
const isNotWin = this.scene.gameData.starterData[container.species.speciesId].classicWinCount === 0;
const isUndefined = this.scene.gameData.starterData[container.species.speciesId].classicWinCount === undefined;
const isHA = this.scene.gameData.starterData[container.species.speciesId].abilityAttr & AbilityAttr.ABILITY_HIDDEN;

const fitsGen = this.filterBar.getVals(DropDownColumn.GEN).includes(container.species.generation);

Expand Down Expand Up @@ -2139,6 +2161,16 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
}
});

const fitsCostReduction = this.filterBar.getVals(DropDownColumn.UNLOCKS).some(unlocks => {
if (unlocks.val === "COST_REDUCTION" && unlocks.state === DropDownState.ON) {
return isCostReduced;
} else if (unlocks.val === "COST_REDUCTION" && unlocks.state === DropDownState.EXCLUDE) {
return !isCostReduced;
} else if (unlocks.val === "COST_REDUCTION" && unlocks.state === DropDownState.OFF) {
return true;
}
});

const fitsWin = this.filterBar.getVals(DropDownColumn.MISC).some(misc => {
if (container.species.speciesId < 10) {
}
Expand All @@ -2151,7 +2183,27 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
}
});

if (fitsGen && fitsType && fitsShiny && fitsPassive && fitsWin) {
const fitsHA = this.filterBar.getVals(DropDownColumn.MISC).some(misc => {
if (misc.val === "HIDDEN_ABILITY" && misc.state === DropDownState.ON) {
return isHA;
} else if (misc.val === "HIDDEN_ABILITY" && misc.state === DropDownState.EXCLUDE) {
return !isHA;
} else if (misc.val === "HIDDEN_ABILITY" && misc.state === DropDownState.OFF) {
return true;
}
});

const fitsPokerus = this.filterBar.getVals(DropDownColumn.MISC).some(misc => {
if (misc.val === "POKERUS" && misc.state === DropDownState.ON) {
return this.pokerusSpecies.includes(container.species);
} else if (misc.val === "POKERUS" && misc.state === DropDownState.EXCLUDE) {
return !this.pokerusSpecies.includes(container.species);
} else if (misc.val === "POKERUS" && misc.state === DropDownState.OFF) {
return true;
}
});

if (fitsGen && fitsType && fitsShiny && fitsPassive && fitsCostReduction && fitsWin && fitsHA && fitsPokerus) {
this.filteredStarterContainers.push(container);
}
});
Expand Down
Loading