From 19c61a041fdbe22936b05030c9e19171c102dcc5 Mon Sep 17 00:00:00 2001 From: damocleas Date: Thu, 27 Mar 2025 22:56:26 -0400 Subject: [PATCH] [Misc] New Splash Texts, March 2025 (#5345) * Update splash-messages.ts 1 * Add Pokemon name splash text This will display a random Pokemon's name, followed by an exclamation point (ex. "Bulbasaur!"). * Make Pokemon name splash message weighted * Update splash-messages.ts * Update splash-messages.ts * fix trailing spaces * Update splash-messages.ts * Update splash-messages.ts * Add splashes which use random Pokemon * Update splash message tests * Update splash-messages.ts * Update splash-messages.ts * Missing comma * Fix length on test It even says to do so whenever weight multipliers are adjusted... * Update splash-messages.ts * add missing prefix thing * adjusted comment in splash_messages.test.ts * Update splash-messages.ts * fix blank line * Add gender splash message code This makes the specific April Fools splash message functional. Also fixed a linter issue with the randomPokemon code. * Update title-ui-handler.ts changed battles won fallback number to -1 * Update splash-messages.ts * changed afd to 2 days * Update splash_messages.test.ts * Update src/data/splash-messages.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> --------- Co-authored-by: Madmadness65 Co-authored-by: Madmadness65 <59298170+Madmadness65@users.noreply.github.com> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> --- src/data/splash-messages.ts | 144 ++++++++++++++++++++++++++---- src/ui/title-ui-handler.ts | 31 ++++++- test/data/splash_messages.test.ts | 28 +++--- 3 files changed, 174 insertions(+), 29 deletions(-) diff --git a/src/data/splash-messages.ts b/src/data/splash-messages.ts index 9fd71d9d95b..de14e913664 100644 --- a/src/data/splash-messages.ts +++ b/src/data/splash-messages.ts @@ -44,14 +44,17 @@ interface Season { //#region Constants /** The weight multiplier for the battles-won splash message */ -const BATTLES_WON_WEIGHT_MULTIPLIER = 10; +const BATTLES_WON_WEIGHT_MULTIPLIER = 15; +/** The weight multiplier for the Pokémon names splash message */ +const POKEMON_NAMES_WEIGHT_MULTIPLIER = 10; /** The weight multiplier for the seasonal splash messages */ -const SEASONAL_WEIGHT_MULTIPLIER = 10; +const SEASONAL_WEIGHT_MULTIPLIER = 15; //#region Common Messages const commonSplashMessages = [ ...Array(BATTLES_WON_WEIGHT_MULTIPLIER).fill("battlesWon"), + ...Array(POKEMON_NAMES_WEIGHT_MULTIPLIER).fill("underratedPokemon"), "joinTheDiscord", "infiniteLevels", "everythingIsStackable", @@ -78,7 +81,7 @@ const commonSplashMessages = [ "mostlyConsistentSeeds", "achievementPointsDontDoAnything", "nothingBeatsAJellyFilledDonut", - "dontTalkAboutTheTinkatonIncident", + "dontTalkAboutThePokemonIncident", "alsoTryPokengine", "alsoTryEmeraldRogue", "alsoTryRadicalRed", @@ -176,41 +179,146 @@ const commonSplashMessages = [ "timeForYourDeliDelivery", "goodFirstImpression", "iPreferRarerCandies", + "pocketRoguelite", + "porygonDidNothingWrong", + "critMattered", + "pickupNotRequired", + "stayHydrated", + "alsoTryCobblemon", + "alsoTryPokeDoku", + "mySleepStyleIsDoesnt", + "makeYourOwnWorldChampDifference", + "yoChampInTheMaking", + "notLiableForDecisionAnxiety", + "theAirIsTastyHere", + "continue", + "startANewRunToday", + "neverGiveUp", + "theresAlwaysNextTime", + "oneTwoThreeAndPoof", + "yourPokemonOnlyGoToLevelOneHundred", + "theBattlesWillBeLegendary", + "levelCurveBetterThanJohto", + "alsoTryShowering", + "wellStillBeHere", + "weHopeToSeeYouAgain", + "aHealthyTeamCanMeanGreaterRewards", + "aWildPokemonAppeared", + "isThisThingOn", + "needsMoreTesting", + "whoChecksStatChanges", + "whenTwoTrainersEyesMeet", + "notOfficiallyOnSteam", + "fiftyFifty", + "metaNotIncluded", + "bornToBeAWinner", + "onARollout", + "itsAlwaysNightDeepInTheAbyss", + "folksThisIsInsane" ]; //#region Seasonal Messages const seasonalSplashMessages: Season[] = [ + { + name: "New Year's", + start: "01-01", + end: "01-15", + messages: [ + "newYears.happyNewYear", + "newYears.andAHappyNewYear" + ], + }, + { + name: "Valentines", + start: "02-07", + end: "02-21", + messages: [ + "valentines.happyValentines", + "valentines.fullOfLove", + "valentines.applinForYou", + "valentines.thePowerOfLoveIsThreeThirtyBST", + "valentines.haveAHeartScale", + "valentines.i<3You" + ], + }, + { + name: "April Fools", + start: "04-01", + end: "04-03", + messages: [ + "aprilFools.battlesOne", + "aprilFools.aprilFools", + "aprilFools.removedPokemon", + "aprilFools.helloKyleAmber", + "aprilFools.gotcha", + "aprilFools.alsoTryPokerogueTwo", + "aprilFools.nowWithSameScumCountermeasures", + "aprilFools.neverGonnaGiveYouGoodRolls", + "aprilFools.youBumblingBuffoon", + "aprilFools.doubleShinyOddsForTrainersOnly", + "aprilFools.nowWithZMoves", + "aprilFools.newLightType", + "aprilFools.removedMegas", + "aprilFools.nerfedYourFavorites", + "aprilFools.grrr", + "aprilFools.enabledEternatusPassiveGoodLuck", + "aprilFools.theDarkestDaySoundsLikeAFutureProblem", + "aprilFools.tmShopWhen", + "aprilFools.whoIsFinn", + "aprilFools.watchOutForShadowPokemon", + "aprilFools.nowWithDarkTypeLuxray", + "aprilFools.onlyOnPokerogueNetAGAIN", + "aprilFools.noFreeVouchers", + "aprilFools.altffourAchievementPoints", + "aprilFools.rokePogue", + "aprilFools.readMe", + "aprilFools.winningNotIncluded", + "aprilFools.timeForYourSoloUnownRun", + "aprilFools.nowARealTimeStrategyGame", + "aprilFools.nowWithQuickTimeEncounters", + "aprilFools.timeYourInputsForHigherCatchrate", + "aprilFools.certifiedButtonSimulator", + "aprilFools.iHopeYouGetSuckerPunched" + ], + }, { name: "Halloween", - start: "09-15", + start: "10-15", end: "10-31", messages: [ + "halloween.happyHalloween", + "halloween.boo", "halloween.pumpkabooAbout", "halloween.mayContainSpiders", "halloween.spookyScarySkeledirge", "halloween.gourgeistUsedTrickOrTreat", - "halloween.letsSnuggleForever", + "halloween.letsSnuggleForever" ], }, { - name: "XMAS", + name: "Winter Holiday", start: "12-01", - end: "12-26", + end: "12-31", messages: [ - "xmas.happyHolidays", - "xmas.unaffilicatedWithDelibirdServices", - "xmas.delibirdSeason", - "xmas.diamondsFromTheSky", - "xmas.holidayStylePikachuNotIncluded", + "winterHoliday.happyHolidays", + "winterHoliday.unaffilicatedWithDelibirdServices", + "winterHoliday.delibirdSeason", + "winterHoliday.diamondsFromTheSky", + "winterHoliday.holidayStylePikachuNotIncluded", + "winterHoliday.delibirdDirectlyToYourHouse", + "winterHoliday.haveAnIceDay", + "winterHoliday.spinTheClaydol", + "winterHoliday.beGoodForGoodnessSake", + "winterHoliday.moomooMilkAndLavaCookies", + "winterHoliday.iNeedAYacheBerry", + "winterHoliday.getJolly", + "winterHoliday.tisTheSeasonToBeSpeSpa", + "winterHoliday.deckTheHalls", + "winterHoliday.saveScummingGetsYouOnTheNaughtyList", + "winterHoliday.badTrainersGetRolycoly" ], }, - { - name: "New Year's", - start: "01-01", - end: "01-31", - messages: ["newYears.happyNewYear"], - }, ]; //#endregion diff --git a/src/ui/title-ui-handler.ts b/src/ui/title-ui-handler.ts index 2f797bb4bfb..a9fdf22ec57 100644 --- a/src/ui/title-ui-handler.ts +++ b/src/ui/title-ui-handler.ts @@ -8,10 +8,13 @@ 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"; +import { PlayerGender } from "#enums/player-gender"; export default class TitleUiHandler extends OptionSelectUiHandler { /** If the stats can not be retrieved, use this fallback value */ - private static readonly BATTLES_WON_FALLBACK: number = -99999999; + private static readonly BATTLES_WON_FALLBACK: number = -1; private titleContainer: Phaser.GameObjects.Container; private playerCountLabel: Phaser.GameObjects.Text; @@ -98,6 +101,29 @@ 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: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); @@ -121,6 +147,9 @@ export default class TitleUiHandler extends OptionSelectUiHandler { this.eventDisplay.show(); } + this.randomPokemon(); + this.genderSplash(); + this.updateTitleStats(); this.titleStatsTimer = setInterval(() => { diff --git a/test/data/splash_messages.test.ts b/test/data/splash_messages.test.ts index 8ae13366670..bd29a17339a 100644 --- a/test/data/splash_messages.test.ts +++ b/test/data/splash_messages.test.ts @@ -7,10 +7,10 @@ describe("Data - Splash Messages", () => { expect(getSplashMessages().length).toBeGreaterThanOrEqual(15); }); - // make sure to adjust this test if the weight it changed! - it("should add contain 10 `battlesWon` splash messages", () => { - const battlesWonMessages = getSplashMessages().filter(message => message === "splashMessages:battlesWon"); - expect(battlesWonMessages).toHaveLength(10); + // Make sure to adjust this test if the weight is changed! + it("should add contain 15 `battlesWon` splash messages", () => { + const battlesWonMessages = getSplashMessages().filter((message) => message === "splashMessages:battlesWon"); + expect(battlesWonMessages).toHaveLength(15); }); describe("Seasonal", () => { @@ -22,16 +22,24 @@ describe("Data - Splash Messages", () => { vi.useRealTimers(); // reset system time }); - it("should contain halloween messages from Sep 15 to Oct 31", () => { - testSeason(new Date("2024-09-15"), new Date("2024-10-31"), "halloween"); + it("should contain new years messages from Jan 1 to Jan 15", () => { + testSeason(new Date("2025-01-01"), new Date("2025-01-15"), "newYears"); }); - it("should contain xmas messages from Dec 1 to Dec 26", () => { - testSeason(new Date("2024-12-01"), new Date("2024-12-26"), "xmas"); + it("should contain valentines messages from Feb 7 to Feb 21", () => { + testSeason(new Date("2025-02-07"), new Date("2025-02-21"), "valentines"); }); - it("should contain new years messages frm Jan 1 to Jan 31", () => { - testSeason(new Date("2024-01-01"), new Date("2024-01-31"), "newYears"); + it("should contain april fools messages from April 1 to April 3", () => { + testSeason(new Date("2025-04-01"), new Date("2025-04-03"), "aprilFools"); + }); + + it("should contain halloween messages from Oct 15 to Oct 31", () => { + testSeason(new Date("2025-10-15"), new Date("2025-10-31"), "halloween"); + }); + + it("should contain winter holiday messages from Dec 1 to Dec 31", () => { + testSeason(new Date("2025-12-01"), new Date("2025-12-31"), "winterHoliday"); }); }); });