Add Pokemon name splash text

This will display a random Pokemon's name, followed by an exclamation point (ex. "Bulbasaur!").
This commit is contained in:
Madmadness65 2025-02-15 23:49:03 -06:00
parent 8cc0660064
commit 76119e9143
2 changed files with 14 additions and 0 deletions

View File

@ -52,6 +52,7 @@ const SEASONAL_WEIGHT_MULTIPLIER = 10;
const commonSplashMessages = [
...Array(BATTLES_WON_WEIGHT_MULTIPLIER).fill("battlesWon"),
"pokemon",
"joinTheDiscord",
"infiniteLevels",
"everythingIsStackable",

View File

@ -8,6 +8,8 @@ import { TimedEventDisplay } from "#app/timed-event-manager";
import { version } from "../../package.json";
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";
export default class TitleUiHandler extends OptionSelectUiHandler {
/** If the stats can not be retrieved, use this fallback value */
@ -92,6 +94,15 @@ export default class TitleUiHandler extends OptionSelectUiHandler {
});
}
/** Used solely to display a random Pokémon name in a splash message. */
randomPokemon(): void {
const rand = Utils.randInt(1025, 1);
const pokemon = getPokemonSpecies(rand as Species);
if (this.splashMessage === "splashMessages:pokemon") {
this.splashMessageText.setText(i18next.t(this.splashMessage, { pokemonName: pokemon.name }));
}
}
show(args: any[]): boolean {
const ret = super.show(args);
@ -111,6 +122,8 @@ export default class TitleUiHandler extends OptionSelectUiHandler {
this.eventDisplay.show();
}
this.randomPokemon();
this.updateTitleStats();
this.titleStatsTimer = setInterval(() => {