From 43aa772603b644fa0b961f1036d5aac667145596 Mon Sep 17 00:00:00 2001 From: Madmadness65 <59298170+Madmadness65@users.noreply.github.com> Date: Thu, 19 Jun 2025 19:04:57 -0500 Subject: [PATCH] =?UTF-8?q?[UI/UX]=20Add=20Pok=C3=A9mon=20category=20flavo?= =?UTF-8?q?r=20text=20to=20Pok=C3=A9dex=20(#5957)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add Pokémon category flavor text to Pokédex * Append `_category` to locale entry --- src/data/pokemon-species.ts | 7 ++++--- src/plugins/i18n.ts | 1 + src/ui/pokedex-page-ui-handler.ts | 16 ++++++++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/data/pokemon-species.ts b/src/data/pokemon-species.ts index 74e25bd8bf7..39e8fbd18e6 100644 --- a/src/data/pokemon-species.ts +++ b/src/data/pokemon-species.ts @@ -764,7 +764,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali readonly subLegendary: boolean; readonly legendary: boolean; readonly mythical: boolean; - readonly species: string; + public category: string; readonly growthRate: GrowthRate; /** The chance (as a decimal) for this Species to be male, or `null` for genderless species */ readonly malePercent: number | null; @@ -778,7 +778,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali subLegendary: boolean, legendary: boolean, mythical: boolean, - species: string, + category: string, type1: PokemonType, type2: PokemonType | null, height: number, @@ -829,7 +829,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali this.subLegendary = subLegendary; this.legendary = legendary; this.mythical = mythical; - this.species = species; + this.category = category; this.growthRate = growthRate; this.malePercent = malePercent; this.genderDiffs = genderDiffs; @@ -968,6 +968,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali localize(): void { this.name = i18next.t(`pokemon:${SpeciesId[this.speciesId].toLowerCase()}`); + this.category = i18next.t(`pokemonCategory:${SpeciesId[this.speciesId].toLowerCase()}_category`); } getWildSpeciesForLevel(level: number, allowEvolving: boolean, isBoss: boolean, gameMode: GameMode): SpeciesId { diff --git a/src/plugins/i18n.ts b/src/plugins/i18n.ts index eab427e7b4a..7d3b30ed5b0 100644 --- a/src/plugins/i18n.ts +++ b/src/plugins/i18n.ts @@ -245,6 +245,7 @@ export async function initI18n(): Promise { "pokeball", "pokedexUiHandler", "pokemon", + "pokemonCategory", "pokemonEvolutions", "pokemonForm", "pokemonInfo", diff --git a/src/ui/pokedex-page-ui-handler.ts b/src/ui/pokedex-page-ui-handler.ts index 50c15336e36..32a88ab36b2 100644 --- a/src/ui/pokedex-page-ui-handler.ts +++ b/src/ui/pokedex-page-ui-handler.ts @@ -174,6 +174,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { private pokemonCaughtHatchedContainer: Phaser.GameObjects.Container; private pokemonCaughtCountText: Phaser.GameObjects.Text; private pokemonFormText: Phaser.GameObjects.Text; + private pokemonCategoryText: Phaser.GameObjects.Text; private pokemonHatchedIcon: Phaser.GameObjects.Sprite; private pokemonHatchedCountText: Phaser.GameObjects.Text; private pokemonShinyIcons: Phaser.GameObjects.Sprite[]; @@ -409,6 +410,12 @@ export default class PokedexPageUiHandler extends MessageUiHandler { this.pokemonFormText.setOrigin(0, 0); this.starterSelectContainer.add(this.pokemonFormText); + this.pokemonCategoryText = addTextObject(100, 18, "Category", TextStyle.WINDOW_ALT, { + fontSize: "42px", + }); + this.pokemonCategoryText.setOrigin(1, 0); + this.starterSelectContainer.add(this.pokemonCategoryText); + this.pokemonCaughtHatchedContainer = globalScene.add.container(2, 25); this.pokemonCaughtHatchedContainer.setScale(0.5); this.starterSelectContainer.add(this.pokemonCaughtHatchedContainer); @@ -2354,6 +2361,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { this.pokemonCaughtHatchedContainer.setVisible(true); this.pokemonCandyContainer.setVisible(false); this.pokemonFormText.setVisible(false); + this.pokemonCategoryText.setVisible(false); const defaultDexAttr = globalScene.gameData.getSpeciesDefaultDexAttr(species, true, true); const props = globalScene.gameData.getSpeciesDexAttrProps(species, defaultDexAttr); @@ -2382,6 +2390,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { this.pokemonCaughtHatchedContainer.setVisible(false); this.pokemonCandyContainer.setVisible(false); this.pokemonFormText.setVisible(false); + this.pokemonCategoryText.setVisible(false); this.setSpeciesDetails(species!, { // TODO: is this bang correct? @@ -2534,6 +2543,13 @@ export default class PokedexPageUiHandler extends MessageUiHandler { this.pokemonNameText.setText(species ? "???" : ""); } + // Setting the category + if (isFormCaught) { + this.pokemonCategoryText.setText(species.category); + } else { + this.pokemonCategoryText.setText(""); + } + // Setting tint of the sprite if (isFormCaught) { this.species.loadAssets(female!, formIndex, shiny, variant as Variant, true).then(() => {