mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-20 07:12:32 +02:00
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:
parent
8cc0660064
commit
76119e9143
@ -52,6 +52,7 @@ const SEASONAL_WEIGHT_MULTIPLIER = 10;
|
||||
|
||||
const commonSplashMessages = [
|
||||
...Array(BATTLES_WON_WEIGHT_MULTIPLIER).fill("battlesWon"),
|
||||
"pokemon",
|
||||
"joinTheDiscord",
|
||||
"infiniteLevels",
|
||||
"everythingIsStackable",
|
||||
|
@ -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(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user