From 19af635b6ea831c01afd999f48879e23c1bfba3d Mon Sep 17 00:00:00 2001 From: Madmadness65 Date: Mon, 24 Mar 2025 21:05:47 -0500 Subject: [PATCH] Add gender splash message code This makes the specific April Fools splash message functional. Also fixed a linter issue with the randomPokemon code. --- src/ui/title-ui-handler.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/ui/title-ui-handler.ts b/src/ui/title-ui-handler.ts index 50f91a7f58e..ed62af89362 100644 --- a/src/ui/title-ui-handler.ts +++ b/src/ui/title-ui-handler.ts @@ -10,6 +10,7 @@ import { pokerogueApi } from "#app/plugins/api/pokerogue-api"; import { globalScene } from "#app/global-scene"; import type { Species } from "#enums/species"; import { getPokemonSpecies } from "#app/data/pokemon-species"; +import { PlayerGender } from "#enums/player-gender"; export default class TitleUiHandler extends OptionSelectUiHandler { /** If the stats can not be retrieved, use this fallback value */ @@ -104,11 +105,25 @@ export default class TitleUiHandler extends OptionSelectUiHandler { randomPokemon(): void { const rand = Utils.randInt(1025, 1); const pokemon = getPokemonSpecies(rand as Species); - if (this.splashMessage === "splashMessages:underratedPokemon" || "splashMessages:dontTalkAboutThePokemonIncident" || "splashMessages:aWildPokemonAppeared" || "splashMessages:aprilFools.removedPokemon") { + if ( + this.splashMessage === "splashMessages:underratedPokemon" || + this.splashMessage === "splashMessages:dontTalkAboutThePokemonIncident" || + this.splashMessage === "splashMessages:aWildPokemonAppeared" || + this.splashMessage === "splashMessages:aprilFools.removedPokemon" + ) { this.splashMessageText.setText(i18next.t(this.splashMessage, { pokemonName: pokemon.name })); } } + /** Used for a specific April Fools splash message. */ + genderSplash(): void { + if (this.splashMessage === "splashMessages:aprilFools.helloKyleAmber") { + globalScene.gameData.gender === PlayerGender.MALE + ? this.splashMessageText.setText(i18next.t(this.splashMessage, { name: i18next.t("trainerNames:player_m") })) + : this.splashMessageText.setText(i18next.t(this.splashMessage, { name: i18next.t("trainerNames:player_f") })); + } + } + show(args: any[]): boolean { const ret = super.show(args); @@ -133,6 +148,7 @@ export default class TitleUiHandler extends OptionSelectUiHandler { } this.randomPokemon(); + this.genderSplash(); this.updateTitleStats();