Merge branch 'beta' into dex-forms-rework

This commit is contained in:
Wlowscha 2025-03-28 20:22:36 +01:00 committed by GitHub
commit 9ec61ce4bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 245 additions and 56 deletions

@ -1 +1 @@
Subproject commit cd4057af258b659ba2c1ed2778bb2793fa1f6141 Subproject commit cae82762eab25f928500b73e0e9a3e7df1ae6bbe

View File

@ -1233,7 +1233,7 @@ export class MoveEffectAttr extends MoveAttr {
getMoveChance(user: Pokemon, target: Pokemon, move: Move, selfEffect?: Boolean, showAbility?: Boolean): number { getMoveChance(user: Pokemon, target: Pokemon, move: Move, selfEffect?: Boolean, showAbility?: Boolean): number {
const moveChance = new Utils.NumberHolder(this.effectChanceOverride ?? move.chance); const moveChance = new Utils.NumberHolder(this.effectChanceOverride ?? move.chance);
applyAbAttrs(MoveEffectChanceMultiplierAbAttr, user, null, false, moveChance, move, target, selfEffect, showAbility); applyAbAttrs(MoveEffectChanceMultiplierAbAttr, user, null, !showAbility, moveChance, move);
if ((!move.hasAttr(FlinchAttr) || moveChance.value <= move.chance) && !move.hasAttr(SecretPowerAttr)) { if ((!move.hasAttr(FlinchAttr) || moveChance.value <= move.chance) && !move.hasAttr(SecretPowerAttr)) {
const userSide = user.isPlayer() ? ArenaTagSide.PLAYER : ArenaTagSide.ENEMY; const userSide = user.isPlayer() ? ArenaTagSide.PLAYER : ArenaTagSide.ENEMY;
@ -1241,7 +1241,7 @@ export class MoveEffectAttr extends MoveAttr {
} }
if (!selfEffect) { if (!selfEffect) {
applyPreDefendAbAttrs(IgnoreMoveEffectsAbAttr, target, user, null, null, false, moveChance); applyPreDefendAbAttrs(IgnoreMoveEffectsAbAttr, target, user, null, null, !showAbility, moveChance);
} }
return moveChance.value; return moveChance.value;
} }

View File

@ -7,7 +7,7 @@ import i18next from "i18next";
import type { AnySound } from "#app/battle-scene"; import type { AnySound } from "#app/battle-scene";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import type { GameMode } from "#app/game-mode"; import type { GameMode } from "#app/game-mode";
import { DexAttr, type StarterMoveset } from "#app/system/game-data"; import { DexAttr, DexEntry, type StarterMoveset } from "#app/system/game-data";
import * as Utils from "#app/utils"; import * as Utils from "#app/utils";
import { uncatchableSpecies } from "#app/data/balance/biomes"; import { uncatchableSpecies } from "#app/data/balance/biomes";
import { speciesEggMoves } from "#app/data/balance/egg-moves"; import { speciesEggMoves } from "#app/data/balance/egg-moves";

View File

@ -44,14 +44,17 @@ interface Season {
//#region Constants //#region Constants
/** The weight multiplier for the battles-won splash message */ /** 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 */ /** The weight multiplier for the seasonal splash messages */
const SEASONAL_WEIGHT_MULTIPLIER = 10; const SEASONAL_WEIGHT_MULTIPLIER = 15;
//#region Common Messages //#region Common Messages
const commonSplashMessages = [ const commonSplashMessages = [
...Array(BATTLES_WON_WEIGHT_MULTIPLIER).fill("battlesWon"), ...Array(BATTLES_WON_WEIGHT_MULTIPLIER).fill("battlesWon"),
...Array(POKEMON_NAMES_WEIGHT_MULTIPLIER).fill("underratedPokemon"),
"joinTheDiscord", "joinTheDiscord",
"infiniteLevels", "infiniteLevels",
"everythingIsStackable", "everythingIsStackable",
@ -78,7 +81,7 @@ const commonSplashMessages = [
"mostlyConsistentSeeds", "mostlyConsistentSeeds",
"achievementPointsDontDoAnything", "achievementPointsDontDoAnything",
"nothingBeatsAJellyFilledDonut", "nothingBeatsAJellyFilledDonut",
"dontTalkAboutTheTinkatonIncident", "dontTalkAboutThePokemonIncident",
"alsoTryPokengine", "alsoTryPokengine",
"alsoTryEmeraldRogue", "alsoTryEmeraldRogue",
"alsoTryRadicalRed", "alsoTryRadicalRed",
@ -176,41 +179,146 @@ const commonSplashMessages = [
"timeForYourDeliDelivery", "timeForYourDeliDelivery",
"goodFirstImpression", "goodFirstImpression",
"iPreferRarerCandies", "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 //#region Seasonal Messages
const seasonalSplashMessages: Season[] = [ 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", name: "Halloween",
start: "09-15", start: "10-15",
end: "10-31", end: "10-31",
messages: [ messages: [
"halloween.happyHalloween",
"halloween.boo",
"halloween.pumpkabooAbout", "halloween.pumpkabooAbout",
"halloween.mayContainSpiders", "halloween.mayContainSpiders",
"halloween.spookyScarySkeledirge", "halloween.spookyScarySkeledirge",
"halloween.gourgeistUsedTrickOrTreat", "halloween.gourgeistUsedTrickOrTreat",
"halloween.letsSnuggleForever", "halloween.letsSnuggleForever"
], ],
}, },
{ {
name: "XMAS", name: "Winter Holiday",
start: "12-01", start: "12-01",
end: "12-26", end: "12-31",
messages: [ messages: [
"xmas.happyHolidays", "winterHoliday.happyHolidays",
"xmas.unaffilicatedWithDelibirdServices", "winterHoliday.unaffilicatedWithDelibirdServices",
"xmas.delibirdSeason", "winterHoliday.delibirdSeason",
"xmas.diamondsFromTheSky", "winterHoliday.diamondsFromTheSky",
"xmas.holidayStylePikachuNotIncluded", "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 //#endregion

View File

@ -25,7 +25,7 @@ import { AbilityAttr, DexAttr } from "#app/system/game-data";
import type { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler"; import type { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
import MessageUiHandler from "#app/ui/message-ui-handler"; import MessageUiHandler from "#app/ui/message-ui-handler";
import { StatsContainer } from "#app/ui/stats-container"; import { StatsContainer } from "#app/ui/stats-container";
import { TextStyle, addTextObject, getTextStyleOptions } from "#app/ui/text"; import { TextStyle, addBBCodeTextObject, addTextObject, getTextColor, getTextStyleOptions } from "#app/ui/text";
import { Mode } from "#app/ui/ui"; import { Mode } from "#app/ui/ui";
import { addWindow } from "#app/ui/ui-theme"; import { addWindow } from "#app/ui/ui-theme";
import { Egg } from "#app/data/egg"; import { Egg } from "#app/data/egg";
@ -63,6 +63,7 @@ import { TimeOfDay } from "#app/enums/time-of-day";
import type { Abilities } from "#app/enums/abilities"; import type { Abilities } from "#app/enums/abilities";
import { BaseStatsOverlay } from "#app/ui/base-stats-overlay"; import { BaseStatsOverlay } from "#app/ui/base-stats-overlay";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import type BBCodeText from "phaser3-rex-plugins/plugins/gameobjects/tagtext/bbcodetext/BBCodeText";
interface LanguageSetting { interface LanguageSetting {
starterInfoTextSize: string; starterInfoTextSize: string;
@ -250,7 +251,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
// Menu // Menu
private menuContainer: Phaser.GameObjects.Container; private menuContainer: Phaser.GameObjects.Container;
private menuBg: Phaser.GameObjects.NineSlice; private menuBg: Phaser.GameObjects.NineSlice;
protected optionSelectText: Phaser.GameObjects.Text; protected optionSelectText: BBCodeText;
private menuOptions: MenuOptions[]; private menuOptions: MenuOptions[];
protected scale = 0.1666666667; protected scale = 0.1666666667;
private menuDescriptions: string[]; private menuDescriptions: string[];
@ -593,14 +594,13 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
this.menuOptions = Utils.getEnumKeys(MenuOptions).map(m => Number.parseInt(MenuOptions[m]) as MenuOptions); this.menuOptions = Utils.getEnumKeys(MenuOptions).map(m => Number.parseInt(MenuOptions[m]) as MenuOptions);
this.optionSelectText = addTextObject( this.optionSelectText = addBBCodeTextObject(
0, 0,
0, 0,
this.menuOptions.map(o => `${i18next.t(`pokedexUiHandler:${MenuOptions[o]}`)}`).join("\n"), this.menuOptions.map(o => `${i18next.t(`pokedexUiHandler:${MenuOptions[o]}`)}`).join("\n"),
TextStyle.WINDOW, TextStyle.WINDOW,
{ maxLines: this.menuOptions.length }, { maxLines: this.menuOptions.length, lineSpacing: 12 },
); );
this.optionSelectText.setLineSpacing(12);
this.menuDescriptions = [ this.menuDescriptions = [
i18next.t("pokedexUiHandler:showBaseStats"), i18next.t("pokedexUiHandler:showBaseStats"),
@ -623,7 +623,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
); );
this.menuBg.setOrigin(0, 0); this.menuBg.setOrigin(0, 0);
this.optionSelectText.setPositionRelative(this.menuBg, 10 + 24 * this.scale, 6); this.optionSelectText.setPosition(this.menuBg.x + 10 + 24 * this.scale, this.menuBg.y + 6);
this.menuContainer.add(this.menuBg); this.menuContainer.add(this.menuBg);
@ -704,11 +704,39 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
this.setSpecies(); this.setSpecies();
this.updateInstructions(); this.updateInstructions();
this.optionSelectText.setText(this.getMenuText());
this.setCursor(0); this.setCursor(0);
return true; return true;
} }
getMenuText(): string {
const isSeen = this.isSeen();
const isStarterCaught = !!this.isCaught(this.getStarterSpecies(this.species));
return this.menuOptions
.map(o => {
const label = `${i18next.t(`pokedexUiHandler:${MenuOptions[o]}`)}`;
const isDark =
!isSeen ||
(!isStarterCaught && (o === MenuOptions.TOGGLE_IVS || o === MenuOptions.NATURES)) ||
(this.tmMoves.length < 1 && o === MenuOptions.TM_MOVES);
const color = getTextColor(
isDark ? TextStyle.SHADOW_TEXT : TextStyle.SETTINGS_VALUE,
false,
globalScene.uiTheme,
);
const shadow = getTextColor(
isDark ? TextStyle.SHADOW_TEXT : TextStyle.SETTINGS_VALUE,
true,
globalScene.uiTheme,
);
return `[shadow=${shadow}][color=${color}]${label}[/color][/shadow]`;
})
.join("\n");
}
starterSetup(): void { starterSetup(): void {
this.evolutions = []; this.evolutions = [];
this.prevolutions = []; this.prevolutions = [];
@ -904,6 +932,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
return (dexEntry?.caughtAttr ?? 0n) & (starterDexEntry?.caughtAttr ?? 0n) & species.getFullUnlocksData(); return (dexEntry?.caughtAttr ?? 0n) & (starterDexEntry?.caughtAttr ?? 0n) & species.getFullUnlocksData();
} }
/** /**
* Check whether a given form is caught for a given species. * Check whether a given form is caught for a given species.
* All forms that can be reached through a form change during battle are considered caught and show up in the dex as such. * All forms that can be reached through a form change during battle are considered caught and show up in the dex as such.
@ -928,6 +957,14 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
return isFormCaught; return isFormCaught;
} }
isSeen(): boolean {
if (this.speciesStarterDexEntry?.seenAttr) {
return true;
}
const starterCaughtAttr = this.isCaught(this.getStarterSpecies(this.species));
return !!starterCaughtAttr;
}
/** /**
* Get the starter attributes for the given PokemonSpecies, after sanitizing them. * Get the starter attributes for the given PokemonSpecies, after sanitizing them.
* If somehow a preference is set for a form, variant, gender, ability or nature * If somehow a preference is set for a form, variant, gender, ability or nature
@ -1076,6 +1113,8 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
const isCaught = this.isCaught(); const isCaught = this.isCaught();
const isFormCaught = this.isFormCaught(); const isFormCaught = this.isFormCaught();
const isSeen = this.isSeen();
const isStarterCaught = !!this.isCaught(this.getStarterSpecies(this.species));
if (this.blockInputOverlay) { if (this.blockInputOverlay) {
if (button === Button.CANCEL || button === Button.ACTION) { if (button === Button.CANCEL || button === Button.ACTION) {
@ -1130,7 +1169,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
if (button === Button.ACTION) { if (button === Button.ACTION) {
switch (this.cursor) { switch (this.cursor) {
case MenuOptions.BASE_STATS: case MenuOptions.BASE_STATS:
if (!isCaught || !isFormCaught) { if (!isSeen) {
error = true; error = true;
} else { } else {
this.blockInput = true; this.blockInput = true;
@ -1150,7 +1189,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
break; break;
case MenuOptions.LEVEL_MOVES: case MenuOptions.LEVEL_MOVES:
if (!isCaught || !isFormCaught) { if (!isSeen) {
error = true; error = true;
} else { } else {
this.blockInput = true; this.blockInput = true;
@ -1208,7 +1247,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
break; break;
case MenuOptions.EGG_MOVES: case MenuOptions.EGG_MOVES:
if (!isCaught || !isFormCaught) { if (!isSeen) {
error = true; error = true;
} else { } else {
this.blockInput = true; this.blockInput = true;
@ -1275,7 +1314,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
break; break;
case MenuOptions.TM_MOVES: case MenuOptions.TM_MOVES:
if (!isCaught || !isFormCaught) { if (!isSeen) {
error = true; error = true;
} else if (this.tmMoves.length < 1) { } else if (this.tmMoves.length < 1) {
ui.showText(i18next.t("pokedexUiHandler:noTmMoves")); ui.showText(i18next.t("pokedexUiHandler:noTmMoves"));
@ -1326,7 +1365,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
break; break;
case MenuOptions.ABILITIES: case MenuOptions.ABILITIES:
if (!isCaught || !isFormCaught) { if (!isSeen) {
error = true; error = true;
} else { } else {
this.blockInput = true; this.blockInput = true;
@ -1414,7 +1453,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
break; break;
case MenuOptions.BIOMES: case MenuOptions.BIOMES:
if (!(isCaught || this.speciesStarterDexEntry?.seenAttr)) { if (!isSeen) {
error = true; error = true;
} else { } else {
this.blockInput = true; this.blockInput = true;
@ -1493,7 +1532,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
break; break;
case MenuOptions.EVOLUTIONS: case MenuOptions.EVOLUTIONS:
if (!isCaught || !isFormCaught) { if (!isSeen) {
error = true; error = true;
} else { } else {
this.blockInput = true; this.blockInput = true;
@ -1677,7 +1716,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
break; break;
case MenuOptions.TOGGLE_IVS: case MenuOptions.TOGGLE_IVS:
if (!isCaught || !isFormCaught) { if (!isStarterCaught) {
error = true; error = true;
} else { } else {
this.toggleStatsMode(); this.toggleStatsMode();
@ -1687,7 +1726,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
break; break;
case MenuOptions.NATURES: case MenuOptions.NATURES:
if (!isCaught || !isFormCaught) { if (!isStarterCaught) {
error = true; error = true;
} else { } else {
this.blockInput = true; this.blockInput = true;
@ -2392,8 +2431,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
} }
if (species) { if (species) {
const dexEntry = globalScene.gameData.dexData[species.speciesId];
const caughtAttr = this.isCaught(species); const caughtAttr = this.isCaught(species);
if (!caughtAttr) { if (!caughtAttr) {
@ -2414,7 +2451,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
} }
const isFormCaught = this.isFormCaught(); const isFormCaught = this.isFormCaught();
const isFormSeen = dexEntry ? (dexEntry.seenAttr & globalScene.gameData.getFormAttr(formIndex ?? 0)) > 0n : false; const isFormSeen = this.isSeen();
this.shinyOverlay.setVisible(shiny ?? false); // TODO: is false the correct default? this.shinyOverlay.setVisible(shiny ?? false); // TODO: is false the correct default?
this.pokemonNumberText.setColor(this.getTextColor(shiny ? TextStyle.SUMMARY_GOLD : TextStyle.SUMMARY, false)); this.pokemonNumberText.setColor(this.getTextColor(shiny ? TextStyle.SUMMARY_GOLD : TextStyle.SUMMARY, false));

View File

@ -675,6 +675,15 @@ export default class PokedexUiHandler extends MessageUiHandler {
this.starterSelectMessageBoxContainer.setVisible(!!text?.length); this.starterSelectMessageBoxContainer.setVisible(!!text?.length);
} }
isSeen(species: PokemonSpecies, dexEntry: DexEntry): boolean {
if (dexEntry?.seenAttr) {
return true;
}
const starterDexEntry = globalScene.gameData.dexData[this.getStarterSpeciesId(species.speciesId)];
return !!starterDexEntry?.caughtAttr;
}
/** /**
* Determines if 'Icon' based upgrade notifications should be shown * Determines if 'Icon' based upgrade notifications should be shown
* @returns true if upgrade notifications are enabled and set to display an 'Icon' * @returns true if upgrade notifications are enabled and set to display an 'Icon'
@ -1620,7 +1629,7 @@ export default class PokedexUiHandler extends MessageUiHandler {
if (caughtAttr & data.species.getFullUnlocksData() || globalScene.dexForDevs) { if (caughtAttr & data.species.getFullUnlocksData() || globalScene.dexForDevs) {
container.icon.clearTint(); container.icon.clearTint();
} else if (dexEntry.seenAttr) { } else if (this.isSeen(data.species, dexEntry)) {
container.icon.setTint(0x808080); container.icon.setTint(0x808080);
} else { } else {
container.icon.setTint(0); container.icon.setTint(0);
@ -1804,14 +1813,12 @@ export default class PokedexUiHandler extends MessageUiHandler {
const dexEntry = globalScene.gameData.dexData[species.speciesId]; const dexEntry = globalScene.gameData.dexData[species.speciesId];
this.trayContainers = []; this.trayContainers = [];
const isFormSeen = this.isSeen(species, dexEntry);
this.trayForms.map((f, index) => { this.trayForms.map((f, index) => {
const props = this.getDefaultProps(species, f.formIndex); const props = this.getDefaultProps(species, f.formIndex);
const isFormCaught = dexEntry const isFormCaught = dexEntry
? (dexEntry.caughtAttr & species.getFullUnlocksData() & globalScene.gameData.getFormAttr(f.formIndex ?? 0)) > 0n ? (dexEntry.caughtAttr & species.getFullUnlocksData() & globalScene.gameData.getFormAttr(f.formIndex ?? 0)) > 0n
: false; : false;
const isFormSeen = dexEntry
? (dexEntry.seenAttr & globalScene.gameData.getFormAttr(f.formIndex ?? 0)) > 0n
: false;
const formContainer = new PokedexMonContainer(species, { const formContainer = new PokedexMonContainer(species, {
formIndex: f.formIndex, formIndex: f.formIndex,
female: props.female, female: props.female,
@ -1998,7 +2005,7 @@ export default class PokedexUiHandler extends MessageUiHandler {
const variant = props.variant; const variant = props.variant;
const isFormCaught = dexEntry ? (caughtAttr & globalScene.gameData.getFormAttr(formIndex ?? 0)) > 0n : false; const isFormCaught = dexEntry ? (caughtAttr & globalScene.gameData.getFormAttr(formIndex ?? 0)) > 0n : false;
const isFormSeen = dexEntry ? (dexEntry.seenAttr & globalScene.gameData.getFormAttr(formIndex ?? 0)) > 0n : false; const isFormSeen = this.isSeen(species, dexEntry);
const assetLoadCancelled = new BooleanHolder(false); const assetLoadCancelled = new BooleanHolder(false);
this.assetLoadCancelled = assetLoadCancelled; this.assetLoadCancelled = assetLoadCancelled;

View File

@ -8,10 +8,13 @@ import { TimedEventDisplay } from "#app/timed-event-manager";
import { version } from "../../package.json"; import { version } from "../../package.json";
import { pokerogueApi } from "#app/plugins/api/pokerogue-api"; import { pokerogueApi } from "#app/plugins/api/pokerogue-api";
import { globalScene } from "#app/global-scene"; 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 { export default class TitleUiHandler extends OptionSelectUiHandler {
/** If the stats can not be retrieved, use this fallback value */ /** 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 titleContainer: Phaser.GameObjects.Container;
private playerCountLabel: Phaser.GameObjects.Text; 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 { show(args: any[]): boolean {
const ret = super.show(args); const ret = super.show(args);
@ -121,6 +147,9 @@ export default class TitleUiHandler extends OptionSelectUiHandler {
this.eventDisplay.show(); this.eventDisplay.show();
} }
this.randomPokemon();
this.genderSplash();
this.updateTitleStats(); this.updateTitleStats();
this.titleStatsTimer = setInterval(() => { this.titleStatsTimer = setInterval(() => {

View File

@ -7,10 +7,10 @@ describe("Data - Splash Messages", () => {
expect(getSplashMessages().length).toBeGreaterThanOrEqual(15); expect(getSplashMessages().length).toBeGreaterThanOrEqual(15);
}); });
// make sure to adjust this test if the weight it changed! // Make sure to adjust this test if the weight is changed!
it("should add contain 10 `battlesWon` splash messages", () => { it("should add contain 15 `battlesWon` splash messages", () => {
const battlesWonMessages = getSplashMessages().filter(message => message === "splashMessages:battlesWon"); const battlesWonMessages = getSplashMessages().filter((message) => message === "splashMessages:battlesWon");
expect(battlesWonMessages).toHaveLength(10); expect(battlesWonMessages).toHaveLength(15);
}); });
describe("Seasonal", () => { describe("Seasonal", () => {
@ -22,16 +22,24 @@ describe("Data - Splash Messages", () => {
vi.useRealTimers(); // reset system time vi.useRealTimers(); // reset system time
}); });
it("should contain halloween messages from Sep 15 to Oct 31", () => { it("should contain new years messages from Jan 1 to Jan 15", () => {
testSeason(new Date("2024-09-15"), new Date("2024-10-31"), "halloween"); testSeason(new Date("2025-01-01"), new Date("2025-01-15"), "newYears");
}); });
it("should contain xmas messages from Dec 1 to Dec 26", () => { it("should contain valentines messages from Feb 7 to Feb 21", () => {
testSeason(new Date("2024-12-01"), new Date("2024-12-26"), "xmas"); testSeason(new Date("2025-02-07"), new Date("2025-02-21"), "valentines");
}); });
it("should contain new years messages frm Jan 1 to Jan 31", () => { it("should contain april fools messages from April 1 to April 3", () => {
testSeason(new Date("2024-01-01"), new Date("2024-01-31"), "newYears"); 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");
}); });
}); });
}); });