[Enhancement] Add Passive / Cost Reduction - Can Unlock option and Egg purchasable filter (#3478)

* add unlockable state in passive/cost reduction filter. add egg purchasable filter

* update placeholders

* update option order of UNLOCKABLE between ON and EXCLUDE

* remove egg restriction when buying eggs
This commit is contained in:
Leo Kim 2024-08-12 13:44:15 +09:00 committed by GitHub
parent f8b9397d06
commit 53e54df9ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 116 additions and 45 deletions

View File

@ -8,14 +8,16 @@ export const filterBar: SimpleTranslationEntries = {
"miscFilter": "Misc",
"sortFilter": "Sort",
"all": "All",
"normal": "Normal",
"normal": "Not Shiny",
"uncaught": "Uncaught",
"passive": "Passive",
"passiveUnlocked": "Passive Unlocked",
"passiveLocked": "Passive Locked",
"passiveUnlocked": "Passive - Yes",
"passiveLocked": "Passive - No",
"passiveUnlockable": "Passive - Can Unlock",
"costReduction": "Cost Reduction",
"costReductionUnlocked": "Cost Reduction Unlocked",
"costReductionLocked": "Cost Reduction Locked",
"costReductionUnlocked": "Cost Reduction - Yes",
"costReductionLocked": "Cost Reduction - No",
"costReductionUnlockable": "Cost Reduction - Can Unlock",
"favorite": "Favorite",
"isFavorite": "Favorite - Yes",
"notFavorite": "Favorite - No",
@ -25,6 +27,8 @@ export const filterBar: SimpleTranslationEntries = {
"hiddenAbility": "Hidden Ability",
"hasHiddenAbility": "Hidden Ability - Yes",
"noHiddenAbility": "Hidden Ability - No",
"egg": "Egg",
"eggPurchasable": "Purchasable Egg",
"pokerus": "Pokerus",
"hasPokerus": "Pokerus - Yes",
"noPokerus": "Pokerus - No",

View File

@ -13,9 +13,11 @@ export const filterBar: SimpleTranslationEntries = {
"passive": "Passive",
"passiveUnlocked": "Passive freigeschaltet",
"passiveLocked": "Passive gesperrt",
"passiveUnlockable": "Passive - Can Unlock",
"costReduction": "Cost Reduction",
"costReductionUnlocked": "Cost Reduction Unlocked",
"costReductionLocked": "Cost Reduction Locked",
"costReductionUnlockable": "Cost Reduction - Can Unlock",
"favorite": "Favorite",
"isFavorite": "Favorite - Yes",
"notFavorite": "Favorite - No",
@ -25,6 +27,8 @@ export const filterBar: SimpleTranslationEntries = {
"hiddenAbility": "Hidden Ability",
"hasHiddenAbility": "Hidden Ability - Yes",
"noHiddenAbility": "Hidden Ability - No",
"egg": "Egg",
"eggPurchasable": "Purchasable Egg",
"pokerus": "Pokerus",
"hasPokerus": "Pokerus - Yes",
"noPokerus": "Pokerus - No",

View File

@ -11,11 +11,13 @@ export const filterBar: SimpleTranslationEntries = {
"normal": "Not Shiny",
"uncaught": "Uncaught",
"passive": "Passive",
"passiveUnlocked": "Passive Unlocked",
"passiveLocked": "Passive Locked",
"passiveUnlocked": "Passive - Yes",
"passiveLocked": "Passive - No",
"passiveUnlockable": "Passive - Can Unlock",
"costReduction": "Cost Reduction",
"costReductionUnlocked": "Cost Reduction Unlocked",
"costReductionLocked": "Cost Reduction Locked",
"costReductionUnlocked": "Cost Reduction - Yes",
"costReductionLocked": "Cost Reduction - No",
"costReductionUnlockable": "Cost Reduction - Can Unlock",
"favorite": "Favorite",
"isFavorite": "Favorite - Yes",
"notFavorite": "Favorite - No",
@ -25,6 +27,8 @@ export const filterBar: SimpleTranslationEntries = {
"hiddenAbility": "Hidden Ability",
"hasHiddenAbility": "Hidden Ability - Yes",
"noHiddenAbility": "Hidden Ability - No",
"egg": "Egg",
"eggPurchasable": "Purchasable Egg",
"pokerus": "Pokerus",
"hasPokerus": "Pokerus - Yes",
"noPokerus": "Pokerus - No",

View File

@ -13,9 +13,11 @@ export const filterBar: SimpleTranslationEntries = {
"passive": "Passive",
"passiveUnlocked": "Pasiva Desbloq.",
"passiveLocked": "Pasiva Bloq.",
"passiveUnlockable": "Passive - Can Unlock",
"costReduction": "Cost Reduction",
"costReductionUnlocked": "Cost Reduction Unlocked",
"costReductionLocked": "Cost Reduction Locked",
"costReductionUnlockable": "Cost Reduction - Can Unlock",
"favorite": "Favorite",
"isFavorite": "Favorite - Yes",
"notFavorite": "Favorite - No",
@ -25,6 +27,8 @@ export const filterBar: SimpleTranslationEntries = {
"hiddenAbility": "Hidden Ability",
"hasHiddenAbility": "Hidden Ability - Yes",
"noHiddenAbility": "Hidden Ability - No",
"egg": "Egg",
"eggPurchasable": "Purchasable Egg",
"pokerus": "Pokerus",
"hasPokerus": "Pokerus - Yes",
"noPokerus": "Pokerus - No",

View File

@ -13,9 +13,11 @@ export const filterBar: SimpleTranslationEntries = {
"passive": "Passif",
"passiveUnlocked": "Passif débloqué",
"passiveLocked": "Passif verrouillé",
"passiveUnlockable": "Passive - Can Unlock",
"costReduction": "Cost Reduction",
"costReductionUnlocked": "Cost Reduction Unlocked",
"costReductionLocked": "Cost Reduction Locked",
"costReductionUnlockable": "Cost Reduction - Can Unlock",
"favorite": "Favorite",
"isFavorite": "Favorite - Yes",
"notFavorite": "Favorite - No",
@ -25,6 +27,8 @@ export const filterBar: SimpleTranslationEntries = {
"hiddenAbility": "Hidden Ability",
"hasHiddenAbility": "Hidden Ability - Yes",
"noHiddenAbility": "Hidden Ability - No",
"egg": "Egg",
"eggPurchasable": "Purchasable Egg",
"pokerus": "Pokerus",
"hasPokerus": "Pokerus - Yes",
"noPokerus": "Pokerus - No",

View File

@ -13,9 +13,11 @@ export const filterBar: SimpleTranslationEntries = {
"passive": "Passive",
"passiveUnlocked": "Passiva sbloccata",
"passiveLocked": "Passiva bloccata",
"passiveUnlockable": "Passive - Can Unlock",
"costReduction": "Cost Reduction",
"costReductionUnlocked": "Cost Reduction Unlocked",
"costReductionLocked": "Cost Reduction Locked",
"costReductionUnlockable": "Cost Reduction - Can Unlock",
"favorite": "Favorite",
"isFavorite": "Favorite - Yes",
"notFavorite": "Favorite - No",
@ -25,6 +27,8 @@ export const filterBar: SimpleTranslationEntries = {
"hiddenAbility": "Hidden Ability",
"hasHiddenAbility": "Hidden Ability - Yes",
"noHiddenAbility": "Hidden Ability - No",
"egg": "Egg",
"eggPurchasable": "Purchasable Egg",
"pokerus": "Pokerus",
"hasPokerus": "Pokerus - Yes",
"noPokerus": "Pokerus - No",

View File

@ -11,11 +11,13 @@ export const filterBar: SimpleTranslationEntries = {
"normal": "Not Shiny",
"uncaught": "Uncaught",
"passive": "Passive",
"passiveUnlocked": "Passive Unlocked",
"passiveLocked": "Passive Locked",
"passiveUnlocked": "Passive - Yes",
"passiveLocked": "Passive - No",
"passiveUnlockable": "Passive - Can Unlock",
"costReduction": "Cost Reduction",
"costReductionUnlocked": "Cost Reduction Unlocked",
"costReductionLocked": "Cost Reduction Locked",
"costReductionUnlocked": "Cost Reduction - Yes",
"costReductionLocked": "Cost Reduction - No",
"costReductionUnlockable": "Cost Reduction - Can Unlock",
"favorite": "Favorite",
"isFavorite": "Favorite - Yes",
"notFavorite": "Favorite - No",
@ -25,6 +27,8 @@ export const filterBar: SimpleTranslationEntries = {
"hiddenAbility": "Hidden Ability",
"hasHiddenAbility": "Hidden Ability - Yes",
"noHiddenAbility": "Hidden Ability - No",
"egg": "Egg",
"eggPurchasable": "Purchasable Egg",
"pokerus": "Pokerus",
"hasPokerus": "Pokerus - Yes",
"noPokerus": "Pokerus - No",

View File

@ -13,9 +13,11 @@ export const filterBar: SimpleTranslationEntries = {
"passive": "패시브",
"passiveUnlocked": "패시브 해금",
"passiveLocked": "패시브 잠김",
"passiveUnlockable": "패시브 해금 가능",
"costReduction": "코스트 감소",
"costReductionUnlocked": "코스트 감소됨",
"costReductionLocked": "코스트 감소 없음",
"costReductionUnlockable": "코스트 감소 가능",
"favorite": "즐겨찾기",
"isFavorite": "즐겨찾기 등록됨",
"notFavorite": "즐겨찾기 제외됨",
@ -25,6 +27,8 @@ export const filterBar: SimpleTranslationEntries = {
"hiddenAbility": "숨겨진 특성",
"hasHiddenAbility": "숨겨진 특성 보유",
"noHiddenAbility": "숨겨진 특성 없음",
"egg": "알",
"eggPurchasable": "알 구매 가능",
"pokerus": "포켓러스",
"hasPokerus": "포켓러스 감염",
"noPokerus": "포켓러스 없음",

View File

@ -13,9 +13,11 @@ export const filterBar: SimpleTranslationEntries = {
"passive": "Passiva",
"passiveUnlocked": "Passiva Desbloqueada",
"passiveLocked": "Passiva Bloqueada",
"passiveUnlockable": "Passive - Can Unlock",
"costReduction": "Redução de Custo",
"costReductionUnlocked": "Redução de Custo Desbloq.",
"costReductionLocked": "Redução de Custo Bloq.",
"costReductionUnlockable": "Cost Reduction - Can Unlock",
"favorite": "Favorite",
"isFavorite": "Favorite - Yes",
"notFavorite": "Favorite - No",
@ -25,6 +27,8 @@ export const filterBar: SimpleTranslationEntries = {
"hiddenAbility": "Habilidade Oculta",
"hasHiddenAbility": "Habilidade Oculta - Sim",
"noHiddenAbility": "Habilidade Oculta - Não",
"egg": "Egg",
"eggPurchasable": "Purchasable Egg",
"pokerus": "Pokérus",
"hasPokerus": "Pokérus - Sim",
"noPokerus": "Pokérus - Não",

View File

@ -13,9 +13,11 @@ export const filterBar: SimpleTranslationEntries = {
"passive": "被动",
"passiveUnlocked": "被动解锁",
"passiveLocked": "被动未解锁",
"passiveUnlockable": "Passive - Can Unlock",
"costReduction": "费用降低",
"costReductionUnlocked": "已降费",
"costReductionLocked": "未降费",
"costReductionUnlockable": "Cost Reduction - Can Unlock",
"favorite": "Favorite",
"isFavorite": "Favorite - Yes",
"notFavorite": "Favorite - No",
@ -25,6 +27,8 @@ export const filterBar: SimpleTranslationEntries = {
"hiddenAbility": "梦特",
"hasHiddenAbility": "有梦特",
"noHiddenAbility": "无梦特",
"egg": "Egg",
"eggPurchasable": "Purchasable Egg",
"pokerus": "病毒",
"hasPokerus": "有病毒",
"noPokerus": "无病毒",

View File

@ -13,9 +13,11 @@ export const filterBar: SimpleTranslationEntries = {
"passive": "被動",
"passiveUnlocked": "被動解鎖",
"passiveLocked": "被動未解鎖",
"passiveUnlockable": "Passive - Can Unlock",
"costReduction": "Cost Reduction",
"costReductionUnlocked": "Cost Reduction Unlocked",
"costReductionLocked": "Cost Reduction Locked",
"costReductionUnlockable": "Cost Reduction - Can Unlock",
"favorite": "Favorite",
"isFavorite": "Favorite - Yes",
"notFavorite": "Favorite - No",
@ -25,6 +27,8 @@ export const filterBar: SimpleTranslationEntries = {
"hiddenAbility": "Hidden Ability",
"hasHiddenAbility": "Hidden Ability - Yes",
"noHiddenAbility": "Hidden Ability - No",
"egg": "Egg",
"eggPurchasable": "Purchasable Egg",
"pokerus": "Pokerus",
"hasPokerus": "Pokerus - Yes",
"noPokerus": "Pokerus - No",

View File

@ -7,7 +7,8 @@ import i18next from "i18next";
export enum DropDownState {
ON = 0,
OFF = 1,
EXCLUDE = 2
EXCLUDE = 2,
UNLOCKABLE = 3
}
export enum DropDownType {
@ -46,6 +47,7 @@ export class DropDownOption extends Phaser.GameObjects.Container {
private onColor = 0x33bbff;
private offColor = 0x272727;
private excludeColor = 0xff5555;
private unlockableColor = 0xffff00;
constructor(scene: SceneBase, val: any, labels: DropDownLabel | DropDownLabel[]) {
super(scene);
@ -114,6 +116,9 @@ export class DropDownOption extends Phaser.GameObjects.Container {
case DropDownState.EXCLUDE:
this.toggle.setTint(this.excludeColor);
break;
case DropDownState.UNLOCKABLE:
this.toggle.setTint(this.unlockableColor);
break;
}
}

View File

@ -445,12 +445,14 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
const passiveLabels = [
new DropDownLabel(i18next.t("filterBar:passive"), undefined, DropDownState.OFF),
new DropDownLabel(i18next.t("filterBar:passiveUnlocked"), undefined, DropDownState.ON),
new DropDownLabel(i18next.t("filterBar:passiveUnlockable"), undefined, DropDownState.UNLOCKABLE),
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:costReductionUnlockable"), undefined, DropDownState.UNLOCKABLE),
new DropDownLabel(i18next.t("filterBar:costReductionLocked"), undefined, DropDownState.EXCLUDE),
];
@ -477,6 +479,10 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
new DropDownLabel(i18next.t("filterBar:hasHiddenAbility"), undefined, DropDownState.ON),
new DropDownLabel(i18next.t("filterBar:noHiddenAbility"), undefined, DropDownState.EXCLUDE),
];
const eggLabels = [
new DropDownLabel(i18next.t("filterBar:egg"), undefined, DropDownState.OFF),
new DropDownLabel(i18next.t("filterBar:eggPurchasable"), undefined, DropDownState.ON),
];
const pokerusLabels = [
new DropDownLabel(i18next.t("filterBar:pokerus"), undefined, DropDownState.OFF),
new DropDownLabel(i18next.t("filterBar:hasPokerus"), undefined, DropDownState.ON),
@ -485,6 +491,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
new DropDownOption(this.scene, "FAVORITE", favoriteLabels),
new DropDownOption(this.scene, "WIN", winLabels),
new DropDownOption(this.scene, "HIDDEN_ABILITY", hiddenAbilityLabels),
new DropDownOption(this.scene, "EGG", eggLabels),
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));
@ -1680,37 +1687,35 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
});
}
// Same species egg menu option. Only visible if passive is bought
if (passiveAttr & PassiveAttr.UNLOCKED) {
const sameSpeciesEggCost = getSameSpeciesEggCandyCounts(speciesStarters[this.lastSpecies.speciesId]);
options.push({
label: `x${sameSpeciesEggCost} ${i18next.t("starterSelectUiHandler:sameSpeciesEgg")}`,
handler: () => {
if (this.scene.gameData.eggs.length < 99 && (Overrides.FREE_CANDY_UPGRADE_OVERRIDE || candyCount >= sameSpeciesEggCost)) {
if (!Overrides.FREE_CANDY_UPGRADE_OVERRIDE) {
starterData.candyCount -= sameSpeciesEggCost;
}
this.pokemonCandyCountText.setText(`x${starterData.candyCount}`);
const egg = new Egg({scene: this.scene, species: this.lastSpecies.speciesId, sourceType: EggSourceType.SAME_SPECIES_EGG});
egg.addEggToGameData(this.scene);
this.scene.gameData.saveSystem().then(success => {
if (!success) {
return this.scene.reset(true);
}
});
ui.setMode(Mode.STARTER_SELECT);
this.scene.playSound("buy");
return true;
// Same species egg menu option.
const sameSpeciesEggCost = getSameSpeciesEggCandyCounts(speciesStarters[this.lastSpecies.speciesId]);
options.push({
label: `x${sameSpeciesEggCost} ${i18next.t("starterSelectUiHandler:sameSpeciesEgg")}`,
handler: () => {
if (this.scene.gameData.eggs.length < 99 && (Overrides.FREE_CANDY_UPGRADE_OVERRIDE || candyCount >= sameSpeciesEggCost)) {
if (!Overrides.FREE_CANDY_UPGRADE_OVERRIDE) {
starterData.candyCount -= sameSpeciesEggCost;
}
return false;
},
item: "candy",
itemArgs: starterColors[this.lastSpecies.speciesId]
});
}
this.pokemonCandyCountText.setText(`x${starterData.candyCount}`);
const egg = new Egg({scene: this.scene, species: this.lastSpecies.speciesId, sourceType: EggSourceType.SAME_SPECIES_EGG});
egg.addEggToGameData(this.scene);
this.scene.gameData.saveSystem().then(success => {
if (!success) {
return this.scene.reset(true);
}
});
ui.setMode(Mode.STARTER_SELECT);
this.scene.playSound("buy");
return true;
}
return false;
},
item: "candy",
itemArgs: starterColors[this.lastSpecies.speciesId]
});
options.push({
label: i18next.t("menu:cancel"),
handler: () => {
@ -2289,13 +2294,16 @@ 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 isPassiveUnlockable = this.isPassiveAvailable(container.species.speciesId) && !isPassiveUnlocked;
const isCostReduced = this.scene.gameData.starterData[container.species.speciesId].valueReduction > 0;
const isCostReductionUnlockable = this.isValueReductionAvailable(container.species.speciesId);
const isFavorite = this.starterPreferences[container.species.speciesId]?.favorite ?? false;
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 isEggPurchasable = this.isSameSpeciesEggAvailable(container.species.speciesId);
const fitsGen = this.filterBar.getVals(DropDownColumn.GEN).includes(container.species.generation);
@ -2320,6 +2328,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
return isPassiveUnlocked;
} else if (unlocks.val === "PASSIVE" && unlocks.state === DropDownState.EXCLUDE) {
return !isPassiveUnlocked;
} else if (unlocks.val === "PASSIVE" && unlocks.state === DropDownState.UNLOCKABLE) {
return isPassiveUnlockable;
} else if (unlocks.val === "PASSIVE" && unlocks.state === DropDownState.OFF) {
return true;
}
@ -2330,6 +2340,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
return isCostReduced;
} else if (unlocks.val === "COST_REDUCTION" && unlocks.state === DropDownState.EXCLUDE) {
return !isCostReduced;
} else if (unlocks.val === "COST_REDUCTION" && unlocks.state === DropDownState.UNLOCKABLE) {
return isCostReductionUnlockable;
} else if (unlocks.val === "COST_REDUCTION" && unlocks.state === DropDownState.OFF) {
return true;
}
@ -2369,6 +2381,16 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
}
});
const fitsEgg = this.filterBar.getVals(DropDownColumn.MISC).some(misc => {
if (misc.val === "EGG" && misc.state === DropDownState.ON) {
return isEggPurchasable;
} else if (misc.val === "EGG" && misc.state === DropDownState.EXCLUDE) {
return !isEggPurchasable;
} else if (misc.val === "EGG" && 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);
@ -2379,7 +2401,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
}
});
if (fitsGen && fitsType && fitsCaught && fitsPassive && fitsCostReduction && fitsFavorite && fitsWin && fitsHA && fitsPokerus) {
if (fitsGen && fitsType && fitsCaught && fitsPassive && fitsCostReduction && fitsFavorite && fitsWin && fitsHA && fitsEgg && fitsPokerus) {
this.filteredStarterContainers.push(container);
}
});