mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-29 11:42:21 +02:00
Regional forms display name of region in evolutions and prevolutions
This commit is contained in:
parent
c72296172d
commit
d529bb78b2
@ -47,7 +47,6 @@ import { speciesTmMoves } from "#app/data/balance/tms";
|
|||||||
import { BiomePoolTier, BiomeTierTod, catchableSpecies } from "#app/data/balance/biomes";
|
import { BiomePoolTier, BiomeTierTod, catchableSpecies } from "#app/data/balance/biomes";
|
||||||
import { Biome } from "#app/enums/biome";
|
import { Biome } from "#app/enums/biome";
|
||||||
import { TimeOfDay } from "#app/enums/time-of-day";
|
import { TimeOfDay } from "#app/enums/time-of-day";
|
||||||
import { SpeciesFormKey } from "#app/enums/species-form-key";
|
|
||||||
import { Abilities } from "#app/enums/abilities";
|
import { Abilities } from "#app/enums/abilities";
|
||||||
import BaseStatsOverlay from "./base-stats-overlay";
|
import BaseStatsOverlay from "./base-stats-overlay";
|
||||||
|
|
||||||
@ -210,7 +209,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
private baseTotal: number;
|
private baseTotal: number;
|
||||||
private evolutions: SpeciesFormEvolution[];
|
private evolutions: SpeciesFormEvolution[];
|
||||||
private battleForms: PokemonForm[];
|
private battleForms: PokemonForm[];
|
||||||
private prevolution: SpeciesFormEvolution | null;
|
private prevolutions: SpeciesFormEvolution[];
|
||||||
|
|
||||||
private speciesStarterDexEntry: DexEntry | null;
|
private speciesStarterDexEntry: DexEntry | null;
|
||||||
private canCycleShiny: boolean;
|
private canCycleShiny: boolean;
|
||||||
@ -575,6 +574,10 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
|
|
||||||
starterSetup(): void {
|
starterSetup(): void {
|
||||||
|
|
||||||
|
this.evolutions = [];
|
||||||
|
this.prevolutions = [];
|
||||||
|
this.battleForms = [];
|
||||||
|
|
||||||
const species = this.lastSpecies;
|
const species = this.lastSpecies;
|
||||||
const formIndex = this.lastFormIndex ?? 0;
|
const formIndex = this.lastFormIndex ?? 0;
|
||||||
|
|
||||||
@ -634,16 +637,13 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
|
|
||||||
this.battleForms = species.forms.filter(f => !f.isStarterSelectable);
|
this.battleForms = species.forms.filter(f => !f.isStarterSelectable);
|
||||||
|
|
||||||
this.prevolution = null;
|
|
||||||
const preSpecies = pokemonPrevolutions.hasOwnProperty(this.lastSpecies.speciesId) ? allSpecies.find(sp => sp.speciesId === pokemonPrevolutions[this.lastSpecies.speciesId]) : null;
|
const preSpecies = pokemonPrevolutions.hasOwnProperty(this.lastSpecies.speciesId) ? allSpecies.find(sp => sp.speciesId === pokemonPrevolutions[this.lastSpecies.speciesId]) : null;
|
||||||
if (preSpecies) {
|
if (preSpecies) {
|
||||||
const preEvolutions = pokemonEvolutions.hasOwnProperty(preSpecies.speciesId) ? pokemonEvolutions[preSpecies.speciesId] : [];
|
const preEvolutions = pokemonEvolutions.hasOwnProperty(preSpecies.speciesId) ? pokemonEvolutions[preSpecies.speciesId] : [];
|
||||||
if (species.forms.length > 0) {
|
console.log(preEvolutions);
|
||||||
this.prevolution = preEvolutions.filter(e => (e.evoFormKey === species.forms[formIndex].formKey || e.evoFormKey === null))[0];
|
this.prevolutions = preEvolutions.filter(
|
||||||
} else {
|
e => e.speciesId === species.speciesId && ((e.evoFormKey === "" || e.evoFormKey === null) || e.evoFormKey === species.forms[formIndex]?.formKey));
|
||||||
this.prevolution = preEvolutions[0];
|
console.log(this.prevolutions);
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.battleForms.find(bf => bf.formIndex === this.lastFormIndex)) {
|
if (this.battleForms.find(bf => bf.formIndex === this.lastFormIndex)) {
|
||||||
@ -989,6 +989,31 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getFormString(formKey: string, species: PokemonSpecies, append: boolean = false): string {
|
||||||
|
let label: string;
|
||||||
|
const formText = capitalizeString(formKey, "-", false, false) ?? "";
|
||||||
|
const speciesName = capitalizeString(this.getStarterSpecies(species).name, "_", true, false) ?? "";
|
||||||
|
if (species.speciesId === Species.ARCEUS) {
|
||||||
|
label = i18next.t(`pokemonInfo:Type.${formText?.toUpperCase()}`);
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
label = formText ? i18next.t(`pokemonForm:${speciesName}${formText}`) : "";
|
||||||
|
if (label === `${speciesName}${formText}`) {
|
||||||
|
label = i18next.t(`battlePokemonForm:${formKey}`, { pokemonName:species.name });
|
||||||
|
} else {
|
||||||
|
// If the label is only the form, we can append the name of the pokemon
|
||||||
|
label += append ? ` ${species.name}` : "";
|
||||||
|
}
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
getRegionName(species: PokemonSpecies): string {
|
||||||
|
const name = species.name;
|
||||||
|
const label = Species[species.speciesId];
|
||||||
|
const suffix = label.includes("_") ? " (" + label.split("_")[0].toLowerCase() + ")" : "";
|
||||||
|
return name + suffix;
|
||||||
|
}
|
||||||
|
|
||||||
processInput(button: Button): boolean {
|
processInput(button: Button): boolean {
|
||||||
if (this.blockInput) {
|
if (this.blockInput) {
|
||||||
return false;
|
return false;
|
||||||
@ -1356,49 +1381,52 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
|
|
||||||
ui.showText(i18next.t("pokedexUiHandler:evolutionsAndForms"), null, () => {
|
ui.showText(i18next.t("pokedexUiHandler:evolutionsAndForms"), null, () => {
|
||||||
|
|
||||||
if (!this.prevolution && !this.evolutions && !this.battleForms) {
|
if (!this.prevolutions && !this.evolutions && !this.battleForms) {
|
||||||
this.blockInput = false;
|
this.blockInput = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.prevolution) {
|
if (this.prevolutions?.length > 0) {
|
||||||
options.push({
|
options.push({
|
||||||
label: i18next.t("pokedexUiHandler:prevolution"),
|
label: i18next.t("pokedexUiHandler:prevolutions"),
|
||||||
skip: true,
|
skip: true,
|
||||||
handler: () => false
|
handler: () => false
|
||||||
});
|
});
|
||||||
|
this.prevolutions.map(pre => {
|
||||||
|
const preSpecies = allSpecies.find(species => species.speciesId === pokemonPrevolutions[this.lastSpecies.speciesId]);
|
||||||
|
options.push({
|
||||||
|
label: pre.preFormKey ?
|
||||||
|
this.getFormString(pre.preFormKey, preSpecies ?? this.lastSpecies, true) :
|
||||||
|
this.getRegionName(preSpecies ?? this.lastSpecies),
|
||||||
|
color: "#ccbe00",
|
||||||
|
handler: () => {
|
||||||
|
const newSpecies = allSpecies.find(species => species.speciesId === pokemonPrevolutions[pre.speciesId]);
|
||||||
|
// Attempts to find the formIndex of the evolved species
|
||||||
|
const newFormKey = pre.evoFormKey ? pre.evoFormKey : (this.lastSpecies.forms.length > 0 ? this.lastSpecies.forms[this.lastFormIndex].formKey : "");
|
||||||
|
const matchingForm = newSpecies?.forms.find(form => form.formKey === newFormKey);
|
||||||
|
const newFormIndex = matchingForm ? matchingForm.formIndex : 0;
|
||||||
|
this.starterAttributes.form = newFormIndex;
|
||||||
|
this.moveInfoOverlay.clear();
|
||||||
|
this.clearText();
|
||||||
|
ui.setMode(Mode.POKEDEX_PAGE, newSpecies, newFormIndex, this.starterAttributes);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const pre = this.prevolution;
|
let label:string = "";
|
||||||
options.push({
|
if (pre.level > 1) {
|
||||||
label: i18next.t(`pokemon:${Species[pokemonPrevolutions[pre.speciesId]].toUpperCase()}`),
|
label = `${pre.level}`;
|
||||||
color: "#ccbe00",
|
} else if (pre.item) {
|
||||||
handler: () => {
|
label = i18next.t(`modifierType:EvolutionItem.${EvolutionItem[pre.item].toUpperCase()}`) +
|
||||||
const newSpecies = allSpecies.find(species => species.speciesId === pokemonPrevolutions[pre.speciesId]);
|
" (" + (pre.item > 50 ? "Ultra" : "Great") + ")";
|
||||||
// Attempts to find the formIndex of the evolved species
|
} else {
|
||||||
const newFormKey = pre.evoFormKey ? pre.evoFormKey : (this.lastSpecies.forms.length > 0 ? this.lastSpecies.forms[this.lastFormIndex].formKey : "");
|
label = "";
|
||||||
const matchingForm = newSpecies?.forms.find(form => form.formKey === newFormKey);
|
|
||||||
const newFormIndex = matchingForm ? matchingForm.formIndex : 0;
|
|
||||||
this.starterAttributes.form = newFormIndex;
|
|
||||||
this.moveInfoOverlay.clear();
|
|
||||||
this.clearText();
|
|
||||||
ui.setMode(Mode.POKEDEX_PAGE, newSpecies, newFormIndex, this.starterAttributes);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
});
|
options.push({
|
||||||
|
label: label,
|
||||||
let label:string = "";
|
skip: true,
|
||||||
if (pre.level > 1) {
|
handler: () => false
|
||||||
label = `${pre.level}`;
|
});
|
||||||
} else if (pre.item) {
|
|
||||||
label = i18next.t(`modifierType:EvolutionItem.${EvolutionItem[pre.item].toUpperCase()}`) +
|
|
||||||
" (" + (pre.item > 50 ? "Ultra" : "Great") + ")";
|
|
||||||
} else {
|
|
||||||
label = "";
|
|
||||||
}
|
|
||||||
options.push({
|
|
||||||
label: label,
|
|
||||||
skip: true,
|
|
||||||
handler: () => false
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1409,8 +1437,11 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
handler: () => false
|
handler: () => false
|
||||||
});
|
});
|
||||||
this.evolutions.map(evo => {
|
this.evolutions.map(evo => {
|
||||||
|
const evoSpecies = allSpecies.find(species => species.speciesId === evo.speciesId);
|
||||||
options.push({
|
options.push({
|
||||||
label: i18next.t(`pokemon:${Species[evo.speciesId].toUpperCase()}`),
|
label: evo.evoFormKey ?
|
||||||
|
this.getFormString(evo.evoFormKey, evoSpecies ?? this.lastSpecies, true) :
|
||||||
|
this.getRegionName(evoSpecies ?? this.lastSpecies),
|
||||||
color: "#ccbe00",
|
color: "#ccbe00",
|
||||||
handler: () => {
|
handler: () => {
|
||||||
const newSpecies = allSpecies.find(species => species.speciesId === evo.speciesId);
|
const newSpecies = allSpecies.find(species => species.speciesId === evo.speciesId);
|
||||||
@ -1449,15 +1480,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
handler: () => false
|
handler: () => false
|
||||||
});
|
});
|
||||||
this.battleForms.map(bf => {
|
this.battleForms.map(bf => {
|
||||||
let label: string;
|
let label: string = this.getFormString(bf.formKey, this.lastSpecies);
|
||||||
const formText = capitalizeString(bf.formKey, "-", false, false);
|
|
||||||
const speciesName = capitalizeString(this.getStarterSpecies(this.lastSpecies).name, "_", true, false);
|
|
||||||
label = Object.values(SpeciesFormKey).includes(bf.formKey as SpeciesFormKey) ?
|
|
||||||
i18next.t(`battlePokemonForm:${bf.formKey}`, { pokemonName:this.lastSpecies.name }) : (
|
|
||||||
this.lastSpecies.speciesId === Species.ARCEUS ?
|
|
||||||
i18next.t(`pokemonInfo:Type.${formText?.toUpperCase()}`) :
|
|
||||||
formText ? i18next.t(`pokemonForm:${speciesName}${formText}`) : ""
|
|
||||||
);
|
|
||||||
if (!label && bf.formIndex === 0) {
|
if (!label && bf.formIndex === 0) {
|
||||||
label = i18next.t(`pokemon:${Species[bf.speciesId].toUpperCase()}`);
|
label = i18next.t(`pokemon:${Species[bf.speciesId].toUpperCase()}`);
|
||||||
}
|
}
|
||||||
@ -2255,11 +2278,15 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
this.pokemonGenderText.setText("");
|
this.pokemonGenderText.setText("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (dexEntry.caughtAttr) {
|
if (dexEntry.caughtAttr) {
|
||||||
const speciesForm = getPokemonSpeciesForm(species.speciesId, formIndex!); // TODO: is the bang correct?
|
const speciesForm = getPokemonSpeciesForm(species.speciesId, formIndex!); // TODO: is the bang correct?
|
||||||
this.setTypeIcons(speciesForm.type1, speciesForm.type2);
|
this.setTypeIcons(speciesForm.type1, speciesForm.type2);
|
||||||
|
this.pokemonFormText.setText(this.getFormString((speciesForm as PokemonForm).formKey, species));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.setTypeIcons(null, null);
|
this.setTypeIcons(null, null);
|
||||||
|
this.pokemonFormText.setText("");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.shinyOverlay.setVisible(false);
|
this.shinyOverlay.setVisible(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user