Merge branch 'beta' into extra-msgs

This commit is contained in:
damocleas 2025-03-28 14:34:49 -04:00 committed by GitHub
commit 997b3d2df9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 248 additions and 56 deletions

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

View File

@ -1285,6 +1285,9 @@ export class MoveEffectChanceMultiplierAbAttr extends AbAttr {
* @see {@linkcode applyPreDefend}
*/
export class IgnoreMoveEffectsAbAttr extends PreDefendAbAttr {
constructor(showAbility: boolean = false) {
super(showAbility);
}
override canApplyPreDefend(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker: Pokemon, move: Move | null, cancelled: Utils.BooleanHolder | null, args: any[]): boolean {
return (args[0] as Utils.NumberHolder).value > 0;
@ -4711,7 +4714,7 @@ export class ForceSwitchOutImmunityAbAttr extends AbAttr {
export class ReduceBerryUseThresholdAbAttr extends AbAttr {
constructor() {
super();
super(false);
}
override canApply(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean {

View File

@ -7,7 +7,7 @@ import i18next from "i18next";
import type { AnySound } from "#app/battle-scene";
import { globalScene } from "#app/global-scene";
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 { uncatchableSpecies } from "#app/data/balance/biomes";
import { speciesEggMoves } from "#app/data/balance/egg-moves";

View File

@ -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

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 MessageUiHandler from "#app/ui/message-ui-handler";
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 { addWindow } from "#app/ui/ui-theme";
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 { BaseStatsOverlay } from "#app/ui/base-stats-overlay";
import { globalScene } from "#app/global-scene";
import type BBCodeText from "phaser3-rex-plugins/plugins/gameobjects/tagtext/bbcodetext/BBCodeText";
interface LanguageSetting {
starterInfoTextSize: string;
@ -250,7 +251,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
// Menu
private menuContainer: Phaser.GameObjects.Container;
private menuBg: Phaser.GameObjects.NineSlice;
protected optionSelectText: Phaser.GameObjects.Text;
protected optionSelectText: BBCodeText;
private menuOptions: MenuOptions[];
protected scale = 0.1666666667;
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.optionSelectText = addTextObject(
this.optionSelectText = addBBCodeTextObject(
0,
0,
this.menuOptions.map(o => `${i18next.t(`pokedexUiHandler:${MenuOptions[o]}`)}`).join("\n"),
TextStyle.WINDOW,
{ maxLines: this.menuOptions.length },
{ maxLines: this.menuOptions.length, lineSpacing: 12 },
);
this.optionSelectText.setLineSpacing(12);
this.menuDescriptions = [
i18next.t("pokedexUiHandler:showBaseStats"),
@ -623,7 +623,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
);
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);
@ -704,11 +704,39 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
this.setSpecies();
this.updateInstructions();
this.optionSelectText.setText(this.getMenuText());
this.setCursor(0);
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 {
this.evolutions = [];
this.prevolutions = [];
@ -904,6 +932,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
return (dexEntry?.caughtAttr ?? 0n) & (starterDexEntry?.caughtAttr ?? 0n) & species.getFullUnlocksData();
}
/**
* 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.
@ -928,6 +957,14 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
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.
* 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 isFormCaught = this.isFormCaught();
const isSeen = this.isSeen();
const isStarterCaught = !!this.isCaught(this.getStarterSpecies(this.species));
if (this.blockInputOverlay) {
if (button === Button.CANCEL || button === Button.ACTION) {
@ -1130,7 +1169,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
if (button === Button.ACTION) {
switch (this.cursor) {
case MenuOptions.BASE_STATS:
if (!isCaught || !isFormCaught) {
if (!isSeen) {
error = true;
} else {
this.blockInput = true;
@ -1150,7 +1189,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
break;
case MenuOptions.LEVEL_MOVES:
if (!isCaught || !isFormCaught) {
if (!isSeen) {
error = true;
} else {
this.blockInput = true;
@ -1208,7 +1247,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
break;
case MenuOptions.EGG_MOVES:
if (!isCaught || !isFormCaught) {
if (!isSeen) {
error = true;
} else {
this.blockInput = true;
@ -1275,7 +1314,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
break;
case MenuOptions.TM_MOVES:
if (!isCaught || !isFormCaught) {
if (!isSeen) {
error = true;
} else if (this.tmMoves.length < 1) {
ui.showText(i18next.t("pokedexUiHandler:noTmMoves"));
@ -1326,7 +1365,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
break;
case MenuOptions.ABILITIES:
if (!isCaught || !isFormCaught) {
if (!isSeen) {
error = true;
} else {
this.blockInput = true;
@ -1414,7 +1453,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
break;
case MenuOptions.BIOMES:
if (!(isCaught || this.speciesStarterDexEntry?.seenAttr)) {
if (!isSeen) {
error = true;
} else {
this.blockInput = true;
@ -1493,7 +1532,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
break;
case MenuOptions.EVOLUTIONS:
if (!isCaught || !isFormCaught) {
if (!isSeen) {
error = true;
} else {
this.blockInput = true;
@ -1677,7 +1716,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
break;
case MenuOptions.TOGGLE_IVS:
if (!isCaught || !isFormCaught) {
if (!isStarterCaught) {
error = true;
} else {
this.toggleStatsMode();
@ -1687,7 +1726,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
break;
case MenuOptions.NATURES:
if (!isCaught || !isFormCaught) {
if (!isStarterCaught) {
error = true;
} else {
this.blockInput = true;
@ -2392,8 +2431,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
}
if (species) {
const dexEntry = globalScene.gameData.dexData[species.speciesId];
const caughtAttr = this.isCaught(species);
if (!caughtAttr) {
@ -2414,7 +2451,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
}
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.pokemonNumberText.setColor(this.getTextColor(shiny ? TextStyle.SUMMARY_GOLD : TextStyle.SUMMARY, false));

View File

@ -781,6 +781,15 @@ export default class PokedexUiHandler extends MessageUiHandler {
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
* @returns true if upgrade notifications are enabled and set to display an 'Icon'
@ -1364,7 +1373,7 @@ export default class PokedexUiHandler extends MessageUiHandler {
const levelMoves = pokemonSpeciesLevelMoves[species.speciesId].map(m => allMoves[m[1]].name);
// This always gets egg moves from the starter
const eggMoves = speciesEggMoves[starterId]?.map(m => allMoves[m].name) ?? [];
const tmMoves = speciesTmMoves[starterId]?.map(m => allMoves[Array.isArray(m) ? m[1] : m].name) ?? [];
const tmMoves = speciesTmMoves[species.speciesId]?.map(m => allMoves[Array.isArray(m) ? m[1] : m].name) ?? [];
const selectedMove1 = this.filterText.getValue(FilterTextRow.MOVE_1);
const selectedMove2 = this.filterText.getValue(FilterTextRow.MOVE_2);
@ -1740,7 +1749,7 @@ export default class PokedexUiHandler extends MessageUiHandler {
if (caughtAttr & data.species.getFullUnlocksData() || globalScene.dexForDevs) {
container.icon.clearTint();
} else if (dexEntry.seenAttr) {
} else if (this.isSeen(data.species, dexEntry)) {
container.icon.setTint(0x808080);
} else {
container.icon.setTint(0);
@ -1931,13 +1940,11 @@ export default class PokedexUiHandler extends MessageUiHandler {
const props = this.getSanitizedProps(globalScene.gameData.getSpeciesDexAttrProps(this.lastSpecies, dexAttr));
this.trayContainers = [];
const isFormSeen = this.isSeen(species, dexEntry);
this.trayForms.map((f, index) => {
const isFormCaught = dexEntry
? (dexEntry.caughtAttr & species.getFullUnlocksData() & globalScene.gameData.getFormAttr(f.formIndex ?? 0)) > 0n
: false;
const isFormSeen = dexEntry
? (dexEntry.seenAttr & globalScene.gameData.getFormAttr(f.formIndex ?? 0)) > 0n
: false;
const formContainer = new PokedexMonContainer(species, {
formIndex: f.formIndex,
female: props.female,
@ -2147,7 +2154,7 @@ export default class PokedexUiHandler extends MessageUiHandler {
}
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);
this.assetLoadCancelled = assetLoadCancelled;

View File

@ -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(() => {

View File

@ -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");
});
});
});