diff --git a/src/data/pokemon-species.ts b/src/data/pokemon-species.ts index 55da6a7e76c..18f85a7ca58 100644 --- a/src/data/pokemon-species.ts +++ b/src/data/pokemon-species.ts @@ -690,6 +690,26 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali return this.name; } + /** + * Find the name of species with proper attachments for regionals and separate starter forms (Floette, Ursaluna) + * @param species the species to check + * @returns a string with the region name or other form name attached + */ + getExpandedSpeciesName(): string { + const name = this.name; + const region = this.getRegion(); + if (this.speciesId === Species.ETERNAL_FLOETTE) { + return i18next.t("pokemonInfo:eternal_floette_expanded"); + } else if (this.speciesId === Species.BLOODMOON_URSALUNA) { + return i18next.t("pokemonInfo:bloodmoon_ursaluna_expanded"); + } else if (region === Region.NORMAL) { + return name; + } else { + const regionalName = i18next.t(`pokemonInfo:expandedName${Region[region]}`, { species: name }); + return regionalName; + } + } + localize(): void { this.name = i18next.t(`pokemon:${Species[this.speciesId].toLowerCase()}`); } diff --git a/src/phases/egg-hatch-phase.ts b/src/phases/egg-hatch-phase.ts index 2d0aa24dd1f..b2844591e33 100644 --- a/src/phases/egg-hatch-phase.ts +++ b/src/phases/egg-hatch-phase.ts @@ -3,7 +3,6 @@ import { globalScene } from "#app/global-scene"; import type { Egg } from "#app/data/egg"; import { EggCountChangedEvent } from "#app/events/egg"; import type { PlayerPokemon } from "#app/field/pokemon"; -import { getPokemonNameWithAffix } from "#app/messages"; import { Phase } from "#app/phase"; import { achvs } from "#app/system/achv"; import EggCounterContainer from "#app/ui/egg-counter-container"; @@ -356,7 +355,7 @@ export class EggHatchPhase extends Phase { globalScene.playSoundWithoutBgm("evolution_fanfare"); - globalScene.ui.showText(i18next.t("egg:hatchFromTheEgg", { pokemonName: getPokemonNameWithAffix(this.pokemon) }), null, () => { + globalScene.ui.showText(i18next.t("egg:hatchFromTheEgg", { pokemonName: this.pokemon.species.getExpandedSpeciesName() }), null, () => { globalScene.gameData.updateSpeciesDexIvs(this.pokemon.species.speciesId, this.pokemon.ivs); globalScene.gameData.setPokemonCaught(this.pokemon, true, true).then(() => { globalScene.gameData.setEggMoveUnlocked(this.pokemon.species, this.eggMoveIndex).then((value) => { diff --git a/src/ui/pokedex-page-ui-handler.ts b/src/ui/pokedex-page-ui-handler.ts index 7ab054ea71b..a0458d762a8 100644 --- a/src/ui/pokedex-page-ui-handler.ts +++ b/src/ui/pokedex-page-ui-handler.ts @@ -918,18 +918,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler { return label; } - /** - * Find the name of the region for regional species - * @param species the species to check - * @returns a string with the region name - */ - 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 { if (this.blockInput) { return false; @@ -1372,7 +1360,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { options.push({ label: pre.preFormKey ? this.getFormString(pre.preFormKey, preSpecies ?? this.species, true) : - this.getRegionName(preSpecies ?? this.species), + (preSpecies ?? this.species).getExpandedSpeciesName(), handler: () => { const newSpecies = allSpecies.find(species => species.speciesId === pokemonPrevolutions[pre.speciesId]); // Attempts to find the formIndex of the prevolved species @@ -1413,7 +1401,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { options.push({ label: evo.evoFormKey ? this.getFormString(evo.evoFormKey, evoSpecies ?? this.species, true) : - this.getRegionName(evoSpecies ?? this.species), + (evoSpecies ?? this.species).getExpandedSpeciesName(), style: isCaughtEvo && isFormCaughtEvo ? TextStyle.WINDOW : TextStyle.SHADOW_TEXT, handler: () => { this.starterAttributes.form = newFormIndex; diff --git a/src/ui/pokemon-hatch-info-container.ts b/src/ui/pokemon-hatch-info-container.ts index a9b8e260b34..e4b431b4d55 100644 --- a/src/ui/pokemon-hatch-info-container.ts +++ b/src/ui/pokemon-hatch-info-container.ts @@ -160,7 +160,7 @@ export default class PokemonHatchInfoContainer extends PokemonInfoContainer { this.pokemonCandyCountText.setVisible(true); this.pokemonNumberText.setText(Utils.padInt(species.speciesId, 4)); - this.pokemonNameText.setText(species.name); + this.pokemonNameText.setText(species.getExpandedSpeciesName()); const hasEggMoves = species && speciesEggMoves.hasOwnProperty(species.speciesId);