Merge branch 'clean-up-move-info-overlay' of https://github.com/Wlowscha/pokerogue into clean-up-move-info-overlay

This commit is contained in:
Wlowscha 2025-07-29 23:07:26 +02:00
commit 67729111a6
No known key found for this signature in database
GPG Key ID: 3C8F1AD330565D04
7 changed files with 447 additions and 522 deletions

View File

@ -30,19 +30,19 @@
"@biomejs/biome": "2.0.0", "@biomejs/biome": "2.0.0",
"@ls-lint/ls-lint": "2.3.1", "@ls-lint/ls-lint": "2.3.1",
"@types/jsdom": "^21.1.7", "@types/jsdom": "^21.1.7",
"@types/node": "^22.16.3", "@types/node": "^22.16.5",
"@vitest/coverage-istanbul": "^3.2.4", "@vitest/coverage-istanbul": "^3.2.4",
"@vitest/expect": "^3.2.4", "@vitest/expect": "^3.2.4",
"chalk": "^5.4.1", "chalk": "^5.4.1",
"dependency-cruiser": "^16.10.4", "dependency-cruiser": "^16.10.4",
"inquirer": "^12.7.0", "inquirer": "^12.8.2",
"jsdom": "^26.1.0", "jsdom": "^26.1.0",
"lefthook": "^1.12.2", "lefthook": "^1.12.2",
"msw": "^2.10.4", "msw": "^2.10.4",
"phaser3spectorjs": "^0.0.8", "phaser3spectorjs": "^0.0.8",
"typedoc": "^0.28.7", "typedoc": "^0.28.8",
"typescript": "^5.8.3", "typescript": "^5.8.3",
"vite": "^6.3.5", "vite": "^7.0.6",
"vite-tsconfig-paths": "^5.1.4", "vite-tsconfig-paths": "^5.1.4",
"vitest": "^3.2.4", "vitest": "^3.2.4",
"vitest-canvas-mock": "^0.3.3" "vitest-canvas-mock": "^0.3.3"

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,7 @@ export interface IllusionData {
/** The name of pokemon featured in the illusion */ /** The name of pokemon featured in the illusion */
name: string; name: string;
/** The nickname of the pokemon featured in the illusion */ /** The nickname of the pokemon featured in the illusion */
nickname: string; nickname?: string;
/** Whether the pokemon featured in the illusion is shiny or not */ /** Whether the pokemon featured in the illusion is shiny or not */
shiny: boolean; shiny: boolean;
/** The variant of the pokemon featured in the illusion */ /** The variant of the pokemon featured in the illusion */

View File

@ -39,6 +39,7 @@ import { addPokemonDataToDexAndValidateAchievements } from "#mystery-encounters/
import type { MysteryEncounter } from "#mystery-encounters/mystery-encounter"; import type { MysteryEncounter } from "#mystery-encounters/mystery-encounter";
import { MysteryEncounterBuilder } from "#mystery-encounters/mystery-encounter"; import { MysteryEncounterBuilder } from "#mystery-encounters/mystery-encounter";
import { MysteryEncounterOptionBuilder } from "#mystery-encounters/mystery-encounter-option"; import { MysteryEncounterOptionBuilder } from "#mystery-encounters/mystery-encounter-option";
import { PartySizeRequirement } from "#mystery-encounters/mystery-encounter-requirements";
import { PokemonData } from "#system/pokemon-data"; import { PokemonData } from "#system/pokemon-data";
import { MusicPreference } from "#system/settings"; import { MusicPreference } from "#system/settings";
import type { OptionSelectItem } from "#ui/abstact-option-select-ui-handler"; import type { OptionSelectItem } from "#ui/abstact-option-select-ui-handler";
@ -151,7 +152,8 @@ export const GlobalTradeSystemEncounter: MysteryEncounter = MysteryEncounterBuil
return true; return true;
}) })
.withOption( .withOption(
MysteryEncounterOptionBuilder.newOptionWithMode(MysteryEncounterOptionMode.DEFAULT) MysteryEncounterOptionBuilder.newOptionWithMode(MysteryEncounterOptionMode.DISABLED_OR_DEFAULT)
.withSceneRequirement(new PartySizeRequirement([2, 6], true)) // Requires 2 valid party members
.withHasDexProgress(true) .withHasDexProgress(true)
.withDialogue({ .withDialogue({
buttonLabel: `${namespace}:option.1.label`, buttonLabel: `${namespace}:option.1.label`,
@ -257,7 +259,8 @@ export const GlobalTradeSystemEncounter: MysteryEncounter = MysteryEncounterBuil
.build(), .build(),
) )
.withOption( .withOption(
MysteryEncounterOptionBuilder.newOptionWithMode(MysteryEncounterOptionMode.DEFAULT) MysteryEncounterOptionBuilder.newOptionWithMode(MysteryEncounterOptionMode.DISABLED_OR_DEFAULT)
.withSceneRequirement(new PartySizeRequirement([2, 6], true)) // Requires 2 valid party members
.withHasDexProgress(true) .withHasDexProgress(true)
.withDialogue({ .withDialogue({
buttonLabel: `${namespace}:option.2.label`, buttonLabel: `${namespace}:option.2.label`,

View File

@ -213,7 +213,11 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
* TODO: Stop treating this like a unique ID and stop treating 0 as no pokemon * TODO: Stop treating this like a unique ID and stop treating 0 as no pokemon
*/ */
public id: number; public id: number;
public nickname: string; /**
* The Pokemon's current nickname, or `undefined` if it currently lacks one.
* If omitted, references to this should refer to the default name for this Pokemon's species.
*/
public nickname?: string;
public species: PokemonSpecies; public species: PokemonSpecies;
public formIndex: number; public formIndex: number;
public abilityIndex: number; public abilityIndex: number;
@ -443,7 +447,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
getNameToRender(useIllusion = true) { getNameToRender(useIllusion = true) {
const illusion = this.summonData.illusion; const illusion = this.summonData.illusion;
const name = useIllusion ? (illusion?.name ?? this.name) : this.name; const name = useIllusion ? (illusion?.name ?? this.name) : this.name;
const nickname: string = useIllusion ? (illusion?.nickname ?? this.nickname) : this.nickname; const nickname: string | undefined = useIllusion ? illusion?.nickname : this.nickname;
try { try {
if (nickname) { if (nickname) {
return decodeURIComponent(escape(atob(nickname))); // TODO: Remove `atob` and `escape`... eventually... return decodeURIComponent(escape(atob(nickname))); // TODO: Remove `atob` and `escape`... eventually...

View File

@ -10,16 +10,24 @@ import { fixedInt, getLocalizedSpriteKey } from "#utils/common";
import i18next from "i18next"; import i18next from "i18next";
export interface MoveInfoOverlaySettings { export interface MoveInfoOverlaySettings {
delayVisibility?: boolean; // if true, showing the overlay will only set it to active and populate the fields and the handler using this field has to manually call setVisible later. /**
top?: boolean; // should the effect box be on top? * If true, showing the overlay will only set it to active and populate the fields
right?: boolean; // should the effect box be on the right? * and the handler using this field has to manually call `setVisible` later.
onSide?: boolean; // should the effect be on the side? ignores top argument if true */
//location and width of the component; unaffected by scaling delayVisibility?: boolean;
/** Whether the effect box should be on top */
top?: boolean;
/** Whether the effect box should be on the right */
right?: boolean;
/** Whether the effect box should be on the side. Overrides the `top` param if `true`. */
onSide?: boolean;
/** `x` position of the component, unaffected by scaling */
x?: number; x?: number;
/** `y` position of the component, unaffected by scaling */
y?: number; y?: number;
// Default width is half the screen /** Width of the component, unaffected by scaling. Defaults to half the screen width. */
width?: number; width?: number;
// Determines whether to display the small secondary box /** Whether to display the small secondary box */
hideEffectBox?: boolean; hideEffectBox?: boolean;
hideBg?: boolean; hideBg?: boolean;
} }

View File

@ -93,7 +93,7 @@ describe("Global Trade System - Mystery Encounter", () => {
describe("Option 1 - Check Trade Offers", () => { describe("Option 1 - Check Trade Offers", () => {
it("should have the correct properties", () => { it("should have the correct properties", () => {
const option = GlobalTradeSystemEncounter.options[0]; const option = GlobalTradeSystemEncounter.options[0];
expect(option.optionMode).toBe(MysteryEncounterOptionMode.DEFAULT); expect(option.optionMode).toBe(MysteryEncounterOptionMode.DISABLED_OR_DEFAULT);
expect(option.dialogue).toBeDefined(); expect(option.dialogue).toBeDefined();
expect(option.dialogue).toStrictEqual({ expect(option.dialogue).toStrictEqual({
buttonLabel: `${namespace}:option.1.label`, buttonLabel: `${namespace}:option.1.label`,
@ -154,7 +154,7 @@ describe("Global Trade System - Mystery Encounter", () => {
describe("Option 2 - Wonder Trade", () => { describe("Option 2 - Wonder Trade", () => {
it("should have the correct properties", () => { it("should have the correct properties", () => {
const option = GlobalTradeSystemEncounter.options[1]; const option = GlobalTradeSystemEncounter.options[1];
expect(option.optionMode).toBe(MysteryEncounterOptionMode.DEFAULT); expect(option.optionMode).toBe(MysteryEncounterOptionMode.DISABLED_OR_DEFAULT);
expect(option.dialogue).toBeDefined(); expect(option.dialogue).toBeDefined();
expect(option.dialogue).toStrictEqual({ expect(option.dialogue).toStrictEqual({
buttonLabel: `${namespace}:option.2.label`, buttonLabel: `${namespace}:option.2.label`,