diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml index fff90047df2..1588a15afeb 100644 --- a/.github/workflows/github-pages.yml +++ b/.github/workflows/github-pages.yml @@ -4,6 +4,7 @@ on: push: branches: - main + - beta pull_request: branches: - main diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 0b2e4c1a5da..82f5abd23a1 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -41,4 +41,7 @@ jobs: run: pnpm biome-ci - name: Check dependencies with depcruise - run: pnpm depcruise \ No newline at end of file + run: pnpm depcruise + + - name: Lint with ls-lint + run: pnpm ls-lint \ No newline at end of file diff --git a/.github/workflows/test-shard-template.yml b/.github/workflows/test-shard-template.yml index b154166f81b..124004f380f 100644 --- a/.github/workflows/test-shard-template.yml +++ b/.github/workflows/test-shard-template.yml @@ -44,4 +44,4 @@ jobs: run: pnpm i - name: Run tests - run: pnpm exec vitest --project ${{ inputs.project }} --no-isolate --shard=${{ inputs.shard }}/${{ inputs.totalShards }} ${{ !runner.debug && '--silent' || '' }} + run: pnpm test:silent --shard=${{ inputs.shard }}/${{ inputs.totalShards }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d3dd23eb379..764a35ace60 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,6 +11,7 @@ on: - beta merge_group: types: [checks_requested] + workflow_dispatch: jobs: check-path-change-filter: diff --git a/.ls-lint.yml b/.ls-lint.yml new file mode 100644 index 00000000000..22f08f72938 --- /dev/null +++ b/.ls-lint.yml @@ -0,0 +1,28 @@ +# Base settings to use +# Note that the `_cfg` key isn't part of ls-lint's configuration, it's just a YAML anchor for reuse. +_cfg: &cfg + .ps1: kebab-case + .ts: kebab-case + .js: kebab-case + .*.ts: kebab-case + .*.js: kebab-case + .dir: kebab-case + .py: snake_case # python files should always use snake_case + +ls: + <<: *cfg + src: &src + <<: *cfg + .dir: kebab-case | regex:@types + .js: exists:0 + src/system/version-migration/versions: + .ts: snake_case + <<: *cfg + test: *src +ignore: + - node_modules + - .vscode + - .github + - .git + - public + - dist diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7092b40b1b6..2d56b868cff 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -104,7 +104,7 @@ Most non-trivial changes (*especially bug fixes*) should come along with new tes - Test edge cases. A good strategy is to think of edge cases beforehand and create tests for them using `it.todo`. Once the edge case has been handled, you can remove the `todo` marker. ## 😈 Development Save File -> Some issues may require you to have unlocks on your save file which go beyond normal overrides. For this reason, the repository contains a [save file](../test/testUtils/saves/everything.psrv) with _everything_ unlocked (even ones not legitimately obtainable, like unimplemented variant shinies). +> Some issues may require you to have unlocks on your save file which go beyond normal overrides. For this reason, the repository contains a [save file](../test/test-utils/saves/everything.psrv) with _everything_ unlocked (even ones not legitimately obtainable, like unimplemented variant shinies). 1. Start the game up locally and navigate to `Menu -> Manage Data -> Import Data` -2. Select [everything.prsv](test/testUtils/saves/everything.prsv) (`test/testUtils/saves/everything.prsv`) and confirm. +2. Select [everything.prsv](test/test-utils/saves/everything.prsv) (`test/test-utils/saves/everything.prsv`) and confirm. diff --git a/biome.jsonc b/biome.jsonc index d4cb67d33a6..470885a543d 100644 --- a/biome.jsonc +++ b/biome.jsonc @@ -177,9 +177,10 @@ } }, - // Overrides to prevent unused import removal inside `overrides.ts` and enums files (for TSDoc linkcodes) + // Overrides to prevent unused import removal inside `overrides.ts` and enums files (for TSDoc linkcodes), + // as well as in all TS files in `scripts/` (which are assumed to be boilerplate templates). { - "includes": ["**/src/overrides.ts", "**/src/enums/**/*"], + "includes": ["**/src/overrides.ts", "**/src/enums/**/*", "**/scripts/**/*.ts"], "linter": { "rules": { "correctness": { @@ -189,7 +190,7 @@ } }, { - "includes": ["**/src/overrides.ts"], + "includes": ["**/src/overrides.ts", "**/scripts/**/*.ts"], "linter": { "rules": { "style": { diff --git a/global.d.ts b/global.d.ts index d2ed6438c0b..27e96a4d8b5 100644 --- a/global.d.ts +++ b/global.d.ts @@ -8,7 +8,7 @@ declare global { * Can technically be undefined/null but for ease of use we are going to assume it is always defined. * Used to load i18n files exclusively. * - * To set up your own server in a test see `game_data.test.ts` + * To set up your own server in a test see `game-data.test.ts` */ var server: SetupServerApi; } diff --git a/lefthook.yml b/lefthook.yml index 40875073fdd..8b5ad2234ed 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -1,11 +1,13 @@ pre-commit: + skip: + - merge + - rebase commands: biome-lint: run: pnpm exec biome check --write --reporter=summary --staged --no-errors-on-unmatched stage_fixed: true - skip: - - merge - - rebase + ls-lint: + run: pnpm exec ls-lint post-merge: commands: diff --git a/package.json b/package.json index 64f2f9786db..02d063389b7 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "test": "vitest run --no-isolate", "test:cov": "vitest run --coverage --no-isolate", "test:watch": "vitest watch --coverage --no-isolate", - "test:silent": "vitest run --silent --no-isolate", + "test:silent": "vitest run --silent='passed-only' --no-isolate", "test:create": "node scripts/create-test/create-test.js", "typecheck": "tsc --noEmit", "eslint": "eslint --fix .", @@ -28,9 +28,11 @@ }, "devDependencies": { "@biomejs/biome": "2.0.0", + "@ls-lint/ls-lint": "2.3.1", "@types/jsdom": "^21.1.7", "@types/node": "^22.16.3", "@vitest/coverage-istanbul": "^3.2.4", + "@vitest/expect": "^3.2.4", "chalk": "^5.4.1", "dependency-cruiser": "^16.10.4", "inquirer": "^12.7.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9f465c56778..86a7bb904a1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -45,6 +45,9 @@ importers: '@biomejs/biome': specifier: 2.0.0 version: 2.0.0 + '@ls-lint/ls-lint': + specifier: 2.3.1 + version: 2.3.1 '@types/jsdom': specifier: ^21.1.7 version: 21.1.7 @@ -54,6 +57,9 @@ importers: '@vitest/coverage-istanbul': specifier: ^3.2.4 version: 3.2.4(vitest@3.2.4(@types/node@22.16.3)(jsdom@26.1.0)(msw@2.10.4(@types/node@22.16.3)(typescript@5.8.3))(yaml@2.8.0)) + '@vitest/expect': + specifier: ^3.2.4 + version: 3.2.4 chalk: specifier: ^5.4.1 version: 5.4.1 @@ -565,6 +571,12 @@ packages: '@jridgewell/trace-mapping@0.3.29': resolution: {integrity: sha512-uw6guiW/gcAGPDhLmd77/6lW8QLeiV5RUTsAX46Db6oLhGaVj4lhnPwb184s1bkc8kdVg/+h988dro8GRDpmYQ==} + '@ls-lint/ls-lint@2.3.1': + resolution: {integrity: sha512-vPe6IDByQnQRTxcAYjTxrmga/tSIui50VBFTB5KIJWY3OOFmxE2VtymjeSEfQfiMbhZV/ZPAqYy2lt8pZFQ0Rw==} + cpu: [x64, arm64, s390x, ppc64le] + os: [darwin, linux, win32] + hasBin: true + '@material/material-color-utilities@0.2.7': resolution: {integrity: sha512-0FCeqG6WvK4/Cc06F/xXMd/pv4FeisI0c1tUpBbfhA2n9Y8eZEv4Karjbmf2ZqQCPUWMrGp8A571tCjizxoTiQ==} @@ -2452,6 +2464,8 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.4 + '@ls-lint/ls-lint@2.3.1': {} + '@material/material-color-utilities@0.2.7': {} '@mswjs/interceptors@0.39.2': diff --git a/public/locales b/public/locales index 362b2c4fcc2..e2fbba17ea7 160000 --- a/public/locales +++ b/public/locales @@ -1 +1 @@ -Subproject commit 362b2c4fcc20b31a7be6c2dab537055fbaeb247f +Subproject commit e2fbba17ea7a96068970ea98a8a84ed3e25b6f07 diff --git a/scripts/create-test/test-boilerplate.ts b/scripts/create-test/boilerplates/default.ts similarity index 94% rename from scripts/create-test/test-boilerplate.ts rename to scripts/create-test/boilerplates/default.ts index 759f3afaec0..fa914b150c2 100644 --- a/scripts/create-test/test-boilerplate.ts +++ b/scripts/create-test/boilerplates/default.ts @@ -1,7 +1,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/scripts/create-test/create-test.js b/scripts/create-test/create-test.js index f24aac548fc..765993959d1 100644 --- a/scripts/create-test/create-test.js +++ b/scripts/create-test/create-test.js @@ -17,15 +17,20 @@ const version = "2.0.1"; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); const projectRoot = path.join(__dirname, "..", ".."); -const boilerplateFilePath = path.join(__dirname, "test-boilerplate.ts"); -const choices = [ - { label: "Move", dir: "moves" }, - { label: "Ability", dir: "abilities" }, - { label: "Item", dir: "items" }, - { label: "Mystery Encounter", dir: "mystery-encounter/encounters" }, - { label: "Utils", dir: "utils" }, - { label: "UI", dir: "ui" }, -]; + +const choices = /** @type {const} */ (["Move", "Ability", "Item", "Reward", "Mystery Encounter", "Utils", "UI"]); +/** @typedef {choices[number]} choiceType */ + +/** @satisfies {{[k in choiceType]: string}} */ +const choicesToDirs = /** @type {const} */ ({ + Move: "moves", + Ability: "abilities", + Item: "items", + Reward: "rewards", + "Mystery Encounter": "mystery-encounter/encounters", + Utils: "utils", + UI: "ui", +}); //#endregion //#region Functions @@ -41,46 +46,47 @@ function getTestFolderPath(...folders) { /** * Prompts the user to select a type via list. - * @returns {Promise<{selectedOption: {label: string, dir: string}}>} the selected type + * @returns {Promise} the selected type */ async function promptTestType() { - const typeAnswer = await inquirer.prompt([ - { - type: "list", - name: "selectedOption", - message: "What type of test would you like to create?", - choices: [...choices.map(choice => ({ name: choice.label, value: choice })), "EXIT"], - }, - ]); + /** @type {choiceType | "EXIT"} */ + const choice = await inquirer + .prompt([ + { + type: "list", + name: "selectedOption", + message: "What type of test would you like to create?", + choices: [...choices, "EXIT"], + }, + ]) + .then(ta => ta.selectedOption); - if (typeAnswer.selectedOption === "EXIT") { + if (choice === "EXIT") { console.log("Exiting..."); - return process.exit(); - } - if (!choices.some(choice => choice.dir === typeAnswer.selectedOption.dir)) { - console.error(`Please provide a valid type: (${choices.map(choice => choice.label).join(", ")})!`); - return await promptTestType(); + return process.exit(0); } - return typeAnswer; + return choice; } /** * Prompts the user to provide a file name. - * @param {string} selectedType - * @returns {Promise<{userInput: string}>} the selected file name + * @param {choiceType} selectedType The chosen string (used to display console logs) + * @returns {Promise} the selected file name */ async function promptFileName(selectedType) { - /** @type {{userInput: string}} */ - const fileNameAnswer = await inquirer.prompt([ - { - type: "input", - name: "userInput", - message: `Please provide the name of the ${selectedType}:`, - }, - ]); + /** @type {string} */ + const fileNameAnswer = await inquirer + .prompt([ + { + type: "input", + name: "userInput", + message: `Please provide the name of the ${selectedType}.`, + }, + ]) + .then(fa => fa.userInput); - if (!fileNameAnswer.userInput || fileNameAnswer.userInput.trim().length === 0) { + if (fileNameAnswer.trim().length === 0) { console.error("Please provide a valid file name!"); return await promptFileName(selectedType); } @@ -88,51 +94,66 @@ async function promptFileName(selectedType) { return fileNameAnswer; } +/** + * Obtain the path to the boilerplate file based on the current option. + * @param {choiceType} choiceType The choice selected + * @returns {string} The path to the boilerplate file + */ +function getBoilerplatePath(choiceType) { + switch (choiceType) { + // case "Reward": + // return path.join(__dirname, "boilerplates/reward.ts"); + default: + return path.join(__dirname, "boilerplates/default.ts"); + } +} + /** * Runs the interactive test:create "CLI" * @returns {Promise} */ async function runInteractive() { - console.group(chalk.grey(`Create Test - v${version}\n`)); + console.group(chalk.grey(`🧪 Create Test - v${version}\n`)); try { - const typeAnswer = await promptTestType(); - const fileNameAnswer = await promptFileName(typeAnswer.selectedOption.label); + const choice = await promptTestType(); + const fileNameAnswer = await promptFileName(choice); - const type = typeAnswer.selectedOption; // Convert fileName from snake_case or camelCase to kebab-case - const fileName = fileNameAnswer.userInput + const fileName = fileNameAnswer .replace(/_+/g, "-") // Convert snake_case (underscore) to kebab-case (dashes) .replace(/([a-z])([A-Z])/g, "$1-$2") // Convert camelCase to kebab-case .replace(/\s+/g, "-") // Replace spaces with dashes .toLowerCase(); // Ensure all lowercase - // Format the description for the test case + // Format the description for the test case in Title Case const formattedName = fileName.replace(/-/g, " ").replace(/\b\w/g, char => char.toUpperCase()); + const description = `${choice} - ${formattedName}`; + // Determine the directory based on the type - const dir = getTestFolderPath(type.dir); - const description = `${type.label} - ${formattedName}`; + const localDir = choicesToDirs[choice]; + const absoluteDir = getTestFolderPath(localDir); // Define the content template - const content = fs.readFileSync(boilerplateFilePath, "utf8").replace("{{description}}", description); + const content = fs.readFileSync(getBoilerplatePath(choice), "utf8").replace("{{description}}", description); // Ensure the directory exists - if (!fs.existsSync(dir)) { - fs.mkdirSync(dir, { recursive: true }); + if (!fs.existsSync(absoluteDir)) { + fs.mkdirSync(absoluteDir, { recursive: true }); } // Create the file with the given name - const filePath = path.join(dir, `${fileName}.test.ts`); + const filePath = path.join(absoluteDir, `${fileName}.test.ts`); if (fs.existsSync(filePath)) { - console.error(chalk.red.bold(`\n✗ File "${fileName}.test.ts" already exists!\n`)); + console.error(chalk.red.bold(`✗ File "${fileName}.test.ts" already exists!\n`)); process.exit(1); } // Write the template content to the file fs.writeFileSync(filePath, content, "utf8"); - console.log(chalk.green.bold(`\n✔ File created at: test/${type.dir}/${fileName}.test.ts\n`)); + console.log(chalk.green.bold(`✔ File created at: test/${localDir}/${fileName}.test.ts\n`)); console.groupEnd(); } catch (err) { console.error(chalk.red("✗ Error: ", err.message)); diff --git a/scripts/decrypt-save.js b/scripts/decrypt-save.js index 219cdb47bed..e50f152f159 100644 --- a/scripts/decrypt-save.js +++ b/scripts/decrypt-save.js @@ -2,7 +2,9 @@ // biome-ignore lint/performance/noNamespaceImport: This is how you import fs from node import * as fs from "node:fs"; -import { AES, enc } from "crypto-js"; +import crypto_js from "crypto-js"; + +const { AES, enc } = crypto_js; const SAVE_KEY = "x0i2O7WRiANTqPmZ"; @@ -144,7 +146,7 @@ function main() { process.exit(0); } - writeToFile(destPath, decrypt); + writeToFile(args[1], decrypt); } main(); diff --git a/update_exp_sprites.ps1 b/scripts/update-exp-sprites.ps1 similarity index 100% rename from update_exp_sprites.ps1 rename to scripts/update-exp-sprites.ps1 diff --git a/public/update-source-comments.py b/scripts/update_source_comments.py similarity index 85% rename from public/update-source-comments.py rename to scripts/update_source_comments.py index 410d1a42566..465285fd4ac 100644 --- a/public/update-source-comments.py +++ b/scripts/update_source_comments.py @@ -2,13 +2,13 @@ import re filenames = [['src/enums/moves.ts', 'move'], ['src/enums/abilities.ts', 'ability'], ['src/enums/species.ts', 'Pokémon']] -commentBlockStart = re.compile('\/\*[^\*].*') # Regex for the start of a comment block -commentBlockEnd = re.compile('.*,\*\/') # Regex for the end of a comment block +commentBlockStart = re.compile(r'\/\*[^\*].*') # Regex for the start of a comment block +commentBlockEnd = re.compile(r'.*,\*\/') # Regex for the end of a comment block -commentExp = re.compile('(?:\/\*\*.*\*\/)') # Regex for a url comment that already existed in the file +commentExp = re.compile(r'(?:\/\*\*.*\*\/)') # Regex for a url comment that already existed in the file enumExp = re.compile('.*,') # Regex for a regular enum line -numberExp = re.compile(' +\= +\d+,') +numberExp = re.compile(r' +\= +\d+,') replaceList = ['ALOLA', 'ETERNAL', 'GALAR', 'HISUI', 'PALDEA', 'BLOODMOON'] diff --git a/src/@types/PokerogueAccountApi.ts b/src/@types/api/pokerogue-account-api.ts similarity index 85% rename from src/@types/PokerogueAccountApi.ts rename to src/@types/api/pokerogue-account-api.ts index 3b3e74ba41d..7bcdc766664 100644 --- a/src/@types/PokerogueAccountApi.ts +++ b/src/@types/api/pokerogue-account-api.ts @@ -1,4 +1,4 @@ -import type { UserInfo } from "#types/UserInfo"; +import type { UserInfo } from "#types/user-info"; export interface AccountInfoResponse extends UserInfo {} diff --git a/src/@types/PokerogueAdminApi.ts b/src/@types/api/pokerogue-admin-api.ts similarity index 100% rename from src/@types/PokerogueAdminApi.ts rename to src/@types/api/pokerogue-admin-api.ts diff --git a/src/@types/PokerogueApi.ts b/src/@types/api/pokerogue-api-types.ts similarity index 100% rename from src/@types/PokerogueApi.ts rename to src/@types/api/pokerogue-api-types.ts diff --git a/src/@types/PokerogueDailyApi.ts b/src/@types/api/pokerogue-daily-api.ts similarity index 100% rename from src/@types/PokerogueDailyApi.ts rename to src/@types/api/pokerogue-daily-api.ts diff --git a/src/@types/PokerogueSavedataApi.ts b/src/@types/api/pokerogue-save-data-api.ts similarity index 100% rename from src/@types/PokerogueSavedataApi.ts rename to src/@types/api/pokerogue-save-data-api.ts diff --git a/src/@types/PokerogueSessionSavedataApi.ts b/src/@types/api/pokerogue-session-save-data-api.ts similarity index 95% rename from src/@types/PokerogueSessionSavedataApi.ts rename to src/@types/api/pokerogue-session-save-data-api.ts index c4650611c4f..bd606ef7e9c 100644 --- a/src/@types/PokerogueSessionSavedataApi.ts +++ b/src/@types/api/pokerogue-session-save-data-api.ts @@ -1,4 +1,4 @@ -export class UpdateSessionSavedataRequest { +export interface UpdateSessionSavedataRequest { slot: number; trainerId: number; secretId: number; diff --git a/src/@types/PokerogueSystemSavedataApi.ts b/src/@types/api/pokerogue-system-save-data-api.ts similarity index 88% rename from src/@types/PokerogueSystemSavedataApi.ts rename to src/@types/api/pokerogue-system-save-data-api.ts index ded22c4c58c..133f9cda506 100644 --- a/src/@types/PokerogueSystemSavedataApi.ts +++ b/src/@types/api/pokerogue-system-save-data-api.ts @@ -4,7 +4,7 @@ export interface GetSystemSavedataRequest { clientSessionId: string; } -export class UpdateSystemSavedataRequest { +export interface UpdateSystemSavedataRequest { clientSessionId: string; trainerId?: number; secretId?: number; diff --git a/src/@types/illusion-data.ts b/src/@types/illusion-data.ts index 854c98c8cc9..5bf86d23ac2 100644 --- a/src/@types/illusion-data.ts +++ b/src/@types/illusion-data.ts @@ -8,20 +8,14 @@ import type { Variant } from "#sprites/variant"; * Data pertaining to a Pokemon's Illusion. */ export interface IllusionData { - basePokemon: { - /** The actual name of the Pokemon */ - name: string; - /** The actual nickname of the Pokemon */ - nickname: string; - /** Whether the base pokemon is shiny or not */ - shiny: boolean; - /** The shiny variant of the base pokemon */ - variant: Variant; - /** Whether the fusion species of the base pokemon is shiny or not */ - fusionShiny: boolean; - /** The variant of the fusion species of the base pokemon */ - fusionVariant: Variant; - }; + /** The name of pokemon featured in the illusion */ + name: string; + /** The nickname of the pokemon featured in the illusion */ + nickname?: string; + /** Whether the pokemon featured in the illusion is shiny or not */ + shiny: boolean; + /** The variant of the pokemon featured in the illusion */ + variant: Variant; /** The species of the illusion */ species: SpeciesId; /** The formIndex of the illusion */ @@ -34,6 +28,10 @@ export interface IllusionData { fusionSpecies?: PokemonSpecies; /** The fusionFormIndex of the illusion */ fusionFormIndex?: number; + /** Whether the fusion species of the pokemon featured in the illusion is shiny or not */ + fusionShiny?: boolean; + /** The variant of the fusion species of the pokemon featured in the illusion */ + fusionVariant?: Variant; /** The fusionGender of the illusion if it's a fusion */ fusionGender?: Gender; /** The level of the illusion (not used currently) */ diff --git a/src/@types/SessionSaveMigrator.ts b/src/@types/session-save-migrator.ts similarity index 100% rename from src/@types/SessionSaveMigrator.ts rename to src/@types/session-save-migrator.ts diff --git a/src/@types/SettingsSaveMigrator.ts b/src/@types/settings-save-migrator.ts similarity index 100% rename from src/@types/SettingsSaveMigrator.ts rename to src/@types/settings-save-migrator.ts diff --git a/src/@types/SystemSaveMigrator.ts b/src/@types/system-save-migrator.ts similarity index 100% rename from src/@types/SystemSaveMigrator.ts rename to src/@types/system-save-migrator.ts diff --git a/src/@types/type-helpers.ts b/src/@types/type-helpers.ts index 3a5c88e3f15..b3e5b1cfc07 100644 --- a/src/@types/type-helpers.ts +++ b/src/@types/type-helpers.ts @@ -75,3 +75,14 @@ export type NonFunctionPropertiesRecursive = { }; export type AbstractConstructor = abstract new (...args: any[]) => T; + +/** + * Type helper that iterates through the fields of the type and coerces any `null` properties to `undefined` (including in union types). + * + * @remarks + * This is primarily useful when an object with nullable properties wants to be serialized and have its `null` + * properties coerced to `undefined`. + */ +export type CoerceNullPropertiesToUndefined = { + [K in keyof T]: null extends T[K] ? Exclude | undefined : T[K]; +}; diff --git a/src/@types/ui.ts b/src/@types/ui.ts new file mode 100644 index 00000000000..10dab01c616 --- /dev/null +++ b/src/@types/ui.ts @@ -0,0 +1,10 @@ +import type Phaser from "phaser"; +import type InputText from "phaser3-rex-plugins/plugins/gameobjects/dom/inputtext/InputText"; + +export interface TextStyleOptions { + scale: number; + styleOptions: Phaser.Types.GameObjects.Text.TextStyle | InputText.IConfig; + shadowColor: string; + shadowXpos: number; + shadowYpos: number; +} diff --git a/src/@types/UserInfo.ts b/src/@types/user-info.ts similarity index 100% rename from src/@types/UserInfo.ts rename to src/@types/user-info.ts diff --git a/src/account.ts b/src/account.ts index 1bfb756b284..b01691ce940 100644 --- a/src/account.ts +++ b/src/account.ts @@ -1,6 +1,6 @@ import { pokerogueApi } from "#api/pokerogue-api"; import { bypassLogin } from "#app/global-vars/bypass-login"; -import type { UserInfo } from "#types/UserInfo"; +import type { UserInfo } from "#types/user-info"; import { randomString } from "#utils/common"; export let loggedInUser: UserInfo | null = null; diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 428f0e895a5..a6bdc211cd3 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -67,6 +67,7 @@ import { PokemonType } from "#enums/pokemon-type"; import { ShopCursorTarget } from "#enums/shop-cursor-target"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; +import { TextStyle } from "#enums/text-style"; import type { TrainerSlot } from "#enums/trainer-slot"; import { TrainerType } from "#enums/trainer-type"; import { TrainerVariant } from "#enums/trainer-variant"; @@ -132,7 +133,7 @@ import { CharSprite } from "#ui/char-sprite"; import { PartyExpBar } from "#ui/party-exp-bar"; import { PokeballTray } from "#ui/pokeball-tray"; import { PokemonInfoContainer } from "#ui/pokemon-info-container"; -import { addTextObject, getTextColor, TextStyle } from "#ui/text"; +import { addTextObject, getTextColor } from "#ui/text"; import { UI } from "#ui/ui"; import { addUiThemeOverrides } from "#ui/ui-theme"; import { @@ -236,6 +237,7 @@ export class BattleScene extends SceneBase { public enableTouchControls = false; public enableVibration = false; public showBgmBar = true; + public hideUsername = false; /** Determines the selected battle style. */ public battleStyle: BattleStyle = BattleStyle.SWITCH; /** @@ -699,16 +701,16 @@ export class BattleScene extends SceneBase { if (expSpriteKeys.size > 0) { return; } - this.cachedFetch("./exp-sprites.json") - .then(res => res.json()) - .then(keys => { - if (Array.isArray(keys)) { - for (const key of keys) { - expSpriteKeys.add(key); - } - } - Promise.resolve(); - }); + const res = await this.cachedFetch("./exp-sprites.json"); + const keys = await res.json(); + if (!Array.isArray(keys)) { + throw new Error("EXP Sprites were not array when fetched!"); + } + + // TODO: Optimize this + for (const k of keys) { + expSpriteKeys.add(k); + } } /** @@ -1669,6 +1671,11 @@ export class BattleScene extends SceneBase { case SpeciesId.MAUSHOLD: case SpeciesId.DUDUNSPARCE: return !randSeedInt(4) ? 1 : 0; + case SpeciesId.SINISTEA: + case SpeciesId.POLTEAGEIST: + case SpeciesId.POLTCHAGEIST: + case SpeciesId.SINISTCHA: + return !randSeedInt(16) ? 1 : 0; case SpeciesId.PIKACHU: if (this.currentBattle?.battleType === BattleType.TRAINER && this.currentBattle?.waveIndex < 30) { return 0; // Ban Cosplay and Partner Pika from Trainers before wave 30 diff --git a/src/configs/inputs/cfg_keyboard_qwerty.ts b/src/configs/inputs/cfg-keyboard-qwerty.ts similarity index 100% rename from src/configs/inputs/cfg_keyboard_qwerty.ts rename to src/configs/inputs/cfg-keyboard-qwerty.ts diff --git a/src/configs/inputs/configHandler.ts b/src/configs/inputs/config-handler.ts similarity index 100% rename from src/configs/inputs/configHandler.ts rename to src/configs/inputs/config-handler.ts diff --git a/src/configs/inputs/pad_dualshock.ts b/src/configs/inputs/pad-dualshock.ts similarity index 100% rename from src/configs/inputs/pad_dualshock.ts rename to src/configs/inputs/pad-dualshock.ts diff --git a/src/configs/inputs/pad_generic.ts b/src/configs/inputs/pad-generic.ts similarity index 100% rename from src/configs/inputs/pad_generic.ts rename to src/configs/inputs/pad-generic.ts diff --git a/src/configs/inputs/pad_procon.ts b/src/configs/inputs/pad-procon.ts similarity index 100% rename from src/configs/inputs/pad_procon.ts rename to src/configs/inputs/pad-procon.ts diff --git a/src/configs/inputs/pad_unlicensedSNES.ts b/src/configs/inputs/pad-unlicensed-snes.ts similarity index 100% rename from src/configs/inputs/pad_unlicensedSNES.ts rename to src/configs/inputs/pad-unlicensed-snes.ts diff --git a/src/configs/inputs/pad_xbox360.ts b/src/configs/inputs/pad-xbox360.ts similarity index 100% rename from src/configs/inputs/pad_xbox360.ts rename to src/configs/inputs/pad-xbox360.ts diff --git a/src/data/abilities/ability.ts b/src/data/abilities/ability.ts index 30f6f6fb8b2..0ee1a51a78e 100644 --- a/src/data/abilities/ability.ts +++ b/src/data/abilities/ability.ts @@ -15,6 +15,7 @@ import { SpeciesFormChangeAbilityTrigger, SpeciesFormChangeWeatherTrigger } from import { Gender } from "#data/gender"; import { getPokeballName } from "#data/pokeball"; import { pokemonFormChanges } from "#data/pokemon-forms"; +import type { PokemonSpecies } from "#data/pokemon-species"; import { getNonVolatileStatusEffects, getStatusEffectDescriptor, getStatusEffectHealText } from "#data/status-effect"; import { TerrainType } from "#data/terrain"; import type { Weather } from "#data/weather"; @@ -28,12 +29,12 @@ import { BattlerTagType } from "#enums/battler-tag-type"; import type { BerryType } from "#enums/berry-type"; import { Command } from "#enums/command"; import { HitResult } from "#enums/hit-result"; -import { MoveCategory } from "#enums/MoveCategory"; -import { MoveFlags } from "#enums/MoveFlags"; -import { MoveTarget } from "#enums/MoveTarget"; import { CommonAnim } from "#enums/move-anims-common"; +import { MoveCategory } from "#enums/move-category"; +import { MoveFlags } from "#enums/move-flags"; import { MoveId } from "#enums/move-id"; import { MoveResult } from "#enums/move-result"; +import { MoveTarget } from "#enums/move-target"; import { MoveUseMode } from "#enums/move-use-mode"; import { PokemonAnimType } from "#enums/pokemon-anim-type"; import { PokemonType } from "#enums/pokemon-type"; @@ -6001,8 +6002,13 @@ export class IllusionPreSummonAbAttr extends PreSummonAbAttr { const party: Pokemon[] = (pokemon.isPlayer() ? globalScene.getPlayerParty() : globalScene.getEnemyParty()).filter( p => p.isAllowedInBattle(), ); - const lastPokemon: Pokemon = party.filter(p => p !== pokemon).at(-1) || pokemon; - pokemon.setIllusion(lastPokemon); + let illusionPokemon: Pokemon | PokemonSpecies; + if (pokemon.hasTrainer()) { + illusionPokemon = party.filter(p => p !== pokemon).at(-1) || pokemon; + } else { + illusionPokemon = globalScene.arena.randomSpecies(globalScene.currentBattle.waveIndex, pokemon.level); + } + pokemon.setIllusion(illusionPokemon); } /** @returns Whether the illusion can be applied. */ diff --git a/src/data/arena-tag.ts b/src/data/arena-tag.ts index 2d49e7011af..2c4c8a04282 100644 --- a/src/data/arena-tag.ts +++ b/src/data/arena-tag.ts @@ -9,10 +9,10 @@ import { ArenaTagType } from "#enums/arena-tag-type"; import type { BattlerIndex } from "#enums/battler-index"; import { BattlerTagType } from "#enums/battler-tag-type"; import { HitResult } from "#enums/hit-result"; -import { MoveCategory } from "#enums/MoveCategory"; -import { MoveTarget } from "#enums/MoveTarget"; import { CommonAnim } from "#enums/move-anims-common"; +import { MoveCategory } from "#enums/move-category"; import { MoveId } from "#enums/move-id"; +import { MoveTarget } from "#enums/move-target"; import { MoveUseMode } from "#enums/move-use-mode"; import { PokemonType } from "#enums/pokemon-type"; import { Stat } from "#enums/stat"; diff --git a/src/data/balance/biomes.ts b/src/data/balance/biomes.ts index 32195b90e43..f84a518fb65 100644 --- a/src/data/balance/biomes.ts +++ b/src/data/balance/biomes.ts @@ -86,7 +86,7 @@ export enum BiomePoolTier { export const uncatchableSpecies: SpeciesId[] = []; -export interface SpeciesTree { +interface SpeciesTree { [key: number]: SpeciesId[] } @@ -94,11 +94,11 @@ export interface PokemonPools { [key: number]: (SpeciesId | SpeciesTree)[] } -export interface BiomeTierPokemonPools { +interface BiomeTierPokemonPools { [key: number]: PokemonPools } -export interface BiomePokemonPools { +interface BiomePokemonPools { [key: number]: BiomeTierPokemonPools } @@ -2022,7 +2022,6 @@ export const biomeTrainerPools: BiomeTrainerPools = { } }; -// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: init methods are expected to have many lines. export function initBiomes() { const pokemonBiomes = [ [ SpeciesId.BULBASAUR, PokemonType.GRASS, PokemonType.POISON, [ diff --git a/src/data/balance/egg-moves.ts b/src/data/balance/egg-moves.ts index f5026abe2ef..3475fe4fdea 100644 --- a/src/data/balance/egg-moves.ts +++ b/src/data/balance/egg-moves.ts @@ -1,8 +1,8 @@ import { allMoves } from "#data/data-lists"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { toReadableString } from "#utils/common"; import { getEnumKeys, getEnumValues } from "#utils/enums"; +import { toTitleCase } from "#utils/strings"; export const speciesEggMoves = { [SpeciesId.BULBASAUR]: [ MoveId.SAPPY_SEED, MoveId.MALIGNANT_CHAIN, MoveId.EARTH_POWER, MoveId.MATCHA_GOTCHA ], @@ -617,7 +617,7 @@ function parseEggMoves(content: string): void { } if (eggMoves.every(m => m === MoveId.NONE)) { - console.warn(`Species ${toReadableString(SpeciesId[species])} could not be parsed, excluding from output...`) + console.warn(`Species ${toTitleCase(SpeciesId[species])} could not be parsed, excluding from output...`) } else { output += `[SpeciesId.${SpeciesId[species]}]: [ ${eggMoves.map(m => `MoveId.${MoveId[m]}`).join(", ")} ],\n`; } diff --git a/src/data/battle-anims.ts b/src/data/battle-anims.ts index d26f0700f7f..55a3cc4e916 100644 --- a/src/data/battle-anims.ts +++ b/src/data/battle-anims.ts @@ -3,12 +3,13 @@ import { allMoves } from "#data/data-lists"; import type { BattlerIndex } from "#enums/battler-index"; import { BattlerTagType } from "#enums/battler-tag-type"; import { EncounterAnim } from "#enums/encounter-anims"; -import { MoveFlags } from "#enums/MoveFlags"; import { AnimBlendType, AnimFocus, AnimFrameTarget, ChargeAnim, CommonAnim } from "#enums/move-anims-common"; +import { MoveFlags } from "#enums/move-flags"; import { MoveId } from "#enums/move-id"; import type { Pokemon } from "#field/pokemon"; -import { animationFileName, coerceArray, getFrameMs, isNullOrUndefined, type nil } from "#utils/common"; +import { coerceArray, getFrameMs, isNullOrUndefined, type nil } from "#utils/common"; import { getEnumKeys, getEnumValues } from "#utils/enums"; +import { toKebabCase } from "#utils/strings"; import Phaser from "phaser"; export class AnimConfig { @@ -412,7 +413,7 @@ export function initCommonAnims(): Promise { const commonAnimId = commonAnimIds[ca]; commonAnimFetches.push( globalScene - .cachedFetch(`./battle-anims/common-${commonAnimNames[ca].toLowerCase().replace(/_/g, "-")}.json`) + .cachedFetch(`./battle-anims/common-${toKebabCase(commonAnimNames[ca])}.json`) .then(response => response.json()) .then(cas => commonAnims.set(commonAnimId, new AnimConfig(cas))), ); @@ -450,7 +451,7 @@ export function initMoveAnim(move: MoveId): Promise { const fetchAnimAndResolve = (move: MoveId) => { globalScene - .cachedFetch(`./battle-anims/${animationFileName(move)}.json`) + .cachedFetch(`./battle-anims/${toKebabCase(MoveId[move])}.json`) .then(response => { const contentType = response.headers.get("content-type"); if (!response.ok || contentType?.indexOf("application/json") === -1) { @@ -506,7 +507,7 @@ function useDefaultAnim(move: MoveId, defaultMoveAnim: MoveId) { * @remarks use {@linkcode useDefaultAnim} to use a default animation */ function logMissingMoveAnim(move: MoveId, ...optionalParams: any[]) { - const moveName = animationFileName(move); + const moveName = toKebabCase(MoveId[move]); console.warn(`Could not load animation file for move '${moveName}'`, ...optionalParams); } @@ -524,7 +525,7 @@ export async function initEncounterAnims(encounterAnim: EncounterAnim | Encounte } encounterAnimFetches.push( globalScene - .cachedFetch(`./battle-anims/encounter-${encounterAnimNames[anim].toLowerCase().replace(/_/g, "-")}.json`) + .cachedFetch(`./battle-anims/encounter-${toKebabCase(encounterAnimNames[anim])}.json`) .then(response => response.json()) .then(cas => encounterAnims.set(anim, new AnimConfig(cas))), ); @@ -548,7 +549,7 @@ export function initMoveChargeAnim(chargeAnim: ChargeAnim): Promise { } else { chargeAnims.set(chargeAnim, null); globalScene - .cachedFetch(`./battle-anims/${ChargeAnim[chargeAnim].toLowerCase().replace(/_/g, "-")}.json`) + .cachedFetch(`./battle-anims/${toKebabCase(ChargeAnim[chargeAnim])}.json`) .then(response => response.json()) .then(ca => { if (Array.isArray(ca)) { @@ -1405,7 +1406,9 @@ export async function populateAnims() { const chargeAnimIds = getEnumValues(ChargeAnim); const commonNamePattern = /name: (?:Common:)?(Opp )?(.*)/; const moveNameToId = {}; + // Exclude MoveId.NONE; for (const move of getEnumValues(MoveId).slice(1)) { + // KARATE_CHOP => KARATECHOP const moveName = MoveId[move].toUpperCase().replace(/_/g, ""); moveNameToId[moveName] = move; } diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index 060b17e889b..c8ddfe32f0b 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -11,9 +11,9 @@ import { AbilityId } from "#enums/ability-id"; import { BattlerTagLapseType } from "#enums/battler-tag-lapse-type"; import { BattlerTagType } from "#enums/battler-tag-type"; import { HitResult } from "#enums/hit-result"; -import { MoveCategory } from "#enums/MoveCategory"; -import { MoveFlags } from "#enums/MoveFlags"; import { ChargeAnim, CommonAnim } from "#enums/move-anims-common"; +import { MoveCategory } from "#enums/move-category"; +import { MoveFlags } from "#enums/move-flags"; import { MoveId } from "#enums/move-id"; import { MoveResult } from "#enums/move-result"; import { MoveUseMode } from "#enums/move-use-mode"; diff --git a/src/data/challenge.ts b/src/data/challenge.ts index 938ee482d01..aaa82a7d20f 100644 --- a/src/data/challenge.ts +++ b/src/data/challenge.ts @@ -4,6 +4,7 @@ import { defaultStarterSpecies } from "#app/constants"; import { globalScene } from "#app/global-scene"; import { pokemonEvolutions } from "#balance/pokemon-evolutions"; import { speciesStarterCosts } from "#balance/starters"; +import { getEggTierForSpecies } from "#data/egg"; import { pokemonFormChanges } from "#data/pokemon-forms"; import type { PokemonSpecies } from "#data/pokemon-species"; import { getPokemonSpeciesForm } from "#data/pokemon-species"; @@ -11,6 +12,7 @@ import { BattleType } from "#enums/battle-type"; import { ChallengeType } from "#enums/challenge-type"; import { Challenges } from "#enums/challenges"; import { TypeColor, TypeShadow } from "#enums/color"; +import { EggTier } from "#enums/egg-type"; import { ClassicFixedBossWaves } from "#enums/fixed-boss-waves"; import { ModifierTier } from "#enums/modifier-tier"; import type { MoveId } from "#enums/move-id"; @@ -27,6 +29,7 @@ import type { DexAttrProps, GameData } from "#system/game-data"; import { BooleanHolder, type NumberHolder, randSeedItem } from "#utils/common"; import { deepCopy } from "#utils/data"; import { getPokemonSpecies } from "#utils/pokemon-utils"; +import { toCamelCase, toSnakeCase } from "#utils/strings"; import i18next from "i18next"; /** A constant for the default max cost of the starting party before a run */ @@ -67,14 +70,11 @@ export abstract class Challenge { } /** - * Gets the localisation key for the challenge - * @returns {@link string} The i18n key for this challenge + * Gets the localization key for the challenge + * @returns The i18n key for this challenge as camel case. */ geti18nKey(): string { - return Challenges[this.id] - .split("_") - .map((f, i) => (i ? `${f[0]}${f.slice(1).toLowerCase()}` : f.toLowerCase())) - .join(""); + return toCamelCase(Challenges[this.id]); } /** @@ -105,23 +105,22 @@ export abstract class Challenge { } /** - * Returns the textual representation of a challenge's current value. - * @param overrideValue {@link number} The value to check for. If undefined, gets the current value. - * @returns {@link string} The localised name for the current value. + * Return the textual representation of a challenge's current value. + * @param overrideValue - The value to check for; default {@linkcode this.value} + * @returns The localised text for the current value. */ - getValue(overrideValue?: number): string { - const value = overrideValue ?? this.value; - return i18next.t(`challenges:${this.geti18nKey()}.value.${value}`); + getValue(overrideValue: number = this.value): string { + return i18next.t(`challenges:${this.geti18nKey()}.value.${overrideValue}`); } /** - * Returns the description of a challenge's current value. - * @param overrideValue {@link number} The value to check for. If undefined, gets the current value. - * @returns {@link string} The localised description for the current value. + * Return the description of a challenge's current value. + * @param overrideValue - The value to check for; default {@linkcode this.value} + * @returns The localised description for the current value. */ - getDescription(overrideValue?: number): string { - const value = overrideValue ?? this.value; - return `${i18next.t([`challenges:${this.geti18nKey()}.desc.${value}`, `challenges:${this.geti18nKey()}.desc`])}`; + // TODO: Do we need an override value here? it's currently unused + getDescription(overrideValue: number = this.value): string { + return `${i18next.t([`challenges:${this.geti18nKey()}.desc.${overrideValue}`, `challenges:${this.geti18nKey()}.desc`])}`; } /** @@ -579,31 +578,19 @@ export class SingleGenerationChallenge extends Challenge { return this.value > 0 ? 1 : 0; } - /** - * Returns the textual representation of a challenge's current value. - * @param {value} overrideValue The value to check for. If undefined, gets the current value. - * @returns {string} The localised name for the current value. - */ - getValue(overrideValue?: number): string { - const value = overrideValue ?? this.value; - if (value === 0) { + getValue(overrideValue: number = this.value): string { + if (overrideValue === 0) { return i18next.t("settings:off"); } - return i18next.t(`starterSelectUiHandler:gen${value}`); + return i18next.t(`starterSelectUiHandler:gen${overrideValue}`); } - /** - * Returns the description of a challenge's current value. - * @param {value} overrideValue The value to check for. If undefined, gets the current value. - * @returns {string} The localised description for the current value. - */ - getDescription(overrideValue?: number): string { - const value = overrideValue ?? this.value; - if (value === 0) { + getDescription(overrideValue: number = this.value): string { + if (overrideValue === 0) { return i18next.t("challenges:singleGeneration.desc_default"); } return i18next.t("challenges:singleGeneration.desc", { - gen: i18next.t(`challenges:singleGeneration.gen_${value}`), + gen: i18next.t(`challenges:singleGeneration.gen_${overrideValue}`), }); } @@ -671,29 +658,13 @@ export class SingleTypeChallenge extends Challenge { return this.value > 0 ? 1 : 0; } - /** - * Returns the textual representation of a challenge's current value. - * @param {value} overrideValue The value to check for. If undefined, gets the current value. - * @returns {string} The localised name for the current value. - */ - getValue(overrideValue?: number): string { - if (overrideValue === undefined) { - overrideValue = this.value; - } - return PokemonType[this.value - 1].toLowerCase(); + getValue(overrideValue: number = this.value): string { + return toSnakeCase(PokemonType[overrideValue - 1]); } - /** - * Returns the description of a challenge's current value. - * @param {value} overrideValue The value to check for. If undefined, gets the current value. - * @returns {string} The localised description for the current value. - */ - getDescription(overrideValue?: number): string { - if (overrideValue === undefined) { - overrideValue = this.value; - } - const type = i18next.t(`pokemonInfo:Type.${PokemonType[this.value - 1]}`); - const typeColor = `[color=${TypeColor[PokemonType[this.value - 1]]}][shadow=${TypeShadow[PokemonType[this.value - 1]]}]${type}[/shadow][/color]`; + getDescription(overrideValue: number = this.value): string { + const type = i18next.t(`pokemonInfo:Type.${PokemonType[overrideValue - 1]}`); + const typeColor = `[color=${TypeColor[PokemonType[overrideValue - 1]]}][shadow=${TypeShadow[PokemonType[this.value - 1]]}]${type}[/shadow][/color]`; const defaultDesc = i18next.t("challenges:singleType.desc_default"); const typeDesc = i18next.t("challenges:singleType.desc", { type: typeColor, @@ -714,11 +685,14 @@ export class SingleTypeChallenge extends Challenge { */ export class FreshStartChallenge extends Challenge { constructor() { - super(Challenges.FRESH_START, 1); + super(Challenges.FRESH_START, 3); } applyStarterChoice(pokemon: PokemonSpecies, valid: BooleanHolder): boolean { - if (!defaultStarterSpecies.includes(pokemon.speciesId)) { + if ( + (this.value === 1 && !defaultStarterSpecies.includes(pokemon.speciesId)) || + (this.value === 2 && getEggTierForSpecies(pokemon) >= EggTier.EPIC) + ) { valid.value = false; return true; } @@ -726,15 +700,12 @@ export class FreshStartChallenge extends Challenge { } applyStarterCost(species: SpeciesId, cost: NumberHolder): boolean { - if (defaultStarterSpecies.includes(species)) { - cost.value = speciesStarterCosts[species]; - return true; - } - return false; + cost.value = speciesStarterCosts[species]; + return true; } applyStarterModify(pokemon: Pokemon): boolean { - pokemon.abilityIndex = 0; // Always base ability, not hidden ability + pokemon.abilityIndex = pokemon.abilityIndex % 2; // Always base ability, if you set it to hidden it wraps to first ability pokemon.passive = false; // Passive isn't unlocked pokemon.nature = Nature.HARDY; // Neutral nature pokemon.moveset = pokemon.species @@ -746,7 +717,22 @@ export class FreshStartChallenge extends Challenge { pokemon.luck = 0; // No luck pokemon.shiny = false; // Not shiny pokemon.variant = 0; // Not shiny - pokemon.formIndex = 0; // Froakie should be base form + if (pokemon.species.speciesId === SpeciesId.ZYGARDE && pokemon.formIndex >= 2) { + pokemon.formIndex -= 2; // Sets 10%-PC to 10%-AB and 50%-PC to 50%-AB + } else if ( + pokemon.formIndex > 0 && + [ + SpeciesId.PIKACHU, + SpeciesId.EEVEE, + SpeciesId.PICHU, + SpeciesId.ROTOM, + SpeciesId.MELOETTA, + SpeciesId.FROAKIE, + SpeciesId.ROCKRUFF, + ].includes(pokemon.species.speciesId) + ) { + pokemon.formIndex = 0; // These mons are set to form 0 because they're meant to be unlocks or mid-run form changes + } pokemon.ivs = [15, 15, 15, 15, 15, 15]; // Default IVs of 15 for all stats (Updated to 15 from 10 in 1.2.0) pokemon.teraType = pokemon.species.type1; // Always primary tera type return true; @@ -832,13 +818,7 @@ export class LowerStarterMaxCostChallenge extends Challenge { super(Challenges.LOWER_MAX_STARTER_COST, 9); } - /** - * @override - */ - getValue(overrideValue?: number): string { - if (overrideValue === undefined) { - overrideValue = this.value; - } + getValue(overrideValue: number = this.value): string { return (DEFAULT_PARTY_MAX_COST - overrideValue).toString(); } @@ -866,13 +846,7 @@ export class LowerStarterPointsChallenge extends Challenge { super(Challenges.LOWER_STARTER_POINTS, 9); } - /** - * @override - */ - getValue(overrideValue?: number): string { - if (overrideValue === undefined) { - overrideValue = this.value; - } + getValue(overrideValue: number = this.value): string { return (DEFAULT_PARTY_MAX_COST - overrideValue).toString(); } diff --git a/src/data/dialogue.ts b/src/data/dialogue.ts index 406e72ee82b..361d005e83b 100644 --- a/src/data/dialogue.ts +++ b/src/data/dialogue.ts @@ -1,6 +1,7 @@ import { BattleSpec } from "#enums/battle-spec"; import { TrainerType } from "#enums/trainer-type"; import { trainerConfigs } from "#trainers/trainer-config"; +import { capitalizeFirstLetter } from "#utils/strings"; export interface TrainerTypeMessages { encounter?: string | string[]; @@ -1755,8 +1756,7 @@ export function initTrainerTypeDialogue(): void { trainerConfigs[trainerType][`${messageType}Messages`] = messages[0][messageType]; } if (messages.length > 1) { - trainerConfigs[trainerType][`female${messageType.slice(0, 1).toUpperCase()}${messageType.slice(1)}Messages`] = - messages[1][messageType]; + trainerConfigs[trainerType][`female${capitalizeFirstLetter(messageType)}Messages`] = messages[1][messageType]; } } else { trainerConfigs[trainerType][`${messageType}Messages`] = messages[messageType]; diff --git a/src/data/moves/move-utils.ts b/src/data/moves/move-utils.ts index 39891f595aa..241144599e5 100644 --- a/src/data/moves/move-utils.ts +++ b/src/data/moves/move-utils.ts @@ -1,8 +1,8 @@ import { allMoves } from "#data/data-lists"; import type { BattlerIndex } from "#enums/battler-index"; import { BattlerTagType } from "#enums/battler-tag-type"; -import { MoveTarget } from "#enums/MoveTarget"; import type { MoveId } from "#enums/move-id"; +import { MoveTarget } from "#enums/move-target"; import { PokemonType } from "#enums/pokemon-type"; import type { Pokemon } from "#field/pokemon"; import { applyMoveAttrs } from "#moves/apply-attrs"; @@ -27,6 +27,28 @@ export function isFieldTargeted(move: Move): boolean { return false; } +/** + * Determine whether a move is a spread move. + * + * @param move - The {@linkcode Move} to check + * @returns Whether {@linkcode move} is spread-targeted. + * @remarks + * Examples include: + * - Moves targeting all adjacent Pokemon (like Surf) + * - Moves targeting all adjacent enemies (like Air Cutter) + */ + +export function isSpreadMove(move: Move): boolean { + switch (move.moveTarget) { + case MoveTarget.ALL_ENEMIES: + case MoveTarget.ALL_NEAR_ENEMIES: + case MoveTarget.ALL_OTHERS: + case MoveTarget.ALL_NEAR_OTHERS: + return true; + } + return false; +} + export function getMoveTargets(user: Pokemon, move: MoveId, replaceTarget?: MoveTarget): MoveTargetSet { const variableTarget = new NumberHolder(0); user.getOpponents(false).forEach(p => applyMoveAttrs("VariableTargetAttr", user, p, allMoves[move], variableTarget)); diff --git a/src/data/moves/move.ts b/src/data/moves/move.ts index d8863016002..965ab23a692 100644 --- a/src/data/moves/move.ts +++ b/src/data/moves/move.ts @@ -48,11 +48,11 @@ import { ChargeAnim } from "#enums/move-anims-common"; import { MoveId } from "#enums/move-id"; import { MoveResult } from "#enums/move-result"; import { isVirtual, MoveUseMode } from "#enums/move-use-mode"; -import { MoveCategory } from "#enums/MoveCategory"; -import { MoveEffectTrigger } from "#enums/MoveEffectTrigger"; -import { MoveFlags } from "#enums/MoveFlags"; -import { MoveTarget } from "#enums/MoveTarget"; -import { MultiHitType } from "#enums/MultiHitType"; +import { MoveCategory } from "#enums/move-category"; +import { MoveEffectTrigger } from "#enums/move-effect-trigger"; +import { MoveFlags } from "#enums/move-flags"; +import { MoveTarget } from "#enums/move-target"; +import { MultiHitType } from "#enums/multi-hit-type"; import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; import { @@ -87,8 +87,9 @@ import type { AttackMoveResult } from "#types/attack-move-result"; import type { Localizable } from "#types/locales"; import type { ChargingMove, MoveAttrMap, MoveAttrString, MoveClassMap, MoveKindString } from "#types/move-types"; import type { TurnMove } from "#types/turn-move"; -import { BooleanHolder, type Constructor, isNullOrUndefined, NumberHolder, randSeedFloat, randSeedInt, randSeedItem, toDmgValue, toReadableString } from "#utils/common"; +import { BooleanHolder, type Constructor, isNullOrUndefined, NumberHolder, randSeedFloat, randSeedInt, randSeedItem, toDmgValue } from "#utils/common"; import { getEnumValues } from "#utils/enums"; +import { toTitleCase } from "#utils/strings"; import i18next from "i18next"; /** @@ -808,16 +809,14 @@ export abstract class Move implements Localizable { } const power = new NumberHolder(this.power); + + applyMoveAttrs("VariablePowerAttr", source, target, this, power); + const typeChangeMovePowerMultiplier = new NumberHolder(1); const typeChangeHolder = new NumberHolder(this.type); applyAbAttrs("MoveTypeChangeAbAttr", {pokemon: source, opponent: target, move: this, simulated: true, moveType: typeChangeHolder, power: typeChangeMovePowerMultiplier}); - const sourceTeraType = source.getTeraType(); - if (source.isTerastallized && sourceTeraType === this.type && power.value < 60 && this.priority <= 0 && !this.hasAttr("MultiHitAttr") && !globalScene.findModifier(m => m instanceof PokemonMultiHitModifier && m.pokemonId === source.id)) { - power.value = 60; - } - const abAttrParams: PreAttackModifyPowerAbAttrParams = { pokemon: source, opponent: target, @@ -832,6 +831,13 @@ export abstract class Move implements Localizable { applyAbAttrs("AllyMoveCategoryPowerBoostAbAttr", {...abAttrParams, pokemon: ally}); } + // Non-priority, single-hit moves of the user's Tera Type are always a bare minimum of 60 power + + const sourceTeraType = source.getTeraType(); + if (source.isTerastallized && sourceTeraType === this.type && power.value < 60 && this.priority <= 0 && !this.hasAttr("MultiHitAttr") && !globalScene.findModifier(m => m instanceof PokemonMultiHitModifier && m.pokemonId === source.id)) { + power.value = 60; + } + const fieldAuras = new Set( globalScene.getField(true) .map((p) => p.getAbilityAttrs("FieldMoveTypePowerBoostAbAttr").filter(attr => { @@ -855,7 +861,6 @@ export abstract class Move implements Localizable { power.value *= typeBoost.boostValue; } - applyMoveAttrs("VariablePowerAttr", source, target, this, power); if (!this.hasAttr("TypelessAttr")) { globalScene.arena.applyTags(WeakenMoveTypeTag, simulated, typeChangeHolder.value, power); @@ -8133,7 +8138,7 @@ export class ResistLastMoveTypeAttr extends MoveEffectAttr { } const type = validTypes[user.randBattleSeedInt(validTypes.length)]; user.summonData.types = [ type ]; - globalScene.phaseManager.queueMessage(i18next.t("battle:transformedIntoType", { pokemonName: getPokemonNameWithAffix(user), type: toReadableString(PokemonType[type]) })); + globalScene.phaseManager.queueMessage(i18next.t("battle:transformedIntoType", { pokemonName: getPokemonNameWithAffix(user), type: toTitleCase(PokemonType[type]) })); user.updateInfo(); return true; diff --git a/src/data/mystery-encounters/encounters/clowning-around-encounter.ts b/src/data/mystery-encounters/encounters/clowning-around-encounter.ts index 1c3335b859f..1c85cb7595c 100644 --- a/src/data/mystery-encounters/encounters/clowning-around-encounter.ts +++ b/src/data/mystery-encounters/encounters/clowning-around-encounter.ts @@ -8,9 +8,9 @@ import { BattlerIndex } from "#enums/battler-index"; import { BerryType } from "#enums/berry-type"; import { Challenges } from "#enums/challenges"; import { EncounterAnim } from "#enums/encounter-anims"; -import { MoveCategory } from "#enums/MoveCategory"; import { ModifierPoolType } from "#enums/modifier-pool-type"; import { ModifierTier } from "#enums/modifier-tier"; +import { MoveCategory } from "#enums/move-category"; import { MoveId } from "#enums/move-id"; import { MoveUseMode } from "#enums/move-use-mode"; import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode"; diff --git a/src/data/mystery-encounters/encounters/field-trip-encounter.ts b/src/data/mystery-encounters/encounters/field-trip-encounter.ts index 84374c87e58..9c655e70b8c 100644 --- a/src/data/mystery-encounters/encounters/field-trip-encounter.ts +++ b/src/data/mystery-encounters/encounters/field-trip-encounter.ts @@ -1,7 +1,7 @@ import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants"; import { globalScene } from "#app/global-scene"; import { modifierTypes } from "#data/data-lists"; -import { MoveCategory } from "#enums/MoveCategory"; +import { MoveCategory } from "#enums/move-category"; import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode"; import { MysteryEncounterTier } from "#enums/mystery-encounter-tier"; import { MysteryEncounterType } from "#enums/mystery-encounter-type"; diff --git a/src/data/mystery-encounters/mystery-encounter-dialogue.ts b/src/data/mystery-encounters/mystery-encounter-dialogue.ts index 42383940755..385ccb5c246 100644 --- a/src/data/mystery-encounters/mystery-encounter-dialogue.ts +++ b/src/data/mystery-encounters/mystery-encounter-dialogue.ts @@ -1,4 +1,4 @@ -import type { TextStyle } from "#ui/text"; +import type { TextStyle } from "#enums/text-style"; export class TextDisplay { speaker?: string; diff --git a/src/data/mystery-encounters/mystery-encounter.ts b/src/data/mystery-encounters/mystery-encounter.ts index a2ca2b20ce7..47dfe58cace 100644 --- a/src/data/mystery-encounters/mystery-encounter.ts +++ b/src/data/mystery-encounters/mystery-encounter.ts @@ -25,7 +25,8 @@ import { StatusEffectRequirement, WaveRangeRequirement, } from "#mystery-encounters/mystery-encounter-requirements"; -import { capitalizeFirstLetter, coerceArray, isNullOrUndefined, randSeedInt } from "#utils/common"; +import { coerceArray, isNullOrUndefined, randSeedInt } from "#utils/common"; +import { capitalizeFirstLetter } from "#utils/strings"; export interface EncounterStartOfBattleEffect { sourcePokemon?: Pokemon; diff --git a/src/data/mystery-encounters/utils/encounter-dialogue-utils.ts b/src/data/mystery-encounters/utils/encounter-dialogue-utils.ts index 4f4af94a88d..1ae0659b29e 100644 --- a/src/data/mystery-encounters/utils/encounter-dialogue-utils.ts +++ b/src/data/mystery-encounters/utils/encounter-dialogue-utils.ts @@ -1,6 +1,6 @@ import { globalScene } from "#app/global-scene"; +import type { TextStyle } from "#enums/text-style"; import { UiTheme } from "#enums/ui-theme"; -import type { TextStyle } from "#ui/text"; import { getTextWithColors } from "#ui/text"; import { isNullOrUndefined } from "#utils/common"; import i18next from "i18next"; diff --git a/src/data/nature.ts b/src/data/nature.ts index 4f4e627daf3..b085faebb80 100644 --- a/src/data/nature.ts +++ b/src/data/nature.ts @@ -1,8 +1,9 @@ import { Nature } from "#enums/nature"; import { EFFECTIVE_STATS, getShortenedStatKey, Stat } from "#enums/stat"; +import { TextStyle } from "#enums/text-style"; import { UiTheme } from "#enums/ui-theme"; -import { getBBCodeFrag, TextStyle } from "#ui/text"; -import { toReadableString } from "#utils/common"; +import { getBBCodeFrag } from "#ui/text"; +import { toTitleCase } from "#utils/strings"; import i18next from "i18next"; export function getNatureName( @@ -12,7 +13,7 @@ export function getNatureName( ignoreBBCode = false, uiTheme: UiTheme = UiTheme.DEFAULT, ): string { - let ret = toReadableString(Nature[nature]); + let ret = toTitleCase(Nature[nature]); //Translating nature if (i18next.exists(`nature:${ret}`)) { ret = i18next.t(`nature:${ret}` as any); diff --git a/src/data/pokemon-forms.ts b/src/data/pokemon-forms.ts index 6d1db296e55..5a50713c5a9 100644 --- a/src/data/pokemon-forms.ts +++ b/src/data/pokemon-forms.ts @@ -18,7 +18,7 @@ import { } from "#data/form-change-triggers"; import { AbilityId } from "#enums/ability-id"; import { FormChangeItem } from "#enums/form-change-item"; -import { MoveCategory } from "#enums/MoveCategory"; +import { MoveCategory } from "#enums/move-category"; import { MoveId } from "#enums/move-id"; import { SpeciesFormKey } from "#enums/species-form-key"; import { SpeciesId } from "#enums/species-id"; diff --git a/src/data/pokemon-species.ts b/src/data/pokemon-species.ts index 140b03e6d4c..dfaa6425ef1 100644 --- a/src/data/pokemon-species.ts +++ b/src/data/pokemon-species.ts @@ -29,15 +29,9 @@ import type { Variant, VariantSet } from "#sprites/variant"; import { populateVariantColorCache, variantColorCache, variantData } from "#sprites/variant"; import type { StarterMoveset } from "#system/game-data"; import type { Localizable } from "#types/locales"; -import { - capitalizeString, - isNullOrUndefined, - randSeedFloat, - randSeedGauss, - randSeedInt, - randSeedItem, -} from "#utils/common"; +import { isNullOrUndefined, randSeedFloat, randSeedGauss, randSeedInt, randSeedItem } from "#utils/common"; import { getPokemonSpecies } from "#utils/pokemon-utils"; +import { toCamelCase, toPascalCase } from "#utils/strings"; import { argbFromRgba, QuantizerCelebi, rgbaFromArgb } from "@material/material-color-utilities"; import i18next from "i18next"; @@ -91,6 +85,7 @@ export function getPokemonSpeciesForm(species: SpeciesId, formIndex: number): Po return retSpecies; } +// TODO: Clean this up and seriously review alternate means of fusion naming export function getFusedSpeciesName(speciesAName: string, speciesBName: string): string { const fragAPattern = /([a-z]{2}.*?[aeiou(?:y$)\-']+)(.*?)$/i; const fragBPattern = /([a-z]{2}.*?[aeiou(?:y$)\-'])(.*?)$/i; @@ -904,14 +899,14 @@ export class PokemonSpecies extends PokemonSpeciesForm implements Localizable { * @returns the pokemon-form locale key for the single form name ("Alolan Form", "Eternal Flower" etc) */ getFormNameToDisplay(formIndex = 0, append = false): string { - const formKey = this.forms?.[formIndex!]?.formKey; - const formText = capitalizeString(formKey, "-", false, false) || ""; - const speciesName = capitalizeString(SpeciesId[this.speciesId], "_", true, false); + const formKey = this.forms[formIndex]?.formKey ?? ""; + const formText = toPascalCase(formKey); + const speciesName = toCamelCase(SpeciesId[this.speciesId]); let ret = ""; const region = this.getRegion(); if (this.speciesId === SpeciesId.ARCEUS) { - ret = i18next.t(`pokemonInfo:Type.${formText?.toUpperCase()}`); + ret = i18next.t(`pokemonInfo:Type.${formText.toUpperCase()}`); } else if ( [ SpeciesFormKey.MEGA, @@ -937,7 +932,7 @@ export class PokemonSpecies extends PokemonSpeciesForm implements Localizable { if (i18next.exists(i18key)) { ret = i18next.t(i18key); } else { - const rootSpeciesName = capitalizeString(SpeciesId[this.getRootSpeciesId()], "_", true, false); + const rootSpeciesName = toCamelCase(SpeciesId[this.getRootSpeciesId()]); const i18RootKey = `pokemonForm:${rootSpeciesName}${formText}`; ret = i18next.exists(i18RootKey) ? i18next.t(i18RootKey) : formText; } @@ -2851,11 +2846,11 @@ export function initSpecies() { new PokemonSpecies(SpeciesId.GRAPPLOCT, 8, false, false, false, "Jujitsu Pokémon", PokemonType.FIGHTING, null, 1.6, 39, AbilityId.LIMBER, AbilityId.NONE, AbilityId.TECHNICIAN, 480, 80, 118, 90, 70, 80, 42, 45, 50, 168, GrowthRate.MEDIUM_SLOW, 50, false), new PokemonSpecies(SpeciesId.SINISTEA, 8, false, false, false, "Black Tea Pokémon", PokemonType.GHOST, null, 0.1, 0.2, AbilityId.WEAK_ARMOR, AbilityId.NONE, AbilityId.CURSED_BODY, 308, 40, 45, 45, 74, 54, 50, 120, 50, 62, GrowthRate.MEDIUM_FAST, null, false, false, new PokemonForm("Phony Form", "phony", PokemonType.GHOST, null, 0.1, 0.2, AbilityId.WEAK_ARMOR, AbilityId.NONE, AbilityId.CURSED_BODY, 308, 40, 45, 45, 74, 54, 50, 120, 50, 62, false, "", true), - new PokemonForm("Antique Form", "antique", PokemonType.GHOST, null, 0.1, 0.2, AbilityId.WEAK_ARMOR, AbilityId.NONE, AbilityId.CURSED_BODY, 308, 40, 45, 45, 74, 54, 50, 120, 50, 62, false, "", true, true), + new PokemonForm("Antique Form", "antique", PokemonType.GHOST, null, 0.1, 0.2, AbilityId.WEAK_ARMOR, AbilityId.NONE, AbilityId.CURSED_BODY, 308, 40, 45, 45, 74, 54, 50, 120, 50, 62, false, "", true), ), new PokemonSpecies(SpeciesId.POLTEAGEIST, 8, false, false, false, "Black Tea Pokémon", PokemonType.GHOST, null, 0.2, 0.4, AbilityId.WEAK_ARMOR, AbilityId.NONE, AbilityId.CURSED_BODY, 508, 60, 65, 65, 134, 114, 70, 60, 50, 178, GrowthRate.MEDIUM_FAST, null, false, false, new PokemonForm("Phony Form", "phony", PokemonType.GHOST, null, 0.2, 0.4, AbilityId.WEAK_ARMOR, AbilityId.NONE, AbilityId.CURSED_BODY, 508, 60, 65, 65, 134, 114, 70, 60, 50, 178, false, "", true), - new PokemonForm("Antique Form", "antique", PokemonType.GHOST, null, 0.2, 0.4, AbilityId.WEAK_ARMOR, AbilityId.NONE, AbilityId.CURSED_BODY, 508, 60, 65, 65, 134, 114, 70, 60, 50, 178, false, "", true, true), + new PokemonForm("Antique Form", "antique", PokemonType.GHOST, null, 0.2, 0.4, AbilityId.WEAK_ARMOR, AbilityId.NONE, AbilityId.CURSED_BODY, 508, 60, 65, 65, 134, 114, 70, 60, 50, 178, false, "", true), ), new PokemonSpecies(SpeciesId.HATENNA, 8, false, false, false, "Calm Pokémon", PokemonType.PSYCHIC, null, 0.4, 3.4, AbilityId.HEALER, AbilityId.ANTICIPATION, AbilityId.MAGIC_BOUNCE, 265, 42, 30, 45, 56, 53, 39, 235, 50, 53, GrowthRate.SLOW, 0, false), new PokemonSpecies(SpeciesId.HATTREM, 8, false, false, false, "Serene Pokémon", PokemonType.PSYCHIC, null, 0.6, 4.8, AbilityId.HEALER, AbilityId.ANTICIPATION, AbilityId.MAGIC_BOUNCE, 370, 57, 40, 65, 86, 73, 49, 120, 50, 130, GrowthRate.SLOW, 0, false), @@ -3109,11 +3104,11 @@ export function initSpecies() { new PokemonSpecies(SpeciesId.DIPPLIN, 9, false, false, false, "Candy Apple Pokémon", PokemonType.GRASS, PokemonType.DRAGON, 0.4, 4.4, AbilityId.SUPERSWEET_SYRUP, AbilityId.GLUTTONY, AbilityId.STICKY_HOLD, 485, 80, 80, 110, 95, 80, 40, 45, 50, 170, GrowthRate.ERRATIC, 50, false), new PokemonSpecies(SpeciesId.POLTCHAGEIST, 9, false, false, false, "Matcha Pokémon", PokemonType.GRASS, PokemonType.GHOST, 0.1, 1.1, AbilityId.HOSPITALITY, AbilityId.NONE, AbilityId.HEATPROOF, 308, 40, 45, 45, 74, 54, 50, 120, 50, 62, GrowthRate.SLOW, null, false, false, new PokemonForm("Counterfeit Form", "counterfeit", PokemonType.GRASS, PokemonType.GHOST, 0.1, 1.1, AbilityId.HOSPITALITY, AbilityId.NONE, AbilityId.HEATPROOF, 308, 40, 45, 45, 74, 54, 50, 120, 50, 62, false, null, true), - new PokemonForm("Artisan Form", "artisan", PokemonType.GRASS, PokemonType.GHOST, 0.1, 1.1, AbilityId.HOSPITALITY, AbilityId.NONE, AbilityId.HEATPROOF, 308, 40, 45, 45, 74, 54, 50, 120, 50, 62, false, null, false, true), + new PokemonForm("Artisan Form", "artisan", PokemonType.GRASS, PokemonType.GHOST, 0.1, 1.1, AbilityId.HOSPITALITY, AbilityId.NONE, AbilityId.HEATPROOF, 308, 40, 45, 45, 74, 54, 50, 120, 50, 62, false, "counterfeit", true), ), new PokemonSpecies(SpeciesId.SINISTCHA, 9, false, false, false, "Matcha Pokémon", PokemonType.GRASS, PokemonType.GHOST, 0.2, 2.2, AbilityId.HOSPITALITY, AbilityId.NONE, AbilityId.HEATPROOF, 508, 71, 60, 106, 121, 80, 70, 60, 50, 178, GrowthRate.SLOW, null, false, false, - new PokemonForm("Unremarkable Form", "unremarkable", PokemonType.GRASS, PokemonType.GHOST, 0.2, 2.2, AbilityId.HOSPITALITY, AbilityId.NONE, AbilityId.HEATPROOF, 508, 71, 60, 106, 121, 80, 70, 60, 50, 178), - new PokemonForm("Masterpiece Form", "masterpiece", PokemonType.GRASS, PokemonType.GHOST, 0.2, 2.2, AbilityId.HOSPITALITY, AbilityId.NONE, AbilityId.HEATPROOF, 508, 71, 60, 106, 121, 80, 70, 60, 50, 178, false, null, false, true), + new PokemonForm("Unremarkable Form", "unremarkable", PokemonType.GRASS, PokemonType.GHOST, 0.2, 2.2, AbilityId.HOSPITALITY, AbilityId.NONE, AbilityId.HEATPROOF, 508, 71, 60, 106, 121, 80, 70, 60, 50, 178, false, null, true), + new PokemonForm("Masterpiece Form", "masterpiece", PokemonType.GRASS, PokemonType.GHOST, 0.2, 2.2, AbilityId.HOSPITALITY, AbilityId.NONE, AbilityId.HEATPROOF, 508, 71, 60, 106, 121, 80, 70, 60, 50, 178, false, "unremarkable", true), ), new PokemonSpecies(SpeciesId.OKIDOGI, 9, true, false, false, "Retainer Pokémon", PokemonType.POISON, PokemonType.FIGHTING, 1.8, 92.2, AbilityId.TOXIC_CHAIN, AbilityId.NONE, AbilityId.GUARD_DOG, 555, 88, 128, 115, 58, 86, 80, 3, 0, 276, GrowthRate.SLOW, 100, false), new PokemonSpecies(SpeciesId.MUNKIDORI, 9, true, false, false, "Retainer Pokémon", PokemonType.POISON, PokemonType.PSYCHIC, 1, 12.2, AbilityId.TOXIC_CHAIN, AbilityId.NONE, AbilityId.FRISK, 555, 88, 75, 66, 130, 90, 106, 3, 0, 276, GrowthRate.SLOW, 100, false), diff --git a/src/data/pokemon/pokemon-data.ts b/src/data/pokemon/pokemon-data.ts index 6ae86bed5e7..a2a0138a17a 100644 --- a/src/data/pokemon/pokemon-data.ts +++ b/src/data/pokemon/pokemon-data.ts @@ -1,18 +1,29 @@ import { type BattlerTag, loadBattlerTag } from "#data/battler-tags"; +import { allSpecies } from "#data/data-lists"; import type { Gender } from "#data/gender"; import { PokemonMove } from "#data/moves/pokemon-move"; -import type { PokemonSpeciesForm } from "#data/pokemon-species"; +import { getPokemonSpeciesForm, type PokemonSpeciesForm } from "#data/pokemon-species"; import type { TypeDamageMultiplier } from "#data/type"; import type { AbilityId } from "#enums/ability-id"; import type { BerryType } from "#enums/berry-type"; import type { MoveId } from "#enums/move-id"; import type { Nature } from "#enums/nature"; import type { PokemonType } from "#enums/pokemon-type"; +import type { SpeciesId } from "#enums/species-id"; import type { AttackMoveResult } from "#types/attack-move-result"; import type { IllusionData } from "#types/illusion-data"; import type { TurnMove } from "#types/turn-move"; +import type { CoerceNullPropertiesToUndefined } from "#types/type-helpers"; import { isNullOrUndefined } from "#utils/common"; +/** + * The type that {@linkcode PokemonSpeciesForm} is converted to when an object containing it serializes it. + */ +type SerializedSpeciesForm = { + id: SpeciesId; + formIdx: number; +}; + /** * Permanent data that can customize a Pokemon in non-standard ways from its Species. * Includes abilities, nature, changed types, etc. @@ -41,9 +52,59 @@ export class CustomPokemonData { } } +/** + * Deserialize a pokemon species form from an object containing `id` and `formIdx` properties. + * @param value - The value to deserialize + * @returns The `PokemonSpeciesForm` or `null` if the fields could not be properly discerned + */ +function deserializePokemonSpeciesForm(value: SerializedSpeciesForm | PokemonSpeciesForm): PokemonSpeciesForm | null { + // @ts-expect-error: We may be deserializing a PokemonSpeciesForm, but we catch later on + let { id, formIdx } = value; + + if (isNullOrUndefined(id) || isNullOrUndefined(formIdx)) { + // @ts-expect-error: Typescript doesn't know that in block, `value` must be a PokemonSpeciesForm + id = value.speciesId; + // @ts-expect-error: Same as above (plus we are accessing a protected property) + formIdx = value._formIndex; + } + // If for some reason either of these fields are null/undefined, we cannot reconstruct the species form + if (isNullOrUndefined(id) || isNullOrUndefined(formIdx)) { + return null; + } + return getPokemonSpeciesForm(id, formIdx); +} + +interface SerializedIllusionData extends Omit { + /** The id of the illusioned fusion species, or `undefined` if not a fusion */ + fusionSpecies?: SpeciesId; +} + +interface SerializedPokemonSummonData { + statStages: number[]; + moveQueue: TurnMove[]; + tags: BattlerTag[]; + abilitySuppressed: boolean; + speciesForm?: SerializedSpeciesForm; + fusionSpeciesForm?: SerializedSpeciesForm; + ability?: AbilityId; + passiveAbility?: AbilityId; + gender?: Gender; + fusionGender?: Gender; + stats: number[]; + moveset?: PokemonMove[]; + types: PokemonType[]; + addedType?: PokemonType; + illusion?: SerializedIllusionData; + illusionBroken: boolean; + berriesEatenLast: BerryType[]; + moveHistory: TurnMove[]; +} + /** * Persistent in-battle data for a {@linkcode Pokemon}. * Resets on switch or new battle. + * + * @sealed */ export class PokemonSummonData { /** [Atk, Def, SpAtk, SpDef, Spd, Acc, Eva] */ @@ -86,7 +147,7 @@ export class PokemonSummonData { */ public moveHistory: TurnMove[] = []; - constructor(source?: PokemonSummonData | Partial) { + constructor(source?: PokemonSummonData | SerializedPokemonSummonData) { if (isNullOrUndefined(source)) { return; } @@ -97,6 +158,30 @@ export class PokemonSummonData { continue; } + if (key === "speciesForm" || key === "fusionSpeciesForm") { + this[key] = deserializePokemonSpeciesForm(value); + } + + if (key === "illusion" && typeof value === "object") { + // Make a copy so as not to mutate provided value + const illusionData = { + ...value, + }; + if (!isNullOrUndefined(illusionData.fusionSpecies)) { + switch (typeof illusionData.fusionSpecies) { + case "object": + illusionData.fusionSpecies = allSpecies[illusionData.fusionSpecies.speciesId]; + break; + case "number": + illusionData.fusionSpecies = allSpecies[illusionData.fusionSpecies]; + break; + default: + illusionData.fusionSpecies = undefined; + } + } + this[key] = illusionData as IllusionData; + } + if (key === "moveset") { this.moveset = value?.map((m: any) => PokemonMove.loadMove(m)); continue; @@ -110,6 +195,49 @@ export class PokemonSummonData { this[key] = value; } } + + /** + * Serialize this PokemonSummonData to JSON, converting {@linkcode PokemonSpeciesForm} and {@linkcode IllusionData.fusionSpecies} + * into simpler types instead of serializing all of their fields. + * + * @remarks + * - `IllusionData.fusionSpecies` is serialized as just the species ID + * - `PokemonSpeciesForm` and `PokemonSpeciesForm.fusionSpeciesForm` are converted into {@linkcode SerializedSpeciesForm} objects + */ + public toJSON(): SerializedPokemonSummonData { + // Pokemon species forms are never saved, only the species ID. + const illusion = this.illusion; + const speciesForm = this.speciesForm; + const fusionSpeciesForm = this.fusionSpeciesForm; + const illusionSpeciesForm = illusion?.fusionSpecies; + const t = { + // the "as omit" is required to avoid TS resolving the overwritten properties to "never" + // We coerce null to undefined in the type, as the for loop below replaces `null` with `undefined` + ...(this as Omit< + CoerceNullPropertiesToUndefined, + "speciesForm" | "fusionSpeciesForm" | "illusion" + >), + speciesForm: isNullOrUndefined(speciesForm) + ? undefined + : { id: speciesForm.speciesId, formIdx: speciesForm.formIndex }, + fusionSpeciesForm: isNullOrUndefined(fusionSpeciesForm) + ? undefined + : { id: fusionSpeciesForm.speciesId, formIdx: fusionSpeciesForm.formIndex }, + illusion: isNullOrUndefined(illusion) + ? undefined + : { + ...(this.illusion as Omit), + fusionSpecies: illusionSpeciesForm?.speciesId, + }, + }; + // Replace `null` with `undefined`, as `undefined` never gets serialized + for (const [key, value] of Object.entries(t)) { + if (value === null) { + t[key] = undefined; + } + } + return t; + } } // TODO: Merge this inside `summmonData` but exclude from save if/when a save data serializer is added diff --git a/src/data/terrain.ts b/src/data/terrain.ts index f5382b1c3ec..7906450d0ea 100644 --- a/src/data/terrain.ts +++ b/src/data/terrain.ts @@ -3,6 +3,7 @@ import type { BattlerIndex } from "#enums/battler-index"; import { PokemonType } from "#enums/pokemon-type"; import type { Pokemon } from "#field/pokemon"; import type { Move } from "#moves/move"; +import { isFieldTargeted, isSpreadMove } from "#moves/move-utils"; import i18next from "i18next"; export enum TerrainType { @@ -60,13 +61,19 @@ export class Terrain { isMoveTerrainCancelled(user: Pokemon, targets: BattlerIndex[], move: Move): boolean { switch (this.terrainType) { case TerrainType.PSYCHIC: - if (!move.hasAttr("ProtectAttr")) { - // Cancels move if the move has positive priority and targets a Pokemon grounded on the Psychic Terrain - return ( - move.getPriority(user) > 0 && - user.getOpponents(true).some(o => targets.includes(o.getBattlerIndex()) && o.isGrounded()) - ); - } + // Cf https://bulbapedia.bulbagarden.net/wiki/Psychic_Terrain_(move)#Generation_VII + // Psychic terrain will only cancel a move if it: + return ( + // ... is neither spread nor field-targeted, + !isFieldTargeted(move) && + !isSpreadMove(move) && + // .. has positive final priority, + move.getPriority(user) > 0 && + // ...and is targeting at least 1 grounded opponent + user + .getOpponents(true) + .some(o => targets.includes(o.getBattlerIndex()) && o.isGrounded()) + ); } return false; diff --git a/src/data/trainer-names.ts b/src/data/trainer-names.ts index 6b882d1ddc1..8eafd9f6404 100644 --- a/src/data/trainer-names.ts +++ b/src/data/trainer-names.ts @@ -1,12 +1,12 @@ import { TrainerType } from "#enums/trainer-type"; -import { toReadableString } from "#utils/common"; +import { toPascalSnakeCase } from "#utils/strings"; class TrainerNameConfig { public urls: string[]; public femaleUrls: string[] | null; constructor(type: TrainerType, ...urls: string[]) { - this.urls = urls.length ? urls : [toReadableString(TrainerType[type]).replace(/ /g, "_")]; + this.urls = urls.length ? urls : [toPascalSnakeCase(TrainerType[type])]; } hasGenderVariant(...femaleUrls: string[]): TrainerNameConfig { diff --git a/src/data/trainers/trainer-config.ts b/src/data/trainers/trainer-config.ts index 4e88399bec3..6b3fcf70f80 100644 --- a/src/data/trainers/trainer-config.ts +++ b/src/data/trainers/trainer-config.ts @@ -41,15 +41,9 @@ import type { TrainerConfigs, TrainerTierPools, } from "#types/trainer-funcs"; -import { - coerceArray, - isNullOrUndefined, - randSeedInt, - randSeedIntRange, - randSeedItem, - toReadableString, -} from "#utils/common"; +import { coerceArray, isNullOrUndefined, randSeedInt, randSeedIntRange, randSeedItem } from "#utils/common"; import { getPokemonSpecies } from "#utils/pokemon-utils"; +import { toSnakeCase, toTitleCase } from "#utils/strings"; import i18next from "i18next"; /** Minimum BST for Pokemon generated onto the Elite Four's teams */ @@ -140,7 +134,7 @@ export class TrainerConfig { constructor(trainerType: TrainerType, allowLegendaries?: boolean) { this.trainerType = trainerType; this.trainerAI = new TrainerAI(); - this.name = toReadableString(TrainerType[this.getDerivedType()]); + this.name = toTitleCase(TrainerType[this.getDerivedType()]); this.battleBgm = "battle_trainer"; this.mixedBattleBgm = "battle_trainer"; this.victoryBgm = "victory_trainer"; @@ -734,7 +728,7 @@ export class TrainerConfig { } // Localize the trainer's name by converting it to lowercase and replacing spaces with underscores. - const nameForCall = this.name.toLowerCase().replace(/\s/g, "_"); + const nameForCall = toSnakeCase(this.name); this.name = i18next.t(`trainerNames:${nameForCall}`); // Set the title to "elite_four". (this is the key in the i18n file) diff --git a/src/enums/MoveCategory.ts b/src/enums/move-category.ts similarity index 100% rename from src/enums/MoveCategory.ts rename to src/enums/move-category.ts diff --git a/src/enums/MoveEffectTrigger.ts b/src/enums/move-effect-trigger.ts similarity index 100% rename from src/enums/MoveEffectTrigger.ts rename to src/enums/move-effect-trigger.ts diff --git a/src/enums/MoveFlags.ts b/src/enums/move-flags.ts similarity index 100% rename from src/enums/MoveFlags.ts rename to src/enums/move-flags.ts diff --git a/src/enums/MoveTarget.ts b/src/enums/move-target.ts similarity index 100% rename from src/enums/MoveTarget.ts rename to src/enums/move-target.ts diff --git a/src/enums/MultiHitType.ts b/src/enums/multi-hit-type.ts similarity index 100% rename from src/enums/MultiHitType.ts rename to src/enums/multi-hit-type.ts diff --git a/src/enums/text-style.ts b/src/enums/text-style.ts new file mode 100644 index 00000000000..964a985cdd6 --- /dev/null +++ b/src/enums/text-style.ts @@ -0,0 +1,59 @@ +export const TextStyle = Object.freeze({ + MESSAGE: 1, + WINDOW: 2, + WINDOW_ALT: 3, + WINDOW_BATTLE_COMMAND: 4, + BATTLE_INFO: 5, + PARTY: 6, + PARTY_RED: 7, + PARTY_CANCEL_BUTTON: 8, + INSTRUCTIONS_TEXT: 9, + MOVE_LABEL: 10, + SUMMARY: 11, + SUMMARY_DEX_NUM: 12, + SUMMARY_DEX_NUM_GOLD: 13, + SUMMARY_ALT: 14, + SUMMARY_HEADER: 15, + SUMMARY_RED: 16, + SUMMARY_BLUE: 17, + SUMMARY_PINK: 18, + SUMMARY_GOLD: 19, + SUMMARY_GRAY: 20, + SUMMARY_GREEN: 21, + SUMMARY_STATS: 22, + SUMMARY_STATS_BLUE: 23, + SUMMARY_STATS_PINK: 24, + SUMMARY_STATS_GOLD: 25, + LUCK_VALUE: 26, + STATS_HEXAGON: 27, + GROWTH_RATE_TYPE: 28, + MONEY: 29, // Money default styling (pale yellow) + MONEY_WINDOW: 30, // Money displayed in Windows (needs different colors based on theme) + HEADER_LABEL: 31, + STATS_LABEL: 32, + STATS_VALUE: 33, + SETTINGS_VALUE: 34, + SETTINGS_LABEL: 35, + SETTINGS_LABEL_NAVBAR: 36, + SETTINGS_SELECTED: 37, + SETTINGS_LOCKED: 38, + EGG_LIST: 39, + EGG_SUMMARY_NAME: 40, + EGG_SUMMARY_DEX: 41, + STARTER_VALUE_LIMIT: 42, + TOOLTIP_TITLE: 43, + TOOLTIP_CONTENT: 44, + FILTER_BAR_MAIN: 45, + MOVE_INFO_CONTENT: 46, + MOVE_PP_FULL: 47, + MOVE_PP_HALF_FULL: 48, + MOVE_PP_NEAR_EMPTY: 49, + MOVE_PP_EMPTY: 50, + SMALLER_WINDOW_ALT: 51, + BGM_BAR: 52, + PERFECT_IV: 53, + ME_OPTION_DEFAULT: 54, // Default style for choices in ME + ME_OPTION_SPECIAL: 55, // Style for choices with special requirements in ME + SHADOW_TEXT: 56 // to obscure unavailable options +}) +export type TextStyle = typeof TextStyle[keyof typeof TextStyle]; \ No newline at end of file diff --git a/src/field/damage-number-handler.ts b/src/field/damage-number-handler.ts index acb279a17a0..1bbacc19566 100644 --- a/src/field/damage-number-handler.ts +++ b/src/field/damage-number-handler.ts @@ -1,9 +1,10 @@ import { globalScene } from "#app/global-scene"; import type { BattlerIndex } from "#enums/battler-index"; import { HitResult } from "#enums/hit-result"; +import { TextStyle } from "#enums/text-style"; import type { Pokemon } from "#field/pokemon"; import type { DamageResult } from "#types/damage-result"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import { fixedInt, formatStat } from "#utils/common"; type TextAndShadowArr = [string | null, string | null]; diff --git a/src/field/pokemon-sprite-sparkle-handler.ts b/src/field/pokemon-sprite-sparkle-handler.ts index 725229ce723..bd44dc03330 100644 --- a/src/field/pokemon-sprite-sparkle-handler.ts +++ b/src/field/pokemon-sprite-sparkle-handler.ts @@ -5,10 +5,11 @@ import { coerceArray, fixedInt, randInt } from "#utils/common"; export class PokemonSpriteSparkleHandler { private sprites: Set; + private counterTween?: Phaser.Tweens.Tween; + setup(): void { this.sprites = new Set(); - - globalScene.tweens.addCounter({ + this.counterTween = globalScene.tweens.addCounter({ duration: fixedInt(200), from: 0, to: 1, @@ -78,4 +79,12 @@ export class PokemonSpriteSparkleHandler { this.sprites.delete(s); } } + + destroy(): void { + this.removeAll(); + if (this.counterTween) { + this.counterTween.destroy(); + this.counterTween = undefined; + } + } } diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 01f137b28fd..7aecc0c8e75 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -82,11 +82,11 @@ import { DexAttr } from "#enums/dex-attr"; import { FieldPosition } from "#enums/field-position"; import { HitResult } from "#enums/hit-result"; import { LearnMoveSituation } from "#enums/learn-move-situation"; -import { MoveCategory } from "#enums/MoveCategory"; -import { MoveFlags } from "#enums/MoveFlags"; -import { MoveTarget } from "#enums/MoveTarget"; import { ModifierTier } from "#enums/modifier-tier"; +import { MoveCategory } from "#enums/move-category"; +import { MoveFlags } from "#enums/move-flags"; import { MoveId } from "#enums/move-id"; +import { MoveTarget } from "#enums/move-target"; import { isIgnorePP, isVirtual, MoveUseMode } from "#enums/move-use-mode"; import { Nature } from "#enums/nature"; import { PokeballType } from "#enums/pokeball"; @@ -213,8 +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 */ public id: number; - public name: string; - 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 formIndex: number; public abilityIndex: number; @@ -442,10 +445,9 @@ export abstract class Pokemon extends Phaser.GameObjects.Container { * @returns The name to render for this {@linkcode Pokemon}. */ getNameToRender(useIllusion = true) { - const name: string = - !useIllusion && this.summonData.illusion ? this.summonData.illusion.basePokemon.name : this.name; - const nickname: string = - !useIllusion && this.summonData.illusion ? this.summonData.illusion.basePokemon.nickname : this.nickname; + const illusion = this.summonData.illusion; + const name = useIllusion ? (illusion?.name ?? this.name) : this.name; + const nickname: string | undefined = useIllusion ? illusion?.nickname : this.nickname; try { if (nickname) { return decodeURIComponent(escape(atob(nickname))); // TODO: Remove `atob` and `escape`... eventually... @@ -463,7 +465,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container { * @returns The {@linkcode PokeballType} that will be shown when this Pokemon is sent out into battle. */ getPokeball(useIllusion = false): PokeballType { - return useIllusion && this.summonData.illusion ? this.summonData.illusion.pokeball : this.pokeball; + return useIllusion ? (this.summonData.illusion?.pokeball ?? this.pokeball) : this.pokeball; } init(): void { @@ -609,24 +611,33 @@ export abstract class Pokemon extends Phaser.GameObjects.Container { } /** - * Generate an illusion of the last pokemon in the party, as other wild pokemon in the area. + * Set this pokemon's illusion to the data of the given pokemon. + * + * @remarks + * When setting the illusion of a wild pokemon, a {@linkcode PokemonSpecies} is generally passed. + * When setting the illusion of a pokemon in this way, the fields required by illusion data + * but missing from `PokemonSpecies` are set as follows + * - `pokeball` and `nickname` are both inherited from this pokemon + * - `shiny` will always be set if this pokemon OR its fusion is shiny + * - `variant` will always be 0 + * - Fields related to fusion will be set to `undefined` or `0` as appropriate + * - The gender is set to be the same as this pokemon, if it is compatible with the provided pokemon. + * - If the provided pokemon can only ever exist as one gender, it is always that gender + * - If this pokemon is genderless but the provided pokemon isn't, then a gender roll is done based on this + * pokemon's ID */ - setIllusion(pokemon: Pokemon): boolean { - if (this.summonData.illusion) { - this.breakIllusion(); - } - if (this.hasTrainer()) { + setIllusion(pokemon: Pokemon | PokemonSpecies): boolean { + this.breakIllusion(); + if (pokemon instanceof Pokemon) { const speciesId = pokemon.species.speciesId; this.summonData.illusion = { - basePokemon: { - name: this.name, - nickname: this.nickname, - shiny: this.shiny, - variant: this.variant, - fusionShiny: this.fusionShiny, - fusionVariant: this.fusionVariant, - }, + name: pokemon.name, + nickname: pokemon.nickname, + shiny: pokemon.shiny, + variant: pokemon.variant, + fusionShiny: pokemon.fusionShiny, + fusionVariant: pokemon.fusionVariant, species: speciesId, formIndex: pokemon.formIndex, gender: pokemon.gender, @@ -636,54 +647,61 @@ export abstract class Pokemon extends Phaser.GameObjects.Container { fusionGender: pokemon.fusionGender, }; - this.name = pokemon.name; - this.nickname = pokemon.nickname; - this.shiny = pokemon.shiny; - this.variant = pokemon.variant; - this.fusionVariant = pokemon.fusionVariant; - this.fusionShiny = pokemon.fusionShiny; - if (this.shiny) { + if (pokemon.shiny || pokemon.fusionShiny) { this.initShinySparkle(); } - this.loadAssets(false, true).then(() => this.playAnim()); - this.updateInfo(); } else { - const randomIllusion: PokemonSpecies = globalScene.arena.randomSpecies( - globalScene.currentBattle.waveIndex, - this.level, - ); - + // Correct the gender in case the illusioned species has a gender incompatible with this pokemon + let gender = this.gender; + switch (pokemon.malePercent) { + case null: + gender = Gender.GENDERLESS; + break; + case 0: + gender = Gender.FEMALE; + break; + case 100: + gender = Gender.MALE; + break; + default: + gender = (this.id % 256) * 0.390625 < pokemon.malePercent ? Gender.MALE : Gender.FEMALE; + } + /* + TODO: Allow setting `variant` to something other than 0, which would require first loading the + assets for the provided species, as its entry would otherwise not + be guaranteed to exist in the `variantData` map. But this would prevent `summonData` from being populated + until the assets are loaded, which would cause issues as this method cannot be easily promisified. + */ this.summonData.illusion = { - basePokemon: { - name: this.name, - nickname: this.nickname, - shiny: this.shiny, - variant: this.variant, - fusionShiny: this.fusionShiny, - fusionVariant: this.fusionVariant, - }, - species: randomIllusion.speciesId, - formIndex: randomIllusion.formIndex, - gender: this.gender, + fusionShiny: false, + fusionVariant: 0, + shiny: this.shiny || this.fusionShiny, + variant: 0, + nickname: this.nickname, + name: pokemon.name, + species: pokemon.speciesId, + formIndex: pokemon.formIndex, + gender, pokeball: this.pokeball, }; - this.name = randomIllusion.name; - this.loadAssets(false, true).then(() => this.playAnim()); + if (this.shiny || this.fusionShiny) { + this.initShinySparkle(); + } } + this.loadAssets(false, true).then(() => this.playAnim()); + this.updateInfo(); return true; } + /** + * Break the illusion of this pokemon, if it has an active illusion. + * @returns Whether an illusion was broken. + */ breakIllusion(): boolean { if (!this.summonData.illusion) { return false; } - this.name = this.summonData.illusion.basePokemon.name; - this.nickname = this.summonData.illusion.basePokemon.nickname; - this.shiny = this.summonData.illusion.basePokemon.shiny; - this.variant = this.summonData.illusion.basePokemon.variant; - this.fusionVariant = this.summonData.illusion.basePokemon.fusionVariant; - this.fusionShiny = this.summonData.illusion.basePokemon.fusionShiny; this.summonData.illusion = null; if (this.isOnField()) { globalScene.playSound("PRSFX- Transform"); @@ -718,8 +736,12 @@ export abstract class Pokemon extends Phaser.GameObjects.Container { // Assets for moves loadPromises.push(loadMoveAnimations(this.getMoveset().map(m => m.getMove().id))); + /** alias for `this.summonData.illusion`; bangs on this are safe when guarded with `useIllusion` being true */ + const illusion = this.summonData.illusion; + useIllusion = useIllusion && !!illusion; + // Load the assets for the species form - const formIndex = useIllusion && this.summonData.illusion ? this.summonData.illusion.formIndex : this.formIndex; + const formIndex = useIllusion ? illusion!.formIndex : this.formIndex; loadPromises.push( this.getSpeciesForm(false, useIllusion).loadAssets( this.getGender(useIllusion) === Gender.FEMALE, @@ -736,16 +758,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container { ); } if (this.getFusionSpeciesForm()) { - const fusionFormIndex = - useIllusion && this.summonData.illusion ? this.summonData.illusion.fusionFormIndex : this.fusionFormIndex; - const fusionShiny = - !useIllusion && this.summonData.illusion?.basePokemon - ? this.summonData.illusion.basePokemon.fusionShiny - : this.fusionShiny; - const fusionVariant = - !useIllusion && this.summonData.illusion?.basePokemon - ? this.summonData.illusion.basePokemon.fusionVariant - : this.fusionVariant; + const { fusionFormIndex, fusionShiny, fusionVariant } = useIllusion ? illusion! : this; loadPromises.push( this.getFusionSpeciesForm(false, useIllusion).loadAssets( this.getFusionGender(false, useIllusion) === Gender.FEMALE, @@ -933,8 +946,8 @@ export abstract class Pokemon extends Phaser.GameObjects.Container { return this.getSpeciesForm(ignoreOverride, false).getSpriteKey( this.getGender(ignoreOverride) === Gender.FEMALE, this.formIndex, - this.summonData.illusion?.basePokemon.shiny ?? this.shiny, - this.summonData.illusion?.basePokemon.variant ?? this.variant, + this.isShiny(false), + this.getVariant(false), ); } @@ -977,11 +990,8 @@ export abstract class Pokemon extends Phaser.GameObjects.Container { } getIconAtlasKey(ignoreOverride = false, useIllusion = true): string { - // TODO: confirm the correct behavior here (is it intentional that the check fails if `illusion.formIndex` is `0`?) - const formIndex = - useIllusion && this.summonData.illusion?.formIndex ? this.summonData.illusion.formIndex : this.formIndex; - const variant = - !useIllusion && this.summonData.illusion ? this.summonData.illusion.basePokemon.variant : this.variant; + const illusion = this.summonData.illusion; + const { formIndex, variant } = useIllusion && illusion ? illusion : this; return this.getSpeciesForm(ignoreOverride, useIllusion).getIconAtlasKey( formIndex, this.isBaseShiny(useIllusion), @@ -990,15 +1000,8 @@ export abstract class Pokemon extends Phaser.GameObjects.Container { } getFusionIconAtlasKey(ignoreOverride = false, useIllusion = true): string { - // TODO: confirm the correct behavior here (is it intentional that the check fails if `illusion.fusionFormIndex` is `0`?) - const fusionFormIndex = - useIllusion && this.summonData.illusion?.fusionFormIndex - ? this.summonData.illusion.fusionFormIndex - : this.fusionFormIndex; - const fusionVariant = - !useIllusion && this.summonData.illusion - ? this.summonData.illusion.basePokemon.fusionVariant - : this.fusionVariant; + const illusion = this.summonData.illusion; + const { fusionFormIndex, fusionVariant } = useIllusion && illusion ? illusion : this; return this.getFusionSpeciesForm(ignoreOverride, useIllusion).getIconAtlasKey( fusionFormIndex, this.isFusionShiny(), @@ -1006,11 +1009,9 @@ export abstract class Pokemon extends Phaser.GameObjects.Container { ); } - getIconId(ignoreOverride?: boolean, useIllusion = true): string { - const formIndex = - useIllusion && this.summonData.illusion?.formIndex ? this.summonData.illusion?.formIndex : this.formIndex; - const variant = - !useIllusion && !!this.summonData.illusion ? this.summonData.illusion?.basePokemon.variant : this.variant; + getIconId(ignoreOverride?: boolean, useIllusion = false): string { + const illusion = this.summonData.illusion; + const { formIndex, variant } = useIllusion && illusion ? illusion : this; return this.getSpeciesForm(ignoreOverride, useIllusion).getIconId( this.getGender(ignoreOverride, useIllusion) === Gender.FEMALE, formIndex, @@ -1020,14 +1021,8 @@ export abstract class Pokemon extends Phaser.GameObjects.Container { } getFusionIconId(ignoreOverride?: boolean, useIllusion = true): string { - const fusionFormIndex = - useIllusion && this.summonData.illusion?.fusionFormIndex - ? this.summonData.illusion?.fusionFormIndex - : this.fusionFormIndex; - const fusionVariant = - !useIllusion && !!this.summonData.illusion - ? this.summonData.illusion?.basePokemon.fusionVariant - : this.fusionVariant; + const illusion = this.summonData.illusion; + const { fusionFormIndex, fusionVariant } = useIllusion && illusion ? illusion : this; return this.getFusionSpeciesForm(ignoreOverride, useIllusion).getIconId( this.getFusionGender(ignoreOverride, useIllusion) === Gender.FEMALE, fusionFormIndex, @@ -1702,29 +1697,18 @@ export abstract class Pokemon extends Phaser.GameObjects.Container { * @returns Whether this Pokemon is shiny */ isShiny(useIllusion = false): boolean { - if (!useIllusion && this.summonData.illusion) { - return ( - this.summonData.illusion.basePokemon?.shiny || - (this.summonData.illusion.fusionSpecies && this.summonData.illusion.basePokemon?.fusionShiny) || - false - ); - } - - return this.shiny || (this.isFusion(useIllusion) && this.fusionShiny); + return this.isBaseShiny(useIllusion) || this.isFusionShiny(useIllusion); } isBaseShiny(useIllusion = false) { - if (!useIllusion && this.summonData.illusion) { - return !!this.summonData.illusion.basePokemon?.shiny; - } - return this.shiny; + return useIllusion ? (this.summonData.illusion?.shiny ?? this.shiny) : this.shiny; } isFusionShiny(useIllusion = false) { - if (!useIllusion && this.summonData.illusion) { - return !!this.summonData.illusion.basePokemon?.fusionShiny; + if (!this.isFusion(useIllusion)) { + return false; } - return this.isFusion(useIllusion) && this.fusionShiny; + return useIllusion ? (this.summonData.illusion?.fusionShiny ?? this.fusionShiny) : this.fusionShiny; } /** @@ -1733,39 +1717,48 @@ export abstract class Pokemon extends Phaser.GameObjects.Container { * @returns Whether this pokemon's base and fusion counterparts are both shiny. */ isDoubleShiny(useIllusion = false): boolean { - if (!useIllusion && this.summonData.illusion?.basePokemon) { - return ( - this.isFusion(false) && - this.summonData.illusion.basePokemon.shiny && - this.summonData.illusion.basePokemon.fusionShiny - ); - } - - return this.isFusion(useIllusion) && this.shiny && this.fusionShiny; + return this.isFusion(useIllusion) && this.isBaseShiny(useIllusion) && this.isFusionShiny(useIllusion); } /** * Return this Pokemon's {@linkcode Variant | shiny variant}. + * If a fusion, returns the maximum of the two variants. * Only meaningful if this pokemon is actually shiny. * @param useIllusion - Whether to consider this pokemon's illusion if present; default `false` * @returns The shiny variant of this Pokemon. */ getVariant(useIllusion = false): Variant { - if (!useIllusion && this.summonData.illusion) { - return !this.isFusion(false) - ? this.summonData.illusion.basePokemon!.variant - : (Math.max(this.variant, this.fusionVariant) as Variant); + const illusion = this.summonData.illusion; + const baseVariant = useIllusion ? (illusion?.variant ?? this.variant) : this.variant; + if (!this.isFusion(useIllusion)) { + return baseVariant; } - - return !this.isFusion(true) ? this.variant : (Math.max(this.variant, this.fusionVariant) as Variant); + const fusionVariant = useIllusion ? (illusion?.fusionVariant ?? this.fusionVariant) : this.fusionVariant; + return Math.max(baseVariant, fusionVariant) as Variant; } - // TODO: Clarify how this differs from `getVariant` - getBaseVariant(doubleShiny: boolean): Variant { - if (doubleShiny) { - return this.summonData.illusion?.basePokemon?.variant ?? this.variant; + /** + * Return the base pokemon's variant. Equivalent to {@linkcode getVariant} if this pokemon is not a fusion. + * @returns The shiny variant of this Pokemon's base species. + */ + getBaseVariant(useIllusion = false): Variant { + const illusion = this.summonData.illusion; + return useIllusion && illusion ? (illusion.variant ?? this.variant) : this.variant; + } + + /** + * Return the fused pokemon's variant. + * + * @remarks + * Always returns `0` if the pokemon is not a fusion. + * @returns The shiny variant of this pokemon's fusion species. + */ + getFusionVariant(useIllusion = false): Variant { + if (!this.isFusion(useIllusion)) { + return 0; } - return this.getVariant(); + const illusion = this.summonData.illusion; + return illusion ? (illusion.fusionVariant ?? this.fusionVariant) : this.fusionVariant; } /** @@ -1782,7 +1775,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container { * @returns Whether this Pokemon is currently fused with another species. */ isFusion(useIllusion = false): boolean { - return useIllusion && this.summonData.illusion ? !!this.summonData.illusion.fusionSpecies : !!this.fusionSpecies; + return useIllusion ? !!this.summonData.illusion?.fusionSpecies : !!this.fusionSpecies; } /** @@ -1792,9 +1785,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container { * @see {@linkcode getNameToRender} - gets this Pokemon's display name. */ getName(useIllusion = false): string { - return !useIllusion && this.summonData.illusion?.basePokemon - ? this.summonData.illusion.basePokemon.name - : this.name; + return useIllusion ? (this.summonData.illusion?.name ?? this.name) : this.name; } /** @@ -5676,7 +5667,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container { } export class PlayerPokemon extends Pokemon { - protected battleInfo: PlayerBattleInfo; + protected declare battleInfo: PlayerBattleInfo; public compatibleTms: MoveId[]; constructor( @@ -6205,7 +6196,7 @@ export class PlayerPokemon extends Pokemon { } export class EnemyPokemon extends Pokemon { - protected battleInfo: EnemyBattleInfo; + protected declare battleInfo: EnemyBattleInfo; public trainerSlot: TrainerSlot; public aiType: AiType; public bossSegments: number; diff --git a/src/field/trainer.ts b/src/field/trainer.ts index 7186cc4e928..584c9310932 100644 --- a/src/field/trainer.ts +++ b/src/field/trainer.ts @@ -23,13 +23,13 @@ import { } from "#trainers/trainer-party-template"; import { randSeedInt, randSeedItem, randSeedWeightedItem } from "#utils/common"; import { getPokemonSpecies } from "#utils/pokemon-utils"; +import { toSnakeCase } from "#utils/strings"; import i18next from "i18next"; export class Trainer extends Phaser.GameObjects.Container { public config: TrainerConfig; public variant: TrainerVariant; public partyTemplateIndex: number; - public name: string; public partnerName: string; public nameKey: string; public partnerNameKey: string | undefined; @@ -170,7 +170,7 @@ export class Trainer extends Phaser.GameObjects.Container { const evilTeamTitles = ["grunt"]; if (this.name === "" && evilTeamTitles.some(t => name.toLocaleLowerCase().includes(t))) { // This is a evil team grunt so we localize it by only using the "name" as the title - title = i18next.t(`trainerClasses:${name.toLowerCase().replace(/\s/g, "_")}`); + title = i18next.t(`trainerClasses:${toSnakeCase(name)}`); console.log("Localized grunt name: " + title); // Since grunts are not named we can just return the title return title; @@ -187,7 +187,7 @@ export class Trainer extends Phaser.GameObjects.Container { } // Get the localized trainer class name from the i18n file and set it as the title. // This is used for trainer class names, not titles like "Elite Four, Champion, etc." - title = i18next.t(`trainerClasses:${name.toLowerCase().replace(/\s/g, "_")}`); + title = i18next.t(`trainerClasses:${toSnakeCase(name)}`); } // If no specific trainer slot is set. @@ -208,7 +208,7 @@ export class Trainer extends Phaser.GameObjects.Container { if (this.config.titleDouble && this.variant === TrainerVariant.DOUBLE && !this.config.doubleOnly) { title = this.config.titleDouble; - name = i18next.t(`trainerNames:${this.config.nameDouble.toLowerCase().replace(/\s/g, "_")}`); + name = i18next.t(`trainerNames:${toSnakeCase(this.config.nameDouble)}`); } console.log(title ? `${title} ${name}` : name); diff --git a/src/init/init.ts b/src/init/init.ts new file mode 100644 index 00000000000..17b991be3a0 --- /dev/null +++ b/src/init/init.ts @@ -0,0 +1,35 @@ +import { initAbilities } from "#abilities/ability"; +import { initBiomes } from "#balance/biomes"; +import { initEggMoves } from "#balance/egg-moves"; +import { initPokemonPrevolutions, initPokemonStarters } from "#balance/pokemon-evolutions"; +import { initChallenges } from "#data/challenge"; +import { initTrainerTypeDialogue } from "#data/dialogue"; +import { initPokemonForms } from "#data/pokemon-forms"; +import { initSpecies } from "#data/pokemon-species"; +import { initModifierPools } from "#modifiers/init-modifier-pools"; +import { initModifierTypes } from "#modifiers/modifier-type"; +import { initMoves } from "#moves/move"; +import { initMysteryEncounters } from "#mystery-encounters/mystery-encounters"; +import { initAchievements } from "#system/achv"; +import { initVouchers } from "#system/voucher"; +import { initStatsKeys } from "#ui/game-stats-ui-handler"; + +/** Initialize the game. */ +export function initializeGame() { + initModifierTypes(); + initModifierPools(); + initAchievements(); + initVouchers(); + initStatsKeys(); + initPokemonPrevolutions(); + initPokemonStarters(); + initBiomes(); + initEggMoves(); + initPokemonForms(); + initTrainerTypeDialogue(); + initSpecies(); + initMoves(); + initAbilities(); + initChallenges(); + initMysteryEncounters(); +} diff --git a/src/inputs-controller.ts b/src/inputs-controller.ts index 1607e4ee74f..03d2278f26c 100644 --- a/src/inputs-controller.ts +++ b/src/inputs-controller.ts @@ -3,13 +3,13 @@ import { TouchControl } from "#app/touch-controls"; import { Button } from "#enums/buttons"; import { Device } from "#enums/devices"; import { UiMode } from "#enums/ui-mode"; -import cfg_keyboard_qwerty from "#inputs/cfg_keyboard_qwerty"; -import { assign, getButtonWithKeycode, getIconForLatestInput, swap } from "#inputs/configHandler"; -import pad_dualshock from "#inputs/pad_dualshock"; -import pad_generic from "#inputs/pad_generic"; -import pad_procon from "#inputs/pad_procon"; -import pad_unlicensedSNES from "#inputs/pad_unlicensedSNES"; -import pad_xbox360 from "#inputs/pad_xbox360"; +import cfg_keyboard_qwerty from "#inputs/cfg-keyboard-qwerty"; +import { assign, getButtonWithKeycode, getIconForLatestInput, swap } from "#inputs/config-handler"; +import pad_dualshock from "#inputs/pad-dualshock"; +import pad_generic from "#inputs/pad-generic"; +import pad_procon from "#inputs/pad-procon"; +import pad_unlicensedSNES from "#inputs/pad-unlicensed-snes"; +import pad_xbox360 from "#inputs/pad-xbox360"; import type { SettingGamepad } from "#system/settings-gamepad"; import type { SettingKeyboard } from "#system/settings-keyboard"; import { MoveTouchControlsHandler } from "#ui/move-touch-controls-handler"; diff --git a/src/loading-scene.ts b/src/loading-scene.ts index 154aef1ea93..c5b0263e785 100644 --- a/src/loading-scene.ts +++ b/src/loading-scene.ts @@ -1,29 +1,16 @@ -import { initAbilities } from "#abilities/ability"; import { timedEventManager } from "#app/global-event-manager"; +import { initializeGame } from "#app/init/init"; import { SceneBase } from "#app/scene-base"; import { isMobile } from "#app/touch-controls"; -import { initBiomes } from "#balance/biomes"; -import { initEggMoves } from "#balance/egg-moves"; -import { initPokemonPrevolutions, initPokemonStarters } from "#balance/pokemon-evolutions"; -import { initChallenges } from "#data/challenge"; -import { initTrainerTypeDialogue } from "#data/dialogue"; -import { initPokemonForms } from "#data/pokemon-forms"; -import { initSpecies } from "#data/pokemon-species"; import { BiomeId } from "#enums/biome-id"; import { GachaType } from "#enums/gacha-types"; import { getBiomeHasProps } from "#field/arena"; -import { initModifierPools } from "#modifiers/init-modifier-pools"; -import { initModifierTypes } from "#modifiers/modifier-type"; -import { initMoves } from "#moves/move"; -import { initMysteryEncounters } from "#mystery-encounters/mystery-encounters"; import { CacheBustedLoaderPlugin } from "#plugins/cache-busted-loader-plugin"; -import { initAchievements } from "#system/achv"; -import { initVouchers } from "#system/voucher"; -import { initStatsKeys } from "#ui/game-stats-ui-handler"; import { getWindowVariantSuffix, WindowVariant } from "#ui/ui-theme"; import { hasAllLocalizedSprites, localPing } from "#utils/common"; import { getEnumValues } from "#utils/enums"; import i18next from "i18next"; +import type { GameObjects } from "phaser"; export class LoadingScene extends SceneBase { public static readonly KEY = "loading"; @@ -369,30 +356,12 @@ export class LoadingScene extends SceneBase { this.loadLoadingScreen(); - initModifierTypes(); - initModifierPools(); - - initAchievements(); - initVouchers(); - initStatsKeys(); - initPokemonPrevolutions(); - initPokemonStarters(); - initBiomes(); - initEggMoves(); - initPokemonForms(); - initTrainerTypeDialogue(); - initSpecies(); - initMoves(); - initAbilities(); - initChallenges(); - initMysteryEncounters(); + initializeGame(); } loadLoadingScreen() { const mobile = isMobile(); - const loadingGraphics: any[] = []; - const bg = this.add.image(0, 0, ""); bg.setOrigin(0, 0); bg.setScale(6); @@ -463,6 +432,7 @@ export class LoadingScene extends SceneBase { }); disclaimerDescriptionText.setOrigin(0.5, 0.5); + const loadingGraphics: (GameObjects.Image | GameObjects.Graphics | GameObjects.Text)[] = []; loadingGraphics.push( bg, graphics, diff --git a/src/modifier/modifier.ts b/src/modifier/modifier.ts index f8c35b3e8f9..b31bee7fc69 100644 --- a/src/modifier/modifier.ts +++ b/src/modifier/modifier.ts @@ -23,6 +23,7 @@ import type { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; import { BATTLE_STATS, type PermanentStat, Stat, TEMP_BATTLE_STATS, type TempBattleStat } from "#enums/stat"; import { StatusEffect } from "#enums/status-effect"; +import { TextStyle } from "#enums/text-style"; import type { PlayerPokemon, Pokemon } from "#field/pokemon"; import type { DoubleBattleChanceBoosterModifierType, @@ -40,7 +41,7 @@ import type { } from "#modifiers/modifier-type"; import type { VoucherType } from "#system/voucher"; import type { ModifierInstanceMap, ModifierString } from "#types/modifier-types"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import { BooleanHolder, hslToHex, isNullOrUndefined, NumberHolder, randSeedFloat, toDmgValue } from "#utils/common"; import { getModifierType } from "#utils/modifier-utils"; import i18next from "i18next"; @@ -461,7 +462,7 @@ export abstract class LapsingPersistentModifier extends PersistentModifier { * @see {@linkcode apply} */ export class DoubleBattleChanceBoosterModifier extends LapsingPersistentModifier { - public override type: DoubleBattleChanceBoosterModifierType; + public declare type: DoubleBattleChanceBoosterModifierType; match(modifier: Modifier): boolean { return modifier instanceof DoubleBattleChanceBoosterModifier && modifier.getMaxBattles() === this.getMaxBattles(); @@ -935,7 +936,7 @@ export class EvoTrackerModifier extends PokemonHeldItemModifier { * Currently used by Shuckle Juice item */ export class PokemonBaseStatTotalModifier extends PokemonHeldItemModifier { - public override type: PokemonBaseStatTotalModifierType; + public declare type: PokemonBaseStatTotalModifierType; public isTransferable = false; public statModifier: 10 | -15; @@ -2073,7 +2074,7 @@ export abstract class ConsumablePokemonModifier extends ConsumableModifier { } export class TerrastalizeModifier extends ConsumablePokemonModifier { - public override type: TerastallizeModifierType; + public declare type: TerastallizeModifierType; public teraType: PokemonType; constructor(type: TerastallizeModifierType, pokemonId: number, teraType: PokemonType) { @@ -2317,7 +2318,7 @@ export class PokemonLevelIncrementModifier extends ConsumablePokemonModifier { } export class TmModifier extends ConsumablePokemonModifier { - public override type: TmModifierType; + public declare type: TmModifierType; /** * Applies {@linkcode TmModifier} @@ -2364,7 +2365,7 @@ export class RememberMoveModifier extends ConsumablePokemonModifier { } export class EvolutionItemModifier extends ConsumablePokemonModifier { - public override type: EvolutionItemModifierType; + public declare type: EvolutionItemModifierType; /** * Applies {@linkcode EvolutionItemModifier} * @param playerPokemon The {@linkcode PlayerPokemon} that should evolve via item @@ -2529,7 +2530,7 @@ export class ExpBoosterModifier extends PersistentModifier { } export class PokemonExpBoosterModifier extends PokemonHeldItemModifier { - public override type: PokemonExpBoosterModifierType; + public declare type: PokemonExpBoosterModifierType; private boostMultiplier: number; @@ -2626,7 +2627,7 @@ export class ExpBalanceModifier extends PersistentModifier { } export class PokemonFriendshipBoosterModifier extends PokemonHeldItemModifier { - public override type: PokemonFriendshipBoosterModifierType; + public declare type: PokemonFriendshipBoosterModifierType; matchType(modifier: Modifier): boolean { return modifier instanceof PokemonFriendshipBoosterModifier; @@ -2683,7 +2684,7 @@ export class PokemonNatureWeightModifier extends PokemonHeldItemModifier { } export class PokemonMoveAccuracyBoosterModifier extends PokemonHeldItemModifier { - public override type: PokemonMoveAccuracyBoosterModifierType; + public declare type: PokemonMoveAccuracyBoosterModifierType; private accuracyAmount: number; constructor(type: PokemonMoveAccuracyBoosterModifierType, pokemonId: number, accuracy: number, stackCount?: number) { @@ -2735,7 +2736,7 @@ export class PokemonMoveAccuracyBoosterModifier extends PokemonHeldItemModifier } export class PokemonMultiHitModifier extends PokemonHeldItemModifier { - public override type: PokemonMultiHitModifierType; + public declare type: PokemonMultiHitModifierType; matchType(modifier: Modifier): boolean { return modifier instanceof PokemonMultiHitModifier; @@ -2816,7 +2817,7 @@ export class PokemonMultiHitModifier extends PokemonHeldItemModifier { } export class PokemonFormChangeItemModifier extends PokemonHeldItemModifier { - public override type: FormChangeItemModifierType; + public declare type: FormChangeItemModifierType; public formChangeItem: FormChangeItem; public active: boolean; public isTransferable = false; diff --git a/src/phases/attempt-capture-phase.ts b/src/phases/attempt-capture-phase.ts index 604d4fd8384..fcddd23dd20 100644 --- a/src/phases/attempt-capture-phase.ts +++ b/src/phases/attempt-capture-phase.ts @@ -279,6 +279,7 @@ export class AttemptCapturePhase extends PokemonPhase { globalScene.updateModifiers(true); removePokemon(); if (newPokemon) { + newPokemon.leaveField(true, true, false); newPokemon.loadAssets().then(end); } else { end(); diff --git a/src/phases/command-phase.ts b/src/phases/command-phase.ts index 14674037fbe..016d4ff5d3b 100644 --- a/src/phases/command-phase.ts +++ b/src/phases/command-phase.ts @@ -2,7 +2,6 @@ import type { TurnCommand } from "#app/battle"; import { globalScene } from "#app/global-scene"; import { getPokemonNameWithAffix } from "#app/messages"; import { speciesStarterCosts } from "#balance/starters"; -import type { EncoreTag } from "#data/battler-tags"; import { TrappedTag } from "#data/battler-tags"; import { AbilityId } from "#enums/ability-id"; import { ArenaTagSide } from "#enums/arena-tag-side"; @@ -22,59 +21,77 @@ import type { MoveTargetSet } from "#moves/move"; import { getMoveTargets } from "#moves/move-utils"; import { FieldPhase } from "#phases/field-phase"; import type { TurnMove } from "#types/turn-move"; -import { isNullOrUndefined } from "#utils/common"; import i18next from "i18next"; export class CommandPhase extends FieldPhase { public readonly phaseName = "CommandPhase"; protected fieldIndex: number; + /** + * Whether the command phase is handling a switch command + */ + private isSwitch = false; + constructor(fieldIndex: number) { super(); this.fieldIndex = fieldIndex; } - start() { - super.start(); - - globalScene.updateGameInfo(); - + /** + * Resets the cursor to the position of {@linkcode Command.FIGHT} if any of the following are true + * - The setting to remember the last action is not enabled + * - This is the first turn of a mystery encounter, trainer battle, or the END biome + * - The cursor is currently on the POKEMON command + */ + private resetCursorIfNeeded(): void { const commandUiHandler = globalScene.ui.handlers[UiMode.COMMAND]; + const { arena, commandCursorMemory, currentBattle } = globalScene; + const { battleType, turn } = currentBattle; + const { biomeType } = arena; // If one of these conditions is true, we always reset the cursor to Command.FIGHT const cursorResetEvent = - globalScene.currentBattle.battleType === BattleType.MYSTERY_ENCOUNTER || - globalScene.currentBattle.battleType === BattleType.TRAINER || - globalScene.arena.biomeType === BiomeId.END; + battleType === BattleType.MYSTERY_ENCOUNTER || battleType === BattleType.TRAINER || biomeType === BiomeId.END; - if (commandUiHandler) { - if ( - (globalScene.currentBattle.turn === 1 && (!globalScene.commandCursorMemory || cursorResetEvent)) || - commandUiHandler.getCursor() === Command.POKEMON - ) { - commandUiHandler.setCursor(Command.FIGHT); - } else { - commandUiHandler.setCursor(commandUiHandler.getCursor()); - } + if (!commandUiHandler) { + return; + } + if ( + (turn === 1 && (!commandCursorMemory || cursorResetEvent)) || + commandUiHandler.getCursor() === Command.POKEMON + ) { + commandUiHandler.setCursor(Command.FIGHT); + } + } + + /** + * Submethod of {@linkcode start} that validates field index logic for nonzero field indices. + * Must only be called if the field index is nonzero. + */ + private handleFieldIndexLogic(): void { + // If we somehow are attempting to check the right pokemon but there's only one pokemon out + // Switch back to the center pokemon. This can happen rarely in double battles with mid turn switching + // TODO: Prevent this from happening in the first place + if (globalScene.getPlayerField().filter(p => p.isActive()).length === 1) { + this.fieldIndex = FieldPosition.CENTER; + return; } - if (this.fieldIndex) { - // If we somehow are attempting to check the right pokemon but there's only one pokemon out - // Switch back to the center pokemon. This can happen rarely in double battles with mid turn switching - if (globalScene.getPlayerField().filter(p => p.isActive()).length === 1) { - this.fieldIndex = FieldPosition.CENTER; - } else { - const allyCommand = globalScene.currentBattle.turnCommands[this.fieldIndex - 1]; - if (allyCommand?.command === Command.BALL || allyCommand?.command === Command.RUN) { - globalScene.currentBattle.turnCommands[this.fieldIndex] = { - command: allyCommand?.command, - skip: true, - }; - } - } + const allyCommand = globalScene.currentBattle.turnCommands[this.fieldIndex - 1]; + if (allyCommand?.command === Command.BALL || allyCommand?.command === Command.RUN) { + globalScene.currentBattle.turnCommands[this.fieldIndex] = { + command: allyCommand?.command, + skip: true, + }; } + } + /** + * Submethod of {@linkcode start} that sets the turn command to skip if this pokemon + * is commanding its ally via {@linkcode AbilityId.COMMANDER}. + */ + private checkCommander(): void { // If the Pokemon has applied Commander's effects to its ally, skip this command if ( globalScene.currentBattle?.double && @@ -86,377 +103,521 @@ export class CommandPhase extends FieldPhase { skip: true, }; } + } - // Checks if the Pokemon is under the effects of Encore. If so, Encore can end early if the encored move has no more PP. - const encoreTag = this.getPokemon().getTag(BattlerTagType.ENCORE) as EncoreTag | undefined; - if (encoreTag) { - this.getPokemon().lapseTag(BattlerTagType.ENCORE); - } - - if (globalScene.currentBattle.turnCommands[this.fieldIndex]?.skip) { - return this.end(); - } - - const playerPokemon = globalScene.getPlayerField()[this.fieldIndex]; - + /** + * Clear out all unusable moves in front of the currently acting pokemon's move queue. + */ + // TODO: Refactor move queue handling to ensure that this method is not necessary. + private clearUnusuableMoves(): void { + const playerPokemon = this.getPokemon(); const moveQueue = playerPokemon.getMoveQueue(); - - while ( - moveQueue.length && - moveQueue[0] && - moveQueue[0].move && - !isVirtual(moveQueue[0].useMode) && - (!playerPokemon.getMoveset().find(m => m.moveId === moveQueue[0].move) || - !playerPokemon - .getMoveset() - [playerPokemon.getMoveset().findIndex(m => m.moveId === moveQueue[0].move)].isUsable( - playerPokemon, - isIgnorePP(moveQueue[0].useMode), - )) - ) { - moveQueue.shift(); + if (moveQueue.length === 0) { + return; } - // TODO: Refactor this. I did a few simple find/replace matches but this is just ABHORRENTLY structured - if (moveQueue.length > 0) { - const queuedMove = moveQueue[0]; - if (!queuedMove.move) { - this.handleCommand(Command.FIGHT, -1, MoveUseMode.NORMAL); - } else { - const moveIndex = playerPokemon.getMoveset().findIndex(m => m.moveId === queuedMove.move); - if ( - (moveIndex > -1 && - playerPokemon.getMoveset()[moveIndex].isUsable(playerPokemon, isIgnorePP(queuedMove.useMode))) || - isVirtual(queuedMove.useMode) - ) { - this.handleCommand(Command.FIGHT, moveIndex, queuedMove.useMode, queuedMove); - } else { - globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); - } - } - } else { + let entriesToDelete = 0; + const moveset = playerPokemon.getMoveset(); + for (const queuedMove of moveQueue) { + const movesetQueuedMove = moveset.find(m => m.moveId === queuedMove.move); if ( - globalScene.currentBattle.isBattleMysteryEncounter() && - globalScene.currentBattle.mysteryEncounter?.skipToFightInput + queuedMove.move !== MoveId.NONE && + !isVirtual(queuedMove.useMode) && + !movesetQueuedMove?.isUsable(playerPokemon, isIgnorePP(queuedMove.useMode)) ) { - globalScene.ui.clearText(); - globalScene.ui.setMode(UiMode.FIGHT, this.fieldIndex); + entriesToDelete++; } else { - globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); + break; } } + if (entriesToDelete) { + moveQueue.splice(0, entriesToDelete); + } } /** - * TODO: Remove `args` and clean this thing up - * Code will need to be copied over from pkty except replacing the `virtual` and `ignorePP` args with a corresponding `MoveUseMode`. + * Attempt to execute the first usable move in this Pokemon's move queue + * @returns Whether a queued move was successfully set to be executed. */ - handleCommand(command: Command, cursor: number, ...args: any[]): boolean { + private tryExecuteQueuedMove(): boolean { + this.clearUnusuableMoves(); const playerPokemon = globalScene.getPlayerField()[this.fieldIndex]; + const moveQueue = playerPokemon.getMoveQueue(); + + if (moveQueue.length === 0) { + return false; + } + + const queuedMove = moveQueue[0]; + if (queuedMove.move === MoveId.NONE) { + this.handleCommand(Command.FIGHT, -1); + return true; + } + const moveIndex = playerPokemon.getMoveset().findIndex(m => m.moveId === queuedMove.move); + if (!isVirtual(queuedMove.useMode) && moveIndex === -1) { + globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); + } else { + this.handleCommand(Command.FIGHT, moveIndex, queuedMove.useMode, queuedMove); + } + + return true; + } + + public override start(): void { + super.start(); + + globalScene.updateGameInfo(); + this.resetCursorIfNeeded(); + + if (this.fieldIndex) { + this.handleFieldIndexLogic(); + } + + this.checkCommander(); + + const playerPokemon = this.getPokemon(); + + // Note: It is OK to call this if the target is not under the effect of encore; it will simply do nothing. + playerPokemon.lapseTag(BattlerTagType.ENCORE); + + if (globalScene.currentBattle.turnCommands[this.fieldIndex]?.skip) { + this.end(); + return; + } + + if (this.tryExecuteQueuedMove()) { + return; + } + + if ( + globalScene.currentBattle.isBattleMysteryEncounter() && + globalScene.currentBattle.mysteryEncounter?.skipToFightInput + ) { + globalScene.ui.clearText(); + globalScene.ui.setMode(UiMode.FIGHT, this.fieldIndex); + } else { + globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); + } + } + + /** + * Submethod of {@linkcode handleFightCommand} responsible for queuing the appropriate + * error message when a move cannot be used. + * @param user - The pokemon using the move + * @param cursor - The index of the move in the moveset + */ + private queueFightErrorMessage(user: PlayerPokemon, cursor: number) { + const move = user.getMoveset()[cursor]; + globalScene.ui.setMode(UiMode.MESSAGE); + + // Decides between a Disabled, Not Implemented, or No PP translation message + const errorMessage = user.isMoveRestricted(move.moveId, user) + ? user.getRestrictingTag(move.moveId, user)!.selectionDeniedText(user, move.moveId) + : move.getName().endsWith(" (N)") + ? "battle:moveNotImplemented" + : "battle:moveNoPP"; + const moveName = move.getName().replace(" (N)", ""); // Trims off the indicator + + globalScene.ui.showText( + i18next.t(errorMessage, { moveName: moveName }), + null, + () => { + globalScene.ui.clearText(); + globalScene.ui.setMode(UiMode.FIGHT, this.fieldIndex); + }, + null, + true, + ); + } + + /** + * Helper method for {@linkcode handleFightCommand} that returns the moveID for the phase + * based on the move passed in or the cursor. + * + * Does not check if the move is usable or not, that should be handled by the caller. + */ + private computeMoveId(playerPokemon: PlayerPokemon, cursor: number, move: TurnMove | undefined): MoveId { + return move?.move ?? (cursor > -1 ? playerPokemon.getMoveset()[cursor]?.moveId : MoveId.NONE); + } + + /** + * Process the logic for executing a fight-related command + * + * @remarks + * - Validates whether the move can be used, using struggle if not + * - Constructs the turn command and inserts it into the battle's turn commands + * + * @param command - The command to handle (FIGHT or TERA) + * @param cursor - The index that the cursor is placed on, or -1 if no move can be selected. + * @param ignorePP - Whether to ignore PP when checking if the move can be used. + * @param move - The move to force the command to use, if any. + */ + private handleFightCommand( + command: Command.FIGHT | Command.TERA, + cursor: number, + useMode: MoveUseMode = MoveUseMode.NORMAL, + move?: TurnMove, + ): boolean { + const playerPokemon = this.getPokemon(); + const ignorePP = isIgnorePP(useMode); + + let canUse = cursor === -1 || playerPokemon.trySelectMove(cursor, ignorePP); + + // Ternary here ensures we don't compute struggle conditions unless necessary + const useStruggle = canUse + ? false + : cursor > -1 && !playerPokemon.getMoveset().some(m => m.isUsable(playerPokemon)); + + canUse ||= useStruggle; + + if (!canUse) { + this.queueFightErrorMessage(playerPokemon, cursor); + return false; + } + + const moveId = useStruggle ? MoveId.STRUGGLE : this.computeMoveId(playerPokemon, cursor, move); + + const turnCommand: TurnCommand = { + command: Command.FIGHT, + cursor, + move: { move: moveId, targets: [], useMode }, + args: [useMode, move], + }; + const preTurnCommand: TurnCommand = { + command, + targets: [this.fieldIndex], + skip: command === Command.FIGHT, + }; + + const moveTargets: MoveTargetSet = + move === undefined + ? getMoveTargets(playerPokemon, moveId) + : { + targets: move.targets, + multiple: move.targets.length > 1, + }; + + if (moveId === MoveId.NONE) { + turnCommand.targets = [this.fieldIndex]; + } + + console.log( + "Move:", + MoveId[moveId], + "Move targets:", + moveTargets, + "\nPlayer Pokemon:", + getPokemonNameWithAffix(playerPokemon), + ); + + if (moveTargets.targets.length > 1 && moveTargets.multiple) { + globalScene.phaseManager.unshiftNew("SelectTargetPhase", this.fieldIndex); + } + + if (turnCommand.move && (moveTargets.targets.length <= 1 || moveTargets.multiple)) { + turnCommand.move.targets = moveTargets.targets; + } else if ( + turnCommand.move && + playerPokemon.getTag(BattlerTagType.CHARGING) && + playerPokemon.getMoveQueue().length >= 1 + ) { + turnCommand.move.targets = playerPokemon.getMoveQueue()[0].targets; + } else { + globalScene.phaseManager.unshiftNew("SelectTargetPhase", this.fieldIndex); + } + + globalScene.currentBattle.preTurnCommands[this.fieldIndex] = preTurnCommand; + globalScene.currentBattle.turnCommands[this.fieldIndex] = turnCommand; + + return true; + } + + /** + * Set the mode in preparation to show the text, and then show the text. + * Only works for parameterless i18next keys. + * @param key - The i18next key for the text to show + */ + private queueShowText(key: string): void { + globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); + globalScene.ui.setMode(UiMode.MESSAGE); + + globalScene.ui.showText( + i18next.t(key), + null, + () => { + globalScene.ui.showText("", 0); + globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); + }, + null, + true, + ); + } + + /** + * Helper method for {@linkcode handleBallCommand} that checks if a pokeball can be thrown + * and displays the appropriate error message. + * + * @remarks + * The pokeball may not be thrown if any of the following are true: + * - It is a trainer battle + * - The player is in the {@linkcode BiomeId.END | End} biome and + * - it is not classic mode; or + * - the fresh start challenge is active; or + * - the player has not caught the target before and the player is still missing more than one starter + * - The player is in a mystery encounter that disallows catching the pokemon + * @returns Whether a pokeball can be thrown + */ + private checkCanUseBall(): boolean { + const { arena, currentBattle, gameData, gameMode } = globalScene; + const { battleType } = currentBattle; + const { biomeType } = arena; + const { isClassic } = gameMode; + const { dexData } = gameData; + + const someUncaughtSpeciesOnField = globalScene + .getEnemyField() + .some(p => p.isActive() && !dexData[p.species.speciesId].caughtAttr); + const missingMultipleStarters = + gameData.getStarterCount(d => !!d.caughtAttr) < Object.keys(speciesStarterCosts).length - 1; + if ( + biomeType === BiomeId.END && + (!isClassic || gameMode.isFreshStartChallenge() || (someUncaughtSpeciesOnField && missingMultipleStarters)) + ) { + this.queueShowText("battle:noPokeballForce"); + } else if (battleType === BattleType.TRAINER) { + this.queueShowText("battle:noPokeballTrainer"); + } else if (currentBattle.isBattleMysteryEncounter() && !currentBattle.mysteryEncounter!.catchAllowed) { + this.queueShowText("battle:noPokeballMysteryEncounter"); + } else { + return true; + } + + return false; + } + + /** + * Helper method for {@linkcode handleCommand} that handles the logic when the selected command is to use a pokeball. + * + * @param cursor - The index of the pokeball to use + * @returns Whether the command was successfully initiated + */ + private handleBallCommand(cursor: number): boolean { + const targets = globalScene + .getEnemyField() + .filter(p => p.isActive(true)) + .map(p => p.getBattlerIndex()); + if (targets.length > 1) { + this.queueShowText("battle:noPokeballMulti"); + return false; + } + + if (!this.checkCanUseBall()) { + return false; + } + + const numBallTypes = 5; + if (cursor < numBallTypes) { + const targetPokemon = globalScene.getEnemyPokemon(); + if ( + targetPokemon?.isBoss() && + targetPokemon?.bossSegmentIndex >= 1 && + // TODO: Decouple this hardcoded exception for wonder guard and just check the target... + !targetPokemon?.hasAbility(AbilityId.WONDER_GUARD, false, true) && + cursor < PokeballType.MASTER_BALL + ) { + this.queueShowText("battle:noPokeballStrong"); + return false; + } + + globalScene.currentBattle.turnCommands[this.fieldIndex] = { + command: Command.BALL, + cursor: cursor, + }; + globalScene.currentBattle.turnCommands[this.fieldIndex]!.targets = targets; + if (this.fieldIndex) { + globalScene.currentBattle.turnCommands[this.fieldIndex - 1]!.skip = true; + } + return true; + } + + return false; + } + + /** + * Submethod of {@linkcode tryLeaveField} to handle the logic for effects that prevent the pokemon from leaving the field + * due to trapping abilities or effects. + * + * This method queues the proper messages in the case of trapping abilities or effects. + * + * @returns Whether the pokemon is currently trapped + */ + private handleTrap(): boolean { + const playerPokemon = this.getPokemon(); + const trappedAbMessages: string[] = []; + const isSwitch = this.isSwitch; + if (!playerPokemon.isTrapped(trappedAbMessages)) { + return false; + } + if (trappedAbMessages.length > 0) { + if (isSwitch) { + globalScene.ui.setMode(UiMode.MESSAGE); + } + globalScene.ui.showText( + trappedAbMessages[0], + null, + () => { + globalScene.ui.showText("", 0); + if (isSwitch) { + globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); + } + }, + null, + true, + ); + } else { + const trapTag = playerPokemon.getTag(TrappedTag); + const fairyLockTag = globalScene.arena.getTagOnSide(ArenaTagType.FAIRY_LOCK, ArenaTagSide.PLAYER); + + if (!isSwitch) { + globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); + globalScene.ui.setMode(UiMode.MESSAGE); + } + if (trapTag) { + this.showNoEscapeText(trapTag, false); + } else if (fairyLockTag) { + this.showNoEscapeText(fairyLockTag, false); + } + } + + return true; + } + + /** + * Common helper method that attempts to have the pokemon leave the field. + * Checks for trapping abilities and effects. + * + * @param cursor - The index of the option that the cursor is on + * @returns Whether the pokemon is able to leave the field, indicating the command phase should end + */ + private tryLeaveField(cursor?: number, isBatonSwitch = false): boolean { + const currentBattle = globalScene.currentBattle; + + if (isBatonSwitch || !this.handleTrap()) { + currentBattle.turnCommands[this.fieldIndex] = this.isSwitch + ? { + command: Command.POKEMON, + cursor, + args: [isBatonSwitch], + } + : { + command: Command.RUN, + }; + if (!this.isSwitch && this.fieldIndex) { + currentBattle.turnCommands[this.fieldIndex - 1]!.skip = true; + } + return true; + } + + return false; + } + + /** + * Helper method for {@linkcode handleCommand} that handles the logic when the selected command is RUN. + * + * @remarks + * Checks if the player is allowed to flee, and if not, queues the appropriate message. + * + * The player cannot flee if: + * - The player is in the {@linkcode BiomeId.END | End} biome + * - The player is in a trainer battle + * - The player is in a mystery encounter that disallows fleeing + * - The player's pokemon is trapped by an ability or effect + * @returns Whether the pokemon is able to leave the field, indicating the command phase should end + */ + private handleRunCommand(): boolean { + const { currentBattle, arena } = globalScene; + const mysteryEncounterFleeAllowed = currentBattle.mysteryEncounter?.fleeAllowed ?? true; + if (arena.biomeType === BiomeId.END || !mysteryEncounterFleeAllowed) { + this.queueShowText("battle:noEscapeForce"); + return false; + } + if ( + currentBattle.battleType === BattleType.TRAINER || + currentBattle.mysteryEncounter?.encounterMode === MysteryEncounterMode.TRAINER_BATTLE + ) { + this.queueShowText("battle:noEscapeTrainer"); + return false; + } + + const success = this.tryLeaveField(); + + return success; + } + + /** + * Show a message indicating that the pokemon cannot escape, and then return to the command phase. + */ + private showNoEscapeText(tag: any, isSwitch: boolean): void { + globalScene.ui.showText( + i18next.t("battle:noEscapePokemon", { + pokemonName: + tag.sourceId && globalScene.getPokemonById(tag.sourceId) + ? getPokemonNameWithAffix(globalScene.getPokemonById(tag.sourceId)!) + : "", + moveName: tag.getMoveName(), + escapeVerb: i18next.t(isSwitch ? "battle:escapeVerbSwitch" : "battle:escapeVerbFlee"), + }), + null, + () => { + globalScene.ui.showText("", 0); + if (!isSwitch) { + globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); + } + }, + null, + true, + ); + } + + // Overloads for handleCommand to provide a more specific signature for the different options + /** + * Process the command phase logic based on the selected command + * + * @param command - The kind of command to handle + * @param cursor - The index of option that the cursor is on, or -1 if no option is selected + * @param useMode - The mode to use for the move, if applicable. For switches, a boolean that specifies whether the switch is a Baton switch. + * @param move - For {@linkcode Command.FIGHT}, the move to use + * @returns Whether the command was successful + */ + handleCommand(command: Command.FIGHT | Command.TERA, cursor: number, useMode?: MoveUseMode, move?: TurnMove): boolean; + handleCommand(command: Command.BALL, cursor: number): boolean; + handleCommand(command: Command.POKEMON, cursor: number, useBaton: boolean): boolean; + handleCommand(command: Command.RUN, cursor: number): boolean; + handleCommand(command: Command, cursor: number, useMode?: boolean | MoveUseMode, move?: TurnMove): boolean; + + public handleCommand( + command: Command, + cursor: number, + useMode: boolean | MoveUseMode = false, + move?: TurnMove, + ): boolean { let success = false; switch (command) { - // TODO: We don't need 2 args for this - moveUseMode is carried over from queuedMove case Command.TERA: - case Command.FIGHT: { - let useStruggle = false; - const turnMove: TurnMove | undefined = args.length === 2 ? (args[1] as TurnMove) : undefined; - if ( - cursor === -1 || - playerPokemon.trySelectMove(cursor, isIgnorePP(args[0] as MoveUseMode)) || - (useStruggle = cursor > -1 && !playerPokemon.getMoveset().filter(m => m.isUsable(playerPokemon)).length) - ) { - let moveId: MoveId; - if (useStruggle) { - moveId = MoveId.STRUGGLE; - } else if (turnMove !== undefined) { - moveId = turnMove.move; - } else if (cursor > -1) { - moveId = playerPokemon.getMoveset()[cursor].moveId; - } else { - moveId = MoveId.NONE; - } - - const turnCommand: TurnCommand = { - command: Command.FIGHT, - cursor: cursor, - move: { move: moveId, targets: [], useMode: args[0] }, - args: args, - }; - const preTurnCommand: TurnCommand = { - command: command, - targets: [this.fieldIndex], - skip: command === Command.FIGHT, - }; - const moveTargets: MoveTargetSet = - turnMove === undefined - ? getMoveTargets(playerPokemon, moveId) - : { - targets: turnMove.targets, - multiple: turnMove.targets.length > 1, - }; - if (!moveId) { - turnCommand.targets = [this.fieldIndex]; - } - console.log(moveTargets, getPokemonNameWithAffix(playerPokemon)); - if (moveTargets.targets.length > 1 && moveTargets.multiple) { - globalScene.phaseManager.unshiftNew("SelectTargetPhase", this.fieldIndex); - } - if (turnCommand.move && (moveTargets.targets.length <= 1 || moveTargets.multiple)) { - turnCommand.move.targets = moveTargets.targets; - } else if ( - turnCommand.move && - playerPokemon.getTag(BattlerTagType.CHARGING) && - playerPokemon.getMoveQueue().length >= 1 - ) { - turnCommand.move.targets = playerPokemon.getMoveQueue()[0].targets; - } else { - globalScene.phaseManager.unshiftNew("SelectTargetPhase", this.fieldIndex); - } - globalScene.currentBattle.preTurnCommands[this.fieldIndex] = preTurnCommand; - globalScene.currentBattle.turnCommands[this.fieldIndex] = turnCommand; - success = true; - } else if (cursor < playerPokemon.getMoveset().length) { - const move = playerPokemon.getMoveset()[cursor]; - globalScene.ui.setMode(UiMode.MESSAGE); - - // Decides between a Disabled, Not Implemented, or No PP translation message - const errorMessage = playerPokemon.isMoveRestricted(move.moveId, playerPokemon) - ? playerPokemon - .getRestrictingTag(move.moveId, playerPokemon)! - .selectionDeniedText(playerPokemon, move.moveId) - : move.getName().endsWith(" (N)") - ? "battle:moveNotImplemented" - : "battle:moveNoPP"; - const moveName = move.getName().replace(" (N)", ""); // Trims off the indicator - - globalScene.ui.showText( - i18next.t(errorMessage, { moveName: moveName }), - null, - () => { - globalScene.ui.clearText(); - globalScene.ui.setMode(UiMode.FIGHT, this.fieldIndex); - }, - null, - true, - ); - } + case Command.FIGHT: + success = this.handleFightCommand(command, cursor, typeof useMode === "boolean" ? undefined : useMode, move); break; - } - case Command.BALL: { - const notInDex = - globalScene - .getEnemyField() - .filter(p => p.isActive(true)) - .some(p => !globalScene.gameData.dexData[p.species.speciesId].caughtAttr) && - globalScene.gameData.getStarterCount(d => !!d.caughtAttr) < Object.keys(speciesStarterCosts).length - 1; - if ( - globalScene.arena.biomeType === BiomeId.END && - (!globalScene.gameMode.isClassic || globalScene.gameMode.isFreshStartChallenge() || notInDex) - ) { - globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); - globalScene.ui.setMode(UiMode.MESSAGE); - globalScene.ui.showText( - i18next.t("battle:noPokeballForce"), - null, - () => { - globalScene.ui.showText("", 0); - globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); - }, - null, - true, - ); - } else if (globalScene.currentBattle.battleType === BattleType.TRAINER) { - globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); - globalScene.ui.setMode(UiMode.MESSAGE); - globalScene.ui.showText( - i18next.t("battle:noPokeballTrainer"), - null, - () => { - globalScene.ui.showText("", 0); - globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); - }, - null, - true, - ); - } else if ( - globalScene.currentBattle.isBattleMysteryEncounter() && - !globalScene.currentBattle.mysteryEncounter!.catchAllowed - ) { - globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); - globalScene.ui.setMode(UiMode.MESSAGE); - globalScene.ui.showText( - i18next.t("battle:noPokeballMysteryEncounter"), - null, - () => { - globalScene.ui.showText("", 0); - globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); - }, - null, - true, - ); - } else { - const targets = globalScene - .getEnemyField() - .filter(p => p.isActive(true)) - .map(p => p.getBattlerIndex()); - if (targets.length > 1) { - globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); - globalScene.ui.setMode(UiMode.MESSAGE); - globalScene.ui.showText( - i18next.t("battle:noPokeballMulti"), - null, - () => { - globalScene.ui.showText("", 0); - globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); - }, - null, - true, - ); - } else if (cursor < 5) { - const targetPokemon = globalScene.getEnemyField().find(p => p.isActive(true)); - if ( - targetPokemon?.isBoss() && - targetPokemon?.bossSegmentIndex >= 1 && - !targetPokemon?.hasAbility(AbilityId.WONDER_GUARD, false, true) && - cursor < PokeballType.MASTER_BALL - ) { - globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); - globalScene.ui.setMode(UiMode.MESSAGE); - globalScene.ui.showText( - i18next.t("battle:noPokeballStrong"), - null, - () => { - globalScene.ui.showText("", 0); - globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); - }, - null, - true, - ); - } else { - globalScene.currentBattle.turnCommands[this.fieldIndex] = { - command: Command.BALL, - cursor: cursor, - }; - globalScene.currentBattle.turnCommands[this.fieldIndex]!.targets = targets; - if (this.fieldIndex) { - globalScene.currentBattle.turnCommands[this.fieldIndex - 1]!.skip = true; - } - success = true; - } - } - } + case Command.BALL: + success = this.handleBallCommand(cursor); break; - } case Command.POKEMON: - case Command.RUN: { - const isSwitch = command === Command.POKEMON; - const { currentBattle, arena } = globalScene; - const mysteryEncounterFleeAllowed = currentBattle.mysteryEncounter?.fleeAllowed; - if ( - !isSwitch && - (arena.biomeType === BiomeId.END || - (!isNullOrUndefined(mysteryEncounterFleeAllowed) && !mysteryEncounterFleeAllowed)) - ) { - globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); - globalScene.ui.setMode(UiMode.MESSAGE); - globalScene.ui.showText( - i18next.t("battle:noEscapeForce"), - null, - () => { - globalScene.ui.showText("", 0); - globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); - }, - null, - true, - ); - } else if ( - !isSwitch && - (currentBattle.battleType === BattleType.TRAINER || - currentBattle.mysteryEncounter?.encounterMode === MysteryEncounterMode.TRAINER_BATTLE) - ) { - globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); - globalScene.ui.setMode(UiMode.MESSAGE); - globalScene.ui.showText( - i18next.t("battle:noEscapeTrainer"), - null, - () => { - globalScene.ui.showText("", 0); - globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); - }, - null, - true, - ); - } else { - const batonPass = isSwitch && (args[0] as boolean); - const trappedAbMessages: string[] = []; - if (batonPass || !playerPokemon.isTrapped(trappedAbMessages)) { - currentBattle.turnCommands[this.fieldIndex] = isSwitch - ? { command: Command.POKEMON, cursor: cursor, args: args } - : { command: Command.RUN }; - success = true; - if (!isSwitch && this.fieldIndex) { - currentBattle.turnCommands[this.fieldIndex - 1]!.skip = true; - } - } else if (trappedAbMessages.length > 0) { - if (!isSwitch) { - globalScene.ui.setMode(UiMode.MESSAGE); - } - globalScene.ui.showText( - trappedAbMessages[0], - null, - () => { - globalScene.ui.showText("", 0); - if (!isSwitch) { - globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); - } - }, - null, - true, - ); - } else { - const trapTag = playerPokemon.getTag(TrappedTag); - const fairyLockTag = globalScene.arena.getTagOnSide(ArenaTagType.FAIRY_LOCK, ArenaTagSide.PLAYER); - - if (!trapTag && !fairyLockTag) { - i18next.t(`battle:noEscape${isSwitch ? "Switch" : "Flee"}`); - break; - } - if (!isSwitch) { - globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); - globalScene.ui.setMode(UiMode.MESSAGE); - } - const showNoEscapeText = (tag: any) => { - globalScene.ui.showText( - i18next.t("battle:noEscapePokemon", { - pokemonName: - tag.sourceId && globalScene.getPokemonById(tag.sourceId) - ? getPokemonNameWithAffix(globalScene.getPokemonById(tag.sourceId)!) - : "", - moveName: tag.getMoveName(), - escapeVerb: isSwitch ? i18next.t("battle:escapeVerbSwitch") : i18next.t("battle:escapeVerbFlee"), - }), - null, - () => { - globalScene.ui.showText("", 0); - if (!isSwitch) { - globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); - } - }, - null, - true, - ); - }; - - if (trapTag) { - showNoEscapeText(trapTag); - } else if (fairyLockTag) { - showNoEscapeText(fairyLockTag); - } - } - } + this.isSwitch = true; + success = this.tryLeaveField(cursor, typeof useMode === "boolean" ? useMode : undefined); + this.isSwitch = false; break; - } + case Command.RUN: + success = this.handleRunCommand(); } if (success) { diff --git a/src/phases/end-card-phase.ts b/src/phases/end-card-phase.ts index 5c3f6e1bf9b..b9b383db13d 100644 --- a/src/phases/end-card-phase.ts +++ b/src/phases/end-card-phase.ts @@ -1,7 +1,8 @@ import { globalScene } from "#app/global-scene"; import { Phase } from "#app/phase"; import { PlayerGender } from "#enums/player-gender"; -import { addTextObject, TextStyle } from "#ui/text"; +import { TextStyle } from "#enums/text-style"; +import { addTextObject } from "#ui/text"; import i18next from "i18next"; export class EndCardPhase extends Phase { diff --git a/src/phases/evolution-phase.ts b/src/phases/evolution-phase.ts index f8bee8371f2..cad79455af3 100644 --- a/src/phases/evolution-phase.ts +++ b/src/phases/evolution-phase.ts @@ -135,7 +135,7 @@ export class EvolutionPhase extends Phase { sprite .setPipelineData("ignoreTimeTint", true) - .setPipelineData("spriteKey", pokemon.getSpriteKey()) + .setPipelineData("spriteKey", spriteKey) .setPipelineData("shiny", pokemon.shiny) .setPipelineData("variant", pokemon.variant); diff --git a/src/phases/move-effect-phase.ts b/src/phases/move-effect-phase.ts index 4446b2071d0..b1cb9e48d51 100644 --- a/src/phases/move-effect-phase.ts +++ b/src/phases/move-effect-phase.ts @@ -13,12 +13,12 @@ import { BattlerTagLapseType } from "#enums/battler-tag-lapse-type"; import { BattlerTagType } from "#enums/battler-tag-type"; import { HitCheckResult } from "#enums/hit-check-result"; import { HitResult } from "#enums/hit-result"; -import { MoveCategory } from "#enums/MoveCategory"; -import { MoveEffectTrigger } from "#enums/MoveEffectTrigger"; -import { MoveFlags } from "#enums/MoveFlags"; -import { MoveTarget } from "#enums/MoveTarget"; +import { MoveCategory } from "#enums/move-category"; +import { MoveEffectTrigger } from "#enums/move-effect-trigger"; +import { MoveFlags } from "#enums/move-flags"; import { MoveId } from "#enums/move-id"; import { MoveResult } from "#enums/move-result"; +import { MoveTarget } from "#enums/move-target"; import { isReflected, isVirtual, MoveUseMode } from "#enums/move-use-mode"; import { PokemonType } from "#enums/pokemon-type"; import type { Pokemon } from "#field/pokemon"; diff --git a/src/phases/move-phase.ts b/src/phases/move-phase.ts index 09a542861be..82bb6b153ef 100644 --- a/src/phases/move-phase.ts +++ b/src/phases/move-phase.ts @@ -13,8 +13,8 @@ import { ArenaTagType } from "#enums/arena-tag-type"; import { BattlerIndex } from "#enums/battler-index"; import { BattlerTagLapseType } from "#enums/battler-tag-lapse-type"; import { BattlerTagType } from "#enums/battler-tag-type"; -import { MoveFlags } from "#enums/MoveFlags"; import { CommonAnim } from "#enums/move-anims-common"; +import { MoveFlags } from "#enums/move-flags"; import { MoveId } from "#enums/move-id"; import { MoveResult } from "#enums/move-result"; import { isIgnorePP, isIgnoreStatus, isReflected, isVirtual, MoveUseMode } from "#enums/move-use-mode"; diff --git a/src/phases/scan-ivs-phase.ts b/src/phases/scan-ivs-phase.ts index e0865feb7ca..eebee28bfbb 100644 --- a/src/phases/scan-ivs-phase.ts +++ b/src/phases/scan-ivs-phase.ts @@ -2,9 +2,10 @@ import { globalScene } from "#app/global-scene"; import { getPokemonNameWithAffix } from "#app/messages"; import type { BattlerIndex } from "#enums/battler-index"; import { PERMANENT_STATS, Stat } from "#enums/stat"; +import { TextStyle } from "#enums/text-style"; import { UiMode } from "#enums/ui-mode"; import { PokemonPhase } from "#phases/pokemon-phase"; -import { getTextColor, TextStyle } from "#ui/text"; +import { getTextColor } from "#ui/text"; import i18next from "i18next"; export class ScanIvsPhase extends PokemonPhase { diff --git a/src/pipelines/field-sprite.ts b/src/pipelines/field-sprite.ts index 647483d1524..b20bacf6a5e 100644 --- a/src/pipelines/field-sprite.ts +++ b/src/pipelines/field-sprite.ts @@ -2,8 +2,8 @@ import { globalScene } from "#app/global-scene"; import { getTerrainColor, TerrainType } from "#data/terrain"; import { getCurrentTime } from "#utils/common"; import Phaser from "phaser"; -import fieldSpriteFragShader from "./glsl/fieldSpriteFragShader.frag?raw"; -import spriteVertShader from "./glsl/spriteShader.vert?raw"; +import fieldSpriteFragShader from "./glsl/field-sprite-frag-shader.frag?raw"; +import spriteVertShader from "./glsl/sprite-shader.vert?raw"; export class FieldSpritePipeline extends Phaser.Renderer.WebGL.Pipelines.MultiPipeline { constructor(game: Phaser.Game, config?: Phaser.Types.Renderer.WebGL.WebGLPipelineConfig) { diff --git a/src/pipelines/glsl/fieldSpriteFragShader.frag b/src/pipelines/glsl/field-sprite-frag-shader.frag similarity index 100% rename from src/pipelines/glsl/fieldSpriteFragShader.frag rename to src/pipelines/glsl/field-sprite-frag-shader.frag diff --git a/src/pipelines/glsl/spriteFragShader.frag b/src/pipelines/glsl/sprite-frag-shader.frag similarity index 100% rename from src/pipelines/glsl/spriteFragShader.frag rename to src/pipelines/glsl/sprite-frag-shader.frag diff --git a/src/pipelines/glsl/spriteShader.vert b/src/pipelines/glsl/sprite-shader.vert similarity index 100% rename from src/pipelines/glsl/spriteShader.vert rename to src/pipelines/glsl/sprite-shader.vert diff --git a/src/pipelines/sprite.ts b/src/pipelines/sprite.ts index 596a761b05f..8d38eda562d 100644 --- a/src/pipelines/sprite.ts +++ b/src/pipelines/sprite.ts @@ -5,8 +5,8 @@ import { Pokemon } from "#field/pokemon"; import { Trainer } from "#field/trainer"; import { variantColorCache } from "#sprites/variant"; import { rgbHexToRgba } from "#utils/common"; -import spriteFragShader from "./glsl/spriteFragShader.frag?raw"; -import spriteVertShader from "./glsl/spriteShader.vert?raw"; +import spriteFragShader from "./glsl/sprite-frag-shader.frag?raw"; +import spriteVertShader from "./glsl/sprite-shader.vert?raw"; export class SpritePipeline extends FieldSpritePipeline { private _tone: number[]; diff --git a/src/plugins/api/pokerogue-account-api.ts b/src/plugins/api/pokerogue-account-api.ts index 56bdc92b9b9..03f522e8dac 100644 --- a/src/plugins/api/pokerogue-account-api.ts +++ b/src/plugins/api/pokerogue-account-api.ts @@ -5,7 +5,7 @@ import type { AccountLoginRequest, AccountLoginResponse, AccountRegisterRequest, -} from "#types/PokerogueAccountApi"; +} from "#types/api/pokerogue-account-api"; import { removeCookie, setCookie } from "#utils/cookies"; /** diff --git a/src/plugins/api/pokerogue-admin-api.ts b/src/plugins/api/pokerogue-admin-api.ts index 4e549c7ff53..7ce4cf8b973 100644 --- a/src/plugins/api/pokerogue-admin-api.ts +++ b/src/plugins/api/pokerogue-admin-api.ts @@ -6,7 +6,7 @@ import type { SearchAccountResponse, UnlinkAccountFromDiscordIdRequest, UnlinkAccountFromGoogledIdRequest, -} from "#types/PokerogueAdminApi"; +} from "#types/api/pokerogue-admin-api"; export class PokerogueAdminApi extends ApiBase { public readonly ERR_USERNAME_NOT_FOUND: string = "Username not found!"; diff --git a/src/plugins/api/pokerogue-api.ts b/src/plugins/api/pokerogue-api.ts index 99600a359a2..ce232685107 100644 --- a/src/plugins/api/pokerogue-api.ts +++ b/src/plugins/api/pokerogue-api.ts @@ -3,7 +3,7 @@ import { PokerogueAccountApi } from "#api/pokerogue-account-api"; import { PokerogueAdminApi } from "#api/pokerogue-admin-api"; import { PokerogueDailyApi } from "#api/pokerogue-daily-api"; import { PokerogueSavedataApi } from "#api/pokerogue-savedata-api"; -import type { TitleStatsResponse } from "#types/PokerogueApi"; +import type { TitleStatsResponse } from "#types/api/pokerogue-api-types"; /** * A wrapper for PokéRogue API requests. diff --git a/src/plugins/api/pokerogue-daily-api.ts b/src/plugins/api/pokerogue-daily-api.ts index 2913c7bd4f2..5ea3846e60e 100644 --- a/src/plugins/api/pokerogue-daily-api.ts +++ b/src/plugins/api/pokerogue-daily-api.ts @@ -1,5 +1,5 @@ import { ApiBase } from "#api/api-base"; -import type { GetDailyRankingsPageCountRequest, GetDailyRankingsRequest } from "#types/PokerogueDailyApi"; +import type { GetDailyRankingsPageCountRequest, GetDailyRankingsRequest } from "#types/api/pokerogue-daily-api"; import type { RankingEntry } from "#ui/daily-run-scoreboard"; /** diff --git a/src/plugins/api/pokerogue-savedata-api.ts b/src/plugins/api/pokerogue-savedata-api.ts index bc77de8060b..f91e7bd027f 100644 --- a/src/plugins/api/pokerogue-savedata-api.ts +++ b/src/plugins/api/pokerogue-savedata-api.ts @@ -2,7 +2,7 @@ import { ApiBase } from "#api/api-base"; import { PokerogueSessionSavedataApi } from "#api/pokerogue-session-savedata-api"; import { PokerogueSystemSavedataApi } from "#api/pokerogue-system-savedata-api"; import { MAX_INT_ATTR_VALUE } from "#app/constants"; -import type { UpdateAllSavedataRequest } from "#types/PokerogueSavedataApi"; +import type { UpdateAllSavedataRequest } from "#types/api/pokerogue-save-data-api"; /** * A wrapper for PokéRogue savedata API requests. diff --git a/src/plugins/api/pokerogue-session-savedata-api.ts b/src/plugins/api/pokerogue-session-savedata-api.ts index a807d4b712c..4ffb0a5d8da 100644 --- a/src/plugins/api/pokerogue-session-savedata-api.ts +++ b/src/plugins/api/pokerogue-session-savedata-api.ts @@ -7,7 +7,7 @@ import type { GetSessionSavedataRequest, NewClearSessionSavedataRequest, UpdateSessionSavedataRequest, -} from "#types/PokerogueSessionSavedataApi"; +} from "#types/api/pokerogue-session-save-data-api"; /** * A wrapper for PokéRogue session savedata API requests. diff --git a/src/plugins/api/pokerogue-system-savedata-api.ts b/src/plugins/api/pokerogue-system-savedata-api.ts index f87aba81ee9..137d4adb18f 100644 --- a/src/plugins/api/pokerogue-system-savedata-api.ts +++ b/src/plugins/api/pokerogue-system-savedata-api.ts @@ -4,7 +4,7 @@ import type { UpdateSystemSavedataRequest, VerifySystemSavedataRequest, VerifySystemSavedataResponse, -} from "#types/PokerogueSystemSavedataApi"; +} from "#types/api/pokerogue-system-save-data-api"; /** * A wrapper for PokéRogue system savedata API requests. diff --git a/src/plugins/i18n.ts b/src/plugins/i18n.ts index 4ee4aa730fb..89946b2691b 100644 --- a/src/plugins/i18n.ts +++ b/src/plugins/i18n.ts @@ -1,5 +1,5 @@ import pkg from "#package.json"; -import { camelCaseToKebabCase } from "#utils/common"; +import { toKebabCase } from "#utils/strings"; import i18next from "i18next"; import LanguageDetector from "i18next-browser-languagedetector"; import HttpBackend from "i18next-http-backend"; @@ -194,14 +194,16 @@ export async function initI18n(): Promise { ], backend: { loadPath(lng: string, [ns]: string[]) { + // Use namespace maps where required let fileName: string; if (namespaceMap[ns]) { fileName = namespaceMap[ns]; } else if (ns.startsWith("mysteryEncounters/")) { - fileName = camelCaseToKebabCase(ns + "Dialogue"); + fileName = toKebabCase(ns + "-dialogue"); // mystery-encounters/a-trainers-test-dialogue } else { - fileName = camelCaseToKebabCase(ns); + fileName = toKebabCase(ns); } + // ex: "./locales/en/move-anims" return `./locales/${lng}/${fileName}.json?v=${pkg.version}`; }, }, diff --git a/src/system/achv.ts b/src/system/achv.ts index abe6f264d20..69eade02e35 100644 --- a/src/system/achv.ts +++ b/src/system/achv.ts @@ -890,7 +890,7 @@ export const achvs = { 100, c => c instanceof FreshStartChallenge && - c.value > 0 && + c.value === 1 && !globalScene.gameMode.challenges.some( c => [Challenges.INVERSE_BATTLE, Challenges.FLIP_STAT].includes(c.id) && c.value > 0, ), diff --git a/src/system/game-data.ts b/src/system/game-data.ts index 4f251b212b1..b148ed4e2ba 100644 --- a/src/system/game-data.ts +++ b/src/system/game-data.ts @@ -57,7 +57,7 @@ import { applySessionVersionMigration, applySettingsVersionMigration, applySystemVersionMigration, -} from "#system/version_converter"; +} from "#system/version-migration/version-converter"; import { VoucherType, vouchers } from "#system/voucher"; import { trainerConfigs } from "#trainers/trainer-config"; import type { DexData, DexEntry } from "#types/dex-data"; @@ -1454,11 +1454,10 @@ export class GameData { reader.onload = (_ => { return e => { - let dataName: string; + let dataName = GameDataType[dataType].toLowerCase(); let dataStr = AES.decrypt(e.target?.result?.toString()!, saveKey).toString(enc.Utf8); // TODO: is this bang correct? let valid = false; try { - dataName = GameDataType[dataType].toLowerCase(); switch (dataType) { case GameDataType.SYSTEM: { dataStr = this.convertSystemDataStr(dataStr); @@ -1493,7 +1492,6 @@ export class GameData { const displayError = (error: string) => globalScene.ui.showText(error, null, () => globalScene.ui.showText("", 0), fixedInt(1500)); - dataName = dataName!; // tell TS compiler that dataName is defined! if (!valid) { return globalScene.ui.showText( diff --git a/src/system/pokemon-data.ts b/src/system/pokemon-data.ts index 9cea08bfb13..69c1539d944 100644 --- a/src/system/pokemon-data.ts +++ b/src/system/pokemon-data.ts @@ -88,12 +88,12 @@ export class PokemonData { this.id = source.id; this.player = sourcePokemon?.isPlayer() ?? source.player; this.species = sourcePokemon?.species.speciesId ?? source.species; - this.nickname = sourcePokemon?.summonData.illusion?.basePokemon.nickname ?? source.nickname; + this.nickname = source.nickname; this.formIndex = Math.max(Math.min(source.formIndex, getPokemonSpecies(this.species).forms.length - 1), 0); this.abilityIndex = source.abilityIndex; this.passive = source.passive; - this.shiny = sourcePokemon?.summonData.illusion?.basePokemon.shiny ?? source.shiny; - this.variant = sourcePokemon?.summonData.illusion?.basePokemon.variant ?? source.variant; + this.shiny = source.shiny; + this.variant = source.variant; this.pokeball = source.pokeball ?? PokeballType.POKEBALL; this.level = source.level; this.exp = source.exp; @@ -134,8 +134,8 @@ export class PokemonData { this.fusionSpecies = sourcePokemon?.fusionSpecies?.speciesId ?? source.fusionSpecies; this.fusionFormIndex = source.fusionFormIndex; this.fusionAbilityIndex = source.fusionAbilityIndex; - this.fusionShiny = sourcePokemon?.summonData.illusion?.basePokemon.fusionShiny ?? source.fusionShiny; - this.fusionVariant = sourcePokemon?.summonData.illusion?.basePokemon.fusionVariant ?? source.fusionVariant; + this.fusionShiny = source.fusionShiny; + this.fusionVariant = source.fusionVariant; this.fusionGender = source.fusionGender; this.fusionLuck = source.fusionLuck ?? (source.fusionShiny ? source.fusionVariant + 1 : 0); this.fusionTeraType = (source.fusionTeraType ?? 0) as PokemonType; diff --git a/src/system/settings/settings.ts b/src/system/settings/settings.ts index 19d10baedfd..33087f2509e 100644 --- a/src/system/settings/settings.ts +++ b/src/system/settings/settings.ts @@ -171,6 +171,7 @@ export const SettingKeys = { UI_Volume: "UI_SOUND_EFFECTS", Battle_Music: "BATTLE_MUSIC", Show_BGM_Bar: "SHOW_BGM_BAR", + Hide_Username: "HIDE_USERNAME", Move_Touch_Controls: "MOVE_TOUCH_CONTROLS", Shop_Overlay_Opacity: "SHOP_OVERLAY_OPACITY", }; @@ -625,6 +626,13 @@ export const Setting: Array = [ default: 1, type: SettingType.DISPLAY, }, + { + key: SettingKeys.Hide_Username, + label: i18next.t("settings:hideUsername"), + options: OFF_ON, + default: 0, + type: SettingType.DISPLAY, + }, { key: SettingKeys.Master_Volume, label: i18next.t("settings:masterVolume"), @@ -792,6 +800,9 @@ export function setSetting(setting: string, value: number): boolean { case SettingKeys.Show_BGM_Bar: globalScene.showBgmBar = Setting[index].options[value].value === "On"; break; + case SettingKeys.Hide_Username: + globalScene.hideUsername = Setting[index].options[value].value === "On"; + break; case SettingKeys.Candy_Upgrade_Notification: if (globalScene.candyUpgradeNotification === value) { break; diff --git a/src/system/version_migration/version_converter.ts b/src/system/version-migration/version-converter.ts similarity index 91% rename from src/system/version_migration/version_converter.ts rename to src/system/version-migration/version-converter.ts index c49490da756..6dde611ce84 100644 --- a/src/system/version_migration/version_converter.ts +++ b/src/system/version-migration/version-converter.ts @@ -2,9 +2,9 @@ import { version } from "#package.json"; import type { SessionSaveData, SystemSaveData } from "#system/game-data"; -import type { SessionSaveMigrator } from "#types/SessionSaveMigrator"; -import type { SettingsSaveMigrator } from "#types/SettingsSaveMigrator"; -import type { SystemSaveMigrator } from "#types/SystemSaveMigrator"; +import type { SessionSaveMigrator } from "#types/session-save-migrator"; +import type { SettingsSaveMigrator } from "#types/settings-save-migrator"; +import type { SystemSaveMigrator } from "#types/system-save-migrator"; import { compareVersions } from "compare-versions"; /* @@ -49,11 +49,11 @@ export const settingsMigrators: readonly SettingsSaveMigrator[] = [settingsMigra // Add migrator imports below: // Example: import * as vA_B_C from "#system/vA_B_C"; -import * as v1_0_4 from "#system/v1_0_4"; -import * as v1_7_0 from "#system/v1_7_0"; -import * as v1_8_3 from "#system/v1_8_3"; -import * as v1_9_0 from "#system/v1_9_0"; -import * as v1_10_0 from "#system/v1_10_0"; +import * as v1_0_4 from "#system/version-migration/versions/v1_0_4"; +import * as v1_7_0 from "#system/version-migration/versions/v1_7_0"; +import * as v1_8_3 from "#system/version-migration/versions/v1_8_3"; +import * as v1_9_0 from "#system/version-migration/versions/v1_9_0"; +import * as v1_10_0 from "#system/version-migration/versions/v1_10_0"; /** Current game version */ const LATEST_VERSION = version; diff --git a/src/system/version_migration/versions/v1_0_4.ts b/src/system/version-migration/versions/v1_0_4.ts similarity index 97% rename from src/system/version_migration/versions/v1_0_4.ts rename to src/system/version-migration/versions/v1_0_4.ts index 3523a5b8826..2c50e05d40f 100644 --- a/src/system/version_migration/versions/v1_0_4.ts +++ b/src/system/version-migration/versions/v1_0_4.ts @@ -5,9 +5,9 @@ import { AbilityAttr } from "#enums/ability-attr"; import { DexAttr } from "#enums/dex-attr"; import type { SessionSaveData, SystemSaveData } from "#system/game-data"; import { SettingKeys } from "#system/settings"; -import type { SessionSaveMigrator } from "#types/SessionSaveMigrator"; -import type { SettingsSaveMigrator } from "#types/SettingsSaveMigrator"; -import type { SystemSaveMigrator } from "#types/SystemSaveMigrator"; +import type { SessionSaveMigrator } from "#types/session-save-migrator"; +import type { SettingsSaveMigrator } from "#types/settings-save-migrator"; +import type { SystemSaveMigrator } from "#types/system-save-migrator"; import { isNullOrUndefined } from "#utils/common"; /** diff --git a/src/system/version_migration/versions/v1_10_0.ts b/src/system/version-migration/versions/v1_10_0.ts similarity index 96% rename from src/system/version_migration/versions/v1_10_0.ts rename to src/system/version-migration/versions/v1_10_0.ts index 66436717639..5c13acd4508 100644 --- a/src/system/version_migration/versions/v1_10_0.ts +++ b/src/system/version-migration/versions/v1_10_0.ts @@ -3,7 +3,7 @@ import type { MoveId } from "#enums/move-id"; import type { MoveResult } from "#enums/move-result"; import { MoveUseMode } from "#enums/move-use-mode"; import type { SessionSaveData } from "#system/game-data"; -import type { SessionSaveMigrator } from "#types/SessionSaveMigrator"; +import type { SessionSaveMigrator } from "#types/session-save-migrator"; import type { TurnMove } from "#types/turn-move"; /** Prior signature of `TurnMove`; used to ensure parity */ diff --git a/src/system/version_migration/versions/v1_7_0.ts b/src/system/version-migration/versions/v1_7_0.ts similarity index 95% rename from src/system/version_migration/versions/v1_7_0.ts rename to src/system/version-migration/versions/v1_7_0.ts index 8f757456d0a..9ba25bcbaac 100644 --- a/src/system/version_migration/versions/v1_7_0.ts +++ b/src/system/version-migration/versions/v1_7_0.ts @@ -2,8 +2,8 @@ import { globalScene } from "#app/global-scene"; import { getPokemonSpeciesForm } from "#data/pokemon-species"; import { DexAttr } from "#enums/dex-attr"; import type { SessionSaveData, SystemSaveData } from "#system/game-data"; -import type { SessionSaveMigrator } from "#types/SessionSaveMigrator"; -import type { SystemSaveMigrator } from "#types/SystemSaveMigrator"; +import type { SessionSaveMigrator } from "#types/session-save-migrator"; +import type { SystemSaveMigrator } from "#types/system-save-migrator"; import { isNullOrUndefined } from "#utils/common"; import { getPokemonSpecies } from "#utils/pokemon-utils"; diff --git a/src/system/version_migration/versions/v1_8_3.ts b/src/system/version-migration/versions/v1_8_3.ts similarity index 94% rename from src/system/version_migration/versions/v1_8_3.ts rename to src/system/version-migration/versions/v1_8_3.ts index e6b5129d9d5..4907b4e5e57 100644 --- a/src/system/version_migration/versions/v1_8_3.ts +++ b/src/system/version-migration/versions/v1_8_3.ts @@ -1,7 +1,7 @@ import { DexAttr } from "#enums/dex-attr"; import { SpeciesId } from "#enums/species-id"; import type { SystemSaveData } from "#system/game-data"; -import type { SystemSaveMigrator } from "#types/SystemSaveMigrator"; +import type { SystemSaveMigrator } from "#types/system-save-migrator"; import { getPokemonSpecies } from "#utils/pokemon-utils"; /** diff --git a/src/system/version_migration/versions/v1_9_0.ts b/src/system/version-migration/versions/v1_9_0.ts similarity index 95% rename from src/system/version_migration/versions/v1_9_0.ts rename to src/system/version-migration/versions/v1_9_0.ts index 80da5f2996b..fb24b9af837 100644 --- a/src/system/version_migration/versions/v1_9_0.ts +++ b/src/system/version-migration/versions/v1_9_0.ts @@ -2,7 +2,7 @@ import { MoveId } from "#enums/move-id"; import { PokemonMove } from "#moves/pokemon-move"; import type { SessionSaveData } from "#system/game-data"; import type { PokemonData } from "#system/pokemon-data"; -import type { SessionSaveMigrator } from "#types/SessionSaveMigrator"; +import type { SessionSaveMigrator } from "#types/session-save-migrator"; /** * Migrate all lingering rage fist data inside `CustomPokemonData`, diff --git a/src/timed-event-manager.ts b/src/timed-event-manager.ts index 02cb7fe8e0d..9877f298404 100644 --- a/src/timed-event-manager.ts +++ b/src/timed-event-manager.ts @@ -5,8 +5,9 @@ import { Challenges } from "#enums/challenges"; import { MysteryEncounterTier } from "#enums/mystery-encounter-tier"; import { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { SpeciesId } from "#enums/species-id"; +import { TextStyle } from "#enums/text-style"; import { WeatherType } from "#enums/weather-type"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import type { nil } from "#utils/common"; import { isNullOrUndefined } from "#utils/common"; import i18next from "i18next"; diff --git a/src/@types/i18next.d.ts b/src/typings/i18next.d.ts similarity index 100% rename from src/@types/i18next.d.ts rename to src/typings/i18next.d.ts diff --git a/src/ui/ability-bar.ts b/src/ui/ability-bar.ts index 79a68e9dce7..4b868d4e66c 100644 --- a/src/ui/ability-bar.ts +++ b/src/ui/ability-bar.ts @@ -1,5 +1,6 @@ import { globalScene } from "#app/global-scene"; -import { addTextObject, TextStyle } from "#ui/text"; +import { TextStyle } from "#enums/text-style"; +import { addTextObject } from "#ui/text"; import i18next from "i18next"; const barWidth = 118; diff --git a/src/ui/abstact-option-select-ui-handler.ts b/src/ui/abstact-option-select-ui-handler.ts index d93ad8b7665..2fb0159b6ef 100644 --- a/src/ui/abstact-option-select-ui-handler.ts +++ b/src/ui/abstact-option-select-ui-handler.ts @@ -1,7 +1,8 @@ import { globalScene } from "#app/global-scene"; import { Button } from "#enums/buttons"; +import { TextStyle } from "#enums/text-style"; import { UiMode } from "#enums/ui-mode"; -import { addBBCodeTextObject, getTextColor, getTextStyleOptions, TextStyle } from "#ui/text"; +import { addBBCodeTextObject, getTextColor, getTextStyleOptions } from "#ui/text"; import { UiHandler } from "#ui/ui-handler"; import { addWindow } from "#ui/ui-theme"; import { fixedInt, rgbHexToRgba } from "#utils/common"; diff --git a/src/ui/achv-bar.ts b/src/ui/achv-bar.ts index 8e0f2a9404b..bb1ef95c9de 100644 --- a/src/ui/achv-bar.ts +++ b/src/ui/achv-bar.ts @@ -1,8 +1,9 @@ import { globalScene } from "#app/global-scene"; import type { PlayerGender } from "#enums/player-gender"; +import { TextStyle } from "#enums/text-style"; import { Achv, getAchievementDescription } from "#system/achv"; import { Voucher } from "#system/voucher"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; export class AchvBar extends Phaser.GameObjects.Container { private defaultWidth: number; diff --git a/src/ui/achvs-ui-handler.ts b/src/ui/achvs-ui-handler.ts index 6b247f6da96..01fd1d45a61 100644 --- a/src/ui/achvs-ui-handler.ts +++ b/src/ui/achvs-ui-handler.ts @@ -1,6 +1,7 @@ import { globalScene } from "#app/global-scene"; import { Button } from "#enums/buttons"; import { PlayerGender } from "#enums/player-gender"; +import { TextStyle } from "#enums/text-style"; import type { UiMode } from "#enums/ui-mode"; import type { Achv } from "#system/achv"; import { achvs, getAchievementDescription } from "#system/achv"; @@ -9,7 +10,7 @@ import type { Voucher } from "#system/voucher"; import { getVoucherTypeIcon, getVoucherTypeName, vouchers } from "#system/voucher"; import { MessageUiHandler } from "#ui/message-ui-handler"; import { ScrollBar } from "#ui/scroll-bar"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import { addWindow } from "#ui/ui-theme"; import i18next from "i18next"; diff --git a/src/ui/admin-ui-handler.ts b/src/ui/admin-ui-handler.ts index 3d0a1153127..e577368363d 100644 --- a/src/ui/admin-ui-handler.ts +++ b/src/ui/admin-ui-handler.ts @@ -1,12 +1,12 @@ import { pokerogueApi } from "#api/pokerogue-api"; import { globalScene } from "#app/global-scene"; import { Button } from "#enums/buttons"; +import { TextStyle } from "#enums/text-style"; import { UiMode } from "#enums/ui-mode"; import type { InputFieldConfig } from "#ui/form-modal-ui-handler"; import { FormModalUiHandler } from "#ui/form-modal-ui-handler"; import type { ModalConfig } from "#ui/modal-ui-handler"; -import { TextStyle } from "#ui/text"; -import { formatText } from "#utils/common"; +import { toTitleCase } from "#utils/strings"; type AdminUiHandlerService = "discord" | "google"; type AdminUiHandlerServiceMode = "Link" | "Unlink"; @@ -21,9 +21,9 @@ export class AdminUiHandler extends FormModalUiHandler { private readonly httpUserNotFoundErrorCode: number = 404; private readonly ERR_REQUIRED_FIELD = (field: string) => { if (field === "username") { - return `${formatText(field)} is required`; + return `${toTitleCase(field)} is required`; } - return `${formatText(field)} Id is required`; + return `${toTitleCase(field)} Id is required`; }; // returns a string saying whether a username has been successfully linked/unlinked to discord/google private readonly SUCCESS_SERVICE_MODE = (service: string, mode: string) => { diff --git a/src/ui/arena-flyout.ts b/src/ui/arena-flyout.ts index 43cc553d936..d2a45646690 100644 --- a/src/ui/arena-flyout.ts +++ b/src/ui/arena-flyout.ts @@ -3,6 +3,7 @@ import { ArenaTrapTag } from "#data/arena-tag"; import { TerrainType } from "#data/terrain"; import { ArenaTagSide } from "#enums/arena-tag-side"; import { ArenaTagType } from "#enums/arena-tag-type"; +import { TextStyle } from "#enums/text-style"; import { WeatherType } from "#enums/weather-type"; import type { ArenaEvent } from "#events/arena"; import { @@ -14,10 +15,11 @@ import { } from "#events/arena"; import type { TurnEndEvent } from "#events/battle-scene"; import { BattleSceneEventType } from "#events/battle-scene"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import { TimeOfDayWidget } from "#ui/time-of-day-widget"; import { addWindow, WindowVariant } from "#ui/ui-theme"; -import { fixedInt, formatText, toCamelCaseString } from "#utils/common"; +import { fixedInt } from "#utils/common"; +import { toCamelCase, toTitleCase } from "#utils/strings"; import type { ParseKeys } from "i18next"; import i18next from "i18next"; @@ -48,10 +50,10 @@ export function getFieldEffectText(arenaTagType: string): string { if (!arenaTagType || arenaTagType === ArenaTagType.NONE) { return arenaTagType; } - const effectName = toCamelCaseString(arenaTagType); + const effectName = toCamelCase(arenaTagType); const i18nKey = `arenaFlyout:${effectName}` as ParseKeys; const resultName = i18next.t(i18nKey); - return !resultName || resultName === i18nKey ? formatText(arenaTagType) : resultName; + return !resultName || resultName === i18nKey ? toTitleCase(arenaTagType) : resultName; } export class ArenaFlyout extends Phaser.GameObjects.Container { @@ -86,14 +88,14 @@ export class ArenaFlyout extends Phaser.GameObjects.Container { private flyoutTextHeaderPlayer: Phaser.GameObjects.Text; /** The {@linkcode Phaser.GameObjects.Text} header used to indicate the enemy's effects */ private flyoutTextHeaderEnemy: Phaser.GameObjects.Text; - /** The {@linkcode Phaser.GameObjects.Text} header used to indicate neutral effects */ + /** The {@linkcode Phaser.GameObjects.Text} header used to indicate field effects */ private flyoutTextHeaderField: Phaser.GameObjects.Text; /** The {@linkcode Phaser.GameObjects.Text} used to indicate the player's effects */ private flyoutTextPlayer: Phaser.GameObjects.Text; /** The {@linkcode Phaser.GameObjects.Text} used to indicate the enemy's effects */ private flyoutTextEnemy: Phaser.GameObjects.Text; - /** The {@linkcode Phaser.GameObjects.Text} used to indicate neutral effects */ + /** The {@linkcode Phaser.GameObjects.Text} used to indicate field effects */ private flyoutTextField: Phaser.GameObjects.Text; /** Container for all field effects observed by this object */ @@ -163,7 +165,7 @@ export class ArenaFlyout extends Phaser.GameObjects.Container { this.flyoutTextHeaderField = addTextObject( this.flyoutWidth / 2, 5, - i18next.t("arenaFlyout:neutral"), + i18next.t("arenaFlyout:field"), TextStyle.SUMMARY_GREEN, ); this.flyoutTextHeaderField.setFontSize(54); diff --git a/src/ui/ball-ui-handler.ts b/src/ui/ball-ui-handler.ts index bde340e3cf7..67beb0eba84 100644 --- a/src/ui/ball-ui-handler.ts +++ b/src/ui/ball-ui-handler.ts @@ -2,9 +2,10 @@ import { globalScene } from "#app/global-scene"; import { getPokeballName } from "#data/pokeball"; import { Button } from "#enums/buttons"; import { Command } from "#enums/command"; +import { TextStyle } from "#enums/text-style"; import { UiMode } from "#enums/ui-mode"; import type { CommandPhase } from "#phases/command-phase"; -import { addTextObject, getTextStyleOptions, TextStyle } from "#ui/text"; +import { addTextObject, getTextStyleOptions } from "#ui/text"; import { UiHandler } from "#ui/ui-handler"; import { addWindow } from "#ui/ui-theme"; import i18next from "i18next"; diff --git a/src/ui/base-stats-overlay.ts b/src/ui/base-stats-overlay.ts index 888b87a8d11..e3ba472475a 100644 --- a/src/ui/base-stats-overlay.ts +++ b/src/ui/base-stats-overlay.ts @@ -1,6 +1,7 @@ import type { InfoToggle } from "#app/battle-scene"; import { globalScene } from "#app/global-scene"; -import { addTextObject, TextStyle } from "#ui/text"; +import { TextStyle } from "#enums/text-style"; +import { addTextObject } from "#ui/text"; import { addWindow } from "#ui/ui-theme"; import { fixedInt } from "#utils/common"; import i18next from "i18next"; diff --git a/src/ui/battle-flyout.ts b/src/ui/battle-flyout.ts index 083dc7bbf19..0a67dc9ad37 100644 --- a/src/ui/battle-flyout.ts +++ b/src/ui/battle-flyout.ts @@ -2,12 +2,13 @@ import { globalScene } from "#app/global-scene"; import { getPokemonNameWithAffix } from "#app/messages"; import { BerryType } from "#enums/berry-type"; import { MoveId } from "#enums/move-id"; +import { TextStyle } from "#enums/text-style"; import { UiTheme } from "#enums/ui-theme"; import type { BerryUsedEvent, MoveUsedEvent } from "#events/battle-scene"; import { BattleSceneEventType } from "#events/battle-scene"; import type { EnemyPokemon, Pokemon } from "#field/pokemon"; import type { Move } from "#moves/move"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import { fixedInt } from "#utils/common"; /** Container for info about a {@linkcode Move} */ diff --git a/src/ui/battle-info/battle-info.ts b/src/ui/battle-info/battle-info.ts index 4a2a6d1804d..0aedfbdf5e7 100644 --- a/src/ui/battle-info/battle-info.ts +++ b/src/ui/battle-info/battle-info.ts @@ -4,9 +4,10 @@ import { getTypeRgb } from "#data/type"; import { PokemonType } from "#enums/pokemon-type"; import { Stat } from "#enums/stat"; import { StatusEffect } from "#enums/status-effect"; +import { TextStyle } from "#enums/text-style"; import type { Pokemon } from "#field/pokemon"; import { getVariantTint } from "#sprites/variant"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import { fixedInt, getLocalizedSpriteKey, getShinyDescriptor } from "#utils/common"; import i18next from "i18next"; diff --git a/src/ui/battle-info/enemy-battle-info.ts b/src/ui/battle-info/enemy-battle-info.ts index 5799fb476ef..d426a49df5c 100644 --- a/src/ui/battle-info/enemy-battle-info.ts +++ b/src/ui/battle-info/enemy-battle-info.ts @@ -1,10 +1,11 @@ import { globalScene } from "#app/global-scene"; import { Stat } from "#enums/stat"; +import { TextStyle } from "#enums/text-style"; import type { EnemyPokemon } from "#field/pokemon"; import { BattleFlyout } from "#ui/battle-flyout"; import type { BattleInfoParamList } from "#ui/battle-info"; import { BattleInfo } from "#ui/battle-info"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import { addWindow, WindowVariant } from "#ui/ui-theme"; import i18next from "i18next"; import type { GameObjects } from "phaser"; diff --git a/src/ui/battle-message-ui-handler.ts b/src/ui/battle-message-ui-handler.ts index bd524f0bb43..b58897b9022 100644 --- a/src/ui/battle-message-ui-handler.ts +++ b/src/ui/battle-message-ui-handler.ts @@ -1,9 +1,10 @@ import { globalScene } from "#app/global-scene"; import { Button } from "#enums/buttons"; import { getStatKey, PERMANENT_STATS } from "#enums/stat"; +import { TextStyle } from "#enums/text-style"; import { UiMode } from "#enums/ui-mode"; import { MessageUiHandler } from "#ui/message-ui-handler"; -import { addBBCodeTextObject, addTextObject, getTextColor, TextStyle } from "#ui/text"; +import { addBBCodeTextObject, addTextObject, getTextColor } from "#ui/text"; import { addWindow } from "#ui/ui-theme"; import i18next from "i18next"; import type BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext"; diff --git a/src/ui/bgm-bar.ts b/src/ui/bgm-bar.ts index d8b6bbe8b8a..e2c6925ec30 100644 --- a/src/ui/bgm-bar.ts +++ b/src/ui/bgm-bar.ts @@ -1,6 +1,7 @@ import { globalScene } from "#app/global-scene"; -import { addTextObject, TextStyle } from "#ui/text"; -import { formatText } from "#utils/common"; +import { TextStyle } from "#enums/text-style"; +import { addTextObject } from "#ui/text"; +import { toTitleCase } from "#utils/strings"; import i18next from "i18next"; const hiddenX = -150; @@ -100,7 +101,7 @@ export class BgmBar extends Phaser.GameObjects.Container { getRealBgmName(bgmName: string): string { return i18next.t([`bgmName:${bgmName}`, "bgmName:missing_entries"], { - name: formatText(bgmName), + name: toTitleCase(bgmName), }); } } diff --git a/src/ui/candy-bar.ts b/src/ui/candy-bar.ts index ea3500d6c4c..239b963227b 100644 --- a/src/ui/candy-bar.ts +++ b/src/ui/candy-bar.ts @@ -1,7 +1,8 @@ import { globalScene } from "#app/global-scene"; import { starterColors } from "#app/global-vars/starter-colors"; import type { SpeciesId } from "#enums/species-id"; -import { addTextObject, TextStyle } from "#ui/text"; +import { TextStyle } from "#enums/text-style"; +import { addTextObject } from "#ui/text"; import { rgbHexToRgba } from "#utils/common"; import { argbFromRgba } from "@material/material-color-utilities"; diff --git a/src/ui/challenges-select-ui-handler.ts b/src/ui/challenges-select-ui-handler.ts index a827cddc9a7..4f205d59de8 100644 --- a/src/ui/challenges-select-ui-handler.ts +++ b/src/ui/challenges-select-ui-handler.ts @@ -3,8 +3,9 @@ import type { Challenge } from "#data/challenge"; import { Button } from "#enums/buttons"; import { Challenges } from "#enums/challenges"; import { Color, ShadowColor } from "#enums/color"; +import { TextStyle } from "#enums/text-style"; import type { UiMode } from "#enums/ui-mode"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import { UiHandler } from "#ui/ui-handler"; import { addWindow } from "#ui/ui-theme"; import { getLocalizedSpriteKey } from "#utils/common"; diff --git a/src/ui/command-ui-handler.ts b/src/ui/command-ui-handler.ts index 2e4acfb7c42..41ff559062a 100644 --- a/src/ui/command-ui-handler.ts +++ b/src/ui/command-ui-handler.ts @@ -5,11 +5,12 @@ import { Button } from "#enums/buttons"; import { Command } from "#enums/command"; import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; +import { TextStyle } from "#enums/text-style"; import { UiMode } from "#enums/ui-mode"; import { TerastallizeAccessModifier } from "#modifiers/modifier"; import type { CommandPhase } from "#phases/command-phase"; import { PartyUiHandler, PartyUiMode } from "#ui/party-ui-handler"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import { UiHandler } from "#ui/ui-handler"; import i18next from "i18next"; diff --git a/src/ui/daily-run-scoreboard.ts b/src/ui/daily-run-scoreboard.ts index dcd45b40390..9391d02859c 100644 --- a/src/ui/daily-run-scoreboard.ts +++ b/src/ui/daily-run-scoreboard.ts @@ -1,6 +1,7 @@ import { pokerogueApi } from "#api/pokerogue-api"; import { globalScene } from "#app/global-scene"; -import { addTextObject, TextStyle } from "#ui/text"; +import { TextStyle } from "#enums/text-style"; +import { addTextObject } from "#ui/text"; import { addWindow, WindowVariant } from "#ui/ui-theme"; import { executeIf } from "#utils/common"; import { getEnumKeys } from "#utils/enums"; diff --git a/src/ui/dropdown.ts b/src/ui/dropdown.ts index 2a100ddbe59..c13d1ab6482 100644 --- a/src/ui/dropdown.ts +++ b/src/ui/dropdown.ts @@ -1,6 +1,7 @@ import { globalScene } from "#app/global-scene"; +import { TextStyle } from "#enums/text-style"; import { ScrollBar } from "#ui/scroll-bar"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import { addWindow, WindowVariant } from "#ui/ui-theme"; import i18next from "i18next"; diff --git a/src/ui/egg-counter-container.ts b/src/ui/egg-counter-container.ts index ff536228fde..da394e73b28 100644 --- a/src/ui/egg-counter-container.ts +++ b/src/ui/egg-counter-container.ts @@ -1,8 +1,9 @@ import { globalScene } from "#app/global-scene"; +import { TextStyle } from "#enums/text-style"; import type { EggCountChangedEvent } from "#events/egg"; import { EggEventType } from "#events/egg"; import type { EggHatchSceneHandler } from "#ui/egg-hatch-scene-handler"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import { addWindow } from "#ui/ui-theme"; /** diff --git a/src/ui/egg-gacha-ui-handler.ts b/src/ui/egg-gacha-ui-handler.ts index 19d1efa75dd..5dcf05e2606 100644 --- a/src/ui/egg-gacha-ui-handler.ts +++ b/src/ui/egg-gacha-ui-handler.ts @@ -6,10 +6,11 @@ import { Egg, getLegendaryGachaSpeciesForTimestamp } from "#data/egg"; import { Button } from "#enums/buttons"; import { EggTier } from "#enums/egg-type"; import { GachaType } from "#enums/gacha-types"; +import { TextStyle } from "#enums/text-style"; import { UiMode } from "#enums/ui-mode"; import { getVoucherTypeIcon, VoucherType } from "#system/voucher"; import { MessageUiHandler } from "#ui/message-ui-handler"; -import { addTextObject, getEggTierTextTint, getTextStyleOptions, TextStyle } from "#ui/text"; +import { addTextObject, getEggTierTextTint, getTextStyleOptions } from "#ui/text"; import { addWindow } from "#ui/ui-theme"; import { fixedInt, randSeedShuffle } from "#utils/common"; import { getEnumValues } from "#utils/enums"; @@ -74,7 +75,7 @@ export class EggGachaUiHandler extends MessageUiHandler { const gachaInfoContainer = globalScene.add.container(160, 46); const currentLanguage = i18next.resolvedLanguage ?? "en"; - let gachaTextStyle = TextStyle.WINDOW_ALT; + let gachaTextStyle: TextStyle = TextStyle.WINDOW_ALT; let gachaX = 4; let gachaY = 0; let pokemonIconX = -20; diff --git a/src/ui/egg-list-ui-handler.ts b/src/ui/egg-list-ui-handler.ts index 94d6889ed48..42f969b9d38 100644 --- a/src/ui/egg-list-ui-handler.ts +++ b/src/ui/egg-list-ui-handler.ts @@ -1,11 +1,12 @@ import { globalScene } from "#app/global-scene"; import { Button } from "#enums/buttons"; +import { TextStyle } from "#enums/text-style"; import { UiMode } from "#enums/ui-mode"; import { MessageUiHandler } from "#ui/message-ui-handler"; import { PokemonIconAnimHandler, PokemonIconAnimMode } from "#ui/pokemon-icon-anim-handler"; import { ScrollBar } from "#ui/scroll-bar"; import { ScrollableGridUiHandler } from "#ui/scrollable-grid-handler"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import { addWindow } from "#ui/ui-theme"; import i18next from "i18next"; diff --git a/src/ui/evolution-scene-handler.ts b/src/ui/evolution-scene-handler.ts index 5ad4fc6fdf5..c22cf31faaa 100644 --- a/src/ui/evolution-scene-handler.ts +++ b/src/ui/evolution-scene-handler.ts @@ -1,8 +1,9 @@ import { globalScene } from "#app/global-scene"; import { Button } from "#enums/buttons"; +import { TextStyle } from "#enums/text-style"; import { UiMode } from "#enums/ui-mode"; import { MessageUiHandler } from "#ui/message-ui-handler"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; export class EvolutionSceneHandler extends MessageUiHandler { public evolutionContainer: Phaser.GameObjects.Container; diff --git a/src/ui/fight-ui-handler.ts b/src/ui/fight-ui-handler.ts index 9c08991e063..42f8cba5df4 100644 --- a/src/ui/fight-ui-handler.ts +++ b/src/ui/fight-ui-handler.ts @@ -4,15 +4,16 @@ import { getTypeDamageMultiplierColor } from "#data/type"; import { BattleType } from "#enums/battle-type"; import { Button } from "#enums/buttons"; import { Command } from "#enums/command"; -import { MoveCategory } from "#enums/MoveCategory"; +import { MoveCategory } from "#enums/move-category"; import { MoveUseMode } from "#enums/move-use-mode"; import { PokemonType } from "#enums/pokemon-type"; +import { TextStyle } from "#enums/text-style"; import { UiMode } from "#enums/ui-mode"; import type { EnemyPokemon, Pokemon } from "#field/pokemon"; import type { PokemonMove } from "#moves/pokemon-move"; import type { CommandPhase } from "#phases/command-phase"; import { MoveInfoOverlay } from "#ui/move-info-overlay"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import { UiHandler } from "#ui/ui-handler"; import { fixedInt, getLocalizedSpriteKey, padInt } from "#utils/common"; import i18next from "i18next"; @@ -284,7 +285,7 @@ export class FightUiHandler extends UiHandler implements InfoToggle { const ppColorStyle = FightUiHandler.ppRatioToColor(pp / maxPP); - //** Changes the text color and shadow according to the determined TextStyle */ + // Changes the text color and shadow according to the determined TextStyle this.ppText.setColor(this.getTextColor(ppColorStyle, false)).setShadowColor(this.getTextColor(ppColorStyle, true)); this.moveInfoOverlay.show(pokemonMove.getMove()); diff --git a/src/ui/filter-bar.ts b/src/ui/filter-bar.ts index 3961ae3415c..ea227655a97 100644 --- a/src/ui/filter-bar.ts +++ b/src/ui/filter-bar.ts @@ -1,10 +1,11 @@ import { globalScene } from "#app/global-scene"; import type { DropDownColumn } from "#enums/drop-down-column"; +import { TextStyle } from "#enums/text-style"; import type { UiTheme } from "#enums/ui-theme"; import type { DropDown } from "#ui/dropdown"; import { DropDownType } from "#ui/dropdown"; import type { StarterContainer } from "#ui/starter-container"; -import { addTextObject, getTextColor, TextStyle } from "#ui/text"; +import { addTextObject, getTextColor } from "#ui/text"; import { addWindow, WindowVariant } from "#ui/ui-theme"; export class FilterBar extends Phaser.GameObjects.Container { diff --git a/src/ui/filter-text.ts b/src/ui/filter-text.ts index 4a9012e44fc..ff7119dd778 100644 --- a/src/ui/filter-text.ts +++ b/src/ui/filter-text.ts @@ -1,9 +1,10 @@ import { globalScene } from "#app/global-scene"; +import { TextStyle } from "#enums/text-style"; import { UiMode } from "#enums/ui-mode"; import type { UiTheme } from "#enums/ui-theme"; import type { AwaitableUiHandler } from "#ui/awaitable-ui-handler"; import type { StarterContainer } from "#ui/starter-container"; -import { addTextObject, getTextColor, TextStyle } from "#ui/text"; +import { addTextObject, getTextColor } from "#ui/text"; import type { UI } from "#ui/ui"; import { addWindow, WindowVariant } from "#ui/ui-theme"; import i18next from "i18next"; diff --git a/src/ui/form-modal-ui-handler.ts b/src/ui/form-modal-ui-handler.ts index 35965b09b80..7ae545a7292 100644 --- a/src/ui/form-modal-ui-handler.ts +++ b/src/ui/form-modal-ui-handler.ts @@ -1,9 +1,10 @@ import { globalScene } from "#app/global-scene"; import { Button } from "#enums/buttons"; +import { TextStyle } from "#enums/text-style"; import type { UiMode } from "#enums/ui-mode"; import type { ModalConfig } from "#ui/modal-ui-handler"; import { ModalUiHandler } from "#ui/modal-ui-handler"; -import { addTextInputObject, addTextObject, TextStyle } from "#ui/text"; +import { addTextInputObject, addTextObject } from "#ui/text"; import { addWindow, WindowVariant } from "#ui/ui-theme"; import { fixedInt } from "#utils/common"; import type InputText from "phaser3-rex-plugins/plugins/inputtext"; diff --git a/src/ui/game-stats-ui-handler.ts b/src/ui/game-stats-ui-handler.ts index a9de827e258..ed66230bed7 100644 --- a/src/ui/game-stats-ui-handler.ts +++ b/src/ui/game-stats-ui-handler.ts @@ -2,12 +2,14 @@ import { globalScene } from "#app/global-scene"; import { speciesStarterCosts } from "#balance/starters"; import { Button } from "#enums/buttons"; import { DexAttr } from "#enums/dex-attr"; +import { TextStyle } from "#enums/text-style"; import { UiTheme } from "#enums/ui-theme"; import type { GameData } from "#system/game-data"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import { UiHandler } from "#ui/ui-handler"; import { addWindow } from "#ui/ui-theme"; -import { formatFancyLargeNumber, getPlayTimeString, toReadableString } from "#utils/common"; +import { formatFancyLargeNumber, getPlayTimeString } from "#utils/common"; +import { toTitleCase } from "#utils/strings"; import i18next from "i18next"; import Phaser from "phaser"; @@ -230,7 +232,7 @@ export class GameStatsUiHandler extends UiHandler { const resolvedLang = i18next.resolvedLanguage ?? "en"; // NOTE TO TRANSLATION TEAM: Add more languages that want to display // in a single-column inside of the `[]` (e.g. `["ru", "fr"]`) - return ["ru"].includes(resolvedLang); + return ["fr", "es-ES", "es-MX", "it", "ja", "pt-BR", "ru"].includes(resolvedLang); } /** The number of columns used by this menu in the resolved language */ private get columnCount(): 1 | 2 { @@ -501,11 +503,9 @@ export function initStatsKeys() { sourceFunc: gameData => gameData.gameStats[key].toString(), }; } - if (!(displayStats[key] as DisplayStat).label_key) { + if (!displayStats[key].label_key) { const splittableKey = key.replace(/([a-z]{2,})([A-Z]{1}(?:[^A-Z]|$))/g, "$1_$2"); - (displayStats[key] as DisplayStat).label_key = toReadableString( - `${splittableKey[0].toUpperCase()}${splittableKey.slice(1)}`, - ); + displayStats[key].label_key = toTitleCase(splittableKey); } } } diff --git a/src/ui/loading-modal-ui-handler.ts b/src/ui/loading-modal-ui-handler.ts index 585d70d51db..de00d911c47 100644 --- a/src/ui/loading-modal-ui-handler.ts +++ b/src/ui/loading-modal-ui-handler.ts @@ -1,6 +1,7 @@ +import { TextStyle } from "#enums/text-style"; import type { UiMode } from "#enums/ui-mode"; import { ModalUiHandler } from "#ui/modal-ui-handler"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import i18next from "i18next"; export class LoadingModalUiHandler extends ModalUiHandler { diff --git a/src/ui/login-form-ui-handler.ts b/src/ui/login-form-ui-handler.ts index 417a9031bf7..524eaeece86 100644 --- a/src/ui/login-form-ui-handler.ts +++ b/src/ui/login-form-ui-handler.ts @@ -1,11 +1,12 @@ import { pokerogueApi } from "#api/pokerogue-api"; import { globalScene } from "#app/global-scene"; +import { TextStyle } from "#enums/text-style"; import { UiMode } from "#enums/ui-mode"; import type { OptionSelectItem } from "#ui/abstact-option-select-ui-handler"; import type { InputFieldConfig } from "#ui/form-modal-ui-handler"; import { FormModalUiHandler } from "#ui/form-modal-ui-handler"; import type { ModalConfig } from "#ui/modal-ui-handler"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import { addWindow } from "#ui/ui-theme"; import { fixedInt } from "#utils/common"; import i18next from "i18next"; diff --git a/src/ui/menu-ui-handler.ts b/src/ui/menu-ui-handler.ts index 4e45dfedcb3..fa65cccab2f 100644 --- a/src/ui/menu-ui-handler.ts +++ b/src/ui/menu-ui-handler.ts @@ -5,13 +5,14 @@ import { bypassLogin } from "#app/global-vars/bypass-login"; import { handleTutorial, Tutorial } from "#app/tutorial"; import { Button } from "#enums/buttons"; import { GameDataType } from "#enums/game-data-type"; +import { TextStyle } from "#enums/text-style"; import { UiMode } from "#enums/ui-mode"; import type { OptionSelectConfig, OptionSelectItem } from "#ui/abstact-option-select-ui-handler"; import { AdminMode, getAdminModeName } from "#ui/admin-ui-handler"; import type { AwaitableUiHandler } from "#ui/awaitable-ui-handler"; import { BgmBar } from "#ui/bgm-bar"; import { MessageUiHandler } from "#ui/message-ui-handler"; -import { addTextObject, getTextStyleOptions, TextStyle } from "#ui/text"; +import { addTextObject, getTextStyleOptions } from "#ui/text"; import { addWindow, WindowVariant } from "#ui/ui-theme"; import { fixedInt, isLocal, sessionIdKey } from "#utils/common"; import { getCookie } from "#utils/cookies"; diff --git a/src/ui/modal-ui-handler.ts b/src/ui/modal-ui-handler.ts index 844f7f43930..c93b713831e 100644 --- a/src/ui/modal-ui-handler.ts +++ b/src/ui/modal-ui-handler.ts @@ -1,7 +1,8 @@ import { globalScene } from "#app/global-scene"; import type { Button } from "#enums/buttons"; +import { TextStyle } from "#enums/text-style"; import type { UiMode } from "#enums/ui-mode"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import { UiHandler } from "#ui/ui-handler"; import { addWindow, WindowVariant } from "#ui/ui-theme"; diff --git a/src/ui/modifier-select-ui-handler.ts b/src/ui/modifier-select-ui-handler.ts index 4fe4eda575d..16eecf6993d 100644 --- a/src/ui/modifier-select-ui-handler.ts +++ b/src/ui/modifier-select-ui-handler.ts @@ -6,13 +6,14 @@ import { getPokeballAtlasKey } from "#data/pokeball"; import { Button } from "#enums/buttons"; import type { PokeballType } from "#enums/pokeball"; import { ShopCursorTarget } from "#enums/shop-cursor-target"; +import { TextStyle } from "#enums/text-style"; import { UiMode } from "#enums/ui-mode"; import { HealShopCostModifier, LockModifierTiersModifier, PokemonHeldItemModifier } from "#modifiers/modifier"; import type { ModifierTypeOption } from "#modifiers/modifier-type"; import { getPlayerShopModifierTypeOptionsForWave, TmModifierType } from "#modifiers/modifier-type"; import { AwaitableUiHandler } from "#ui/awaitable-ui-handler"; import { MoveInfoOverlay } from "#ui/move-info-overlay"; -import { addTextObject, getModifierTierTextTint, getTextColor, getTextStyleOptions, TextStyle } from "#ui/text"; +import { addTextObject, getModifierTierTextTint, getTextColor, getTextStyleOptions } from "#ui/text"; import { formatMoney, NumberHolder } from "#utils/common"; import i18next from "i18next"; import Phaser from "phaser"; @@ -273,12 +274,23 @@ export class ModifierSelectUiHandler extends AwaitableUiHandler { // causing errors if reroll is selected this.awaitingActionInput = false; - // TODO: Replace with `Promise.withResolvers` when possible. - let tweenResolve: () => void; - const tweenPromise = new Promise(resolve => (tweenResolve = resolve)); + const { promise: tweenPromise, resolve: tweenResolve } = Promise.withResolvers(); let i = 0; - // TODO: Rework this bespoke logic for animating the modifier options. + // #region: animation + /** Holds promises that resolve once each reward's *upgrade animation* has finished playing */ + const rewardAnimPromises: Promise[] = []; + /** Holds promises that resolves once *all* animations for a reward have finished playing */ + const rewardAnimAllSettledPromises: Promise[] = []; + + /* + * A counter here is used instead of a loop to "stagger" the apperance of each reward, + * using `sine.easeIn` to speed up the appearance of the rewards as each animation progresses. + * + * The `onComplete` callback for this tween is set to resolve once the upgrade animations + * for each reward has finished playing, allowing for the next set of animations to + * start to appear. + */ globalScene.tweens.addCounter({ ease: "Sine.easeIn", duration: 1250, @@ -288,30 +300,35 @@ export class ModifierSelectUiHandler extends AwaitableUiHandler { const index = Math.floor(value * typeOptions.length); if (index > i && index <= typeOptions.length) { const option = this.options[i]; - option?.show( - Math.floor((1 - value) * 1250) * 0.325 + 2000 * maxUpgradeCount, - -(maxUpgradeCount - typeOptions[i].upgradeCount), - ); + if (option) { + rewardAnimPromises.push( + option.show( + Math.floor((1 - value) * 1250) * 0.325 + 2000 * maxUpgradeCount, + -(maxUpgradeCount - typeOptions[i].upgradeCount), + rewardAnimAllSettledPromises, + ), + ); + } i++; } }, onComplete: () => { - tweenResolve(); + Promise.allSettled(rewardAnimPromises).then(() => tweenResolve()); }, }); - let shopResolve: () => void; - const shopPromise = new Promise(resolve => (shopResolve = resolve)); - tweenPromise.then(() => { - globalScene.time.delayedCall(1000, () => { - for (const shopOption of this.shopOptionsRows.flat()) { - shopOption.show(0, 0); - } - shopResolve(); - }); + /** Holds promises that resolve once each shop item has finished animating */ + const shopAnimPromises: Promise[] = []; + globalScene.time.delayedCall(1000 + maxUpgradeCount * 2000, () => { + for (const shopOption of this.shopOptionsRows.flat()) { + // It is safe to skip awaiting the `show` method here, + // as the promise it returns is also part of the promise appended to `shopAnimPromises`, + // which is awaited later on. + shopOption.show(0, 0, shopAnimPromises, false); + } }); - shopPromise.then(() => { + tweenPromise.then(() => { globalScene.time.delayedCall(500, () => { if (partyHasHeldItem) { this.transferButtonContainer.setAlpha(0); @@ -344,31 +361,39 @@ export class ModifierSelectUiHandler extends AwaitableUiHandler { duration: 250, }); - const updateCursorTarget = () => { - if (globalScene.shopCursorTarget === ShopCursorTarget.CHECK_TEAM) { - this.setRowCursor(0); - this.setCursor(2); - } else if (globalScene.shopCursorTarget === ShopCursorTarget.SHOP && globalScene.gameMode.hasNoShop) { - this.setRowCursor(ShopCursorTarget.REWARDS); - this.setCursor(0); - } else { - this.setRowCursor(globalScene.shopCursorTarget); - this.setCursor(0); - } - }; + // Ensure that the reward animations have completed before allowing input to proceed. + // Required to ensure that the user cannot interact with the UI before the animations + // have completed, (which, among other things, would allow the GameObjects to be destroyed + // before the animations have completed, causing errors). + Promise.allSettled([...shopAnimPromises, ...rewardAnimAllSettledPromises]).then(() => { + const updateCursorTarget = () => { + if (globalScene.shopCursorTarget === ShopCursorTarget.CHECK_TEAM) { + this.setRowCursor(0); + this.setCursor(2); + } else if (globalScene.shopCursorTarget === ShopCursorTarget.SHOP && globalScene.gameMode.hasNoShop) { + this.setRowCursor(ShopCursorTarget.REWARDS); + this.setCursor(0); + } else { + this.setRowCursor(globalScene.shopCursorTarget); + this.setCursor(0); + } + }; - updateCursorTarget(); + updateCursorTarget(); - handleTutorial(Tutorial.Select_Item).then(res => { - if (res) { - updateCursorTarget(); - } - this.awaitingActionInput = true; - this.onActionInput = args[2]; + handleTutorial(Tutorial.Select_Item).then(res => { + if (res) { + updateCursorTarget(); + } + this.awaitingActionInput = true; + this.onActionInput = args[2]; + }); }); }); }); + // #endregion: animation + return true; } @@ -820,14 +845,45 @@ class ModifierOption extends Phaser.GameObjects.Container { } } - show(remainingDuration: number, upgradeCountOffset: number) { - if (!this.modifierTypeOption.cost) { + /** + * Start the tweens responsible for animating the option's appearance + * + * @privateremarks + * This method is unusual. It "returns" (one via the actual return, one by via appending to the `promiseHolder` + * parameter) two promises. The promise returned by the method resolves once the option's appearance animations have + * completed, and is meant to allow callers to synchronize with the completion of the option's appearance animations. + * The promise appended to `promiseHolder` resolves once *all* animations started by this method have completed, + * and should be used by callers to ensure that all animations have completed before proceeding. + * + * @param remainingDuration - The duration in milliseconds that the animation can play for + * @param upgradeCountOffset - The offset to apply to the upgrade count for options whose rarity is being upgraded + * @param promiseHolder - A promise that resolves once all tweens started by this method have completed will be pushed to this array. + * @param isReward - Whether the option being shown is a reward, meaning it should show pokeball and upgrade animations. + * @returns A promise that resolves once the *option's apperance animations* have completed. This promise will resolve _before_ all + * promises that are initiated in this method complete. Instead, the `promiseHolder` array will contain a new promise + * that will resolve once all animations have completed. + * + */ + async show( + remainingDuration: number, + upgradeCountOffset: number, + promiseHolder: Promise[], + isReward = true, + ): Promise { + /** Promises for the pokeball and upgrade animations */ + const animPromises: Promise[] = []; + if (isReward) { + const { promise: bouncePromise, resolve: resolveBounce } = Promise.withResolvers(); globalScene.tweens.add({ targets: this.pb, y: 0, duration: 1250, ease: "Bounce.Out", + onComplete: () => { + resolveBounce(); + }, }); + animPromises.push(bouncePromise); let lastValue = 1; let bounceCount = 0; @@ -857,7 +913,9 @@ class ModifierOption extends Phaser.GameObjects.Container { // TODO: Figure out proper delay between chains and then convert this into a single tween chain // rather than starting multiple tween chains. + for (let u = 0; u < this.modifierTypeOption.upgradeCount; u++) { + const { resolve, promise } = Promise.withResolvers(); globalScene.tweens.chain({ tweens: [ { @@ -883,65 +941,99 @@ class ModifierOption extends Phaser.GameObjects.Container { ease: "Sine.easeOut", onComplete: () => { this.pbTint.setVisible(false); + resolve(); }, }, ], }); + animPromises.push(promise); } } + const finalPromises: Promise[] = []; globalScene.time.delayedCall(remainingDuration + 2000, () => { - if (!globalScene) { - return; - } - - if (!this.modifierTypeOption.cost) { + if (isReward) { this.pb.setTexture("pb", `${this.getPbAtlasKey(0)}_open`); globalScene.playSound("se/pb_rel"); + const { resolve: pbResolve, promise: pbPromise } = Promise.withResolvers(); + globalScene.tweens.add({ targets: this.pb, duration: 500, - delay: 250, ease: "Sine.easeIn", alpha: 0, - onComplete: () => this.pb.destroy(), + onComplete: () => { + Promise.allSettled(animPromises).then(() => this.pb.destroy()); + pbResolve(); + }, }); + finalPromises.push(pbPromise); } + /** Delay for the rest of the tweens to ensure they show after the pokeball animation begins to appear */ + const delay = isReward ? 250 : 0; + + const { resolve: itemResolve, promise: itemPromise } = Promise.withResolvers(); globalScene.tweens.add({ targets: this.itemContainer, + delay, duration: 500, ease: "Elastic.Out", scale: 2, alpha: 1, + onComplete: () => { + itemResolve(); + }, }); - if (!this.modifierTypeOption.cost) { + finalPromises.push(itemPromise); + + if (isReward) { + const { resolve: itemTintResolve, promise: itemTintPromise } = Promise.withResolvers(); globalScene.tweens.add({ targets: this.itemTint, alpha: 0, + delay, duration: 500, ease: "Sine.easeIn", - onComplete: () => this.itemTint.destroy(), + onComplete: () => { + this.itemTint.destroy(); + itemTintResolve(); + }, }); + finalPromises.push(itemTintPromise); } + + const { resolve: itemTextResolve, promise: itemTextPromise } = Promise.withResolvers(); globalScene.tweens.add({ targets: this.itemText, + delay, duration: 500, alpha: 1, y: 25, ease: "Cubic.easeInOut", + onComplete: () => itemTextResolve(), }); + finalPromises.push(itemTextPromise); + if (this.itemCostText) { + const { resolve: itemCostResolve, promise: itemCostPromise } = Promise.withResolvers(); globalScene.tweens.add({ targets: this.itemCostText, + delay, duration: 500, alpha: 1, y: 35, ease: "Cubic.easeInOut", + onComplete: () => itemCostResolve(), }); + finalPromises.push(itemCostPromise); } }); + // The `.then` suppresses the return type for the Promise.allSettled so that it returns void. + promiseHolder.push(Promise.allSettled([...animPromises, ...finalPromises]).then()); + + await Promise.allSettled(animPromises); } getPbAtlasKey(tierOffset = 0) { diff --git a/src/ui/move-info-overlay.ts b/src/ui/move-info-overlay.ts index 1747021b7ec..f8632eb244e 100644 --- a/src/ui/move-info-overlay.ts +++ b/src/ui/move-info-overlay.ts @@ -1,9 +1,10 @@ import type { InfoToggle } from "#app/battle-scene"; import { globalScene } from "#app/global-scene"; -import { MoveCategory } from "#enums/MoveCategory"; +import { MoveCategory } from "#enums/move-category"; import { PokemonType } from "#enums/pokemon-type"; +import { TextStyle } from "#enums/text-style"; import type { Move } from "#moves/move"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import { addWindow } from "#ui/ui-theme"; import { fixedInt, getLocalizedSpriteKey } from "#utils/common"; import i18next from "i18next"; diff --git a/src/ui/mystery-encounter-ui-handler.ts b/src/ui/mystery-encounter-ui-handler.ts index 37f0efb50e4..b6bc464855c 100644 --- a/src/ui/mystery-encounter-ui-handler.ts +++ b/src/ui/mystery-encounter-ui-handler.ts @@ -3,13 +3,14 @@ import { getPokeballAtlasKey } from "#data/pokeball"; import { Button } from "#enums/buttons"; import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode"; import { MysteryEncounterTier } from "#enums/mystery-encounter-tier"; +import { TextStyle } from "#enums/text-style"; import { UiMode } from "#enums/ui-mode"; import { getEncounterText } from "#mystery-encounters/encounter-dialogue-utils"; import type { OptionSelectSettings } from "#mystery-encounters/encounter-phase-utils"; import type { MysteryEncounterOption } from "#mystery-encounters/mystery-encounter-option"; import type { MysteryEncounterPhase } from "#phases/mystery-encounter-phases"; import { PartyUiMode } from "#ui/party-ui-handler"; -import { addBBCodeTextObject, getBBCodeFrag, TextStyle } from "#ui/text"; +import { addBBCodeTextObject, getBBCodeFrag } from "#ui/text"; import { UiHandler } from "#ui/ui-handler"; import { addWindow, WindowVariant } from "#ui/ui-theme"; import { fixedInt, isNullOrUndefined } from "#utils/common"; diff --git a/src/ui/party-exp-bar.ts b/src/ui/party-exp-bar.ts index 0d6ec936a92..952a1f8227a 100644 --- a/src/ui/party-exp-bar.ts +++ b/src/ui/party-exp-bar.ts @@ -1,6 +1,7 @@ import { globalScene } from "#app/global-scene"; +import { TextStyle } from "#enums/text-style"; import type { Pokemon } from "#field/pokemon"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import i18next from "i18next"; export class PartyExpBar extends Phaser.GameObjects.Container { diff --git a/src/ui/party-ui-handler.ts b/src/ui/party-ui-handler.ts index 1990f43cfd6..ee753827838 100644 --- a/src/ui/party-ui-handler.ts +++ b/src/ui/party-ui-handler.ts @@ -13,6 +13,7 @@ import { MoveId } from "#enums/move-id"; import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; +import { TextStyle } from "#enums/text-style"; import { UiMode } from "#enums/ui-mode"; import type { PlayerPokemon, Pokemon } from "#field/pokemon"; import type { PokemonFormChangeItemModifier, PokemonHeldItemModifier } from "#modifiers/modifier"; @@ -23,9 +24,10 @@ import type { TurnMove } from "#types/turn-move"; import { MessageUiHandler } from "#ui/message-ui-handler"; import { MoveInfoOverlay } from "#ui/move-info-overlay"; import { PokemonIconAnimHandler, PokemonIconAnimMode } from "#ui/pokemon-icon-anim-handler"; -import { addBBCodeTextObject, addTextObject, getTextColor, TextStyle } from "#ui/text"; +import { addBBCodeTextObject, addTextObject, getTextColor } from "#ui/text"; import { addWindow } from "#ui/ui-theme"; -import { BooleanHolder, getLocalizedSpriteKey, randInt, toReadableString } from "#utils/common"; +import { BooleanHolder, getLocalizedSpriteKey, randInt } from "#utils/common"; +import { toTitleCase } from "#utils/strings"; import i18next from "i18next"; import type BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext"; @@ -1571,7 +1573,7 @@ export class PartyUiHandler extends MessageUiHandler { if (this.localizedOptions.includes(option)) { optionName = i18next.t(`partyUiHandler:${PartyOption[option]}`); } else { - optionName = toReadableString(PartyOption[option]); + optionName = toTitleCase(PartyOption[option]); } } break; @@ -1955,17 +1957,16 @@ class PartySlot extends Phaser.GameObjects.Container { const shinyStar = globalScene.add.image(0, 0, `shiny_star_small${doubleShiny ? "_1" : ""}`); shinyStar.setOrigin(0, 0); shinyStar.setPositionRelative(this.slotName, -9, 3); - shinyStar.setTint(getVariantTint(this.pokemon.getBaseVariant(doubleShiny))); + shinyStar.setTint(getVariantTint(this.pokemon.getBaseVariant())); slotInfoContainer.add(shinyStar); if (doubleShiny) { - const fusionShinyStar = globalScene.add.image(0, 0, "shiny_star_small_2"); - fusionShinyStar.setOrigin(0, 0); - fusionShinyStar.setPosition(shinyStar.x, shinyStar.y); - fusionShinyStar.setTint( - getVariantTint(this.pokemon.summonData.illusion?.basePokemon.fusionVariant ?? this.pokemon.fusionVariant), - ); + const fusionShinyStar = globalScene.add + .image(0, 0, "shiny_star_small_2") + .setOrigin(0) + .setPosition(shinyStar.x, shinyStar.y) + .setTint(getVariantTint(this.pokemon.fusionVariant)); slotInfoContainer.add(fusionShinyStar); } diff --git a/src/ui/pokedex-info-overlay.ts b/src/ui/pokedex-info-overlay.ts index 6d3b8f1009f..0f2f5fa3dde 100644 --- a/src/ui/pokedex-info-overlay.ts +++ b/src/ui/pokedex-info-overlay.ts @@ -1,6 +1,7 @@ import type { InfoToggle } from "#app/battle-scene"; import { globalScene } from "#app/global-scene"; -import { addTextObject, TextStyle } from "#ui/text"; +import { TextStyle } from "#enums/text-style"; +import { addTextObject } from "#ui/text"; import { addWindow } from "#ui/ui-theme"; import { fixedInt } from "#utils/common"; diff --git a/src/ui/pokedex-mon-container.ts b/src/ui/pokedex-mon-container.ts index 73799870e6b..cfb8555e6c9 100644 --- a/src/ui/pokedex-mon-container.ts +++ b/src/ui/pokedex-mon-container.ts @@ -1,7 +1,8 @@ import { globalScene } from "#app/global-scene"; import type { PokemonSpecies } from "#data/pokemon-species"; +import { TextStyle } from "#enums/text-style"; import type { Variant } from "#sprites/variant"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import { isNullOrUndefined } from "#utils/common"; interface SpeciesDetails { diff --git a/src/ui/pokedex-page-ui-handler.ts b/src/ui/pokedex-page-ui-handler.ts index ff96aa55772..49ce5b64d9f 100644 --- a/src/ui/pokedex-page-ui-handler.ts +++ b/src/ui/pokedex-page-ui-handler.ts @@ -38,6 +38,7 @@ import type { Nature } from "#enums/nature"; import { Passive as PassiveAttr } from "#enums/passive"; import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; +import { TextStyle } from "#enums/text-style"; import { TimeOfDay } from "#enums/time-of-day"; import { UiMode } from "#enums/ui-mode"; import type { Variant } from "#sprites/variant"; @@ -51,18 +52,12 @@ import { MessageUiHandler } from "#ui/message-ui-handler"; import { MoveInfoOverlay } from "#ui/move-info-overlay"; import { PokedexInfoOverlay } from "#ui/pokedex-info-overlay"; import { StatsContainer } from "#ui/stats-container"; -import { addBBCodeTextObject, addTextObject, getTextColor, getTextStyleOptions, TextStyle } from "#ui/text"; +import { addBBCodeTextObject, addTextObject, getTextColor, getTextStyleOptions } from "#ui/text"; import { addWindow } from "#ui/ui-theme"; -import { - BooleanHolder, - getLocalizedSpriteKey, - isNullOrUndefined, - padInt, - rgbHexToRgba, - toReadableString, -} from "#utils/common"; +import { BooleanHolder, getLocalizedSpriteKey, isNullOrUndefined, padInt, rgbHexToRgba } from "#utils/common"; import { getEnumValues } from "#utils/enums"; import { getPokemonSpecies } from "#utils/pokemon-utils"; +import { toTitleCase } from "#utils/strings"; import { argbFromRgba } from "@material/material-color-utilities"; import i18next from "i18next"; import type BBCodeText from "phaser3-rex-plugins/plugins/gameobjects/tagtext/bbcodetext/BBCodeText"; @@ -2619,7 +2614,7 @@ export class PokedexPageUiHandler extends MessageUiHandler { // Setting growth rate text if (isFormCaught) { - let growthReadable = toReadableString(GrowthRate[species.growthRate]); + let growthReadable = toTitleCase(GrowthRate[species.growthRate]); const growthAux = growthReadable.replace(" ", "_"); if (i18next.exists("growth:" + growthAux)) { growthReadable = i18next.t(("growth:" + growthAux) as any); diff --git a/src/ui/pokedex-ui-handler.ts b/src/ui/pokedex-ui-handler.ts index c2f595cb190..5d49e867b59 100644 --- a/src/ui/pokedex-ui-handler.ts +++ b/src/ui/pokedex-ui-handler.ts @@ -26,6 +26,7 @@ import type { Nature } from "#enums/nature"; import { Passive as PassiveAttr } from "#enums/passive"; import { PokemonType } from "#enums/pokemon-type"; import type { SpeciesId } from "#enums/species-id"; +import { TextStyle } from "#enums/text-style"; import { UiMode } from "#enums/ui-mode"; import type { Variant } from "#sprites/variant"; import { getVariantIcon, getVariantTint } from "#sprites/variant"; @@ -40,7 +41,7 @@ import { MessageUiHandler } from "#ui/message-ui-handler"; import { PokedexMonContainer } from "#ui/pokedex-mon-container"; import { PokemonIconAnimHandler, PokemonIconAnimMode } from "#ui/pokemon-icon-anim-handler"; import { ScrollBar } from "#ui/scroll-bar"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import { addWindow } from "#ui/ui-theme"; import { BooleanHolder, fixedInt, getLocalizedSpriteKey, padInt, randIntRange, rgbHexToRgba } from "#utils/common"; import type { StarterPreferences } from "#utils/data"; diff --git a/src/ui/pokemon-hatch-info-container.ts b/src/ui/pokemon-hatch-info-container.ts index 8bcd62316cd..9c223adf837 100644 --- a/src/ui/pokemon-hatch-info-container.ts +++ b/src/ui/pokemon-hatch-info-container.ts @@ -8,9 +8,10 @@ import { Gender } from "#data/gender"; import { getPokemonSpeciesForm } from "#data/pokemon-species"; import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; +import { TextStyle } from "#enums/text-style"; import type { PlayerPokemon } from "#field/pokemon"; import { PokemonInfoContainer } from "#ui/pokemon-info-container"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import { padInt, rgbHexToRgba } from "#utils/common"; import { argbFromRgba } from "@material/material-color-utilities"; diff --git a/src/ui/pokemon-info-container.ts b/src/ui/pokemon-info-container.ts index c95f412c834..3b2349348a8 100644 --- a/src/ui/pokemon-info-container.ts +++ b/src/ui/pokemon-info-container.ts @@ -3,13 +3,14 @@ import { Gender, getGenderColor, getGenderSymbol } from "#data/gender"; import { getNatureName } from "#data/nature"; import { DexAttr } from "#enums/dex-attr"; import { PokemonType } from "#enums/pokemon-type"; +import { TextStyle } from "#enums/text-style"; import type { Pokemon } from "#field/pokemon"; import { getVariantTint } from "#sprites/variant"; import type { StarterDataEntry } from "#system/game-data"; import type { DexEntry } from "#types/dex-data"; import { ConfirmUiHandler } from "#ui/confirm-ui-handler"; import { StatsContainer } from "#ui/stats-container"; -import { addBBCodeTextObject, addTextObject, getTextColor, TextStyle } from "#ui/text"; +import { addBBCodeTextObject, addTextObject, getTextColor } from "#ui/text"; import { addWindow } from "#ui/ui-theme"; import { fixedInt, getShinyDescriptor } from "#utils/common"; import i18next from "i18next"; diff --git a/src/ui/registration-form-ui-handler.ts b/src/ui/registration-form-ui-handler.ts index 2466603af71..60f8d1d987f 100644 --- a/src/ui/registration-form-ui-handler.ts +++ b/src/ui/registration-form-ui-handler.ts @@ -1,10 +1,11 @@ import { pokerogueApi } from "#api/pokerogue-api"; import { globalScene } from "#app/global-scene"; +import { TextStyle } from "#enums/text-style"; import { UiMode } from "#enums/ui-mode"; import type { InputFieldConfig } from "#ui/form-modal-ui-handler"; import { FormModalUiHandler } from "#ui/form-modal-ui-handler"; import type { ModalConfig } from "#ui/modal-ui-handler"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import i18next from "i18next"; interface LanguageSetting { diff --git a/src/ui/run-history-ui-handler.ts b/src/ui/run-history-ui-handler.ts index f810468aea1..00aa47ae65d 100644 --- a/src/ui/run-history-ui-handler.ts +++ b/src/ui/run-history-ui-handler.ts @@ -3,13 +3,14 @@ import { BattleType } from "#enums/battle-type"; import { Button } from "#enums/buttons"; import { GameModes } from "#enums/game-modes"; import { PlayerGender } from "#enums/player-gender"; +import { TextStyle } from "#enums/text-style"; import { TrainerVariant } from "#enums/trainer-variant"; import { UiMode } from "#enums/ui-mode"; import type { RunEntry } from "#system/game-data"; import type { PokemonData } from "#system/pokemon-data"; import { MessageUiHandler } from "#ui/message-ui-handler"; import { RunDisplayMode } from "#ui/run-info-ui-handler"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import { addWindow } from "#ui/ui-theme"; import { fixedInt, formatLargeNumber } from "#utils/common"; import i18next from "i18next"; diff --git a/src/ui/run-info-ui-handler.ts b/src/ui/run-info-ui-handler.ts index 29f95c4e4c8..465e48a45ad 100644 --- a/src/ui/run-info-ui-handler.ts +++ b/src/ui/run-info-ui-handler.ts @@ -12,6 +12,7 @@ import type { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { PlayerGender } from "#enums/player-gender"; import { PokemonType } from "#enums/pokemon-type"; import type { SpeciesId } from "#enums/species-id"; +import { TextStyle } from "#enums/text-style"; import { TrainerVariant } from "#enums/trainer-variant"; import { UiMode } from "#enums/ui-mode"; // biome-ignore lint/performance/noNamespaceImport: See `src/system/game-data.ts` @@ -21,7 +22,7 @@ import { getVariantTint } from "#sprites/variant"; import type { SessionSaveData } from "#system/game-data"; import type { PokemonData } from "#system/pokemon-data"; import { SettingKeyboard } from "#system/settings-keyboard"; -import { addBBCodeTextObject, addTextObject, getTextColor, TextStyle } from "#ui/text"; +import { addBBCodeTextObject, addTextObject, getTextColor } from "#ui/text"; import { UiHandler } from "#ui/ui-handler"; import { addWindow } from "#ui/ui-theme"; import { formatFancyLargeNumber, formatLargeNumber, formatMoney, getPlayTimeString } from "#utils/common"; diff --git a/src/ui/save-slot-select-ui-handler.ts b/src/ui/save-slot-select-ui-handler.ts index bcbe60265cd..9da34e672f1 100644 --- a/src/ui/save-slot-select-ui-handler.ts +++ b/src/ui/save-slot-select-ui-handler.ts @@ -1,6 +1,7 @@ import { GameMode } from "#app/game-mode"; import { globalScene } from "#app/global-scene"; import { Button } from "#enums/buttons"; +import { TextStyle } from "#enums/text-style"; import { UiMode } from "#enums/ui-mode"; // biome-ignore lint/performance/noNamespaceImport: See `src/system/game-data.ts` import * as Modifier from "#modifiers/modifier"; @@ -8,7 +9,7 @@ import type { SessionSaveData } from "#system/game-data"; import type { PokemonData } from "#system/pokemon-data"; import { MessageUiHandler } from "#ui/message-ui-handler"; import { RunDisplayMode } from "#ui/run-info-ui-handler"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import { addWindow } from "#ui/ui-theme"; import { fixedInt, formatLargeNumber, getPlayTimeString, isNullOrUndefined } from "#utils/common"; import i18next from "i18next"; diff --git a/src/ui/session-reload-modal-ui-handler.ts b/src/ui/session-reload-modal-ui-handler.ts index ab1197324a6..1f5a205f990 100644 --- a/src/ui/session-reload-modal-ui-handler.ts +++ b/src/ui/session-reload-modal-ui-handler.ts @@ -1,7 +1,8 @@ +import { TextStyle } from "#enums/text-style"; import type { UiMode } from "#enums/ui-mode"; import type { ModalConfig } from "#ui/modal-ui-handler"; import { ModalUiHandler } from "#ui/modal-ui-handler"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; export class SessionReloadModalUiHandler extends ModalUiHandler { constructor(mode: UiMode | null = null) { diff --git a/src/ui/settings/abstract-binding-ui-handler.ts b/src/ui/settings/abstract-binding-ui-handler.ts index aaf3572b489..eb68456a69d 100644 --- a/src/ui/settings/abstract-binding-ui-handler.ts +++ b/src/ui/settings/abstract-binding-ui-handler.ts @@ -1,8 +1,9 @@ import { globalScene } from "#app/global-scene"; import { Button } from "#enums/buttons"; +import { TextStyle } from "#enums/text-style"; import type { UiMode } from "#enums/ui-mode"; -import { NavigationManager } from "#ui/navigationMenu"; -import { addTextObject, TextStyle } from "#ui/text"; +import { NavigationManager } from "#ui/navigation-menu"; +import { addTextObject } from "#ui/text"; import { UiHandler } from "#ui/ui-handler"; import { addWindow } from "#ui/ui-theme"; import i18next from "i18next"; diff --git a/src/ui/settings/abstract-control-settings-ui-handler.ts b/src/ui/settings/abstract-control-settings-ui-handler.ts index 67cc3ad7c03..ee9e990ee2a 100644 --- a/src/ui/settings/abstract-control-settings-ui-handler.ts +++ b/src/ui/settings/abstract-control-settings-ui-handler.ts @@ -2,13 +2,15 @@ import { globalScene } from "#app/global-scene"; import type { InterfaceConfig } from "#app/inputs-controller"; import { Button } from "#enums/buttons"; import type { Device } from "#enums/devices"; +import { TextStyle } from "#enums/text-style"; import type { UiMode } from "#enums/ui-mode"; -import { getIconWithSettingName } from "#inputs/configHandler"; -import { NavigationManager, NavigationMenu } from "#ui/navigationMenu"; +import { getIconWithSettingName } from "#inputs/config-handler"; +import { NavigationManager, NavigationMenu } from "#ui/navigation-menu"; import { ScrollBar } from "#ui/scroll-bar"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import { UiHandler } from "#ui/ui-handler"; import { addWindow } from "#ui/ui-theme"; +import { toCamelCase } from "#utils/strings"; import i18next from "i18next"; export interface InputsIcons { @@ -87,12 +89,6 @@ export abstract class AbstractControlSettingsUiHandler extends UiHandler { return settings; } - private camelize(string: string): string { - return string - .replace(/(?:^\w|[A-Z]|\b\w)/g, (word, index) => (index === 0 ? word.toLowerCase() : word.toUpperCase())) - .replace(/\s+/g, ""); - } - /** * Setup UI elements. */ @@ -209,14 +205,15 @@ export abstract class AbstractControlSettingsUiHandler extends UiHandler { settingFiltered.forEach((setting, s) => { // Convert the setting key from format 'Key_Name' to 'Key name' for display. - const settingName = setting.replace(/_/g, " "); + // TODO: IDK if this can be followed by both an underscore and a space, so leaving it as a regex matching both for now + const i18nKey = toCamelCase(setting.replace(/Alt(_| )/, "")); // Create and add a text object for the setting name to the scene. const isLock = this.settingBlacklisted.includes(this.setting[setting]); const labelStyle = isLock ? TextStyle.SETTINGS_LOCKED : TextStyle.SETTINGS_LABEL; + const isAlt = setting.includes("Alt"); let labelText: string; - const i18nKey = this.camelize(settingName.replace("Alt ", "")); - if (settingName.toLowerCase().includes("alt")) { + if (isAlt) { labelText = `${i18next.t(`settings:${i18nKey}`)}${i18next.t("settings:alt")}`; } else { labelText = i18next.t(`settings:${i18nKey}`); diff --git a/src/ui/settings/abstract-settings-ui-handler.ts b/src/ui/settings/abstract-settings-ui-handler.ts index 303ad229ea6..81d733220fc 100644 --- a/src/ui/settings/abstract-settings-ui-handler.ts +++ b/src/ui/settings/abstract-settings-ui-handler.ts @@ -1,13 +1,14 @@ import { globalScene } from "#app/global-scene"; import { Button } from "#enums/buttons"; +import { TextStyle } from "#enums/text-style"; import { UiMode } from "#enums/ui-mode"; import type { SettingType } from "#system/settings"; import { Setting, SettingKeys } from "#system/settings"; import type { InputsIcons } from "#ui/abstract-control-settings-ui-handler"; import { MessageUiHandler } from "#ui/message-ui-handler"; -import { NavigationManager, NavigationMenu } from "#ui/navigationMenu"; +import { NavigationManager, NavigationMenu } from "#ui/navigation-menu"; import { ScrollBar } from "#ui/scroll-bar"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import { addWindow } from "#ui/ui-theme"; import i18next from "i18next"; diff --git a/src/ui/settings/gamepad-binding-ui-handler.ts b/src/ui/settings/gamepad-binding-ui-handler.ts index c514e93ec51..53d606b6f84 100644 --- a/src/ui/settings/gamepad-binding-ui-handler.ts +++ b/src/ui/settings/gamepad-binding-ui-handler.ts @@ -1,9 +1,10 @@ import { globalScene } from "#app/global-scene"; import { Device } from "#enums/devices"; +import { TextStyle } from "#enums/text-style"; import type { UiMode } from "#enums/ui-mode"; -import { getIconWithSettingName, getKeyWithKeycode } from "#inputs/configHandler"; +import { getIconWithSettingName, getKeyWithKeycode } from "#inputs/config-handler"; import { AbstractBindingUiHandler } from "#ui/abstract-binding-ui-handler"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import i18next from "i18next"; export class GamepadBindingUiHandler extends AbstractBindingUiHandler { diff --git a/src/ui/settings/keyboard-binding-ui-handler.ts b/src/ui/settings/keyboard-binding-ui-handler.ts index a789225a8ef..b339ac16188 100644 --- a/src/ui/settings/keyboard-binding-ui-handler.ts +++ b/src/ui/settings/keyboard-binding-ui-handler.ts @@ -1,9 +1,10 @@ import { globalScene } from "#app/global-scene"; import { Device } from "#enums/devices"; +import { TextStyle } from "#enums/text-style"; import type { UiMode } from "#enums/ui-mode"; -import { getKeyWithKeycode } from "#inputs/configHandler"; +import { getKeyWithKeycode } from "#inputs/config-handler"; import { AbstractBindingUiHandler } from "#ui/abstract-binding-ui-handler"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import i18next from "i18next"; export class KeyboardBindingUiHandler extends AbstractBindingUiHandler { diff --git a/src/ui/settings/navigationMenu.ts b/src/ui/settings/navigation-menu.ts similarity index 98% rename from src/ui/settings/navigationMenu.ts rename to src/ui/settings/navigation-menu.ts index 1303c32d3a5..2f3aa50f7f3 100644 --- a/src/ui/settings/navigationMenu.ts +++ b/src/ui/settings/navigation-menu.ts @@ -1,8 +1,9 @@ import { globalScene } from "#app/global-scene"; import { Button } from "#enums/buttons"; +import { TextStyle } from "#enums/text-style"; import { UiMode } from "#enums/ui-mode"; import type { InputsIcons } from "#ui/abstract-control-settings-ui-handler"; -import { addTextObject, setTextStyle, TextStyle } from "#ui/text"; +import { addTextObject, setTextStyle } from "#ui/text"; import { addWindow } from "#ui/ui-theme"; import i18next from "i18next"; diff --git a/src/ui/settings/settings-gamepad-ui-handler.ts b/src/ui/settings/settings-gamepad-ui-handler.ts index 63dd4c74618..57a70411f4c 100644 --- a/src/ui/settings/settings-gamepad-ui-handler.ts +++ b/src/ui/settings/settings-gamepad-ui-handler.ts @@ -1,10 +1,11 @@ import { globalScene } from "#app/global-scene"; import type { InterfaceConfig } from "#app/inputs-controller"; import { Device } from "#enums/devices"; +import { TextStyle } from "#enums/text-style"; import type { UiMode } from "#enums/ui-mode"; -import pad_dualshock from "#inputs/pad_dualshock"; -import pad_unlicensedSNES from "#inputs/pad_unlicensedSNES"; -import pad_xbox360 from "#inputs/pad_xbox360"; +import pad_dualshock from "#inputs/pad-dualshock"; +import pad_unlicensedSNES from "#inputs/pad-unlicensed-snes"; +import pad_xbox360 from "#inputs/pad-xbox360"; import { SettingGamepad, setSettingGamepad, @@ -13,7 +14,7 @@ import { settingGamepadOptions, } from "#system/settings-gamepad"; import { AbstractControlSettingsUiHandler } from "#ui/abstract-control-settings-ui-handler"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import { truncateString } from "#utils/common"; import i18next from "i18next"; diff --git a/src/ui/settings/settings-keyboard-ui-handler.ts b/src/ui/settings/settings-keyboard-ui-handler.ts index 581e3e938be..295a71abe36 100644 --- a/src/ui/settings/settings-keyboard-ui-handler.ts +++ b/src/ui/settings/settings-keyboard-ui-handler.ts @@ -1,9 +1,10 @@ import { globalScene } from "#app/global-scene"; import type { InterfaceConfig } from "#app/inputs-controller"; import { Device } from "#enums/devices"; +import { TextStyle } from "#enums/text-style"; import { UiMode } from "#enums/ui-mode"; -import cfg_keyboard_qwerty from "#inputs/cfg_keyboard_qwerty"; -import { deleteBind } from "#inputs/configHandler"; +import cfg_keyboard_qwerty from "#inputs/cfg-keyboard-qwerty"; +import { deleteBind } from "#inputs/config-handler"; import { SettingKeyboard, setSettingKeyboard, @@ -12,9 +13,10 @@ import { settingKeyboardOptions, } from "#system/settings-keyboard"; import { AbstractControlSettingsUiHandler } from "#ui/abstract-control-settings-ui-handler"; -import { NavigationManager } from "#ui/navigationMenu"; -import { addTextObject, TextStyle } from "#ui/text"; -import { reverseValueToKeySetting, truncateString } from "#utils/common"; +import { NavigationManager } from "#ui/navigation-menu"; +import { addTextObject } from "#ui/text"; +import { truncateString } from "#utils/common"; +import { toPascalSnakeCase } from "#utils/strings"; import i18next from "i18next"; /** @@ -100,7 +102,7 @@ export class SettingsKeyboardUiHandler extends AbstractControlSettingsUiHandler } const cursor = this.cursor + this.scrollCursor; // Calculate the absolute cursor position. const selection = this.settingLabels[cursor].text; - const key = reverseValueToKeySetting(selection); + const key = toPascalSnakeCase(selection); const settingName = SettingKeyboard[key]; const activeConfig = this.getActiveConfig(); const success = deleteBind(this.getActiveConfig(), settingName); diff --git a/src/ui/settings/shiny_icons.json b/src/ui/settings/shiny_icons.json deleted file mode 100644 index f40c606ca47..00000000000 --- a/src/ui/settings/shiny_icons.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "textures": [ - { - "image": "shiny_icons.png", - "format": "RGBA8888", - "size": { - "w": 45, - "h": 14 - }, - "scale": 1, - "frames": [ - { - "filename": "0", - "rotated": false, - "trimmed": false, - "sourceSize": { - "w": 45, - "h": 14 - }, - "spriteSourceSize": { - "x": 0, - "y": 0, - "w": 15, - "h": 14 - }, - "frame": { - "x": 0, - "y": 0, - "w": 15, - "h": 14 - } - } - ] - } - ], - "meta": { - "app": "https://www.codeandweb.com/texturepacker", - "version": "3.0", - "smartupdate": "$TexturePacker:SmartUpdate:a3275c7504a9b35b288265e191b1d14c:420725f3fb73c2cac0ab3bbc0a46f2e1:3a8b8ca0f0e4be067dd46c07b78ee013$" - } -} diff --git a/src/ui/starter-container.ts b/src/ui/starter-container.ts index 4c174dc5955..f81ac8e5bfb 100644 --- a/src/ui/starter-container.ts +++ b/src/ui/starter-container.ts @@ -1,6 +1,7 @@ import { globalScene } from "#app/global-scene"; import type { PokemonSpecies } from "#data/pokemon-species"; -import { addTextObject, TextStyle } from "#ui/text"; +import { TextStyle } from "#enums/text-style"; +import { addTextObject } from "#ui/text"; export class StarterContainer extends Phaser.GameObjects.Container { public species: PokemonSpecies; diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index 18a3fbc30a3..e8f9b5e1c38 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -39,6 +39,7 @@ import type { Nature } from "#enums/nature"; import { Passive as PassiveAttr } from "#enums/passive"; import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; +import { TextStyle } from "#enums/text-style"; import { UiMode } from "#enums/ui-mode"; import type { CandyUpgradeNotificationChangedEvent } from "#events/battle-scene"; import { BattleSceneEventType } from "#events/battle-scene"; @@ -57,7 +58,7 @@ import { PokemonIconAnimHandler, PokemonIconAnimMode } from "#ui/pokemon-icon-an import { ScrollBar } from "#ui/scroll-bar"; import { StarterContainer } from "#ui/starter-container"; import { StatsContainer } from "#ui/stats-container"; -import { addBBCodeTextObject, addTextObject, TextStyle } from "#ui/text"; +import { addBBCodeTextObject, addTextObject } from "#ui/text"; import { addWindow } from "#ui/ui-theme"; import { BooleanHolder, @@ -68,10 +69,10 @@ import { padInt, randIntRange, rgbHexToRgba, - toReadableString, } from "#utils/common"; import type { StarterPreferences } from "#utils/data"; import { loadStarterPreferences, saveStarterPreferences } from "#utils/data"; +import { toTitleCase } from "#utils/strings"; import { argbFromRgba } from "@material/material-color-utilities"; import i18next from "i18next"; import type { GameObjects } from "phaser"; @@ -1476,7 +1477,7 @@ export class StarterSelectUiHandler extends MessageUiHandler { loop: -1, // Make the initial bounce a little randomly delayed delay: randIntRange(0, 50) * 5, - loopDelay: 1000, + loopDelay: fixedInt(1000), tweens: [ { targets: icon, @@ -3526,7 +3527,7 @@ export class StarterSelectUiHandler extends MessageUiHandler { this.pokemonLuckLabelText.setVisible(this.pokemonLuckText.visible); //Growth translate - let growthReadable = toReadableString(GrowthRate[species.growthRate]); + let growthReadable = toTitleCase(GrowthRate[species.growthRate]); const growthAux = growthReadable.replace(" ", "_"); if (i18next.exists("growth:" + growthAux)) { growthReadable = i18next.t(("growth:" + growthAux) as any); diff --git a/src/ui/stats-container.ts b/src/ui/stats-container.ts index 6b89e80b80a..e9af5eed3e3 100644 --- a/src/ui/stats-container.ts +++ b/src/ui/stats-container.ts @@ -1,6 +1,7 @@ import { globalScene } from "#app/global-scene"; import { getStatKey, PERMANENT_STATS } from "#enums/stat"; -import { addBBCodeTextObject, addTextObject, getTextColor, TextStyle } from "#ui/text"; +import { TextStyle } from "#enums/text-style"; +import { addBBCodeTextObject, addTextObject, getTextColor } from "#ui/text"; import i18next from "i18next"; import type BBCodeText from "phaser3-rex-plugins/plugins/gameobjects/tagtext/bbcodetext/BBCodeText"; diff --git a/src/ui/summary-ui-handler.ts b/src/ui/summary-ui-handler.ts index da0a7f9a40f..b51bdfdb157 100644 --- a/src/ui/summary-ui-handler.ts +++ b/src/ui/summary-ui-handler.ts @@ -10,12 +10,13 @@ import { getNatureName, getNatureStatMultiplier } from "#data/nature"; import { getPokeballAtlasKey } from "#data/pokeball"; import { getTypeRgb } from "#data/type"; import { Button } from "#enums/buttons"; -import { MoveCategory } from "#enums/MoveCategory"; +import { MoveCategory } from "#enums/move-category"; import { Nature } from "#enums/nature"; import { PlayerGender } from "#enums/player-gender"; import { PokemonType } from "#enums/pokemon-type"; import { getStatKey, PERMANENT_STATS, Stat } from "#enums/stat"; import { StatusEffect } from "#enums/status-effect"; +import { TextStyle } from "#enums/text-style"; import { UiMode } from "#enums/ui-mode"; import type { PlayerPokemon } from "#field/pokemon"; import { modifierSortFunc, PokemonHeldItemModifier } from "#modifiers/modifier"; @@ -24,7 +25,7 @@ import type { PokemonMove } from "#moves/pokemon-move"; import type { Variant } from "#sprites/variant"; import { getVariantTint } from "#sprites/variant"; import { achvs } from "#system/achv"; -import { addBBCodeTextObject, addTextObject, getBBCodeFrag, TextStyle } from "#ui/text"; +import { addBBCodeTextObject, addTextObject, getBBCodeFrag } from "#ui/text"; import { UiHandler } from "#ui/ui-handler"; import { fixedInt, @@ -34,9 +35,9 @@ import { isNullOrUndefined, padInt, rgbHexToRgba, - toReadableString, } from "#utils/common"; import { getEnumValues } from "#utils/enums"; +import { toTitleCase } from "#utils/strings"; import { argbFromRgba } from "@material/material-color-utilities"; import i18next from "i18next"; @@ -354,18 +355,13 @@ export class SummaryUiHandler extends UiHandler { } catch (err: unknown) { console.error(`Failed to play animation for ${spriteKey}`, err); } - this.pokemonSprite.setPipelineData("teraColor", getTypeRgb(this.pokemon.getTeraType())); - this.pokemonSprite.setPipelineData("isTerastallized", this.pokemon.isTerastallized); - this.pokemonSprite.setPipelineData("ignoreTimeTint", true); - this.pokemonSprite.setPipelineData("spriteKey", this.pokemon.getSpriteKey()); - this.pokemonSprite.setPipelineData( - "shiny", - this.pokemon.summonData.illusion?.basePokemon.shiny ?? this.pokemon.shiny, - ); - this.pokemonSprite.setPipelineData( - "variant", - this.pokemon.summonData.illusion?.basePokemon.variant ?? this.pokemon.variant, - ); + this.pokemonSprite + .setPipelineData("teraColor", getTypeRgb(this.pokemon.getTeraType())) + .setPipelineData("isTerastallized", this.pokemon.isTerastallized) + .setPipelineData("ignoreTimeTint", true) + .setPipelineData("spriteKey", this.pokemon.getSpriteKey()) + .setPipelineData("shiny", this.pokemon.shiny) + .setPipelineData("variant", this.pokemon.variant); ["spriteColors", "fusionSpriteColors"].map(k => { delete this.pokemonSprite.pipelineData[`${k}Base`]; if (this.pokemon?.summonData.speciesForm) { @@ -463,9 +459,7 @@ export class SummaryUiHandler extends UiHandler { this.fusionShinyIcon.setPosition(this.shinyIcon.x, this.shinyIcon.y); this.fusionShinyIcon.setVisible(doubleShiny); if (isFusion) { - this.fusionShinyIcon.setTint( - getVariantTint(this.pokemon.summonData.illusion?.basePokemon.fusionVariant ?? this.pokemon.fusionVariant), - ); + this.fusionShinyIcon.setTint(getVariantTint(this.pokemon.fusionVariant)); } this.pokeball.setFrame(getPokeballAtlasKey(this.pokemon.pokeball)); @@ -810,24 +804,34 @@ export class SummaryUiHandler extends UiHandler { case Page.PROFILE: { const profileContainer = globalScene.add.container(0, -pageBg.height); pageContainer.add(profileContainer); + const otColor = + globalScene.gameData.gender === PlayerGender.FEMALE ? TextStyle.SUMMARY_PINK : TextStyle.SUMMARY_BLUE; + const usernameReplacement = + globalScene.gameData.gender === PlayerGender.FEMALE + ? i18next.t("trainerNames:player_f") + : i18next.t("trainerNames:player_m"); // TODO: should add field for original trainer name to Pokemon object, to support gift/traded Pokemon from MEs const trainerText = addBBCodeTextObject( 7, 12, - `${i18next.t("pokemonSummary:ot")}/${getBBCodeFrag(loggedInUser?.username || i18next.t("pokemonSummary:unknown"), globalScene.gameData.gender === PlayerGender.FEMALE ? TextStyle.SUMMARY_PINK : TextStyle.SUMMARY_BLUE)}`, + `${i18next.t("pokemonSummary:ot")}/${getBBCodeFrag( + !globalScene.hideUsername + ? loggedInUser?.username || i18next.t("pokemonSummary:unknown") + : usernameReplacement, + otColor, + )}`, TextStyle.SUMMARY_ALT, - ); - trainerText.setOrigin(0, 0); + ).setOrigin(0); profileContainer.add(trainerText); + const idToDisplay = globalScene.hideUsername ? "*****" : globalScene.gameData.trainerId.toString(); const trainerIdText = addTextObject( 141, 12, - `${i18next.t("pokemonSummary:idNo")}${globalScene.gameData.trainerId.toString()}`, + `${i18next.t("pokemonSummary:idNo")}${idToDisplay}`, TextStyle.SUMMARY_ALT, - ); - trainerIdText.setOrigin(0, 0); + ).setOrigin(0); profileContainer.add(trainerIdText); const typeLabel = addTextObject(7, 28, `${i18next.t("pokemonSummary:type")}/`, TextStyle.WINDOW_ALT); @@ -958,8 +962,8 @@ export class SummaryUiHandler extends UiHandler { this.passiveContainer?.descriptionText?.setVisible(false); const closeFragment = getBBCodeFrag("", TextStyle.WINDOW_ALT); - const rawNature = toReadableString(Nature[this.pokemon?.getNature()!]); // TODO: is this bang correct? - const nature = `${getBBCodeFrag(toReadableString(getNatureName(this.pokemon?.getNature()!)), TextStyle.SUMMARY_RED)}${closeFragment}`; // TODO: is this bang correct? + const rawNature = toTitleCase(Nature[this.pokemon?.getNature()!]); // TODO: is this bang correct? + const nature = `${getBBCodeFrag(toTitleCase(getNatureName(this.pokemon?.getNature()!)), TextStyle.SUMMARY_RED)}${closeFragment}`; // TODO: is this bang correct? const memoString = i18next.t("pokemonSummary:memoString", { metFragment: i18next.t( diff --git a/src/ui/text.ts b/src/ui/text.ts index b2a1894c85c..8aa50983874 100644 --- a/src/ui/text.ts +++ b/src/ui/text.ts @@ -1,79 +1,14 @@ import { globalScene } from "#app/global-scene"; import { EggTier } from "#enums/egg-type"; import { ModifierTier } from "#enums/modifier-tier"; +import { TextStyle } from "#enums/text-style"; import { UiTheme } from "#enums/ui-theme"; import i18next from "#plugins/i18n"; +import type { TextStyleOptions } from "#types/ui"; import type Phaser from "phaser"; import BBCodeText from "phaser3-rex-plugins/plugins/gameobjects/tagtext/bbcodetext/BBCodeText"; import type InputText from "phaser3-rex-plugins/plugins/inputtext"; -export enum TextStyle { - MESSAGE, - WINDOW, - WINDOW_ALT, - WINDOW_BATTLE_COMMAND, - BATTLE_INFO, - PARTY, - PARTY_RED, - PARTY_CANCEL_BUTTON, - INSTRUCTIONS_TEXT, - MOVE_LABEL, - SUMMARY, - SUMMARY_DEX_NUM, - SUMMARY_DEX_NUM_GOLD, - SUMMARY_ALT, - SUMMARY_HEADER, - SUMMARY_RED, - SUMMARY_BLUE, - SUMMARY_PINK, - SUMMARY_GOLD, - SUMMARY_GRAY, - SUMMARY_GREEN, - SUMMARY_STATS, - SUMMARY_STATS_BLUE, - SUMMARY_STATS_PINK, - SUMMARY_STATS_GOLD, - LUCK_VALUE, - STATS_HEXAGON, - GROWTH_RATE_TYPE, - MONEY, // Money default styling (pale yellow) - MONEY_WINDOW, // Money displayed in Windows (needs different colors based on theme) - HEADER_LABEL, - STATS_LABEL, - STATS_VALUE, - SETTINGS_VALUE, - SETTINGS_LABEL, - SETTINGS_LABEL_NAVBAR, - SETTINGS_SELECTED, - SETTINGS_LOCKED, - EGG_LIST, - EGG_SUMMARY_NAME, - EGG_SUMMARY_DEX, - STARTER_VALUE_LIMIT, - TOOLTIP_TITLE, - TOOLTIP_CONTENT, - FILTER_BAR_MAIN, - MOVE_INFO_CONTENT, - MOVE_PP_FULL, - MOVE_PP_HALF_FULL, - MOVE_PP_NEAR_EMPTY, - MOVE_PP_EMPTY, - SMALLER_WINDOW_ALT, - BGM_BAR, - PERFECT_IV, - ME_OPTION_DEFAULT, // Default style for choices in ME - ME_OPTION_SPECIAL, // Style for choices with special requirements in ME - SHADOW_TEXT, // To obscure unavailable options -} - -export interface TextStyleOptions { - scale: number; - styleOptions: Phaser.Types.GameObjects.Text.TextStyle | InputText.IConfig; - shadowColor: string; - shadowXpos: number; - shadowYpos: number; -} - export function addTextObject( x: number, y: number, @@ -87,9 +22,10 @@ export function addTextObject( extraStyleOptions, ); - const ret = globalScene.add.text(x, y, content, styleOptions); - ret.setScale(scale); - ret.setShadow(shadowXpos, shadowYpos, shadowColor); + const ret = globalScene.add + .text(x, y, content, styleOptions) + .setScale(scale) + .setShadow(shadowXpos, shadowYpos, shadowColor); if (!(styleOptions as Phaser.Types.GameObjects.Text.TextStyle).lineSpacing) { ret.setLineSpacing(scale * 30); } @@ -107,8 +43,7 @@ export function setTextStyle( globalScene.uiTheme, extraStyleOptions, ); - obj.setScale(scale); - obj.setShadow(shadowXpos, shadowYpos, shadowColor); + obj.setScale(scale).setShadow(shadowXpos, shadowYpos, shadowColor); if (!(styleOptions as Phaser.Types.GameObjects.Text.TextStyle).lineSpacing) { obj.setLineSpacing(scale * 30); } @@ -133,8 +68,7 @@ export function addBBCodeTextObject( const ret = new BBCodeText(globalScene, x, y, content, styleOptions as BBCodeText.TextStyle); globalScene.add.existing(ret); - ret.setScale(scale); - ret.setShadow(shadowXpos, shadowYpos, shadowColor); + ret.setScale(scale).setShadow(shadowXpos, shadowYpos, shadowColor); if (!(styleOptions as BBCodeText.TextStyle).lineSpacing) { ret.setLineSpacing(scale * 60); } diff --git a/src/ui/title-ui-handler.ts b/src/ui/title-ui-handler.ts index b7c37538a3e..66cb69f6a26 100644 --- a/src/ui/title-ui-handler.ts +++ b/src/ui/title-ui-handler.ts @@ -5,10 +5,11 @@ import { TimedEventDisplay } from "#app/timed-event-manager"; import { getSplashMessages } from "#data/splash-messages"; import { PlayerGender } from "#enums/player-gender"; import type { SpeciesId } from "#enums/species-id"; +import { TextStyle } from "#enums/text-style"; import { UiMode } from "#enums/ui-mode"; import { version } from "#package.json"; import { OptionSelectUiHandler } from "#ui/option-select-ui-handler"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import { fixedInt, randInt, randItem } from "#utils/common"; import { getPokemonSpecies } from "#utils/pokemon-utils"; import i18next from "i18next"; diff --git a/src/ui/ui-handler.ts b/src/ui/ui-handler.ts index c7b25c90205..7dde6b22dcd 100644 --- a/src/ui/ui-handler.ts +++ b/src/ui/ui-handler.ts @@ -1,7 +1,7 @@ import { globalScene } from "#app/global-scene"; import type { Button } from "#enums/buttons"; +import type { TextStyle } from "#enums/text-style"; import type { UiMode } from "#enums/ui-mode"; -import type { TextStyle } from "#ui/text"; import { getTextColor } from "#ui/text"; /** diff --git a/src/ui/ui.ts b/src/ui/ui.ts index 394409bcb9d..4c8f0613122 100644 --- a/src/ui/ui.ts +++ b/src/ui/ui.ts @@ -2,6 +2,7 @@ import { globalScene } from "#app/global-scene"; import type { Button } from "#enums/buttons"; import { Device } from "#enums/devices"; import { PlayerGender } from "#enums/player-gender"; +import { TextStyle } from "#enums/text-style"; import { UiMode } from "#enums/ui-mode"; import { AchvBar } from "#ui/achv-bar"; import { AchvsUiHandler } from "#ui/achvs-ui-handler"; @@ -29,7 +30,7 @@ import { MenuUiHandler } from "#ui/menu-ui-handler"; import { MessageUiHandler } from "#ui/message-ui-handler"; import { ModifierSelectUiHandler } from "#ui/modifier-select-ui-handler"; import { MysteryEncounterUiHandler } from "#ui/mystery-encounter-ui-handler"; -import { NavigationManager } from "#ui/navigationMenu"; +import { NavigationManager } from "#ui/navigation-menu"; import { OptionSelectUiHandler } from "#ui/option-select-ui-handler"; import { PartyUiHandler } from "#ui/party-ui-handler"; import { PokedexPageUiHandler } from "#ui/pokedex-page-ui-handler"; @@ -51,7 +52,7 @@ import { StarterSelectUiHandler } from "#ui/starter-select-ui-handler"; import { SummaryUiHandler } from "#ui/summary-ui-handler"; import { TargetSelectUiHandler } from "#ui/target-select-ui-handler"; import { TestDialogueUiHandler } from "#ui/test-dialogue-ui-handler"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import { TitleUiHandler } from "#ui/title-ui-handler"; import type { UiHandler } from "#ui/ui-handler"; import { addWindow } from "#ui/ui-theme"; diff --git a/src/ui/unavailable-modal-ui-handler.ts b/src/ui/unavailable-modal-ui-handler.ts index 420a47664a7..5c3dc513473 100644 --- a/src/ui/unavailable-modal-ui-handler.ts +++ b/src/ui/unavailable-modal-ui-handler.ts @@ -1,9 +1,10 @@ import { updateUserInfo } from "#app/account"; import { globalScene } from "#app/global-scene"; +import { TextStyle } from "#enums/text-style"; import type { UiMode } from "#enums/ui-mode"; import type { ModalConfig } from "#ui/modal-ui-handler"; import { ModalUiHandler } from "#ui/modal-ui-handler"; -import { addTextObject, TextStyle } from "#ui/text"; +import { addTextObject } from "#ui/text"; import { sessionIdKey } from "#utils/common"; import { removeCookie } from "#utils/cookies"; import i18next from "i18next"; diff --git a/src/utils/common.ts b/src/utils/common.ts index e9ba3acb5e5..66a74ed2c33 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -1,6 +1,5 @@ import { pokerogueApi } from "#api/pokerogue-api"; import { MoneyFormat } from "#enums/money-format"; -import { MoveId } from "#enums/move-id"; import type { Variant } from "#sprites/variant"; import i18next from "i18next"; @@ -10,19 +9,6 @@ export const MissingTextureKey = "__MISSING"; // TODO: Draft tests for these utility functions // TODO: Break up this file -/** - * Convert a `snake_case` string in any capitalization (such as one from an enum reverse mapping) - * into a readable `Title Case` version. - * @param str - The snake case string to be converted. - * @returns The result of converting `str` into title case. - */ -export function toReadableString(str: string): string { - return str - .replace(/_/g, " ") - .split(" ") - .map(s => capitalizeFirstLetter(s.toLowerCase())) - .join(" "); -} export function randomString(length: number, seeded = false) { const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; @@ -278,7 +264,7 @@ export function formatMoney(format: MoneyFormat, amount: number) { } export function formatStat(stat: number, forHp = false): string { - return formatLargeNumber(stat, forHp ? 100000 : 1000000); + return formatLargeNumber(stat, forHp ? 100_000 : 1_000_000); } export function executeIf(condition: boolean, promiseFunc: () => Promise): Promise { @@ -359,31 +345,6 @@ export function fixedInt(value: number): number { return new FixedInt(value) as unknown as number; } -/** - * Formats a string to title case - * @param unformattedText Text to be formatted - * @returns the formatted string - */ -export function formatText(unformattedText: string): string { - const text = unformattedText.split("_"); - for (let i = 0; i < text.length; i++) { - text[i] = text[i].charAt(0).toUpperCase() + text[i].substring(1).toLowerCase(); - } - - return text.join(" "); -} - -export function toCamelCaseString(unformattedText: string): string { - if (!unformattedText) { - return ""; - } - return unformattedText - .split(/[_ ]/) - .filter(f => f) - .map((f, i) => (i ? `${f[0].toUpperCase()}${f.slice(1).toLowerCase()}` : f.toLowerCase())) - .join(""); -} - export function rgbToHsv(r: number, g: number, b: number) { const v = Math.max(r, g, b); const c = v - Math.min(r, g, b); @@ -510,41 +471,6 @@ export function truncateString(str: string, maxLength = 10) { return str; } -/** - * Convert a space-separated string into a capitalized and underscored string. - * @param input - The string to be converted. - * @returns The converted string with words capitalized and separated by underscores. - */ -export function reverseValueToKeySetting(input: string) { - // Split the input string into an array of words - const words = input.split(" "); - // Capitalize the first letter of each word and convert the rest to lowercase - const capitalizedWords = words.map((word: string) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()); - // Join the capitalized words with underscores and return the result - return capitalizedWords.join("_"); -} - -/** - * Capitalize a string. - * @param str - The string to be capitalized. - * @param sep - The separator between the words of the string. - * @param lowerFirstChar - Whether the first character of the string should be lowercase or not. - * @param returnWithSpaces - Whether the returned string should have spaces between the words or not. - * @returns The capitalized string. - */ -export function capitalizeString(str: string, sep: string, lowerFirstChar = true, returnWithSpaces = false) { - if (str) { - const splitedStr = str.toLowerCase().split(sep); - - for (let i = +lowerFirstChar; i < splitedStr?.length; i++) { - splitedStr[i] = splitedStr[i].charAt(0).toUpperCase() + splitedStr[i].substring(1); - } - - return returnWithSpaces ? splitedStr.join(" ") : splitedStr.join(""); - } - return null; -} - /** * Report whether a given value is nullish (`null`/`undefined`). * @param val - The value whose nullishness is being checked @@ -554,15 +480,6 @@ export function isNullOrUndefined(val: any): val is null | undefined { return val === null || val === undefined; } -/** - * Capitalize the first letter of a string. - * @param str - The string whose first letter is being capitalized - * @return The original string with its first letter capitalized - */ -export function capitalizeFirstLetter(str: string) { - return str.charAt(0).toUpperCase() + str.slice(1); -} - /** * This function is used in the context of a Pokémon battle game to calculate the actual integer damage value from a float result. * Many damage calculation formulas involve various parameters and result in float values. @@ -597,26 +514,6 @@ export function isBetween(num: number, min: number, max: number): boolean { return min <= num && num <= max; } -/** - * Helper method to return the animation filename for a given move - * - * @param move the move for which the animation filename is needed - */ -export function animationFileName(move: MoveId): string { - return MoveId[move].toLowerCase().replace(/_/g, "-"); -} - -/** - * Transforms a camelCase string into a kebab-case string - * @param str The camelCase string - * @returns A kebab-case string - * - * @source {@link https://stackoverflow.com/a/67243723/} - */ -export function camelCaseToKebabCase(str: string): string { - return str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (s, o) => (o ? "-" : "") + s.toLowerCase()); -} - /** Get the localized shiny descriptor for the provided variant * @param variant - The variant to get the shiny descriptor for * @returns The localized shiny descriptor diff --git a/src/utils/strings.ts b/src/utils/strings.ts new file mode 100644 index 00000000000..bf5e5c6473f --- /dev/null +++ b/src/utils/strings.ts @@ -0,0 +1,181 @@ +// TODO: Standardize file and path casing to remove the need for all these different casing methods + +// #region Split string code + +// Regexps involved with splitting words in various case formats. +// Sourced from https://www.npmjs.com/package/change-case (with slight tweaking here and there) + +/** Regex to split at word boundaries.*/ +const SPLIT_LOWER_UPPER_RE = /([\p{Ll}\d])(\p{Lu})/gu; +/** Regex to split around single-letter uppercase words.*/ +const SPLIT_UPPER_UPPER_RE = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu; +/** Regexp involved with stripping non-word delimiters from the result. */ +const DELIM_STRIP_REGEXP = /[-_ ]+/giu; +// The replacement value for splits. +const SPLIT_REPLACE_VALUE = "$1\0$2"; + +/** + * Split any cased string into an array of its constituent words. + * @param string - The string to be split + * @returns The new string, delimited at each instance of one or more spaces, underscores, hyphens + * or lower-to-upper boundaries. + * @remarks + * **DO NOT USE THIS FUNCTION!** + * Exported only to allow for testing. + * @todo Consider tests into [in-source testing](https://vitest.dev/guide/in-source.html) and converting this to unexported + */ +export function splitWords(value: string): string[] { + let result = value.trim(); + result = result.replace(SPLIT_LOWER_UPPER_RE, SPLIT_REPLACE_VALUE).replace(SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE); + result = result.replace(DELIM_STRIP_REGEXP, "\0"); + + // Trim the delimiter from around the output string + return trimFromStartAndEnd(result, "\0").split(/\0/g); +} + +/** + * Helper function to remove one or more sequences of characters from either end of a string. + * @param str - The string to replace + * @param charToTrim - The string to remove + * @returns The result of removing all instances of {@linkcode charsToTrim} from either end of {@linkcode str}. + */ +function trimFromStartAndEnd(str: string, charToTrim: string): string { + let start = 0; + let end = str.length; + const blockLength = charToTrim.length; + + while (str.startsWith(charToTrim, start)) { + start += blockLength; + } + if (start - end === blockLength) { + // Occurs if the ENTIRE string is made up of charToTrim (at which point we return nothing) + return ""; + } + while (str.endsWith(charToTrim, end)) { + end -= blockLength; + } + return str.slice(start, end); +} + +// #endregion Split String code + +/** + * Capitalize the first letter of a string. + * @param str - The string whose first letter is to be capitalized + * @return The original string with its first letter capitalized. + * @example + * ```ts + * console.log(capitalizeFirstLetter("consectetur adipiscing elit")); // returns "Consectetur adipiscing elit" + * ``` + */ +export function capitalizeFirstLetter(str: string) { + return str.charAt(0).toUpperCase() + str.slice(1); +} + +/** + * Helper method to convert a string into `Title Case` (such as one used for console logs). + * @param str - The string being converted + * @returns The result of converting `str` into title case. + * @example + * ```ts + * console.log(toTitleCase("lorem ipsum dolor sit amet")); // returns "Lorem Ipsum Dolor Sit Amet" + * ``` + */ +export function toTitleCase(str: string): string { + return splitWords(str) + .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()) + .join(" "); +} + +/** + * Helper method to convert a string into `camelCase` (such as one used for i18n keys). + * @param str - The string being converted + * @returns The result of converting `str` into camel case. + * @example + * ```ts + * console.log(toCamelCase("BIG_ANGRY_TRAINER")); // returns "bigAngryTrainer" + * ``` + */ +export function toCamelCase(str: string) { + return splitWords(str) + .map((word, index) => + index === 0 ? word.toLowerCase() : word.charAt(0).toUpperCase() + word.slice(1).toLowerCase(), + ) + .join(""); +} + +/** + * Helper method to convert a string into `PascalCase`. + * @param str - The string being converted + * @returns The result of converting `str` into pascal case. + * @example + * ```ts + * console.log(toPascalCase("hi how was your day")); // returns "HiHowWasYourDay" + * ``` + * @remarks + */ +export function toPascalCase(str: string) { + return splitWords(str) + .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()) + .join(""); +} + +/** + * Helper method to convert a string into `kebab-case` (such as one used for filenames). + * @param str - The string being converted + * @returns The result of converting `str` into kebab case. + * @example + * ```ts + * console.log(toKebabCase("not_kebab-caSe String")); // returns "not-kebab-case-string" + * ``` + */ +export function toKebabCase(str: string): string { + return splitWords(str) + .map(word => word.toLowerCase()) + .join("-"); +} + +/** + * Helper method to convert a string into `snake_case` (such as one used for filenames). + * @param str - The string being converted + * @returns The result of converting `str` into snake case. + * @example + * ```ts + * console.log(toSnakeCase("not-in snake_CaSe")); // returns "not_in_snake_case" + * ``` + */ +export function toSnakeCase(str: string) { + return splitWords(str) + .map(word => word.toLowerCase()) + .join("_"); +} + +/** + * Helper method to convert a string into `UPPER_SNAKE_CASE`. + * @param str - The string being converted + * @returns The result of converting `str` into upper snake case. + * @example + * ```ts + * console.log(toUpperSnakeCase("apples bananas_oranGes-PearS")); // returns "APPLES_BANANAS_ORANGES_PEARS" + * ``` + */ +export function toUpperSnakeCase(str: string) { + return splitWords(str) + .map(word => word.toUpperCase()) + .join("_"); +} + +/** + * Helper method to convert a string into `Pascal_Snake_Case`. + * @param str - The string being converted + * @returns The result of converting `str` into pascal snake case. + * @example + * ```ts + * console.log(toPascalSnakeCase("apples-bananas_oranGes Pears")); // returns "Apples_Bananas_Oranges_Pears" + * ``` + */ +export function toPascalSnakeCase(str: string) { + return splitWords(str) + .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()) + .join("_"); +} diff --git a/test/@types/vitest.d.ts b/test/@types/vitest.d.ts new file mode 100644 index 00000000000..58b36580727 --- /dev/null +++ b/test/@types/vitest.d.ts @@ -0,0 +1,26 @@ +import type { Pokemon } from "#field/pokemon"; +import type { PokemonType } from "#enums/pokemon-type"; +import type { expect } from "vitest"; +import type { toHaveTypesOptions } from "#test/test-utils/matchers/to-have-types"; + +declare module "vitest" { + interface Assertion { + /** + * Matcher to check if an array contains EXACTLY the given items (in any order). + * + * Different from {@linkcode expect.arrayContaining} as the latter only requires the array contain + * _at least_ the listed items. + * + * @param expected - The expected contents of the array, in any order. + * @see {@linkcode expect.arrayContaining} + */ + toEqualArrayUnsorted(expected: E[]): void; + /** + * Matcher to check if a {@linkcode Pokemon}'s current typing includes the given types. + * + * @param expected - The expected types (in any order). + * @param options - The options passed to the matcher. + */ + toHaveTypes(expected: PokemonType[], options?: toHaveTypesOptions): void; + } +} \ No newline at end of file diff --git a/test/abilities/ability_activation_order.test.ts b/test/abilities/ability-activation-order.test.ts similarity index 98% rename from test/abilities/ability_activation_order.test.ts rename to test/abilities/ability-activation-order.test.ts index 8344ba6be11..54ff5e8b99a 100644 --- a/test/abilities/ability_activation_order.test.ts +++ b/test/abilities/ability-activation-order.test.ts @@ -3,7 +3,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { WeatherType } from "#enums/weather-type"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/ability_duplication.test.ts b/test/abilities/ability-duplication.test.ts similarity index 96% rename from test/abilities/ability_duplication.test.ts rename to test/abilities/ability-duplication.test.ts index 0c88b65a00e..da572d94466 100644 --- a/test/abilities/ability_duplication.test.ts +++ b/test/abilities/ability-duplication.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/ability_timing.test.ts b/test/abilities/ability-timing.test.ts similarity index 96% rename from test/abilities/ability_timing.test.ts rename to test/abilities/ability-timing.test.ts index c3e841d8216..f5315d2b80e 100644 --- a/test/abilities/ability_timing.test.ts +++ b/test/abilities/ability-timing.test.ts @@ -5,7 +5,7 @@ import { UiMode } from "#enums/ui-mode"; import { CommandPhase } from "#phases/command-phase"; import { TurnInitPhase } from "#phases/turn-init-phase"; import i18next from "#plugins/i18n"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/analytic.test.ts b/test/abilities/analytic.test.ts index 0bacfe6775b..d1b9ba4cbbb 100644 --- a/test/abilities/analytic.test.ts +++ b/test/abilities/analytic.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { isBetween, toDmgValue } from "#utils/common"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/anger-point.test.ts b/test/abilities/anger-point.test.ts index 576062eadeb..84a22449dae 100644 --- a/test/abilities/anger-point.test.ts +++ b/test/abilities/anger-point.test.ts @@ -3,7 +3,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/arena_trap.test.ts b/test/abilities/arena-trap.test.ts similarity index 97% rename from test/abilities/arena_trap.test.ts rename to test/abilities/arena-trap.test.ts index c47cf3cd327..f85fae5b259 100644 --- a/test/abilities/arena_trap.test.ts +++ b/test/abilities/arena-trap.test.ts @@ -2,7 +2,7 @@ import { allAbilities } from "#data/data-lists"; import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/aroma_veil.test.ts b/test/abilities/aroma-veil.test.ts similarity index 97% rename from test/abilities/aroma_veil.test.ts rename to test/abilities/aroma-veil.test.ts index fb08d60c24f..3bdb83203c5 100644 --- a/test/abilities/aroma_veil.test.ts +++ b/test/abilities/aroma-veil.test.ts @@ -5,7 +5,7 @@ import { BattlerTagType } from "#enums/battler-tag-type"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import type { PlayerPokemon } from "#field/pokemon"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/aura_break.test.ts b/test/abilities/aura-break.test.ts similarity index 97% rename from test/abilities/aura_break.test.ts rename to test/abilities/aura-break.test.ts index 6f33e3f047f..0fe3a253561 100644 --- a/test/abilities/aura_break.test.ts +++ b/test/abilities/aura-break.test.ts @@ -2,7 +2,7 @@ import { allMoves } from "#data/data-lists"; import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/battery.test.ts b/test/abilities/battery.test.ts index 13ebd52367a..cdb3935c33e 100644 --- a/test/abilities/battery.test.ts +++ b/test/abilities/battery.test.ts @@ -4,7 +4,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { MoveEffectPhase } from "#phases/move-effect-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/battle_bond.test.ts b/test/abilities/battle-bond.test.ts similarity index 96% rename from test/abilities/battle_bond.test.ts rename to test/abilities/battle-bond.test.ts index ef8c2ffed75..c4ffe1e784b 100644 --- a/test/abilities/battle_bond.test.ts +++ b/test/abilities/battle-bond.test.ts @@ -1,11 +1,11 @@ import { allMoves } from "#data/data-lists"; import { Status } from "#data/status-effect"; import { AbilityId } from "#enums/ability-id"; -import { MultiHitType } from "#enums/MultiHitType"; import { MoveId } from "#enums/move-id"; +import { MultiHitType } from "#enums/multi-hit-type"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; describe("Abilities - BATTLE BOND", () => { diff --git a/test/abilities/beast_boost.test.ts b/test/abilities/beast-boost.test.ts similarity index 98% rename from test/abilities/beast_boost.test.ts rename to test/abilities/beast-boost.test.ts index 0a49728698b..193de9b7669 100644 --- a/test/abilities/beast_boost.test.ts +++ b/test/abilities/beast-boost.test.ts @@ -3,7 +3,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/commander.test.ts b/test/abilities/commander.test.ts index 8c19ee083c5..d485cab83a2 100644 --- a/test/abilities/commander.test.ts +++ b/test/abilities/commander.test.ts @@ -9,7 +9,7 @@ import type { EffectiveStat } from "#enums/stat"; import { Stat } from "#enums/stat"; import { StatusEffect } from "#enums/status-effect"; import { WeatherType } from "#enums/weather-type"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/competitive.test.ts b/test/abilities/competitive.test.ts index 7dcc677a74e..1a083705e5c 100644 --- a/test/abilities/competitive.test.ts +++ b/test/abilities/competitive.test.ts @@ -3,7 +3,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { TurnInitPhase } from "#phases/turn-init-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/contrary.test.ts b/test/abilities/contrary.test.ts index 7db48dedbfd..df72c25054a 100644 --- a/test/abilities/contrary.test.ts +++ b/test/abilities/contrary.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/corrosion.test.ts b/test/abilities/corrosion.test.ts index 22abc158fc7..490a365394b 100644 --- a/test/abilities/corrosion.test.ts +++ b/test/abilities/corrosion.test.ts @@ -1,7 +1,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/costar.test.ts b/test/abilities/costar.test.ts index c8c0ffd3184..1ca1d06d76f 100644 --- a/test/abilities/costar.test.ts +++ b/test/abilities/costar.test.ts @@ -3,7 +3,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { MessagePhase } from "#phases/message-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; diff --git a/test/abilities/cud_chew.test.ts b/test/abilities/cud-chew.test.ts similarity index 99% rename from test/abilities/cud_chew.test.ts rename to test/abilities/cud-chew.test.ts index 8fc62b38528..5f15de04cae 100644 --- a/test/abilities/cud_chew.test.ts +++ b/test/abilities/cud-chew.test.ts @@ -7,7 +7,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { Pokemon } from "#field/pokemon"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import i18next from "i18next"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/dancer.test.ts b/test/abilities/dancer.test.ts index 86b5b68e901..bbf1a368573 100644 --- a/test/abilities/dancer.test.ts +++ b/test/abilities/dancer.test.ts @@ -5,7 +5,7 @@ import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import type { MovePhase } from "#phases/move-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/defiant.test.ts b/test/abilities/defiant.test.ts index 44187429e2b..29c386ff093 100644 --- a/test/abilities/defiant.test.ts +++ b/test/abilities/defiant.test.ts @@ -3,7 +3,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { TurnInitPhase } from "#phases/turn-init-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/desolate-land.test.ts b/test/abilities/desolate-land.test.ts index fc066fa8955..c88f7415bb1 100644 --- a/test/abilities/desolate-land.test.ts +++ b/test/abilities/desolate-land.test.ts @@ -6,7 +6,7 @@ import { PokeballType } from "#enums/pokeball"; import { SpeciesId } from "#enums/species-id"; import { WeatherType } from "#enums/weather-type"; import type { CommandPhase } from "#phases/command-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/disguise.test.ts b/test/abilities/disguise.test.ts index 9bd36def8d7..bf271c81e4d 100644 --- a/test/abilities/disguise.test.ts +++ b/test/abilities/disguise.test.ts @@ -4,7 +4,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { toDmgValue } from "#utils/common"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/dry_skin.test.ts b/test/abilities/dry-skin.test.ts similarity index 98% rename from test/abilities/dry_skin.test.ts rename to test/abilities/dry-skin.test.ts index 712d3295e6f..01602150710 100644 --- a/test/abilities/dry_skin.test.ts +++ b/test/abilities/dry-skin.test.ts @@ -1,7 +1,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/early_bird.test.ts b/test/abilities/early-bird.test.ts similarity index 97% rename from test/abilities/early_bird.test.ts rename to test/abilities/early-bird.test.ts index be4a2c802af..97ce02e5e62 100644 --- a/test/abilities/early_bird.test.ts +++ b/test/abilities/early-bird.test.ts @@ -4,7 +4,7 @@ import { MoveId } from "#enums/move-id"; import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/flash_fire.test.ts b/test/abilities/flash-fire.test.ts similarity index 98% rename from test/abilities/flash_fire.test.ts rename to test/abilities/flash-fire.test.ts index d6085c4e591..d9f0e194d9c 100644 --- a/test/abilities/flash_fire.test.ts +++ b/test/abilities/flash-fire.test.ts @@ -6,7 +6,7 @@ import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; import { MovePhase } from "#phases/move-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/flower_gift.test.ts b/test/abilities/flower-gift.test.ts similarity index 99% rename from test/abilities/flower_gift.test.ts rename to test/abilities/flower-gift.test.ts index b283729d951..2fc67b098b7 100644 --- a/test/abilities/flower_gift.test.ts +++ b/test/abilities/flower-gift.test.ts @@ -6,7 +6,7 @@ import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { WeatherType } from "#enums/weather-type"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/flower_veil.test.ts b/test/abilities/flower-veil.test.ts similarity index 99% rename from test/abilities/flower_veil.test.ts rename to test/abilities/flower-veil.test.ts index e890ea24fad..46478a3dd9c 100644 --- a/test/abilities/flower_veil.test.ts +++ b/test/abilities/flower-veil.test.ts @@ -6,7 +6,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/forecast.test.ts b/test/abilities/forecast.test.ts index 372e32a27fa..644927186f4 100644 --- a/test/abilities/forecast.test.ts +++ b/test/abilities/forecast.test.ts @@ -9,7 +9,7 @@ import { MovePhase } from "#phases/move-phase"; import { PostSummonPhase } from "#phases/post-summon-phase"; import { QuietFormChangePhase } from "#phases/quiet-form-change-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/friend_guard.test.ts b/test/abilities/friend-guard.test.ts similarity index 97% rename from test/abilities/friend_guard.test.ts rename to test/abilities/friend-guard.test.ts index e26fd5b5f1f..32f4fe06df4 100644 --- a/test/abilities/friend_guard.test.ts +++ b/test/abilities/friend-guard.test.ts @@ -1,10 +1,10 @@ import { allAbilities, allMoves } from "#data/data-lists"; import { AbilityId } from "#enums/ability-id"; import { BattlerIndex } from "#enums/battler-index"; -import { MoveCategory } from "#enums/MoveCategory"; +import { MoveCategory } from "#enums/move-category"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/good_as_gold.test.ts b/test/abilities/good-as-gold.test.ts similarity index 98% rename from test/abilities/good_as_gold.test.ts rename to test/abilities/good-as-gold.test.ts index 956553a96d9..7fc1ad85b53 100644 --- a/test/abilities/good_as_gold.test.ts +++ b/test/abilities/good-as-gold.test.ts @@ -9,7 +9,7 @@ import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { StatusEffect } from "#enums/status-effect"; import { WeatherType } from "#enums/weather-type"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/gorilla_tactics.test.ts b/test/abilities/gorilla-tactics.test.ts similarity index 98% rename from test/abilities/gorilla_tactics.test.ts rename to test/abilities/gorilla-tactics.test.ts index 05714fe77ea..83e6cdb156e 100644 --- a/test/abilities/gorilla_tactics.test.ts +++ b/test/abilities/gorilla-tactics.test.ts @@ -6,7 +6,7 @@ import { MoveUseMode } from "#enums/move-use-mode"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { RandomMoveAttr } from "#moves/move"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/guard-dog.test.ts b/test/abilities/guard-dog.test.ts index aef8f081975..fb06c4c76c3 100644 --- a/test/abilities/guard-dog.test.ts +++ b/test/abilities/guard-dog.test.ts @@ -1,7 +1,7 @@ import { AbilityId } from "#enums/ability-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/gulp_missile.test.ts b/test/abilities/gulp-missile.test.ts similarity index 99% rename from test/abilities/gulp_missile.test.ts rename to test/abilities/gulp-missile.test.ts index 69ed6c51ac9..faf30adae33 100644 --- a/test/abilities/gulp_missile.test.ts +++ b/test/abilities/gulp-missile.test.ts @@ -6,7 +6,7 @@ import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { StatusEffect } from "#enums/status-effect"; import type { Pokemon } from "#field/pokemon"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/harvest.test.ts b/test/abilities/harvest.test.ts index 244de383b44..d27ee491fed 100644 --- a/test/abilities/harvest.test.ts +++ b/test/abilities/harvest.test.ts @@ -9,7 +9,7 @@ import { WeatherType } from "#enums/weather-type"; import type { Pokemon } from "#field/pokemon"; import { BerryModifier, PreserveBerryModifier } from "#modifiers/modifier"; import type { ModifierOverride } from "#modifiers/modifier-type"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import type { BooleanHolder } from "#utils/common"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/healer.test.ts b/test/abilities/healer.test.ts index 8ce8b5bada0..c151836d76d 100644 --- a/test/abilities/healer.test.ts +++ b/test/abilities/healer.test.ts @@ -5,7 +5,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; import type { Pokemon } from "#field/pokemon"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { isNullOrUndefined } from "#utils/common"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/heatproof.test.ts b/test/abilities/heatproof.test.ts index 0d76c1ad40b..63f877a3567 100644 --- a/test/abilities/heatproof.test.ts +++ b/test/abilities/heatproof.test.ts @@ -3,7 +3,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { toDmgValue } from "#utils/common"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/honey_gather.test.ts b/test/abilities/honey-gather.test.ts similarity index 97% rename from test/abilities/honey_gather.test.ts rename to test/abilities/honey-gather.test.ts index 65c590083f5..8dfd2c189f8 100644 --- a/test/abilities/honey_gather.test.ts +++ b/test/abilities/honey-gather.test.ts @@ -4,7 +4,7 @@ import { Command } from "#enums/command"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import type { CommandPhase } from "#phases/command-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/hustle.test.ts b/test/abilities/hustle.test.ts index 94045d231d1..74ee01f02ef 100644 --- a/test/abilities/hustle.test.ts +++ b/test/abilities/hustle.test.ts @@ -3,7 +3,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/hyper_cutter.test.ts b/test/abilities/hyper-cutter.test.ts similarity index 96% rename from test/abilities/hyper_cutter.test.ts rename to test/abilities/hyper-cutter.test.ts index 212083b62b6..8a509d026b6 100644 --- a/test/abilities/hyper_cutter.test.ts +++ b/test/abilities/hyper-cutter.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/ice_face.test.ts b/test/abilities/ice-face.test.ts similarity index 99% rename from test/abilities/ice_face.test.ts rename to test/abilities/ice-face.test.ts index a0e2a949672..9b3020b67a7 100644 --- a/test/abilities/ice_face.test.ts +++ b/test/abilities/ice-face.test.ts @@ -8,7 +8,7 @@ import { MoveEndPhase } from "#phases/move-end-phase"; import { QuietFormChangePhase } from "#phases/quiet-form-change-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; import { TurnInitPhase } from "#phases/turn-init-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/illuminate.test.ts b/test/abilities/illuminate.test.ts index 0fb31379542..814b7dc64b7 100644 --- a/test/abilities/illuminate.test.ts +++ b/test/abilities/illuminate.test.ts @@ -1,7 +1,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/illusion.test.ts b/test/abilities/illusion.test.ts index 0624c5e19f4..e48cd9e9b78 100644 --- a/test/abilities/illusion.test.ts +++ b/test/abilities/illusion.test.ts @@ -3,7 +3,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { PokeballType } from "#enums/pokeball"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; @@ -145,8 +145,8 @@ describe("Abilities - Illusion", () => { const zoroark = game.scene.getPlayerPokemon()!; - expect(zoroark.name).equals("Axew"); - expect(zoroark.getNameToRender()).equals("axew nickname"); + expect(zoroark.summonData.illusion?.name).equals("Axew"); + expect(zoroark.getNameToRender(true)).equals("axew nickname"); expect(zoroark.getGender(false, true)).equals(Gender.FEMALE); expect(zoroark.isShiny(true)).equals(true); expect(zoroark.getPokeball(true)).equals(PokeballType.GREAT_BALL); diff --git a/test/abilities/immunity.test.ts b/test/abilities/immunity.test.ts index 6f6fac10bf9..dccee93ac10 100644 --- a/test/abilities/immunity.test.ts +++ b/test/abilities/immunity.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/infiltrator.test.ts b/test/abilities/infiltrator.test.ts index 9f1eed466b9..9f3678850a1 100644 --- a/test/abilities/infiltrator.test.ts +++ b/test/abilities/infiltrator.test.ts @@ -7,7 +7,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/innards-out.test.ts b/test/abilities/innards-out.test.ts index a10465ce1cb..96c07344b11 100644 --- a/test/abilities/innards-out.test.ts +++ b/test/abilities/innards-out.test.ts @@ -1,7 +1,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/insomnia.test.ts b/test/abilities/insomnia.test.ts index 2f683b516eb..679220687b9 100644 --- a/test/abilities/insomnia.test.ts +++ b/test/abilities/insomnia.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/intimidate.test.ts b/test/abilities/intimidate.test.ts index 9ff408aaeb5..3c283e0392b 100644 --- a/test/abilities/intimidate.test.ts +++ b/test/abilities/intimidate.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/intrepid_sword.test.ts b/test/abilities/intrepid-sword.test.ts similarity index 95% rename from test/abilities/intrepid_sword.test.ts rename to test/abilities/intrepid-sword.test.ts index 7465b331791..75a1ab14e82 100644 --- a/test/abilities/intrepid_sword.test.ts +++ b/test/abilities/intrepid-sword.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { CommandPhase } from "#phases/command-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/lightningrod.test.ts b/test/abilities/lightningrod.test.ts index 2d5b6881869..20fcb176055 100644 --- a/test/abilities/lightningrod.test.ts +++ b/test/abilities/lightningrod.test.ts @@ -3,7 +3,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/limber.test.ts b/test/abilities/limber.test.ts index ed140c09fb1..e65a54b545d 100644 --- a/test/abilities/limber.test.ts +++ b/test/abilities/limber.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/magic_bounce.test.ts b/test/abilities/magic-bounce.test.ts similarity index 99% rename from test/abilities/magic_bounce.test.ts rename to test/abilities/magic-bounce.test.ts index 84b4cea8376..3b4185e848f 100644 --- a/test/abilities/magic_bounce.test.ts +++ b/test/abilities/magic-bounce.test.ts @@ -8,7 +8,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; describe("Abilities - Magic Bounce", () => { diff --git a/test/abilities/magic_guard.test.ts b/test/abilities/magic-guard.test.ts similarity index 99% rename from test/abilities/magic_guard.test.ts rename to test/abilities/magic-guard.test.ts index 63b22f347fb..e2977420edf 100644 --- a/test/abilities/magic_guard.test.ts +++ b/test/abilities/magic-guard.test.ts @@ -6,7 +6,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { toDmgValue } from "#utils/common"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/magma_armor.test.ts b/test/abilities/magma-armor.test.ts similarity index 96% rename from test/abilities/magma_armor.test.ts rename to test/abilities/magma-armor.test.ts index cc40ea9f679..2e7176fdf96 100644 --- a/test/abilities/magma_armor.test.ts +++ b/test/abilities/magma-armor.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/mimicry.test.ts b/test/abilities/mimicry.test.ts index f377ab89ffe..c04860d1fcd 100644 --- a/test/abilities/mimicry.test.ts +++ b/test/abilities/mimicry.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/mirror_armor.test.ts b/test/abilities/mirror-armor.test.ts similarity index 99% rename from test/abilities/mirror_armor.test.ts rename to test/abilities/mirror-armor.test.ts index 4d4ee973527..b2f9c9dc8fa 100644 --- a/test/abilities/mirror_armor.test.ts +++ b/test/abilities/mirror-armor.test.ts @@ -3,7 +3,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/mold_breaker.test.ts b/test/abilities/mold-breaker.test.ts similarity index 95% rename from test/abilities/mold_breaker.test.ts rename to test/abilities/mold-breaker.test.ts index c3214cdc224..2af17b625b0 100644 --- a/test/abilities/mold_breaker.test.ts +++ b/test/abilities/mold-breaker.test.ts @@ -1,7 +1,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/moody.test.ts b/test/abilities/moody.test.ts index 150456bc0f7..80879837bce 100644 --- a/test/abilities/moody.test.ts +++ b/test/abilities/moody.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { BATTLE_STATS, EFFECTIVE_STATS } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/moxie.test.ts b/test/abilities/moxie.test.ts index 882b4b0df2f..28b90042969 100644 --- a/test/abilities/moxie.test.ts +++ b/test/abilities/moxie.test.ts @@ -6,7 +6,7 @@ import { Stat } from "#enums/stat"; import { EnemyCommandPhase } from "#phases/enemy-command-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; import { VictoryPhase } from "#phases/victory-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/mummy.test.ts b/test/abilities/mummy.test.ts index 6c94fea407b..e3843f9c112 100644 --- a/test/abilities/mummy.test.ts +++ b/test/abilities/mummy.test.ts @@ -1,7 +1,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/mycelium_might.test.ts b/test/abilities/mycelium-might.test.ts similarity index 98% rename from test/abilities/mycelium_might.test.ts rename to test/abilities/mycelium-might.test.ts index fa3ab8e5301..41da6b5c693 100644 --- a/test/abilities/mycelium_might.test.ts +++ b/test/abilities/mycelium-might.test.ts @@ -4,7 +4,7 @@ import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { TurnEndPhase } from "#phases/turn-end-phase"; import { TurnStartPhase } from "#phases/turn-start-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/neutralizing_gas.test.ts b/test/abilities/neutralizing-gas.test.ts similarity index 99% rename from test/abilities/neutralizing_gas.test.ts rename to test/abilities/neutralizing-gas.test.ts index bcc00e4249a..560b7af72e7 100644 --- a/test/abilities/neutralizing_gas.test.ts +++ b/test/abilities/neutralizing-gas.test.ts @@ -8,7 +8,7 @@ import { PokeballType } from "#enums/pokeball"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import type { CommandPhase } from "#phases/command-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/no_guard.test.ts b/test/abilities/no-guard.test.ts similarity index 96% rename from test/abilities/no_guard.test.ts rename to test/abilities/no-guard.test.ts index f6f55ce3b80..9ce12e710e5 100644 --- a/test/abilities/no_guard.test.ts +++ b/test/abilities/no-guard.test.ts @@ -5,7 +5,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { MoveEffectPhase } from "#phases/move-effect-phase"; import { MoveEndPhase } from "#phases/move-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/normal-move-type-change.test.ts b/test/abilities/normal-move-type-change.test.ts index aa673ddde29..fdf9ef0f9f2 100644 --- a/test/abilities/normal-move-type-change.test.ts +++ b/test/abilities/normal-move-type-change.test.ts @@ -5,7 +5,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { toDmgValue } from "#utils/common"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; @@ -48,7 +48,7 @@ describe.each([ .startingLevel(100) .starterSpecies(SpeciesId.MAGIKARP) .ability(ab) - .moveset([MoveId.TACKLE, MoveId.REVELATION_DANCE, MoveId.FURY_SWIPES]) + .moveset([MoveId.TACKLE, MoveId.REVELATION_DANCE, MoveId.FURY_SWIPES, MoveId.CRUSH_GRIP]) .enemySpecies(SpeciesId.DUSCLOPS) .enemyAbility(AbilityId.BALL_FETCH) .enemyMoveset(MoveId.SPLASH) @@ -75,6 +75,27 @@ describe.each([ expect(enemyPokemon.hp).toBeLessThan(enemyPokemon.getMaxHp()); }); + // Regression test to ensure proper ordering of effects + it("should still boost variable-power moves", async () => { + await game.classicMode.startBattle([SpeciesId.MAGIKARP]); + + const playerPokemon = game.field.getPlayerPokemon(); + const typeSpy = vi.spyOn(playerPokemon, "getMoveType"); + + const enemyPokemon = game.field.getEnemyPokemon(); + const enemySpy = vi.spyOn(enemyPokemon, "getMoveEffectiveness"); + const powerSpy = vi.spyOn(allMoves[MoveId.CRUSH_GRIP], "calculateBattlePower"); + + game.move.select(MoveId.CRUSH_GRIP); + + await game.toEndOfTurn(); + + expect(typeSpy).toHaveLastReturnedWith(ty); + expect(enemySpy).toHaveReturnedWith(1); + expect(powerSpy).toHaveReturnedWith(144); // 120 * 1.2 + expect(enemyPokemon.hp).toBeLessThan(enemyPokemon.getMaxHp()); + }); + // Galvanize specifically would like to check for volt absorb's activation if (ab === AbilityId.GALVANIZE) { it("should cause Normal-type attacks to activate Volt Absorb", async () => { diff --git a/test/abilities/normalize.test.ts b/test/abilities/normalize.test.ts index 1128dd1a562..a19a08fdaf0 100644 --- a/test/abilities/normalize.test.ts +++ b/test/abilities/normalize.test.ts @@ -4,7 +4,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { toDmgValue } from "#utils/common"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; @@ -44,6 +44,18 @@ describe("Abilities - Normalize", () => { expect(powerSpy).toHaveLastReturnedWith(toDmgValue(allMoves[MoveId.TACKLE].power * 1.2)); }); + it("should boost variable power moves", async () => { + await game.classicMode.startBattle([SpeciesId.MAGIKARP]); + const magikarp = game.field.getPlayerPokemon(); + magikarp.friendship = 255; + + const powerSpy = vi.spyOn(allMoves[MoveId.RETURN], "calculateBattlePower"); + + game.move.use(MoveId.RETURN); + await game.toEndOfTurn(); + expect(powerSpy).toHaveLastReturnedWith(102 * 1.2); + }); + it("should not apply the old type boost item after changing a move's type", async () => { game.override .startingHeldItems([{ name: "ATTACK_TYPE_BOOSTER", count: 1, type: PokemonType.GRASS }]) diff --git a/test/abilities/oblivious.test.ts b/test/abilities/oblivious.test.ts index 8b18fe65455..6b9598903c5 100644 --- a/test/abilities/oblivious.test.ts +++ b/test/abilities/oblivious.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { BattlerTagType } from "#enums/battler-tag-type"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/own_tempo.test.ts b/test/abilities/own-tempo.test.ts similarity index 96% rename from test/abilities/own_tempo.test.ts rename to test/abilities/own-tempo.test.ts index bdb247c4987..c919d9eae53 100644 --- a/test/abilities/own_tempo.test.ts +++ b/test/abilities/own-tempo.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { BattlerTagType } from "#enums/battler-tag-type"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/parental_bond.test.ts b/test/abilities/parental-bond.test.ts similarity index 99% rename from test/abilities/parental_bond.test.ts rename to test/abilities/parental-bond.test.ts index 4937857c8e1..51c15ea32b1 100644 --- a/test/abilities/parental_bond.test.ts +++ b/test/abilities/parental-bond.test.ts @@ -5,7 +5,7 @@ import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { toDmgValue } from "#utils/common"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/pastel_veil.test.ts b/test/abilities/pastel-veil.test.ts similarity index 97% rename from test/abilities/pastel_veil.test.ts rename to test/abilities/pastel-veil.test.ts index 88f5415524f..c4b368c94d0 100644 --- a/test/abilities/pastel_veil.test.ts +++ b/test/abilities/pastel-veil.test.ts @@ -4,7 +4,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/perish_body.test.ts b/test/abilities/perish-body.test.ts similarity index 98% rename from test/abilities/perish_body.test.ts rename to test/abilities/perish-body.test.ts index 83a862164a1..251d29abe36 100644 --- a/test/abilities/perish_body.test.ts +++ b/test/abilities/perish-body.test.ts @@ -1,7 +1,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/power_construct.test.ts b/test/abilities/power-construct.test.ts similarity index 97% rename from test/abilities/power_construct.test.ts rename to test/abilities/power-construct.test.ts index 0917082d7bd..34e02851daf 100644 --- a/test/abilities/power_construct.test.ts +++ b/test/abilities/power-construct.test.ts @@ -5,7 +5,7 @@ import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; import { QuietFormChangePhase } from "#phases/quiet-form-change-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; describe("Abilities - POWER CONSTRUCT", () => { diff --git a/test/abilities/power_spot.test.ts b/test/abilities/power-spot.test.ts similarity index 97% rename from test/abilities/power_spot.test.ts rename to test/abilities/power-spot.test.ts index f07ece17245..75d5cd78ae0 100644 --- a/test/abilities/power_spot.test.ts +++ b/test/abilities/power-spot.test.ts @@ -4,7 +4,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { MoveEffectPhase } from "#phases/move-effect-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/protean-libero.test.ts b/test/abilities/protean-libero.test.ts index 35be3fcf63d..305955f5221 100644 --- a/test/abilities/protean-libero.test.ts +++ b/test/abilities/protean-libero.test.ts @@ -8,7 +8,7 @@ import { MoveResult } from "#enums/move-result"; import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; import type { PlayerPokemon } from "#field/pokemon"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/protosynthesis.test.ts b/test/abilities/protosynthesis.test.ts index 5629ea503d7..f4461a562ea 100644 --- a/test/abilities/protosynthesis.test.ts +++ b/test/abilities/protosynthesis.test.ts @@ -4,7 +4,7 @@ import { MoveId } from "#enums/move-id"; import { Nature } from "#enums/nature"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/quick_draw.test.ts b/test/abilities/quick-draw.test.ts similarity index 97% rename from test/abilities/quick_draw.test.ts rename to test/abilities/quick-draw.test.ts index f881adce5ed..d3914e24268 100644 --- a/test/abilities/quick_draw.test.ts +++ b/test/abilities/quick-draw.test.ts @@ -3,7 +3,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { FaintPhase } from "#phases/faint-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; diff --git a/test/abilities/sand_spit.test.ts b/test/abilities/sand-spit.test.ts similarity index 96% rename from test/abilities/sand_spit.test.ts rename to test/abilities/sand-spit.test.ts index dfd8a342ccc..9cfd94a1857 100644 --- a/test/abilities/sand_spit.test.ts +++ b/test/abilities/sand-spit.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { WeatherType } from "#enums/weather-type"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/sand_veil.test.ts b/test/abilities/sand-veil.test.ts similarity index 97% rename from test/abilities/sand_veil.test.ts rename to test/abilities/sand-veil.test.ts index 2ad9ef7eaa1..4777a016743 100644 --- a/test/abilities/sand_veil.test.ts +++ b/test/abilities/sand-veil.test.ts @@ -6,7 +6,7 @@ import { Stat } from "#enums/stat"; import { WeatherType } from "#enums/weather-type"; import { MoveEffectPhase } from "#phases/move-effect-phase"; import { MoveEndPhase } from "#phases/move-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import type { StatMultiplierAbAttrParams } from "#types/ability-types"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; diff --git a/test/abilities/sap_sipper.test.ts b/test/abilities/sap-sipper.test.ts similarity index 98% rename from test/abilities/sap_sipper.test.ts rename to test/abilities/sap-sipper.test.ts index a8fe10d7fc5..a1c034ab126 100644 --- a/test/abilities/sap_sipper.test.ts +++ b/test/abilities/sap-sipper.test.ts @@ -8,7 +8,7 @@ import { Stat } from "#enums/stat"; import { RandomMoveAttr } from "#moves/move"; import { MoveEndPhase } from "#phases/move-end-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/schooling.test.ts b/test/abilities/schooling.test.ts index 94bb4cb80f9..fea919c7c5a 100644 --- a/test/abilities/schooling.test.ts +++ b/test/abilities/schooling.test.ts @@ -5,7 +5,7 @@ import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; import { QuietFormChangePhase } from "#phases/quiet-form-change-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; describe("Abilities - SCHOOLING", () => { diff --git a/test/abilities/screen_cleaner.test.ts b/test/abilities/screen-cleaner.test.ts similarity index 97% rename from test/abilities/screen_cleaner.test.ts rename to test/abilities/screen-cleaner.test.ts index 8b53ab30d49..50a854adeb1 100644 --- a/test/abilities/screen_cleaner.test.ts +++ b/test/abilities/screen-cleaner.test.ts @@ -4,7 +4,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { PostSummonPhase } from "#phases/post-summon-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/seed_sower.test.ts b/test/abilities/seed-sower.test.ts similarity index 96% rename from test/abilities/seed_sower.test.ts rename to test/abilities/seed-sower.test.ts index 8573f0242ea..f31955a0bbb 100644 --- a/test/abilities/seed_sower.test.ts +++ b/test/abilities/seed-sower.test.ts @@ -2,7 +2,7 @@ import { TerrainType } from "#data/terrain"; import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/serene_grace.test.ts b/test/abilities/serene-grace.test.ts similarity index 96% rename from test/abilities/serene_grace.test.ts rename to test/abilities/serene-grace.test.ts index aaa0f26f78b..bbf9cf7555b 100644 --- a/test/abilities/serene_grace.test.ts +++ b/test/abilities/serene-grace.test.ts @@ -3,7 +3,7 @@ import { AbilityId } from "#enums/ability-id"; import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/sheer_force.test.ts b/test/abilities/sheer-force.test.ts similarity index 98% rename from test/abilities/sheer_force.test.ts rename to test/abilities/sheer-force.test.ts index 0b0c0c10ccf..0e2ce85bfca 100644 --- a/test/abilities/sheer_force.test.ts +++ b/test/abilities/sheer-force.test.ts @@ -5,7 +5,7 @@ import { MoveId } from "#enums/move-id"; import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/shell-armor.test.ts b/test/abilities/shell-armor.test.ts index e10c3a90444..df0802b25da 100644 --- a/test/abilities/shell-armor.test.ts +++ b/test/abilities/shell-armor.test.ts @@ -4,7 +4,7 @@ import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; import { Pokemon } from "#field/pokemon"; import type { Move } from "#moves/move"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, type MockInstance, vi } from "vitest"; diff --git a/test/abilities/shield_dust.test.ts b/test/abilities/shield-dust.test.ts similarity index 97% rename from test/abilities/shield_dust.test.ts rename to test/abilities/shield-dust.test.ts index 371c7d9cf29..025b415dbc0 100644 --- a/test/abilities/shield_dust.test.ts +++ b/test/abilities/shield-dust.test.ts @@ -5,7 +5,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { MoveEffectPhase } from "#phases/move-effect-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { NumberHolder } from "#utils/common"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/shields_down.test.ts b/test/abilities/shields-down.test.ts similarity index 99% rename from test/abilities/shields_down.test.ts rename to test/abilities/shields-down.test.ts index 7678c7d8dac..0323a4afbec 100644 --- a/test/abilities/shields_down.test.ts +++ b/test/abilities/shields-down.test.ts @@ -6,7 +6,7 @@ import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; import { QuietFormChangePhase } from "#phases/quiet-form-change-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; describe("Abilities - SHIELDS DOWN", () => { diff --git a/test/abilities/simple.test.ts b/test/abilities/simple.test.ts index a709c8696d3..39f1b579a19 100644 --- a/test/abilities/simple.test.ts +++ b/test/abilities/simple.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/speed_boost.test.ts b/test/abilities/speed-boost.test.ts similarity index 98% rename from test/abilities/speed_boost.test.ts rename to test/abilities/speed-boost.test.ts index 975fc8ebecf..ff0beaf74a0 100644 --- a/test/abilities/speed_boost.test.ts +++ b/test/abilities/speed-boost.test.ts @@ -6,7 +6,7 @@ import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { AttemptRunPhase } from "#phases/attempt-run-phase"; import type { CommandPhase } from "#phases/command-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/stakeout.test.ts b/test/abilities/stakeout.test.ts index 85838a52abe..5dafb620274 100644 --- a/test/abilities/stakeout.test.ts +++ b/test/abilities/stakeout.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { isBetween } from "#utils/common"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/stall.test.ts b/test/abilities/stall.test.ts index c012586eea5..71796d376a3 100644 --- a/test/abilities/stall.test.ts +++ b/test/abilities/stall.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { TurnStartPhase } from "#phases/turn-start-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/steely_spirit.test.ts b/test/abilities/steely-spirit.test.ts similarity index 98% rename from test/abilities/steely_spirit.test.ts rename to test/abilities/steely-spirit.test.ts index 0ca7bebe17a..072566fdb96 100644 --- a/test/abilities/steely_spirit.test.ts +++ b/test/abilities/steely-spirit.test.ts @@ -2,7 +2,7 @@ import { allAbilities, allMoves } from "#data/data-lists"; import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/storm_drain.test.ts b/test/abilities/storm-drain.test.ts similarity index 98% rename from test/abilities/storm_drain.test.ts rename to test/abilities/storm-drain.test.ts index 59626546578..bc4d4f15cfa 100644 --- a/test/abilities/storm_drain.test.ts +++ b/test/abilities/storm-drain.test.ts @@ -3,7 +3,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/sturdy.test.ts b/test/abilities/sturdy.test.ts index 0cde40a91da..28d3098a420 100644 --- a/test/abilities/sturdy.test.ts +++ b/test/abilities/sturdy.test.ts @@ -4,7 +4,7 @@ import { SpeciesId } from "#enums/species-id"; import type { EnemyPokemon } from "#field/pokemon"; import { DamageAnimPhase } from "#phases/damage-anim-phase"; import { MoveEndPhase } from "#phases/move-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; diff --git a/test/abilities/super_luck.test.ts b/test/abilities/super-luck.test.ts similarity index 95% rename from test/abilities/super_luck.test.ts rename to test/abilities/super-luck.test.ts index 954251583f8..a0f5293b036 100644 --- a/test/abilities/super_luck.test.ts +++ b/test/abilities/super-luck.test.ts @@ -1,7 +1,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/supreme_overlord.test.ts b/test/abilities/supreme-overlord.test.ts similarity index 98% rename from test/abilities/supreme_overlord.test.ts rename to test/abilities/supreme-overlord.test.ts index b68153a2cc8..a0f2d9050b3 100644 --- a/test/abilities/supreme_overlord.test.ts +++ b/test/abilities/supreme-overlord.test.ts @@ -5,7 +5,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import type { Move } from "#moves/move"; import { MoveEffectPhase } from "#phases/move-effect-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/sweet_veil.test.ts b/test/abilities/sweet-veil.test.ts similarity index 97% rename from test/abilities/sweet_veil.test.ts rename to test/abilities/sweet-veil.test.ts index ca98e827c4f..12eeae9f9c5 100644 --- a/test/abilities/sweet_veil.test.ts +++ b/test/abilities/sweet-veil.test.ts @@ -4,7 +4,7 @@ import { BattlerTagType } from "#enums/battler-tag-type"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/synchronize.test.ts b/test/abilities/synchronize.test.ts index 1874560a166..c95ae1b7828 100644 --- a/test/abilities/synchronize.test.ts +++ b/test/abilities/synchronize.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/tera_shell.test.ts b/test/abilities/tera-shell.test.ts similarity index 98% rename from test/abilities/tera_shell.test.ts rename to test/abilities/tera-shell.test.ts index bd461e3aeba..385fabe1a54 100644 --- a/test/abilities/tera_shell.test.ts +++ b/test/abilities/tera-shell.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/thermal_exchange.test.ts b/test/abilities/thermal-exchange.test.ts similarity index 96% rename from test/abilities/thermal_exchange.test.ts rename to test/abilities/thermal-exchange.test.ts index 5e684b982e7..193676ccc18 100644 --- a/test/abilities/thermal_exchange.test.ts +++ b/test/abilities/thermal-exchange.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/trace.test.ts b/test/abilities/trace.test.ts index 7b87b3669b6..4211234a451 100644 --- a/test/abilities/trace.test.ts +++ b/test/abilities/trace.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/unburden.test.ts b/test/abilities/unburden.test.ts index 8d738db9076..686a6c20904 100644 --- a/test/abilities/unburden.test.ts +++ b/test/abilities/unburden.test.ts @@ -9,7 +9,7 @@ import { Stat } from "#enums/stat"; import type { Pokemon } from "#field/pokemon"; import type { ContactHeldItemTransferChanceModifier } from "#modifiers/modifier"; import { StealHeldItemChanceAttr } from "#moves/move"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/unseen_fist.test.ts b/test/abilities/unseen-fist.test.ts similarity index 98% rename from test/abilities/unseen_fist.test.ts rename to test/abilities/unseen-fist.test.ts index c986a112517..01b573fe66c 100644 --- a/test/abilities/unseen_fist.test.ts +++ b/test/abilities/unseen-fist.test.ts @@ -4,7 +4,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { BerryPhase } from "#phases/berry-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/victory_star.test.ts b/test/abilities/victory-star.test.ts similarity index 96% rename from test/abilities/victory_star.test.ts rename to test/abilities/victory-star.test.ts index aff91a7702b..40611f6fbc1 100644 --- a/test/abilities/victory_star.test.ts +++ b/test/abilities/victory-star.test.ts @@ -3,7 +3,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/vital_spirit.test.ts b/test/abilities/vital-spirit.test.ts similarity index 96% rename from test/abilities/vital_spirit.test.ts rename to test/abilities/vital-spirit.test.ts index 7530b2c6c04..e5d80a66a8e 100644 --- a/test/abilities/vital_spirit.test.ts +++ b/test/abilities/vital-spirit.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/volt_absorb.test.ts b/test/abilities/volt-absorb.test.ts similarity index 97% rename from test/abilities/volt_absorb.test.ts rename to test/abilities/volt-absorb.test.ts index 12de6ceff87..921d56f075b 100644 --- a/test/abilities/volt_absorb.test.ts +++ b/test/abilities/volt-absorb.test.ts @@ -5,7 +5,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/wandering_spirit.test.ts b/test/abilities/wandering-spirit.test.ts similarity index 97% rename from test/abilities/wandering_spirit.test.ts rename to test/abilities/wandering-spirit.test.ts index 3d26238e970..63c2550b198 100644 --- a/test/abilities/wandering_spirit.test.ts +++ b/test/abilities/wandering-spirit.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/water_bubble.test.ts b/test/abilities/water-bubble.test.ts similarity index 96% rename from test/abilities/water_bubble.test.ts rename to test/abilities/water-bubble.test.ts index c8d01eb2800..6be1ac51094 100644 --- a/test/abilities/water_bubble.test.ts +++ b/test/abilities/water-bubble.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/water_veil.test.ts b/test/abilities/water-veil.test.ts similarity index 96% rename from test/abilities/water_veil.test.ts rename to test/abilities/water-veil.test.ts index dcfe5b60fe9..0c7068ae209 100644 --- a/test/abilities/water_veil.test.ts +++ b/test/abilities/water-veil.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/wimp_out.test.ts b/test/abilities/wimp-out.test.ts similarity index 99% rename from test/abilities/wimp_out.test.ts rename to test/abilities/wimp-out.test.ts index d6e6908e19b..a1c19a12fd4 100644 --- a/test/abilities/wimp_out.test.ts +++ b/test/abilities/wimp-out.test.ts @@ -9,7 +9,7 @@ import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { StatusEffect } from "#enums/status-effect"; import { WeatherType } from "#enums/weather-type"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { toDmgValue } from "#utils/common"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/wind_power.test.ts b/test/abilities/wind-power.test.ts similarity index 98% rename from test/abilities/wind_power.test.ts rename to test/abilities/wind-power.test.ts index 255e8fa69be..377a8052e13 100644 --- a/test/abilities/wind_power.test.ts +++ b/test/abilities/wind-power.test.ts @@ -3,7 +3,7 @@ import { BattlerTagType } from "#enums/battler-tag-type"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/wind_rider.test.ts b/test/abilities/wind-rider.test.ts similarity index 98% rename from test/abilities/wind_rider.test.ts rename to test/abilities/wind-rider.test.ts index e7b55d2ef65..be30acb0f64 100644 --- a/test/abilities/wind_rider.test.ts +++ b/test/abilities/wind-rider.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/wonder_skin.test.ts b/test/abilities/wonder-skin.test.ts similarity index 97% rename from test/abilities/wonder_skin.test.ts rename to test/abilities/wonder-skin.test.ts index f55c303c9e3..8f14bf10101 100644 --- a/test/abilities/wonder_skin.test.ts +++ b/test/abilities/wonder-skin.test.ts @@ -3,7 +3,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { MoveEffectPhase } from "#phases/move-effect-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/abilities/zen_mode.test.ts b/test/abilities/zen-mode.test.ts similarity index 98% rename from test/abilities/zen_mode.test.ts rename to test/abilities/zen-mode.test.ts index 89dc0690ead..24d53bda7b6 100644 --- a/test/abilities/zen_mode.test.ts +++ b/test/abilities/zen-mode.test.ts @@ -3,7 +3,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/abilities/zero_to_hero.test.ts b/test/abilities/zero-to-hero.test.ts similarity index 98% rename from test/abilities/zero_to_hero.test.ts rename to test/abilities/zero-to-hero.test.ts index 84b3ddab60c..cb0fe75d11b 100644 --- a/test/abilities/zero_to_hero.test.ts +++ b/test/abilities/zero-to-hero.test.ts @@ -5,7 +5,7 @@ import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; import { QuietFormChangePhase } from "#phases/quiet-form-change-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; describe("Abilities - ZERO TO HERO", () => { diff --git a/test/achievements/achievement.test.ts b/test/achievements/achievement.test.ts index d736485b25f..9060d6213cc 100644 --- a/test/achievements/achievement.test.ts +++ b/test/achievements/achievement.test.ts @@ -11,7 +11,7 @@ import { MoneyAchv, RibbonAchv, } from "#system/achv"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { NumberHolder } from "#utils/common"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/arena/arena_gravity.test.ts b/test/arena/arena-gravity.test.ts similarity index 98% rename from test/arena/arena_gravity.test.ts rename to test/arena/arena-gravity.test.ts index d1cee1655a1..b08dcf0c9b0 100644 --- a/test/arena/arena_gravity.test.ts +++ b/test/arena/arena-gravity.test.ts @@ -5,7 +5,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { BattlerTagType } from "#enums/battler-tag-type"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/arena/grassy_terrain.test.ts b/test/arena/grassy-terrain.test.ts similarity index 96% rename from test/arena/grassy_terrain.test.ts rename to test/arena/grassy-terrain.test.ts index 541402123c4..d87498cdd23 100644 --- a/test/arena/grassy_terrain.test.ts +++ b/test/arena/grassy-terrain.test.ts @@ -2,7 +2,7 @@ import { allMoves } from "#data/data-lists"; import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/arena/psychic-terrain.test.ts b/test/arena/psychic-terrain.test.ts new file mode 100644 index 00000000000..82232cd8d05 --- /dev/null +++ b/test/arena/psychic-terrain.test.ts @@ -0,0 +1,59 @@ +import { AbilityId } from "#enums/ability-id"; +import { MoveId } from "#enums/move-id"; +import { SpeciesId } from "#enums/species-id"; +import { StatusEffect } from "#enums/status-effect"; +import { WeatherType } from "#enums/weather-type"; +import { GameManager } from "#test/test-utils/game-manager"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; + +describe("Arena - Psychic Terrain", () => { + let phaserGame: Phaser.Game; + let game: GameManager; + beforeAll(() => { + phaserGame = new Phaser.Game({ + type: Phaser.HEADLESS, + }); + }); + + afterEach(() => { + game.phaseInterceptor.restoreOg(); + }); + + beforeEach(() => { + game = new GameManager(phaserGame); + game.override + .battleStyle("single") + .criticalHits(false) + .enemyLevel(1) + .enemySpecies(SpeciesId.SHUCKLE) + .enemyAbility(AbilityId.STURDY) + .enemyMoveset(MoveId.SPLASH) + .moveset([MoveId.PSYCHIC_TERRAIN, MoveId.RAIN_DANCE, MoveId.DARK_VOID]) + .ability(AbilityId.NO_GUARD); + }); + + it("Dark Void with Prankster is not blocked", async () => { + await game.classicMode.startBattle([SpeciesId.MAGIKARP]); + + game.move.select(MoveId.PSYCHIC_TERRAIN); + await game.toNextTurn(); + + game.move.select(MoveId.DARK_VOID); + await game.toEndOfTurn(); + + expect(game.scene.getEnemyPokemon()!.status?.effect).toBe(StatusEffect.SLEEP); + }); + + it("Rain Dance with Prankster is not blocked", async () => { + await game.classicMode.startBattle([SpeciesId.MAGIKARP]); + + game.move.select(MoveId.PSYCHIC_TERRAIN); + await game.toNextTurn(); + + game.move.select(MoveId.RAIN_DANCE); + await game.toEndOfTurn(); + + expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.RAIN); + }); +}); diff --git a/test/arena/weather_fog.test.ts b/test/arena/weather-fog.test.ts similarity index 95% rename from test/arena/weather_fog.test.ts rename to test/arena/weather-fog.test.ts index f55a12e3e0f..8dd906d2df3 100644 --- a/test/arena/weather_fog.test.ts +++ b/test/arena/weather-fog.test.ts @@ -4,7 +4,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { WeatherType } from "#enums/weather-type"; import { MoveEffectPhase } from "#phases/move-effect-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/arena/weather_hail.test.ts b/test/arena/weather-hail.test.ts similarity index 97% rename from test/arena/weather_hail.test.ts rename to test/arena/weather-hail.test.ts index c6f27f647fe..b3ff8de3d42 100644 --- a/test/arena/weather_hail.test.ts +++ b/test/arena/weather-hail.test.ts @@ -2,7 +2,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { WeatherType } from "#enums/weather-type"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/arena/weather_sandstorm.test.ts b/test/arena/weather-sandstorm.test.ts similarity index 97% rename from test/arena/weather_sandstorm.test.ts rename to test/arena/weather-sandstorm.test.ts index a600aeed000..f5cf44458c5 100644 --- a/test/arena/weather_sandstorm.test.ts +++ b/test/arena/weather-sandstorm.test.ts @@ -3,7 +3,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { WeatherType } from "#enums/weather-type"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/arena/weather_strong_winds.test.ts b/test/arena/weather-strong-winds.test.ts similarity index 98% rename from test/arena/weather_strong_winds.test.ts rename to test/arena/weather-strong-winds.test.ts index b0b1bca8c4c..8d2d1ee0a75 100644 --- a/test/arena/weather_strong_winds.test.ts +++ b/test/arena/weather-strong-winds.test.ts @@ -4,7 +4,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; import { TurnStartPhase } from "#phases/turn-start-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/battle-scene.test.ts b/test/battle-scene.test.ts index a920c48ea75..0ff4b03a50f 100644 --- a/test/battle-scene.test.ts +++ b/test/battle-scene.test.ts @@ -1,5 +1,5 @@ import { LoadingScene } from "#app/loading-scene"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; describe("BattleScene", () => { diff --git a/test/battle/ability_swap.test.ts b/test/battle/ability-swap.test.ts similarity index 97% rename from test/battle/ability_swap.test.ts rename to test/battle/ability-swap.test.ts index 525c038d011..4ce60e1f0b2 100644 --- a/test/battle/ability_swap.test.ts +++ b/test/battle/ability-swap.test.ts @@ -3,7 +3,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/battle/battle-order.test.ts b/test/battle/battle-order.test.ts index a47da66c4d7..47afb582a5a 100644 --- a/test/battle/battle-order.test.ts +++ b/test/battle/battle-order.test.ts @@ -4,7 +4,7 @@ import { SpeciesId } from "#enums/species-id"; import { EnemyCommandPhase } from "#phases/enemy-command-phase"; import { SelectTargetPhase } from "#phases/select-target-phase"; import { TurnStartPhase } from "#phases/turn-start-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/battle/battle.test.ts b/test/battle/battle.test.ts index 7a2365fb6d8..ff5090e5f8d 100644 --- a/test/battle/battle.test.ts +++ b/test/battle/battle.test.ts @@ -21,8 +21,8 @@ import { SummonPhase } from "#phases/summon-phase"; import { SwitchPhase } from "#phases/switch-phase"; import { TitlePhase } from "#phases/title-phase"; import { TurnInitPhase } from "#phases/turn-init-phase"; -import { GameManager } from "#test/testUtils/gameManager"; -import { generateStarter } from "#test/testUtils/gameManagerUtils"; +import { GameManager } from "#test/test-utils/game-manager"; +import { generateStarter } from "#test/test-utils/game-manager-utils"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; @@ -111,7 +111,7 @@ describe("Phase - Battle Phase", () => { }); it("load 100% data file", async () => { - await game.importData("./test/testUtils/saves/everything.prsv"); + await game.importData("./test/test-utils/saves/everything.prsv"); const caughtCount = Object.keys(game.scene.gameData.dexData).filter(key => { const species = game.scene.gameData.dexData[key]; return species.caughtAttr !== 0n; diff --git a/test/battle/damage_calculation.test.ts b/test/battle/damage-calculation.test.ts similarity index 98% rename from test/battle/damage_calculation.test.ts rename to test/battle/damage-calculation.test.ts index fbcefcb0693..ca01830abd0 100644 --- a/test/battle/damage_calculation.test.ts +++ b/test/battle/damage-calculation.test.ts @@ -4,7 +4,7 @@ import { ArenaTagType } from "#enums/arena-tag-type"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import type { EnemyPersistentModifier } from "#modifiers/modifier"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/battle/double_battle.test.ts b/test/battle/double-battle.test.ts similarity index 98% rename from test/battle/double_battle.test.ts rename to test/battle/double-battle.test.ts index 7e0aa0f6c69..ad385a1cecf 100644 --- a/test/battle/double_battle.test.ts +++ b/test/battle/double-battle.test.ts @@ -7,7 +7,7 @@ import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; import { BattleEndPhase } from "#phases/battle-end-phase"; import { TurnInitPhase } from "#phases/turn-init-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/battle/inverse_battle.test.ts b/test/battle/inverse-battle.test.ts similarity index 99% rename from test/battle/inverse_battle.test.ts rename to test/battle/inverse-battle.test.ts index f9fd8f80a37..9ba2df9bc44 100644 --- a/test/battle/inverse_battle.test.ts +++ b/test/battle/inverse-battle.test.ts @@ -6,7 +6,7 @@ import { MoveId } from "#enums/move-id"; import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/battle/special_battle.test.ts b/test/battle/special-battle.test.ts similarity index 98% rename from test/battle/special_battle.test.ts rename to test/battle/special-battle.test.ts index 36b543b0666..d22931bfea5 100644 --- a/test/battle/special_battle.test.ts +++ b/test/battle/special-battle.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { UiMode } from "#enums/ui-mode"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/battlerTags/octolock.test.ts b/test/battler-tags/octolock.test.ts similarity index 96% rename from test/battlerTags/octolock.test.ts rename to test/battler-tags/octolock.test.ts index 5b395a180a2..29024f177cb 100644 --- a/test/battlerTags/octolock.test.ts +++ b/test/battler-tags/octolock.test.ts @@ -3,7 +3,7 @@ import { BattlerTagLapseType } from "#enums/battler-tag-lapse-type"; import { Stat } from "#enums/stat"; import type { Pokemon } from "#field/pokemon"; import { StatStageChangePhase } from "#phases/stat-stage-change-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { afterEach, beforeAll, describe, expect, it, vi } from "vitest"; describe("BattlerTag - OctolockTag", () => { diff --git a/test/battlerTags/stockpiling.test.ts b/test/battler-tags/stockpiling.test.ts similarity index 99% rename from test/battlerTags/stockpiling.test.ts rename to test/battler-tags/stockpiling.test.ts index 9024b3edb3c..a4bed560687 100644 --- a/test/battlerTags/stockpiling.test.ts +++ b/test/battler-tags/stockpiling.test.ts @@ -4,7 +4,7 @@ import { PokemonSummonData } from "#data/pokemon-data"; import { Stat } from "#enums/stat"; import type { Pokemon } from "#field/pokemon"; import { StatStageChangePhase } from "#phases/stat-stage-change-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; beforeEach(() => { diff --git a/test/battlerTags/substitute.test.ts b/test/battler-tags/substitute.test.ts similarity index 99% rename from test/battlerTags/substitute.test.ts rename to test/battler-tags/substitute.test.ts index 825bebf1a1e..7ae60ad1408 100644 --- a/test/battlerTags/substitute.test.ts +++ b/test/battler-tags/substitute.test.ts @@ -9,7 +9,7 @@ import { MoveResult } from "#enums/move-result"; import { PokemonAnimType } from "#enums/pokemon-anim-type"; import type { Pokemon } from "#field/pokemon"; import type { MoveEffectPhase } from "#phases/move-effect-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import type { TurnMove } from "#types/turn-move"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/boss-pokemon.test.ts b/test/boss-pokemon.test.ts index 06a2f313016..0a7c71c95e7 100644 --- a/test/boss-pokemon.test.ts +++ b/test/boss-pokemon.test.ts @@ -3,7 +3,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { EFFECTIVE_STATS } from "#enums/stat"; import type { EnemyPokemon } from "#field/pokemon"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { toDmgValue } from "#utils/common"; import { getPokemonSpecies } from "#utils/pokemon-utils"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/daily_mode.test.ts b/test/daily-mode.test.ts similarity index 98% rename from test/daily_mode.test.ts rename to test/daily-mode.test.ts index 0fa7c0dc846..34a8da80478 100644 --- a/test/daily_mode.test.ts +++ b/test/daily-mode.test.ts @@ -4,7 +4,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { UiMode } from "#enums/ui-mode"; import { MapModifier } from "#modifiers/modifier"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { ModifierSelectUiHandler } from "#ui/modifier-select-ui-handler"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/data/splash_messages.test.ts b/test/data/splash-messages.test.ts similarity index 100% rename from test/data/splash_messages.test.ts rename to test/data/splash-messages.test.ts diff --git a/test/data/status_effect.test.ts b/test/data/status-effect.test.ts similarity index 99% rename from test/data/status_effect.test.ts rename to test/data/status-effect.test.ts index 2ea4dce4147..ebfd9066b3c 100644 --- a/test/data/status_effect.test.ts +++ b/test/data/status-effect.test.ts @@ -11,8 +11,8 @@ import { MoveId } from "#enums/move-id"; import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; -import { mockI18next } from "#test/testUtils/testUtils"; +import { GameManager } from "#test/test-utils/game-manager"; +import { mockI18next } from "#test/test-utils/test-utils"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; const pokemonName = "PKM"; diff --git a/test/eggs/egg.test.ts b/test/eggs/egg.test.ts index b27124bd786..8b47e68f402 100644 --- a/test/eggs/egg.test.ts +++ b/test/eggs/egg.test.ts @@ -6,7 +6,7 @@ import { EggTier } from "#enums/egg-type"; import { SpeciesId } from "#enums/species-id"; import { VariantTier } from "#enums/variant-tier"; import { EggData } from "#system/egg-data"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import * as Utils from "#utils/common"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; @@ -28,7 +28,7 @@ describe("Egg Generation Tests", () => { }); beforeEach(async () => { - await game.importData("./test/testUtils/saves/everything.prsv"); + await game.importData("./test/test-utils/saves/everything.prsv"); }); it("should return Kyogre for the 10th of June", () => { diff --git a/test/eggs/manaphy-egg.test.ts b/test/eggs/manaphy-egg.test.ts index 319b5a15d7b..484426f1b76 100644 --- a/test/eggs/manaphy-egg.test.ts +++ b/test/eggs/manaphy-egg.test.ts @@ -2,7 +2,7 @@ import { Egg } from "#data/egg"; import { EggSourceType } from "#enums/egg-source-types"; import { EggTier } from "#enums/egg-type"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; @@ -24,7 +24,7 @@ describe("Manaphy Eggs", () => { }); beforeEach(async () => { - await game.importData("./test/testUtils/saves/everything.prsv"); + await game.importData("./test/test-utils/saves/everything.prsv"); /** * In our tests, we will perform an "RNG sweep" by letting rngSweepProgress diff --git a/test/endless_boss.test.ts b/test/endless-boss.test.ts similarity index 98% rename from test/endless_boss.test.ts rename to test/endless-boss.test.ts index 99c179ceeb6..707d164d4d0 100644 --- a/test/endless_boss.test.ts +++ b/test/endless-boss.test.ts @@ -1,7 +1,7 @@ import { BiomeId } from "#enums/biome-id"; import { GameModes } from "#enums/game-modes"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; const EndlessBossWave = { diff --git a/test/enemy_command.test.ts b/test/enemy-command.test.ts similarity index 96% rename from test/enemy_command.test.ts rename to test/enemy-command.test.ts index 249c819a107..12281179e0d 100644 --- a/test/enemy_command.test.ts +++ b/test/enemy-command.test.ts @@ -2,11 +2,11 @@ import type { BattleScene } from "#app/battle-scene"; import { allMoves } from "#data/data-lists"; import { AbilityId } from "#enums/ability-id"; import { AiType } from "#enums/ai-type"; -import { MoveCategory } from "#enums/MoveCategory"; +import { MoveCategory } from "#enums/move-category"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import type { EnemyPokemon } from "#field/pokemon"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { randSeedInt } from "#utils/common"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/escape-calculations.test.ts b/test/escape-calculations.test.ts index 338d2a1dcfc..f1bb955582a 100644 --- a/test/escape-calculations.test.ts +++ b/test/escape-calculations.test.ts @@ -3,7 +3,7 @@ import { Command } from "#enums/command"; import { SpeciesId } from "#enums/species-id"; import { AttemptRunPhase } from "#phases/attempt-run-phase"; import type { CommandPhase } from "#phases/command-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/evolution.test.ts b/test/evolution.test.ts index ffede4d09d6..172a4e5d3aa 100644 --- a/test/evolution.test.ts +++ b/test/evolution.test.ts @@ -2,7 +2,7 @@ import { pokemonEvolutions, SpeciesFormEvolution, SpeciesWildEvolutionDelay } fr import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import * as Utils from "#utils/common"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/field/pokemon-id-checks.test.ts b/test/field/pokemon-id-checks.test.ts index 065a1ffeb7e..3a648802a1d 100644 --- a/test/field/pokemon-id-checks.test.ts +++ b/test/field/pokemon-id-checks.test.ts @@ -5,7 +5,7 @@ import { BattlerTagType } from "#enums/battler-tag-type"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import type { Pokemon } from "#field/pokemon"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/field/pokemon.test.ts b/test/field/pokemon.test.ts index 8c04dc61b32..baa50556473 100644 --- a/test/field/pokemon.test.ts +++ b/test/field/pokemon.test.ts @@ -4,7 +4,7 @@ import { MoveId } from "#enums/move-id"; import { PokeballType } from "#enums/pokeball"; import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; describe("Spec - Pokemon", () => { diff --git a/test/final_boss.test.ts b/test/final-boss.test.ts similarity index 98% rename from test/final_boss.test.ts rename to test/final-boss.test.ts index 9dc54490330..2180979899a 100644 --- a/test/final_boss.test.ts +++ b/test/final-boss.test.ts @@ -5,7 +5,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; import { TurnHeldItemTransferModifier } from "#modifiers/modifier"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; const FinalWave = { diff --git a/test/fontFace.setup.ts b/test/font-face.setup.ts similarity index 100% rename from test/fontFace.setup.ts rename to test/font-face.setup.ts diff --git a/test/game-mode.test.ts b/test/game-mode.test.ts index 52de7e6a705..56af49b3f12 100644 --- a/test/game-mode.test.ts +++ b/test/game-mode.test.ts @@ -1,7 +1,7 @@ import type { GameMode } from "#app/game-mode"; import { getGameMode } from "#app/game-mode"; import { GameModes } from "#enums/game-modes"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import * as Utils from "#utils/common"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/inputs/inputs.test.ts b/test/inputs/inputs.test.ts index ce208d6ce6d..636b2e7a99e 100644 --- a/test/inputs/inputs.test.ts +++ b/test/inputs/inputs.test.ts @@ -1,7 +1,7 @@ -import cfg_keyboard_qwerty from "#inputs/cfg_keyboard_qwerty"; -import pad_xbox360 from "#inputs/pad_xbox360"; -import { GameManager } from "#test/testUtils/gameManager"; -import { InputsHandler } from "#test/testUtils/inputsHandler"; +import cfg_keyboard_qwerty from "#inputs/cfg-keyboard-qwerty"; +import pad_xbox360 from "#inputs/pad-xbox360"; +import { GameManager } from "#test/test-utils/game-manager"; +import { InputsHandler } from "#test/test-utils/inputs-handler"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/internals.test.ts b/test/internals.test.ts index bb3cd89565c..bb33b01c265 100644 --- a/test/internals.test.ts +++ b/test/internals.test.ts @@ -1,6 +1,6 @@ import { AbilityId } from "#enums/ability-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/items/dire_hit.test.ts b/test/items/dire-hit.test.ts similarity index 98% rename from test/items/dire_hit.test.ts rename to test/items/dire-hit.test.ts index 2473dd0038e..fe7fabd3c4c 100644 --- a/test/items/dire_hit.test.ts +++ b/test/items/dire-hit.test.ts @@ -9,7 +9,7 @@ import { CommandPhase } from "#phases/command-phase"; import { NewBattlePhase } from "#phases/new-battle-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; import { TurnInitPhase } from "#phases/turn-init-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import type { ModifierSelectUiHandler } from "#ui/modifier-select-ui-handler"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/items/double_battle_chance_booster.test.ts b/test/items/double-battle-chance-booster.test.ts similarity index 98% rename from test/items/double_battle_chance_booster.test.ts rename to test/items/double-battle-chance-booster.test.ts index df6a3c6d7de..2c12b34eba3 100644 --- a/test/items/double_battle_chance_booster.test.ts +++ b/test/items/double-battle-chance-booster.test.ts @@ -4,7 +4,7 @@ import { ShopCursorTarget } from "#enums/shop-cursor-target"; import { SpeciesId } from "#enums/species-id"; import { UiMode } from "#enums/ui-mode"; import { DoubleBattleChanceBoosterModifier } from "#modifiers/modifier"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import type { ModifierSelectUiHandler } from "#ui/modifier-select-ui-handler"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/items/eviolite.test.ts b/test/items/eviolite.test.ts index 74aff03616c..2e64135d264 100644 --- a/test/items/eviolite.test.ts +++ b/test/items/eviolite.test.ts @@ -1,7 +1,7 @@ import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { StatBoosterModifier } from "#modifiers/modifier"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { NumberHolder, randItem } from "#utils/common"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/items/exp_booster.test.ts b/test/items/exp-booster.test.ts similarity index 95% rename from test/items/exp_booster.test.ts rename to test/items/exp-booster.test.ts index 6c8c16d08f4..dd2c8eb0c2b 100644 --- a/test/items/exp_booster.test.ts +++ b/test/items/exp-booster.test.ts @@ -1,6 +1,6 @@ import { AbilityId } from "#enums/ability-id"; import { PokemonExpBoosterModifier } from "#modifiers/modifier"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { NumberHolder } from "#utils/common"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/items/grip_claw.test.ts b/test/items/grip-claw.test.ts similarity index 98% rename from test/items/grip_claw.test.ts rename to test/items/grip-claw.test.ts index 6e25cdf6c08..5ffebd76946 100644 --- a/test/items/grip_claw.test.ts +++ b/test/items/grip-claw.test.ts @@ -5,7 +5,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import type { Pokemon } from "#field/pokemon"; import type { ContactHeldItemTransferChanceModifier } from "#modifiers/modifier"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/items/leek.test.ts b/test/items/leek.test.ts index 7ee3dff23d6..c38294d07a4 100644 --- a/test/items/leek.test.ts +++ b/test/items/leek.test.ts @@ -1,7 +1,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { randInt } from "#utils/common"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/items/leftovers.test.ts b/test/items/leftovers.test.ts index 9f2c532ef8b..bed40b1c83a 100644 --- a/test/items/leftovers.test.ts +++ b/test/items/leftovers.test.ts @@ -3,7 +3,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { DamageAnimPhase } from "#phases/damage-anim-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/items/light_ball.test.ts b/test/items/light-ball.test.ts similarity index 99% rename from test/items/light_ball.test.ts rename to test/items/light-ball.test.ts index eebcc81c224..a7f41255ff3 100644 --- a/test/items/light_ball.test.ts +++ b/test/items/light-ball.test.ts @@ -3,7 +3,7 @@ import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { SpeciesStatBoosterModifier } from "#modifiers/modifier"; import i18next from "#plugins/i18n"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { NumberHolder } from "#utils/common"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/items/lock_capsule.test.ts b/test/items/lock-capsule.test.ts similarity index 96% rename from test/items/lock_capsule.test.ts rename to test/items/lock-capsule.test.ts index e98e6880eb1..01552a4db37 100644 --- a/test/items/lock_capsule.test.ts +++ b/test/items/lock-capsule.test.ts @@ -3,7 +3,7 @@ import { ModifierTier } from "#enums/modifier-tier"; import { MoveId } from "#enums/move-id"; import { UiMode } from "#enums/ui-mode"; import { SelectModifierPhase } from "#phases/select-modifier-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/items/metal_powder.test.ts b/test/items/metal-powder.test.ts similarity index 99% rename from test/items/metal_powder.test.ts rename to test/items/metal-powder.test.ts index 17baa057fd5..4dac8dd39b1 100644 --- a/test/items/metal_powder.test.ts +++ b/test/items/metal-powder.test.ts @@ -3,7 +3,7 @@ import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { SpeciesStatBoosterModifier } from "#modifiers/modifier"; import i18next from "#plugins/i18n"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { NumberHolder } from "#utils/common"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/items/multi_lens.test.ts b/test/items/multi-lens.test.ts similarity index 99% rename from test/items/multi_lens.test.ts rename to test/items/multi-lens.test.ts index 56d452df9d2..e3cf39e4933 100644 --- a/test/items/multi_lens.test.ts +++ b/test/items/multi-lens.test.ts @@ -3,7 +3,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/items/mystical_rock.test.ts b/test/items/mystical-rock.test.ts similarity index 96% rename from test/items/mystical_rock.test.ts rename to test/items/mystical-rock.test.ts index f1e9bb91ecf..3a29c359582 100644 --- a/test/items/mystical_rock.test.ts +++ b/test/items/mystical-rock.test.ts @@ -2,7 +2,7 @@ import { globalScene } from "#app/global-scene"; import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/items/quick_powder.test.ts b/test/items/quick-powder.test.ts similarity index 99% rename from test/items/quick_powder.test.ts rename to test/items/quick-powder.test.ts index 6c8cb0751c3..2200e8cf96e 100644 --- a/test/items/quick_powder.test.ts +++ b/test/items/quick-powder.test.ts @@ -3,7 +3,7 @@ import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { SpeciesStatBoosterModifier } from "#modifiers/modifier"; import i18next from "#plugins/i18n"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { NumberHolder } from "#utils/common"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/items/reviver_seed.test.ts b/test/items/reviver-seed.test.ts similarity index 98% rename from test/items/reviver_seed.test.ts rename to test/items/reviver-seed.test.ts index f0929ee0993..268c5497899 100644 --- a/test/items/reviver_seed.test.ts +++ b/test/items/reviver-seed.test.ts @@ -5,7 +5,7 @@ import { BattlerTagType } from "#enums/battler-tag-type"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import type { PokemonInstantReviveModifier } from "#modifiers/modifier"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/items/scope_lens.test.ts b/test/items/scope-lens.test.ts similarity index 95% rename from test/items/scope_lens.test.ts rename to test/items/scope-lens.test.ts index 866164629f8..578b0576aaa 100644 --- a/test/items/scope_lens.test.ts +++ b/test/items/scope-lens.test.ts @@ -1,7 +1,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/items/temp_stat_stage_booster.test.ts b/test/items/temp-stat-stage-booster.test.ts similarity index 98% rename from test/items/temp_stat_stage_booster.test.ts rename to test/items/temp-stat-stage-booster.test.ts index 454a469700a..806ff20df6c 100644 --- a/test/items/temp_stat_stage_booster.test.ts +++ b/test/items/temp-stat-stage-booster.test.ts @@ -7,7 +7,7 @@ import { BATTLE_STATS, Stat } from "#enums/stat"; import { UiMode } from "#enums/ui-mode"; import { TempStatStageBoosterModifier } from "#modifiers/modifier"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import type { ModifierSelectUiHandler } from "#ui/modifier-select-ui-handler"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/items/thick_club.test.ts b/test/items/thick-club.test.ts similarity index 99% rename from test/items/thick_club.test.ts rename to test/items/thick-club.test.ts index 3a993d64a0c..c497cef6338 100644 --- a/test/items/thick_club.test.ts +++ b/test/items/thick-club.test.ts @@ -3,7 +3,7 @@ import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { SpeciesStatBoosterModifier } from "#modifiers/modifier"; import i18next from "#plugins/i18n"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { NumberHolder, randInt } from "#utils/common"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/items/toxic_orb.test.ts b/test/items/toxic-orb.test.ts similarity index 96% rename from test/items/toxic_orb.test.ts rename to test/items/toxic-orb.test.ts index 0f4acedbfb5..a1888a6aa1d 100644 --- a/test/items/toxic_orb.test.ts +++ b/test/items/toxic-orb.test.ts @@ -3,7 +3,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; import i18next from "#plugins/i18n"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/matchers.setup.ts b/test/matchers.setup.ts new file mode 100644 index 00000000000..03d9dd342e4 --- /dev/null +++ b/test/matchers.setup.ts @@ -0,0 +1,13 @@ +import { toEqualArrayUnsorted } from "#test/test-utils/matchers/to-equal-array-unsorted"; +import { toHaveTypes } from "#test/test-utils/matchers/to-have-types"; +import { expect } from "vitest"; + +/* + * Setup file for custom matchers. + * Make sure to define the call signatures in `test/@types/vitest.d.ts` too! + */ + +expect.extend({ + toEqualArrayUnsorted, + toHaveTypes, +}); diff --git a/test/misc.test.ts b/test/misc.test.ts index 5afd8f898c6..96407b78470 100644 --- a/test/misc.test.ts +++ b/test/misc.test.ts @@ -1,5 +1,5 @@ -import { GameManager } from "#test/testUtils/gameManager"; -import { waitUntil } from "#test/testUtils/gameManagerUtils"; +import { GameManager } from "#test/test-utils/game-manager"; +import { waitUntil } from "#test/test-utils/game-manager-utils"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/ability-ignore-moves.test.ts b/test/moves/ability-ignore-moves.test.ts index 99c5b8f8efe..750d8fe2f20 100644 --- a/test/moves/ability-ignore-moves.test.ts +++ b/test/moves/ability-ignore-moves.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/after_you.test.ts b/test/moves/after-you.test.ts similarity index 98% rename from test/moves/after_you.test.ts rename to test/moves/after-you.test.ts index e961342dc36..1625af3dd88 100644 --- a/test/moves/after_you.test.ts +++ b/test/moves/after-you.test.ts @@ -5,7 +5,7 @@ import { MoveResult } from "#enums/move-result"; import { MoveUseMode } from "#enums/move-use-mode"; import { SpeciesId } from "#enums/species-id"; import { MovePhase } from "#phases/move-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/alluring_voice.test.ts b/test/moves/alluring-voice.test.ts similarity index 95% rename from test/moves/alluring_voice.test.ts rename to test/moves/alluring-voice.test.ts index d72d7b4f906..dc01cc1a54e 100644 --- a/test/moves/alluring_voice.test.ts +++ b/test/moves/alluring-voice.test.ts @@ -4,7 +4,7 @@ import { BattlerTagType } from "#enums/battler-tag-type"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { BerryPhase } from "#phases/berry-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/aromatherapy.test.ts b/test/moves/aromatherapy.test.ts index 39850c4f841..60f9923a2f8 100644 --- a/test/moves/aromatherapy.test.ts +++ b/test/moves/aromatherapy.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/assist.test.ts b/test/moves/assist.test.ts index eff153534dd..52467c2ba98 100644 --- a/test/moves/assist.test.ts +++ b/test/moves/assist.test.ts @@ -4,7 +4,7 @@ import { MoveId } from "#enums/move-id"; import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; @@ -86,12 +86,11 @@ describe("Moves - Assist", () => { }); it("should apply secondary effects of a move", async () => { - game.override.moveset([MoveId.ASSIST, MoveId.WOOD_HAMMER, MoveId.WOOD_HAMMER, MoveId.WOOD_HAMMER]); await game.classicMode.startBattle([SpeciesId.FEEBAS, SpeciesId.SHUCKLE]); const [feebas, shuckle] = game.scene.getPlayerField(); - game.move.changeMoveset(feebas, [MoveId.ASSIST, MoveId.SKETCH, MoveId.PROTECT, MoveId.DRAGON_TAIL]); - game.move.changeMoveset(shuckle, [MoveId.ASSIST, MoveId.SKETCH, MoveId.PROTECT, MoveId.DRAGON_TAIL]); + game.move.changeMoveset(feebas, [MoveId.ASSIST, MoveId.WOOD_HAMMER]); + game.move.changeMoveset(shuckle, [MoveId.ASSIST, MoveId.WOOD_HAMMER]); game.move.select(MoveId.ASSIST, 0); game.move.select(MoveId.ASSIST, 1); diff --git a/test/moves/astonish.test.ts b/test/moves/astonish.test.ts index 7db149c9975..0f7dc526b2d 100644 --- a/test/moves/astonish.test.ts +++ b/test/moves/astonish.test.ts @@ -7,7 +7,7 @@ import { BerryPhase } from "#phases/berry-phase"; import { CommandPhase } from "#phases/command-phase"; import { MoveEndPhase } from "#phases/move-end-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; diff --git a/test/moves/aurora_veil.test.ts b/test/moves/aurora-veil.test.ts similarity index 98% rename from test/moves/aurora_veil.test.ts rename to test/moves/aurora-veil.test.ts index 24e7b1857cc..3c7c86c7fdf 100644 --- a/test/moves/aurora_veil.test.ts +++ b/test/moves/aurora-veil.test.ts @@ -8,7 +8,7 @@ import { SpeciesId } from "#enums/species-id"; import { WeatherType } from "#enums/weather-type"; import type { Pokemon } from "#field/pokemon"; import type { Move } from "#moves/move"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { NumberHolder } from "#utils/common"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/autotomize.test.ts b/test/moves/autotomize.test.ts index 01021870b88..a8a7309e03e 100644 --- a/test/moves/autotomize.test.ts +++ b/test/moves/autotomize.test.ts @@ -1,7 +1,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/baddy_bad.test.ts b/test/moves/baddy-bad.test.ts similarity index 94% rename from test/moves/baddy_bad.test.ts rename to test/moves/baddy-bad.test.ts index 0af04f0c0c7..5888dd58c31 100644 --- a/test/moves/baddy_bad.test.ts +++ b/test/moves/baddy-bad.test.ts @@ -1,7 +1,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/baneful_bunker.test.ts b/test/moves/baneful-bunker.test.ts similarity index 97% rename from test/moves/baneful_bunker.test.ts rename to test/moves/baneful-bunker.test.ts index 09050dcbb44..da2a8e0418a 100644 --- a/test/moves/baneful_bunker.test.ts +++ b/test/moves/baneful-bunker.test.ts @@ -3,7 +3,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; diff --git a/test/moves/baton_pass.test.ts b/test/moves/baton-pass.test.ts similarity index 98% rename from test/moves/baton_pass.test.ts rename to test/moves/baton-pass.test.ts index af49ac0db9f..ef1979b223d 100644 --- a/test/moves/baton_pass.test.ts +++ b/test/moves/baton-pass.test.ts @@ -4,7 +4,7 @@ import { BattlerTagType } from "#enums/battler-tag-type"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/beak_blast.test.ts b/test/moves/beak-blast.test.ts similarity index 98% rename from test/moves/beak_blast.test.ts rename to test/moves/beak-blast.test.ts index 60a6bb75066..71d2d957bed 100644 --- a/test/moves/beak_blast.test.ts +++ b/test/moves/beak-blast.test.ts @@ -6,7 +6,7 @@ import { StatusEffect } from "#enums/status-effect"; import { BerryPhase } from "#phases/berry-phase"; import { MovePhase } from "#phases/move-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/beat_up.test.ts b/test/moves/beat-up.test.ts similarity index 97% rename from test/moves/beat_up.test.ts rename to test/moves/beat-up.test.ts index 8387b6f671b..79d672bd0ed 100644 --- a/test/moves/beat_up.test.ts +++ b/test/moves/beat-up.test.ts @@ -3,7 +3,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; import { MoveEffectPhase } from "#phases/move-effect-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/belly_drum.test.ts b/test/moves/belly-drum.test.ts similarity index 98% rename from test/moves/belly_drum.test.ts rename to test/moves/belly-drum.test.ts index 9044e10589f..9cbb7adb1ae 100644 --- a/test/moves/belly_drum.test.ts +++ b/test/moves/belly-drum.test.ts @@ -3,7 +3,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { toDmgValue } from "#utils/common"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; diff --git a/test/moves/burning_jealousy.test.ts b/test/moves/burning-jealousy.test.ts similarity index 98% rename from test/moves/burning_jealousy.test.ts rename to test/moves/burning-jealousy.test.ts index 9f8dfc29ee4..62f41790582 100644 --- a/test/moves/burning_jealousy.test.ts +++ b/test/moves/burning-jealousy.test.ts @@ -4,7 +4,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/camouflage.test.ts b/test/moves/camouflage.test.ts index 39bf8f6d5b5..badab8ec4a5 100644 --- a/test/moves/camouflage.test.ts +++ b/test/moves/camouflage.test.ts @@ -4,7 +4,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/ceaseless_edge.test.ts b/test/moves/ceaseless-edge.test.ts similarity index 98% rename from test/moves/ceaseless_edge.test.ts rename to test/moves/ceaseless-edge.test.ts index 2d28f4b1a1b..56d7c97ea68 100644 --- a/test/moves/ceaseless_edge.test.ts +++ b/test/moves/ceaseless-edge.test.ts @@ -7,7 +7,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { MoveEffectPhase } from "#phases/move-effect-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; diff --git a/test/moves/chilly_reception.test.ts b/test/moves/chilly-reception.test.ts similarity index 98% rename from test/moves/chilly_reception.test.ts rename to test/moves/chilly-reception.test.ts index f34e61873cc..948b42cb3f2 100644 --- a/test/moves/chilly_reception.test.ts +++ b/test/moves/chilly-reception.test.ts @@ -5,7 +5,7 @@ import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; import { WeatherType } from "#enums/weather-type"; import { RandomMoveAttr } from "#moves/move"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import i18next from "i18next"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/chloroblast.test.ts b/test/moves/chloroblast.test.ts index c87f79c440a..a6320d2691d 100644 --- a/test/moves/chloroblast.test.ts +++ b/test/moves/chloroblast.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/clangorous_soul.test.ts b/test/moves/clangorous-soul.test.ts similarity index 98% rename from test/moves/clangorous_soul.test.ts rename to test/moves/clangorous-soul.test.ts index dc208087bb8..82a0d383f65 100644 --- a/test/moves/clangorous_soul.test.ts +++ b/test/moves/clangorous-soul.test.ts @@ -2,7 +2,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/copycat.test.ts b/test/moves/copycat.test.ts index e6a81cb5627..91e941e2845 100644 --- a/test/moves/copycat.test.ts +++ b/test/moves/copycat.test.ts @@ -5,7 +5,7 @@ import { MoveResult } from "#enums/move-result"; import { MoveUseMode } from "#enums/move-use-mode"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/crafty_shield.test.ts b/test/moves/crafty-shield.test.ts similarity index 97% rename from test/moves/crafty_shield.test.ts rename to test/moves/crafty-shield.test.ts index 98c0dfd7c9a..d0c148c1f41 100644 --- a/test/moves/crafty_shield.test.ts +++ b/test/moves/crafty-shield.test.ts @@ -4,7 +4,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { BerryPhase } from "#phases/berry-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; diff --git a/test/moves/defog.test.ts b/test/moves/defog.test.ts index 253eac4f22c..820dfaa6bcb 100644 --- a/test/moves/defog.test.ts +++ b/test/moves/defog.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/destiny_bond.test.ts b/test/moves/destiny-bond.test.ts similarity index 99% rename from test/moves/destiny_bond.test.ts rename to test/moves/destiny-bond.test.ts index 29bbfabb09f..48bd29fe662 100644 --- a/test/moves/destiny_bond.test.ts +++ b/test/moves/destiny-bond.test.ts @@ -8,7 +8,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; import { PokemonInstantReviveModifier } from "#modifiers/modifier"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/diamond_storm.test.ts b/test/moves/diamond-storm.test.ts similarity index 95% rename from test/moves/diamond_storm.test.ts rename to test/moves/diamond-storm.test.ts index 1eb86f94b76..9de7409ca18 100644 --- a/test/moves/diamond_storm.test.ts +++ b/test/moves/diamond-storm.test.ts @@ -3,7 +3,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/dig.test.ts b/test/moves/dig.test.ts index 9d431b78838..2cb8ae05963 100644 --- a/test/moves/dig.test.ts +++ b/test/moves/dig.test.ts @@ -6,7 +6,7 @@ import { MoveId } from "#enums/move-id"; import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; describe("Moves - Dig", () => { diff --git a/test/moves/disable.test.ts b/test/moves/disable.test.ts index f6b1c24ac7d..5543c16fecf 100644 --- a/test/moves/disable.test.ts +++ b/test/moves/disable.test.ts @@ -6,7 +6,7 @@ import { MoveUseMode } from "#enums/move-use-mode"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { RandomMoveAttr } from "#moves/move"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; describe("Moves - Disable", () => { diff --git a/test/moves/dive.test.ts b/test/moves/dive.test.ts index c7e4f99f6cb..c34f3dc54dc 100644 --- a/test/moves/dive.test.ts +++ b/test/moves/dive.test.ts @@ -5,7 +5,7 @@ import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; import { WeatherType } from "#enums/weather-type"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/doodle.test.ts b/test/moves/doodle.test.ts index 5f4b8ab9b39..c4380720f20 100644 --- a/test/moves/doodle.test.ts +++ b/test/moves/doodle.test.ts @@ -3,7 +3,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/double_team.test.ts b/test/moves/double-team.test.ts similarity index 96% rename from test/moves/double_team.test.ts rename to test/moves/double-team.test.ts index 9cdae33af41..9276a0956e8 100644 --- a/test/moves/double_team.test.ts +++ b/test/moves/double-team.test.ts @@ -3,7 +3,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/dragon_cheer.test.ts b/test/moves/dragon-cheer.test.ts similarity index 98% rename from test/moves/dragon_cheer.test.ts rename to test/moves/dragon-cheer.test.ts index 7d1f35fe2d4..614dd9ab6ab 100644 --- a/test/moves/dragon_cheer.test.ts +++ b/test/moves/dragon-cheer.test.ts @@ -3,7 +3,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/dragon_rage.test.ts b/test/moves/dragon-rage.test.ts similarity index 98% rename from test/moves/dragon_rage.test.ts rename to test/moves/dragon-rage.test.ts index 46e7dfa5a21..1b850ade488 100644 --- a/test/moves/dragon_rage.test.ts +++ b/test/moves/dragon-rage.test.ts @@ -6,7 +6,7 @@ import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import type { EnemyPokemon, PlayerPokemon } from "#field/pokemon"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/dragon_tail.test.ts b/test/moves/dragon-tail.test.ts similarity index 99% rename from test/moves/dragon_tail.test.ts rename to test/moves/dragon-tail.test.ts index c5a77716c56..487647784f7 100644 --- a/test/moves/dragon_tail.test.ts +++ b/test/moves/dragon-tail.test.ts @@ -7,7 +7,7 @@ import { MoveId } from "#enums/move-id"; import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/dynamax_cannon.test.ts b/test/moves/dynamax-cannon.test.ts similarity index 99% rename from test/moves/dynamax_cannon.test.ts rename to test/moves/dynamax-cannon.test.ts index fcbbccd5123..5090a228e23 100644 --- a/test/moves/dynamax_cannon.test.ts +++ b/test/moves/dynamax-cannon.test.ts @@ -5,7 +5,7 @@ import { SpeciesId } from "#enums/species-id"; import type { Move } from "#moves/move"; import { DamageAnimPhase } from "#phases/damage-anim-phase"; import { MoveEffectPhase } from "#phases/move-effect-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/effectiveness.test.ts b/test/moves/effectiveness.test.ts index 58e041fb5c5..0bdef2428a4 100644 --- a/test/moves/effectiveness.test.ts +++ b/test/moves/effectiveness.test.ts @@ -5,7 +5,7 @@ import { MoveId } from "#enums/move-id"; import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; import { TrainerSlot } from "#enums/trainer-slot"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { getPokemonSpecies } from "#utils/pokemon-utils"; import Phaser from "phaser"; import { afterEach, beforeAll, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/electrify.test.ts b/test/moves/electrify.test.ts index c3aa925a331..19a2fdfb7a2 100644 --- a/test/moves/electrify.test.ts +++ b/test/moves/electrify.test.ts @@ -3,7 +3,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/electro_shot.test.ts b/test/moves/electro-shot.test.ts similarity index 98% rename from test/moves/electro_shot.test.ts rename to test/moves/electro-shot.test.ts index cb696b162d5..e5031fefb3d 100644 --- a/test/moves/electro_shot.test.ts +++ b/test/moves/electro-shot.test.ts @@ -5,7 +5,7 @@ import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { WeatherType } from "#enums/weather-type"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/encore.test.ts b/test/moves/encore.test.ts index c20dc194ead..1b0e2ed03f2 100644 --- a/test/moves/encore.test.ts +++ b/test/moves/encore.test.ts @@ -4,7 +4,7 @@ import { BattlerTagType } from "#enums/battler-tag-type"; import { MoveId } from "#enums/move-id"; import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/endure.test.ts b/test/moves/endure.test.ts index 717c9d58211..71a16ef4cc1 100644 --- a/test/moves/endure.test.ts +++ b/test/moves/endure.test.ts @@ -1,7 +1,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/entrainment.test.ts b/test/moves/entrainment.test.ts index 9d7da455525..c96cacc8d0b 100644 --- a/test/moves/entrainment.test.ts +++ b/test/moves/entrainment.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/fairy_lock.test.ts b/test/moves/fairy-lock.test.ts similarity index 99% rename from test/moves/fairy_lock.test.ts rename to test/moves/fairy-lock.test.ts index 5f20c39c6f8..eba139fee22 100644 --- a/test/moves/fairy_lock.test.ts +++ b/test/moves/fairy-lock.test.ts @@ -3,7 +3,7 @@ import { ArenaTagSide } from "#enums/arena-tag-side"; import { ArenaTagType } from "#enums/arena-tag-type"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/fake_out.test.ts b/test/moves/fake-out.test.ts similarity index 98% rename from test/moves/fake_out.test.ts rename to test/moves/fake-out.test.ts index 815de9b9225..8db73681f05 100644 --- a/test/moves/fake_out.test.ts +++ b/test/moves/fake-out.test.ts @@ -1,6 +1,6 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/false_swipe.test.ts b/test/moves/false-swipe.test.ts similarity index 96% rename from test/moves/false_swipe.test.ts rename to test/moves/false-swipe.test.ts index 0aa16ff43e1..30547036e69 100644 --- a/test/moves/false_swipe.test.ts +++ b/test/moves/false-swipe.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/fell_stinger.test.ts b/test/moves/fell-stinger.test.ts similarity index 99% rename from test/moves/fell_stinger.test.ts rename to test/moves/fell-stinger.test.ts index c3ea17904af..9f482202c47 100644 --- a/test/moves/fell_stinger.test.ts +++ b/test/moves/fell-stinger.test.ts @@ -5,7 +5,7 @@ import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { StatusEffect } from "#enums/status-effect"; import { WeatherType } from "#enums/weather-type"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/fillet_away.test.ts b/test/moves/fillet-away.test.ts similarity index 98% rename from test/moves/fillet_away.test.ts rename to test/moves/fillet-away.test.ts index 3ba4f5740eb..c4c87e1d00e 100644 --- a/test/moves/fillet_away.test.ts +++ b/test/moves/fillet-away.test.ts @@ -2,7 +2,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { toDmgValue } from "#utils/common"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; diff --git a/test/moves/first-attack-double-power.test.ts b/test/moves/first-attack-double-power.test.ts index 7d1d9c4d762..4172f843872 100644 --- a/test/moves/first-attack-double-power.test.ts +++ b/test/moves/first-attack-double-power.test.ts @@ -4,7 +4,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { MoveUseMode } from "#enums/move-use-mode"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/fissure.test.ts b/test/moves/fissure.test.ts index 6fadf867e8a..8a8673811ce 100644 --- a/test/moves/fissure.test.ts +++ b/test/moves/fissure.test.ts @@ -5,7 +5,7 @@ import { Stat } from "#enums/stat"; import type { EnemyPokemon, PlayerPokemon } from "#field/pokemon"; import { DamageAnimPhase } from "#phases/damage-anim-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/flame_burst.test.ts b/test/moves/flame-burst.test.ts similarity index 98% rename from test/moves/flame_burst.test.ts rename to test/moves/flame-burst.test.ts index 76d9a100e37..ce82b46d0fc 100644 --- a/test/moves/flame_burst.test.ts +++ b/test/moves/flame-burst.test.ts @@ -4,7 +4,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import type { Pokemon } from "#field/pokemon"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/flower_shield.test.ts b/test/moves/flower-shield.test.ts similarity index 98% rename from test/moves/flower_shield.test.ts rename to test/moves/flower-shield.test.ts index 16a1efacf35..425d0443ca7 100644 --- a/test/moves/flower_shield.test.ts +++ b/test/moves/flower-shield.test.ts @@ -6,7 +6,7 @@ import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/fly.test.ts b/test/moves/fly.test.ts index c27db3686b4..3682fce3d0c 100644 --- a/test/moves/fly.test.ts +++ b/test/moves/fly.test.ts @@ -6,7 +6,7 @@ import { MoveId } from "#enums/move-id"; import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/focus_punch.test.ts b/test/moves/focus-punch.test.ts similarity index 98% rename from test/moves/focus_punch.test.ts rename to test/moves/focus-punch.test.ts index 5123e99c6ff..c67053ef7ec 100644 --- a/test/moves/focus_punch.test.ts +++ b/test/moves/focus-punch.test.ts @@ -6,7 +6,7 @@ import { MessagePhase } from "#phases/message-phase"; import { MoveHeaderPhase } from "#phases/move-header-phase"; import { SwitchSummonPhase } from "#phases/switch-summon-phase"; import { TurnStartPhase } from "#phases/turn-start-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import i18next from "i18next"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/follow_me.test.ts b/test/moves/follow-me.test.ts similarity index 98% rename from test/moves/follow_me.test.ts rename to test/moves/follow-me.test.ts index 891b1844512..2624a1fd267 100644 --- a/test/moves/follow_me.test.ts +++ b/test/moves/follow-me.test.ts @@ -4,7 +4,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; diff --git a/test/moves/foresight.test.ts b/test/moves/foresight.test.ts index 3163f65dd79..c3b29d8fabb 100644 --- a/test/moves/foresight.test.ts +++ b/test/moves/foresight.test.ts @@ -1,7 +1,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { MoveEffectPhase } from "#phases/move-effect-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/forests_curse.test.ts b/test/moves/forests-curse.test.ts similarity index 95% rename from test/moves/forests_curse.test.ts rename to test/moves/forests-curse.test.ts index 812d3c57217..4467a5c4037 100644 --- a/test/moves/forests_curse.test.ts +++ b/test/moves/forests-curse.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/freeze_dry.test.ts b/test/moves/freeze-dry.test.ts similarity index 99% rename from test/moves/freeze_dry.test.ts rename to test/moves/freeze-dry.test.ts index 5639330db1b..5d84d6be795 100644 --- a/test/moves/freeze_dry.test.ts +++ b/test/moves/freeze-dry.test.ts @@ -4,7 +4,7 @@ import { Challenges } from "#enums/challenges"; import { MoveId } from "#enums/move-id"; import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/freezy_frost.test.ts b/test/moves/freezy-frost.test.ts similarity index 98% rename from test/moves/freezy_frost.test.ts rename to test/moves/freezy-frost.test.ts index 9cf2f38b286..8a8a47013ca 100644 --- a/test/moves/freezy_frost.test.ts +++ b/test/moves/freezy-frost.test.ts @@ -3,7 +3,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/fusion_bolt.test.ts b/test/moves/fusion-bolt.test.ts similarity index 95% rename from test/moves/fusion_bolt.test.ts rename to test/moves/fusion-bolt.test.ts index ad6810cb412..aa8073c4c1f 100644 --- a/test/moves/fusion_bolt.test.ts +++ b/test/moves/fusion-bolt.test.ts @@ -1,7 +1,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/fusion_flare_bolt.test.ts b/test/moves/fusion-flare-bolt.test.ts similarity index 99% rename from test/moves/fusion_flare_bolt.test.ts rename to test/moves/fusion-flare-bolt.test.ts index 1777eb5e07e..42cc1248325 100644 --- a/test/moves/fusion_flare_bolt.test.ts +++ b/test/moves/fusion-flare-bolt.test.ts @@ -8,7 +8,7 @@ import { DamageAnimPhase } from "#phases/damage-anim-phase"; import { MoveEffectPhase } from "#phases/move-effect-phase"; import { MoveEndPhase } from "#phases/move-end-phase"; import { MovePhase } from "#phases/move-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/fusion_flare.test.ts b/test/moves/fusion-flare.test.ts similarity index 96% rename from test/moves/fusion_flare.test.ts rename to test/moves/fusion-flare.test.ts index d86f784bce4..be8ce4eeec4 100644 --- a/test/moves/fusion_flare.test.ts +++ b/test/moves/fusion-flare.test.ts @@ -2,7 +2,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; import { TurnStartPhase } from "#phases/turn-start-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/future_sight.test.ts b/test/moves/future-sight.test.ts similarity index 95% rename from test/moves/future_sight.test.ts rename to test/moves/future-sight.test.ts index 96b71b8b0f1..53e93412570 100644 --- a/test/moves/future_sight.test.ts +++ b/test/moves/future-sight.test.ts @@ -1,7 +1,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/gastro_acid.test.ts b/test/moves/gastro-acid.test.ts similarity index 98% rename from test/moves/gastro_acid.test.ts rename to test/moves/gastro-acid.test.ts index 9b8e8f33250..59177528492 100644 --- a/test/moves/gastro_acid.test.ts +++ b/test/moves/gastro-acid.test.ts @@ -4,7 +4,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; describe("Moves - Gastro Acid", () => { diff --git a/test/moves/geomancy.test.ts b/test/moves/geomancy.test.ts index 100c4d85637..b01ad756f9b 100644 --- a/test/moves/geomancy.test.ts +++ b/test/moves/geomancy.test.ts @@ -4,7 +4,7 @@ import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; import type { EffectiveStat } from "#enums/stat"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/gigaton_hammer.test.ts b/test/moves/gigaton-hammer.test.ts similarity index 97% rename from test/moves/gigaton_hammer.test.ts rename to test/moves/gigaton-hammer.test.ts index 69186886f40..6043f9d7f51 100644 --- a/test/moves/gigaton_hammer.test.ts +++ b/test/moves/gigaton-hammer.test.ts @@ -1,7 +1,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/glaive_rush.test.ts b/test/moves/glaive-rush.test.ts similarity index 98% rename from test/moves/glaive_rush.test.ts rename to test/moves/glaive-rush.test.ts index a09c35604b9..f20abd68500 100644 --- a/test/moves/glaive_rush.test.ts +++ b/test/moves/glaive-rush.test.ts @@ -2,7 +2,7 @@ import { allMoves } from "#data/data-lists"; import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/growth.test.ts b/test/moves/growth.test.ts index 94df21271a1..5737f32d891 100644 --- a/test/moves/growth.test.ts +++ b/test/moves/growth.test.ts @@ -4,7 +4,7 @@ import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { EnemyCommandPhase } from "#phases/enemy-command-phase"; import { TurnInitPhase } from "#phases/turn-init-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/grudge.test.ts b/test/moves/grudge.test.ts index ff18cd5d6a4..6f5df077d9f 100644 --- a/test/moves/grudge.test.ts +++ b/test/moves/grudge.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/guard_split.test.ts b/test/moves/guard-split.test.ts similarity index 97% rename from test/moves/guard_split.test.ts rename to test/moves/guard-split.test.ts index 7972296f6ae..fa5dc162a6c 100644 --- a/test/moves/guard_split.test.ts +++ b/test/moves/guard-split.test.ts @@ -3,7 +3,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/guard_swap.test.ts b/test/moves/guard-swap.test.ts similarity index 96% rename from test/moves/guard_swap.test.ts rename to test/moves/guard-swap.test.ts index eda4349b9f8..e7f8ed1df91 100644 --- a/test/moves/guard_swap.test.ts +++ b/test/moves/guard-swap.test.ts @@ -4,7 +4,7 @@ import { SpeciesId } from "#enums/species-id"; import { BATTLE_STATS, Stat } from "#enums/stat"; import { MoveEndPhase } from "#phases/move-end-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/hard_press.test.ts b/test/moves/hard-press.test.ts similarity index 97% rename from test/moves/hard_press.test.ts rename to test/moves/hard-press.test.ts index f61f5084752..f269373e697 100644 --- a/test/moves/hard_press.test.ts +++ b/test/moves/hard-press.test.ts @@ -4,7 +4,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import type { Move } from "#moves/move"; import { MoveEffectPhase } from "#phases/move-effect-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/haze.test.ts b/test/moves/haze.test.ts index 990bbc62ae8..179a06fba09 100644 --- a/test/moves/haze.test.ts +++ b/test/moves/haze.test.ts @@ -3,7 +3,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { TurnInitPhase } from "#phases/turn-init-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/heal_bell.test.ts b/test/moves/heal-bell.test.ts similarity index 98% rename from test/moves/heal_bell.test.ts rename to test/moves/heal-bell.test.ts index e7f6548713a..8b526601e49 100644 --- a/test/moves/heal_bell.test.ts +++ b/test/moves/heal-bell.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/heal_block.test.ts b/test/moves/heal-block.test.ts similarity index 98% rename from test/moves/heal_block.test.ts rename to test/moves/heal-block.test.ts index 0f3ff0df683..4e4a9355467 100644 --- a/test/moves/heal_block.test.ts +++ b/test/moves/heal-block.test.ts @@ -6,7 +6,7 @@ import { BattlerTagType } from "#enums/battler-tag-type"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { WeatherType } from "#enums/weather-type"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/heart_swap.test.ts b/test/moves/heart-swap.test.ts similarity index 96% rename from test/moves/heart_swap.test.ts rename to test/moves/heart-swap.test.ts index c90b13b88ef..e876ec06646 100644 --- a/test/moves/heart_swap.test.ts +++ b/test/moves/heart-swap.test.ts @@ -4,7 +4,7 @@ import { SpeciesId } from "#enums/species-id"; import { BATTLE_STATS } from "#enums/stat"; import { MoveEndPhase } from "#phases/move-end-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/hyper_beam.test.ts b/test/moves/hyper-beam.test.ts similarity index 97% rename from test/moves/hyper_beam.test.ts rename to test/moves/hyper-beam.test.ts index aa3ecfe910b..510dac5f662 100644 --- a/test/moves/hyper_beam.test.ts +++ b/test/moves/hyper-beam.test.ts @@ -5,7 +5,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { BerryPhase } from "#phases/berry-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/imprison.test.ts b/test/moves/imprison.test.ts index 0007c07985c..ed2213bbc7b 100644 --- a/test/moves/imprison.test.ts +++ b/test/moves/imprison.test.ts @@ -3,7 +3,7 @@ import { ArenaTagType } from "#enums/arena-tag-type"; import { BattlerTagType } from "#enums/battler-tag-type"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/instruct.test.ts b/test/moves/instruct.test.ts index c73091a0eea..c34626f5e76 100644 --- a/test/moves/instruct.test.ts +++ b/test/moves/instruct.test.ts @@ -9,7 +9,7 @@ import { Stat } from "#enums/stat"; import type { Pokemon } from "#field/pokemon"; import { RandomMoveAttr } from "#moves/move"; import type { MovePhase } from "#phases/move-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import type { TurnMove } from "#types/turn-move"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/jaw_lock.test.ts b/test/moves/jaw-lock.test.ts similarity index 98% rename from test/moves/jaw_lock.test.ts rename to test/moves/jaw-lock.test.ts index b5e98fbf6d8..919e07ece9a 100644 --- a/test/moves/jaw_lock.test.ts +++ b/test/moves/jaw-lock.test.ts @@ -7,7 +7,7 @@ import { BerryPhase } from "#phases/berry-phase"; import { FaintPhase } from "#phases/faint-phase"; import { MoveEffectPhase } from "#phases/move-effect-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/lash_out.test.ts b/test/moves/lash-out.test.ts similarity index 96% rename from test/moves/lash_out.test.ts rename to test/moves/lash-out.test.ts index b529351e01f..06629997b71 100644 --- a/test/moves/lash_out.test.ts +++ b/test/moves/lash-out.test.ts @@ -3,7 +3,7 @@ import { AbilityId } from "#enums/ability-id"; import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/last-resort.test.ts b/test/moves/last-resort.test.ts index 4eaf1ee7f5d..e6f4faacd09 100644 --- a/test/moves/last-resort.test.ts +++ b/test/moves/last-resort.test.ts @@ -4,7 +4,7 @@ import { MoveId } from "#enums/move-id"; import { MoveResult } from "#enums/move-result"; import { MoveUseMode } from "#enums/move-use-mode"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/last_respects.test.ts b/test/moves/last-respects.test.ts similarity index 99% rename from test/moves/last_respects.test.ts rename to test/moves/last-respects.test.ts index e438971125a..9dadb316144 100644 --- a/test/moves/last_respects.test.ts +++ b/test/moves/last-respects.test.ts @@ -5,7 +5,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import type { Move } from "#moves/move"; import { MoveEffectPhase } from "#phases/move-effect-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/light_screen.test.ts b/test/moves/light-screen.test.ts similarity index 98% rename from test/moves/light_screen.test.ts rename to test/moves/light-screen.test.ts index 5dcdc3c271c..04f7f59f184 100644 --- a/test/moves/light_screen.test.ts +++ b/test/moves/light-screen.test.ts @@ -8,7 +8,7 @@ import { SpeciesId } from "#enums/species-id"; import type { Pokemon } from "#field/pokemon"; import type { Move } from "#moves/move"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { NumberHolder } from "#utils/common"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/lucky_chant.test.ts b/test/moves/lucky-chant.test.ts similarity index 98% rename from test/moves/lucky_chant.test.ts rename to test/moves/lucky-chant.test.ts index afcdd901382..1128f79b1d2 100644 --- a/test/moves/lucky_chant.test.ts +++ b/test/moves/lucky-chant.test.ts @@ -3,7 +3,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { BattlerTagType } from "#enums/battler-tag-type"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; describe("Moves - Lucky Chant", () => { diff --git a/test/moves/lunar_blessing.test.ts b/test/moves/lunar-blessing.test.ts similarity index 97% rename from test/moves/lunar_blessing.test.ts rename to test/moves/lunar-blessing.test.ts index 481156748e3..480c7fb3b31 100644 --- a/test/moves/lunar_blessing.test.ts +++ b/test/moves/lunar-blessing.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/lunar_dance.test.ts b/test/moves/lunar-dance.test.ts similarity index 97% rename from test/moves/lunar_dance.test.ts rename to test/moves/lunar-dance.test.ts index 3fcf953a37c..7386d15079b 100644 --- a/test/moves/lunar_dance.test.ts +++ b/test/moves/lunar-dance.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/magic_coat.test.ts b/test/moves/magic-coat.test.ts similarity index 99% rename from test/moves/magic_coat.test.ts rename to test/moves/magic-coat.test.ts index 4a026ceb84e..2ed09499e95 100644 --- a/test/moves/magic_coat.test.ts +++ b/test/moves/magic-coat.test.ts @@ -9,7 +9,7 @@ import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; describe("Moves - Magic Coat", () => { diff --git a/test/moves/magnet_rise.test.ts b/test/moves/magnet-rise.test.ts similarity index 96% rename from test/moves/magnet_rise.test.ts rename to test/moves/magnet-rise.test.ts index da76c178be8..181113b5328 100644 --- a/test/moves/magnet_rise.test.ts +++ b/test/moves/magnet-rise.test.ts @@ -1,6 +1,6 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/make_it_rain.test.ts b/test/moves/make-it-rain.test.ts similarity index 98% rename from test/moves/make_it_rain.test.ts rename to test/moves/make-it-rain.test.ts index 47f1bc89fc1..ab242d0c3a0 100644 --- a/test/moves/make_it_rain.test.ts +++ b/test/moves/make-it-rain.test.ts @@ -4,7 +4,7 @@ import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { MoveEndPhase } from "#phases/move-end-phase"; import { StatStageChangePhase } from "#phases/stat-stage-change-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/mat_block.test.ts b/test/moves/mat-block.test.ts similarity index 97% rename from test/moves/mat_block.test.ts rename to test/moves/mat-block.test.ts index 954e2a8135d..0870a38f062 100644 --- a/test/moves/mat_block.test.ts +++ b/test/moves/mat-block.test.ts @@ -5,7 +5,7 @@ import { Stat } from "#enums/stat"; import { BerryPhase } from "#phases/berry-phase"; import { CommandPhase } from "#phases/command-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; diff --git a/test/moves/metal_burst.test.ts b/test/moves/metal-burst.test.ts similarity index 97% rename from test/moves/metal_burst.test.ts rename to test/moves/metal-burst.test.ts index c99b4324878..024f12d76af 100644 --- a/test/moves/metal_burst.test.ts +++ b/test/moves/metal-burst.test.ts @@ -3,7 +3,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/metronome.test.ts b/test/moves/metronome.test.ts index 8ca9e63582e..e39d24c81db 100644 --- a/test/moves/metronome.test.ts +++ b/test/moves/metronome.test.ts @@ -9,7 +9,7 @@ import { MoveUseMode } from "#enums/move-use-mode"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import type { RandomMoveAttr } from "#moves/move"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/miracle_eye.test.ts b/test/moves/miracle-eye.test.ts similarity index 95% rename from test/moves/miracle_eye.test.ts rename to test/moves/miracle-eye.test.ts index d77da857068..9ed3824fc28 100644 --- a/test/moves/miracle_eye.test.ts +++ b/test/moves/miracle-eye.test.ts @@ -2,7 +2,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { MoveEffectPhase } from "#phases/move-effect-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/mirror_move.test.ts b/test/moves/mirror-move.test.ts similarity index 97% rename from test/moves/mirror_move.test.ts rename to test/moves/mirror-move.test.ts index 7f833c08bf5..0253932026b 100644 --- a/test/moves/mirror_move.test.ts +++ b/test/moves/mirror-move.test.ts @@ -4,7 +4,7 @@ import { MoveId } from "#enums/move-id"; import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/mist.test.ts b/test/moves/mist.test.ts index b420b234e15..c1a3777e2a5 100644 --- a/test/moves/mist.test.ts +++ b/test/moves/mist.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/multi_target.test.ts b/test/moves/multi-target.test.ts similarity index 98% rename from test/moves/multi_target.test.ts rename to test/moves/multi-target.test.ts index a58fb8d3a6b..53480a6505f 100644 --- a/test/moves/multi_target.test.ts +++ b/test/moves/multi-target.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { toDmgValue } from "#utils/common"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/nightmare.test.ts b/test/moves/nightmare.test.ts index 07579a6790c..7b3772d8b71 100644 --- a/test/moves/nightmare.test.ts +++ b/test/moves/nightmare.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/obstruct.test.ts b/test/moves/obstruct.test.ts index ef589213c74..9abc60be129 100644 --- a/test/moves/obstruct.test.ts +++ b/test/moves/obstruct.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/octolock.test.ts b/test/moves/octolock.test.ts index bf2f8dc5865..09992dd52c7 100644 --- a/test/moves/octolock.test.ts +++ b/test/moves/octolock.test.ts @@ -3,7 +3,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/order_up.test.ts b/test/moves/order-up.test.ts similarity index 98% rename from test/moves/order_up.test.ts rename to test/moves/order-up.test.ts index 2c9702fd6cb..2e77d4b2fa7 100644 --- a/test/moves/order_up.test.ts +++ b/test/moves/order-up.test.ts @@ -6,7 +6,7 @@ import { PokemonAnimType } from "#enums/pokemon-anim-type"; import { SpeciesId } from "#enums/species-id"; import type { EffectiveStat } from "#enums/stat"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/parting_shot.test.ts b/test/moves/parting-shot.test.ts similarity index 99% rename from test/moves/parting_shot.test.ts rename to test/moves/parting-shot.test.ts index 86a14330a3e..7785bdd3a2f 100644 --- a/test/moves/parting_shot.test.ts +++ b/test/moves/parting-shot.test.ts @@ -6,7 +6,7 @@ import { BerryPhase } from "#phases/berry-phase"; import { FaintPhase } from "#phases/faint-phase"; import { MessagePhase } from "#phases/message-phase"; import { TurnInitPhase } from "#phases/turn-init-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, test } from "vitest"; diff --git a/test/moves/payback.test.ts b/test/moves/payback.test.ts index 20e832288a3..f9692bd480f 100644 --- a/test/moves/payback.test.ts +++ b/test/moves/payback.test.ts @@ -4,7 +4,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { PokeballType } from "#enums/pokeball"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, type MockInstance, vi } from "vitest"; diff --git a/test/moves/plasma_fists.test.ts b/test/moves/plasma-fists.test.ts similarity index 98% rename from test/moves/plasma_fists.test.ts rename to test/moves/plasma-fists.test.ts index 7a5ba77b62d..569fb1d5c0d 100644 --- a/test/moves/plasma_fists.test.ts +++ b/test/moves/plasma-fists.test.ts @@ -3,7 +3,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/pledge_moves.test.ts b/test/moves/pledge-moves.test.ts similarity index 99% rename from test/moves/pledge_moves.test.ts rename to test/moves/pledge-moves.test.ts index bd0c981517c..c67519d417b 100644 --- a/test/moves/pledge_moves.test.ts +++ b/test/moves/pledge-moves.test.ts @@ -7,7 +7,7 @@ import { MoveId } from "#enums/move-id"; import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { toDmgValue } from "#utils/common"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/pollen_puff.test.ts b/test/moves/pollen-puff.test.ts similarity index 97% rename from test/moves/pollen_puff.test.ts rename to test/moves/pollen-puff.test.ts index d372f72a390..ecd208f777b 100644 --- a/test/moves/pollen_puff.test.ts +++ b/test/moves/pollen-puff.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/powder.test.ts b/test/moves/powder.test.ts index 3e60c0d9fec..17f64a95179 100644 --- a/test/moves/powder.test.ts +++ b/test/moves/powder.test.ts @@ -6,7 +6,7 @@ import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; import { BerryPhase } from "#phases/berry-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/power_shift.test.ts b/test/moves/power-shift.test.ts similarity index 96% rename from test/moves/power_shift.test.ts rename to test/moves/power-shift.test.ts index 069d793a794..adfd1f0aaa9 100644 --- a/test/moves/power_shift.test.ts +++ b/test/moves/power-shift.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/power_split.test.ts b/test/moves/power-split.test.ts similarity index 97% rename from test/moves/power_split.test.ts rename to test/moves/power-split.test.ts index ef6fda419ca..1eaabf6090d 100644 --- a/test/moves/power_split.test.ts +++ b/test/moves/power-split.test.ts @@ -3,7 +3,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/power_swap.test.ts b/test/moves/power-swap.test.ts similarity index 96% rename from test/moves/power_swap.test.ts rename to test/moves/power-swap.test.ts index cdd52fbc524..b25db40e64c 100644 --- a/test/moves/power_swap.test.ts +++ b/test/moves/power-swap.test.ts @@ -4,7 +4,7 @@ import { SpeciesId } from "#enums/species-id"; import { BATTLE_STATS, Stat } from "#enums/stat"; import { MoveEndPhase } from "#phases/move-end-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/power_trick.test.ts b/test/moves/power-trick.test.ts similarity index 98% rename from test/moves/power_trick.test.ts rename to test/moves/power-trick.test.ts index 29a8107d891..3ddd27212e1 100644 --- a/test/moves/power_trick.test.ts +++ b/test/moves/power-trick.test.ts @@ -4,7 +4,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/protect.test.ts b/test/moves/protect.test.ts index 9fd54d44891..7da54f268e0 100644 --- a/test/moves/protect.test.ts +++ b/test/moves/protect.test.ts @@ -7,7 +7,7 @@ import { MoveId } from "#enums/move-id"; import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; diff --git a/test/moves/psycho_shift.test.ts b/test/moves/psycho-shift.test.ts similarity index 96% rename from test/moves/psycho_shift.test.ts rename to test/moves/psycho-shift.test.ts index 6414a91543b..f2e762f1381 100644 --- a/test/moves/psycho_shift.test.ts +++ b/test/moves/psycho-shift.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/purify.test.ts b/test/moves/purify.test.ts index a5d7d86851b..88e0da802a3 100644 --- a/test/moves/purify.test.ts +++ b/test/moves/purify.test.ts @@ -5,7 +5,7 @@ import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; import type { EnemyPokemon, PlayerPokemon } from "#field/pokemon"; import { MoveEndPhase } from "#phases/move-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; diff --git a/test/moves/quash.test.ts b/test/moves/quash.test.ts index 632d37a4e13..91ff5581b9e 100644 --- a/test/moves/quash.test.ts +++ b/test/moves/quash.test.ts @@ -5,7 +5,7 @@ import { MoveResult } from "#enums/move-result"; import { MoveUseMode } from "#enums/move-use-mode"; import { SpeciesId } from "#enums/species-id"; import { WeatherType } from "#enums/weather-type"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/quick_guard.test.ts b/test/moves/quick-guard.test.ts similarity index 98% rename from test/moves/quick_guard.test.ts rename to test/moves/quick-guard.test.ts index 5e2e1ae1f24..d14eada2445 100644 --- a/test/moves/quick_guard.test.ts +++ b/test/moves/quick-guard.test.ts @@ -4,7 +4,7 @@ import { MoveId } from "#enums/move-id"; import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; diff --git a/test/moves/rage_fist.test.ts b/test/moves/rage-fist.test.ts similarity index 99% rename from test/moves/rage_fist.test.ts rename to test/moves/rage-fist.test.ts index d7928ddd310..8ed0a71306b 100644 --- a/test/moves/rage_fist.test.ts +++ b/test/moves/rage-fist.test.ts @@ -5,7 +5,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import type { Move } from "#moves/move"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/rage_powder.test.ts b/test/moves/rage-powder.test.ts similarity index 97% rename from test/moves/rage_powder.test.ts rename to test/moves/rage-powder.test.ts index a0b836f0917..9ae81720e32 100644 --- a/test/moves/rage_powder.test.ts +++ b/test/moves/rage-powder.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; diff --git a/test/moves/reflect_type.test.ts b/test/moves/reflect-type.test.ts similarity index 96% rename from test/moves/reflect_type.test.ts rename to test/moves/reflect-type.test.ts index 499c167bee0..ceaff4019b3 100644 --- a/test/moves/reflect_type.test.ts +++ b/test/moves/reflect-type.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/reflect.test.ts b/test/moves/reflect.test.ts index 47c49ea4d36..228730e9fb6 100644 --- a/test/moves/reflect.test.ts +++ b/test/moves/reflect.test.ts @@ -8,7 +8,7 @@ import { SpeciesId } from "#enums/species-id"; import type { Pokemon } from "#field/pokemon"; import type { Move } from "#moves/move"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { NumberHolder } from "#utils/common"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/relic_song.test.ts b/test/moves/relic-song.test.ts similarity index 97% rename from test/moves/relic_song.test.ts rename to test/moves/relic-song.test.ts index 36c46769515..62069ac3cd3 100644 --- a/test/moves/relic_song.test.ts +++ b/test/moves/relic-song.test.ts @@ -3,7 +3,7 @@ import { Challenges } from "#enums/challenges"; import { MoveId } from "#enums/move-id"; import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/retaliate.test.ts b/test/moves/retaliate.test.ts index 3eefbe3ceb6..9e564c52a99 100644 --- a/test/moves/retaliate.test.ts +++ b/test/moves/retaliate.test.ts @@ -2,7 +2,7 @@ import { allMoves } from "#data/data-lists"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import type { Move } from "#moves/move"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/revival_blessing.test.ts b/test/moves/revival-blessing.test.ts similarity index 98% rename from test/moves/revival_blessing.test.ts rename to test/moves/revival-blessing.test.ts index a9a6bd0fd7d..89a1996fe03 100644 --- a/test/moves/revival_blessing.test.ts +++ b/test/moves/revival-blessing.test.ts @@ -3,7 +3,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { toDmgValue } from "#utils/common"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/role_play.test.ts b/test/moves/role-play.test.ts similarity index 96% rename from test/moves/role_play.test.ts rename to test/moves/role-play.test.ts index dda7f319cd5..af9fc68efa4 100644 --- a/test/moves/role_play.test.ts +++ b/test/moves/role-play.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/rollout.test.ts b/test/moves/rollout.test.ts index eed61f82ab4..c1c66f4ab39 100644 --- a/test/moves/rollout.test.ts +++ b/test/moves/rollout.test.ts @@ -2,7 +2,7 @@ import { allMoves } from "#data/data-lists"; import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/roost.test.ts b/test/moves/roost.test.ts index 30a71721d03..e4ea09e245c 100644 --- a/test/moves/roost.test.ts +++ b/test/moves/roost.test.ts @@ -5,7 +5,7 @@ import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; import { MoveEffectPhase } from "#phases/move-effect-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; diff --git a/test/moves/round.test.ts b/test/moves/round.test.ts index a706fd15e9b..517e2202d4d 100644 --- a/test/moves/round.test.ts +++ b/test/moves/round.test.ts @@ -4,7 +4,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import type { MoveEffectPhase } from "#phases/move-effect-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/safeguard.test.ts b/test/moves/safeguard.test.ts index 2651d8473be..19b56cd759f 100644 --- a/test/moves/safeguard.test.ts +++ b/test/moves/safeguard.test.ts @@ -4,7 +4,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/scale_shot.test.ts b/test/moves/scale-shot.test.ts similarity index 97% rename from test/moves/scale_shot.test.ts rename to test/moves/scale-shot.test.ts index 4e420f6b3ef..7e5c60577ce 100644 --- a/test/moves/scale_shot.test.ts +++ b/test/moves/scale-shot.test.ts @@ -8,7 +8,7 @@ import { DamageAnimPhase } from "#phases/damage-anim-phase"; import { MoveEffectPhase } from "#phases/move-effect-phase"; import { MoveEndPhase } from "#phases/move-end-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/secret_power.test.ts b/test/moves/secret-power.test.ts similarity index 98% rename from test/moves/secret_power.test.ts rename to test/moves/secret-power.test.ts index 8ec69fb276a..16090bebcbe 100644 --- a/test/moves/secret_power.test.ts +++ b/test/moves/secret-power.test.ts @@ -8,7 +8,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/shed_tail.test.ts b/test/moves/shed-tail.test.ts similarity index 97% rename from test/moves/shed_tail.test.ts rename to test/moves/shed-tail.test.ts index 8a837a642c9..ff2b29e846d 100644 --- a/test/moves/shed_tail.test.ts +++ b/test/moves/shed-tail.test.ts @@ -3,7 +3,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/shell_side_arm.test.ts b/test/moves/shell-side-arm.test.ts similarity index 97% rename from test/moves/shell_side_arm.test.ts rename to test/moves/shell-side-arm.test.ts index 685cebce4cf..32f37fcc8ac 100644 --- a/test/moves/shell_side_arm.test.ts +++ b/test/moves/shell-side-arm.test.ts @@ -4,7 +4,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import type { Move, ShellSideArmCategoryAttr } from "#moves/move"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/shell_trap.test.ts b/test/moves/shell-trap.test.ts similarity index 98% rename from test/moves/shell_trap.test.ts rename to test/moves/shell-trap.test.ts index c484d1195aa..d2908278d93 100644 --- a/test/moves/shell_trap.test.ts +++ b/test/moves/shell-trap.test.ts @@ -6,7 +6,7 @@ import { SpeciesId } from "#enums/species-id"; import { BerryPhase } from "#phases/berry-phase"; import { MoveEndPhase } from "#phases/move-end-phase"; import { MovePhase } from "#phases/move-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/simple_beam.test.ts b/test/moves/simple-beam.test.ts similarity index 95% rename from test/moves/simple_beam.test.ts rename to test/moves/simple-beam.test.ts index 106977aea84..f45c19c690e 100644 --- a/test/moves/simple_beam.test.ts +++ b/test/moves/simple-beam.test.ts @@ -1,7 +1,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/sketch.test.ts b/test/moves/sketch.test.ts index 10ad31c35eb..fff9be97e2d 100644 --- a/test/moves/sketch.test.ts +++ b/test/moves/sketch.test.ts @@ -7,7 +7,7 @@ import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; import { RandomMoveAttr } from "#moves/move"; import { PokemonMove } from "#moves/pokemon-move"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/skill_swap.test.ts b/test/moves/skill-swap.test.ts similarity index 96% rename from test/moves/skill_swap.test.ts rename to test/moves/skill-swap.test.ts index d5ba509b0df..50a0a232f6e 100644 --- a/test/moves/skill_swap.test.ts +++ b/test/moves/skill-swap.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/sleep_talk.test.ts b/test/moves/sleep-talk.test.ts similarity index 97% rename from test/moves/sleep_talk.test.ts rename to test/moves/sleep-talk.test.ts index 972c54463e2..8593f4b4d07 100644 --- a/test/moves/sleep_talk.test.ts +++ b/test/moves/sleep-talk.test.ts @@ -4,7 +4,7 @@ import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/solar_beam.test.ts b/test/moves/solar-beam.test.ts similarity index 98% rename from test/moves/solar_beam.test.ts rename to test/moves/solar-beam.test.ts index 32400abfc0f..f4347493de5 100644 --- a/test/moves/solar_beam.test.ts +++ b/test/moves/solar-beam.test.ts @@ -5,7 +5,7 @@ import { MoveId } from "#enums/move-id"; import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; import { WeatherType } from "#enums/weather-type"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/sparkly_swirl.test.ts b/test/moves/sparkly-swirl.test.ts similarity index 97% rename from test/moves/sparkly_swirl.test.ts rename to test/moves/sparkly-swirl.test.ts index d58b6efe990..6e43211ed50 100644 --- a/test/moves/sparkly_swirl.test.ts +++ b/test/moves/sparkly-swirl.test.ts @@ -3,7 +3,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/spectral_thief.test.ts b/test/moves/spectral-thief.test.ts similarity index 99% rename from test/moves/spectral_thief.test.ts rename to test/moves/spectral-thief.test.ts index acb3e22cf6c..dd988ac667a 100644 --- a/test/moves/spectral_thief.test.ts +++ b/test/moves/spectral-thief.test.ts @@ -5,7 +5,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/speed_swap.test.ts b/test/moves/speed-swap.test.ts similarity index 96% rename from test/moves/speed_swap.test.ts rename to test/moves/speed-swap.test.ts index e0c06bfb0f7..b67ad68746a 100644 --- a/test/moves/speed_swap.test.ts +++ b/test/moves/speed-swap.test.ts @@ -3,7 +3,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/spikes.test.ts b/test/moves/spikes.test.ts index 424aecb5c3c..0055945cef9 100644 --- a/test/moves/spikes.test.ts +++ b/test/moves/spikes.test.ts @@ -4,7 +4,7 @@ import { ArenaTagSide } from "#enums/arena-tag-side"; import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/spit_up.test.ts b/test/moves/spit-up.test.ts similarity index 99% rename from test/moves/spit_up.test.ts rename to test/moves/spit-up.test.ts index 03e0cee1e4b..22722cfed2b 100644 --- a/test/moves/spit_up.test.ts +++ b/test/moves/spit-up.test.ts @@ -9,7 +9,7 @@ import { Stat } from "#enums/stat"; import type { Move } from "#moves/move"; import { MovePhase } from "#phases/move-phase"; import { TurnInitPhase } from "#phases/turn-init-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/spotlight.test.ts b/test/moves/spotlight.test.ts index 4feff5eb719..69510c1d852 100644 --- a/test/moves/spotlight.test.ts +++ b/test/moves/spotlight.test.ts @@ -2,7 +2,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; diff --git a/test/moves/steamroller.test.ts b/test/moves/steamroller.test.ts index a9da98c1429..2219b95e733 100644 --- a/test/moves/steamroller.test.ts +++ b/test/moves/steamroller.test.ts @@ -4,7 +4,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { BattlerTagType } from "#enums/battler-tag-type"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import type { DamageCalculationResult } from "#types/damage-result"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/stockpile.test.ts b/test/moves/stockpile.test.ts index efc1757738a..5b170c10fcb 100644 --- a/test/moves/stockpile.test.ts +++ b/test/moves/stockpile.test.ts @@ -5,7 +5,7 @@ import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { TurnInitPhase } from "#phases/turn-init-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/struggle.test.ts b/test/moves/struggle.test.ts index 2d624f6d338..21c4e204974 100644 --- a/test/moves/struggle.test.ts +++ b/test/moves/struggle.test.ts @@ -1,7 +1,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/substitute.test.ts b/test/moves/substitute.test.ts index 39418fb5b99..15fd770805a 100644 --- a/test/moves/substitute.test.ts +++ b/test/moves/substitute.test.ts @@ -15,7 +15,7 @@ import { StatusEffect } from "#enums/status-effect"; import { UiMode } from "#enums/ui-mode"; import { StealHeldItemChanceAttr } from "#moves/move"; import type { CommandPhase } from "#phases/command-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/swallow.test.ts b/test/moves/swallow.test.ts index 176b00b030c..1ae31517cb6 100644 --- a/test/moves/swallow.test.ts +++ b/test/moves/swallow.test.ts @@ -7,7 +7,7 @@ import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { MovePhase } from "#phases/move-phase"; import { TurnInitPhase } from "#phases/turn-init-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/synchronoise.test.ts b/test/moves/synchronoise.test.ts index fe4a316a32a..3cfeaf04af9 100644 --- a/test/moves/synchronoise.test.ts +++ b/test/moves/synchronoise.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/syrup_bomb.test.ts b/test/moves/syrup-bomb.test.ts similarity index 98% rename from test/moves/syrup_bomb.test.ts rename to test/moves/syrup-bomb.test.ts index f45070d81a5..3e5bddf1e7b 100644 --- a/test/moves/syrup_bomb.test.ts +++ b/test/moves/syrup-bomb.test.ts @@ -4,7 +4,7 @@ import { BattlerTagType } from "#enums/battler-tag-type"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/tackle.test.ts b/test/moves/tackle.test.ts index 998afd23f9d..23abd650e55 100644 --- a/test/moves/tackle.test.ts +++ b/test/moves/tackle.test.ts @@ -3,7 +3,7 @@ import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { EnemyCommandPhase } from "#phases/enemy-command-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/tail_whip.test.ts b/test/moves/tail-whip.test.ts similarity index 96% rename from test/moves/tail_whip.test.ts rename to test/moves/tail-whip.test.ts index 272816a88a6..c872b2535e3 100644 --- a/test/moves/tail_whip.test.ts +++ b/test/moves/tail-whip.test.ts @@ -4,7 +4,7 @@ import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { EnemyCommandPhase } from "#phases/enemy-command-phase"; import { TurnInitPhase } from "#phases/turn-init-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/tailwind.test.ts b/test/moves/tailwind.test.ts index 1c8701de5bc..436c854066f 100644 --- a/test/moves/tailwind.test.ts +++ b/test/moves/tailwind.test.ts @@ -4,7 +4,7 @@ import { ArenaTagType } from "#enums/arena-tag-type"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/tar_shot.test.ts b/test/moves/tar-shot.test.ts similarity index 98% rename from test/moves/tar_shot.test.ts rename to test/moves/tar-shot.test.ts index c2ae397e43a..719b5e4c7fe 100644 --- a/test/moves/tar_shot.test.ts +++ b/test/moves/tar-shot.test.ts @@ -4,7 +4,7 @@ import { MoveId } from "#enums/move-id"; import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/taunt.test.ts b/test/moves/taunt.test.ts index ba76551708b..f16a019ce2c 100644 --- a/test/moves/taunt.test.ts +++ b/test/moves/taunt.test.ts @@ -3,7 +3,7 @@ import { BattlerTagType } from "#enums/battler-tag-type"; import { MoveId } from "#enums/move-id"; import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/telekinesis.test.ts b/test/moves/telekinesis.test.ts index 92d7f8cc885..4c452c24ec6 100644 --- a/test/moves/telekinesis.test.ts +++ b/test/moves/telekinesis.test.ts @@ -5,7 +5,7 @@ import { BattlerTagType } from "#enums/battler-tag-type"; import { MoveId } from "#enums/move-id"; import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/tera_blast.test.ts b/test/moves/tera-blast.test.ts similarity index 99% rename from test/moves/tera_blast.test.ts rename to test/moves/tera-blast.test.ts index d6c16c31544..37dd8f53eaf 100644 --- a/test/moves/tera_blast.test.ts +++ b/test/moves/tera-blast.test.ts @@ -6,7 +6,7 @@ import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import type { Move, TeraMoveCategoryAttr } from "#moves/move"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/tera_starstorm.test.ts b/test/moves/tera-starstorm.test.ts similarity index 98% rename from test/moves/tera_starstorm.test.ts rename to test/moves/tera-starstorm.test.ts index a63573b360d..d13ab3fb3b0 100644 --- a/test/moves/tera_starstorm.test.ts +++ b/test/moves/tera-starstorm.test.ts @@ -3,7 +3,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/thousand_arrows.test.ts b/test/moves/thousand-arrows.test.ts similarity index 98% rename from test/moves/thousand_arrows.test.ts rename to test/moves/thousand-arrows.test.ts index 3c7bacfbb2b..e42e92d35d2 100644 --- a/test/moves/thousand_arrows.test.ts +++ b/test/moves/thousand-arrows.test.ts @@ -4,7 +4,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { BerryPhase } from "#phases/berry-phase"; import { MoveEffectPhase } from "#phases/move-effect-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/throat_chop.test.ts b/test/moves/throat-chop.test.ts similarity index 96% rename from test/moves/throat_chop.test.ts rename to test/moves/throat-chop.test.ts index 1a17cb1fba2..f5e6a978e3d 100644 --- a/test/moves/throat_chop.test.ts +++ b/test/moves/throat-chop.test.ts @@ -3,7 +3,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/thunder_wave.test.ts b/test/moves/thunder-wave.test.ts similarity index 98% rename from test/moves/thunder_wave.test.ts rename to test/moves/thunder-wave.test.ts index 06a24e454fa..84408ace7e9 100644 --- a/test/moves/thunder_wave.test.ts +++ b/test/moves/thunder-wave.test.ts @@ -3,7 +3,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; import type { EnemyPokemon } from "#field/pokemon"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/tidy_up.test.ts b/test/moves/tidy-up.test.ts similarity index 98% rename from test/moves/tidy_up.test.ts rename to test/moves/tidy-up.test.ts index c96718e2332..8dd74e4ab78 100644 --- a/test/moves/tidy_up.test.ts +++ b/test/moves/tidy-up.test.ts @@ -6,7 +6,7 @@ import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { MoveEndPhase } from "#phases/move-end-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/torment.test.ts b/test/moves/torment.test.ts index 71a4f3cb504..1ed4529fcbd 100644 --- a/test/moves/torment.test.ts +++ b/test/moves/torment.test.ts @@ -4,7 +4,7 @@ import { MoveId } from "#enums/move-id"; import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; import { TurnEndPhase } from "#phases/turn-end-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/toxic_spikes.test.ts b/test/moves/toxic-spikes.test.ts similarity index 98% rename from test/moves/toxic_spikes.test.ts rename to test/moves/toxic-spikes.test.ts index 69f09ce966a..1315eaa31c3 100644 --- a/test/moves/toxic_spikes.test.ts +++ b/test/moves/toxic-spikes.test.ts @@ -7,7 +7,7 @@ import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; import type { SessionSaveData } from "#system/game-data"; import { GameData } from "#system/game-data"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { decrypt, encrypt } from "#utils/data"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/toxic.test.ts b/test/moves/toxic.test.ts index 5aaa4e3e85d..13af6cf48fd 100644 --- a/test/moves/toxic.test.ts +++ b/test/moves/toxic.test.ts @@ -3,7 +3,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/transform-imposter.test.ts b/test/moves/transform-imposter.test.ts index c12542e64e9..b1631130154 100644 --- a/test/moves/transform-imposter.test.ts +++ b/test/moves/transform-imposter.test.ts @@ -12,7 +12,7 @@ import { Stat } from "#enums/stat"; import { StatusEffect } from "#enums/status-effect"; import type { EnemyPokemon } from "#field/pokemon"; import { Pokemon } from "#field/pokemon"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, type MockInstance, vi } from "vitest"; diff --git a/test/moves/trick_or_treat.test.ts b/test/moves/trick-or-treat.test.ts similarity index 95% rename from test/moves/trick_or_treat.test.ts rename to test/moves/trick-or-treat.test.ts index 4e563c97ddc..095cda873e0 100644 --- a/test/moves/trick_or_treat.test.ts +++ b/test/moves/trick-or-treat.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/triple_arrows.test.ts b/test/moves/triple-arrows.test.ts similarity index 97% rename from test/moves/triple_arrows.test.ts rename to test/moves/triple-arrows.test.ts index a60c7106a21..2f7c50f8a44 100644 --- a/test/moves/triple_arrows.test.ts +++ b/test/moves/triple-arrows.test.ts @@ -3,7 +3,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import type { FlinchAttr, Move, StatStageChangeAttr } from "#moves/move"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/u_turn.test.ts b/test/moves/u-turn.test.ts similarity index 98% rename from test/moves/u_turn.test.ts rename to test/moves/u-turn.test.ts index cf8b91511ca..fb34490fdf4 100644 --- a/test/moves/u_turn.test.ts +++ b/test/moves/u-turn.test.ts @@ -2,7 +2,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/upper_hand.test.ts b/test/moves/upper-hand.test.ts similarity index 98% rename from test/moves/upper_hand.test.ts rename to test/moves/upper-hand.test.ts index f03a84397f2..91f3a34b9c6 100644 --- a/test/moves/upper_hand.test.ts +++ b/test/moves/upper-hand.test.ts @@ -3,7 +3,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/moves/whirlwind.test.ts b/test/moves/whirlwind.test.ts index 9def19c4668..90bbf722224 100644 --- a/test/moves/whirlwind.test.ts +++ b/test/moves/whirlwind.test.ts @@ -11,7 +11,7 @@ import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; import { TrainerType } from "#enums/trainer-type"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/moves/wide_guard.test.ts b/test/moves/wide-guard.test.ts similarity index 97% rename from test/moves/wide_guard.test.ts rename to test/moves/wide-guard.test.ts index 7de1faea900..e599829e1b9 100644 --- a/test/moves/wide_guard.test.ts +++ b/test/moves/wide-guard.test.ts @@ -3,7 +3,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { BerryPhase } from "#phases/berry-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; diff --git a/test/moves/will_o_wisp.test.ts b/test/moves/will-o-wisp.test.ts similarity index 96% rename from test/moves/will_o_wisp.test.ts rename to test/moves/will-o-wisp.test.ts index 6f878e1198c..5cb94c4617c 100644 --- a/test/moves/will_o_wisp.test.ts +++ b/test/moves/will-o-wisp.test.ts @@ -3,7 +3,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/mystery-encounter/encounter-test-utils.ts b/test/mystery-encounter/encounter-test-utils.ts index 6b6a570d318..784e8ae4950 100644 --- a/test/mystery-encounter/encounter-test-utils.ts +++ b/test/mystery-encounter/encounter-test-utils.ts @@ -13,7 +13,7 @@ import { MysteryEncounterRewardsPhase, } from "#phases/mystery-encounter-phases"; import { VictoryPhase } from "#phases/victory-phase"; -import type { GameManager } from "#test/testUtils/gameManager"; +import type { GameManager } from "#test/test-utils/game-manager"; import type { MessageUiHandler } from "#ui/message-ui-handler"; import type { MysteryEncounterUiHandler } from "#ui/mystery-encounter-ui-handler"; import type { OptionSelectUiHandler } from "#ui/option-select-ui-handler"; diff --git a/test/mystery-encounter/encounters/a-trainers-test-encounter.test.ts b/test/mystery-encounter/encounters/a-trainers-test-encounter.test.ts index a2832052611..93cf4537c53 100644 --- a/test/mystery-encounter/encounters/a-trainers-test-encounter.test.ts +++ b/test/mystery-encounter/encounters/a-trainers-test-encounter.test.ts @@ -16,8 +16,8 @@ import { runMysteryEncounterToEnd, skipBattleRunMysteryEncounterRewardsPhase, } from "#test/mystery-encounter/encounter-test-utils"; -import { GameManager } from "#test/testUtils/gameManager"; -import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils"; +import { GameManager } from "#test/test-utils/game-manager"; +import { initSceneWithoutEncounterPhase } from "#test/test-utils/game-manager-utils"; import i18next from "i18next"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/mystery-encounter/encounters/absolute-avarice-encounter.test.ts b/test/mystery-encounter/encounters/absolute-avarice-encounter.test.ts index 969ac812907..562482dd520 100644 --- a/test/mystery-encounter/encounters/absolute-avarice-encounter.test.ts +++ b/test/mystery-encounter/encounters/absolute-avarice-encounter.test.ts @@ -17,7 +17,7 @@ import { runMysteryEncounterToEnd, skipBattleRunMysteryEncounterRewardsPhase, } from "#test/mystery-encounter/encounter-test-utils"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import i18next from "i18next"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/mystery-encounter/encounters/an-offer-you-cant-refuse-encounter.test.ts b/test/mystery-encounter/encounters/an-offer-you-cant-refuse-encounter.test.ts index 97326e89a83..d903568785a 100644 --- a/test/mystery-encounter/encounters/an-offer-you-cant-refuse-encounter.test.ts +++ b/test/mystery-encounter/encounters/an-offer-you-cant-refuse-encounter.test.ts @@ -14,8 +14,8 @@ import * as MysteryEncounters from "#mystery-encounters/mystery-encounters"; import { HUMAN_TRANSITABLE_BIOMES } from "#mystery-encounters/mystery-encounters"; import { SelectModifierPhase } from "#phases/select-modifier-phase"; import { runMysteryEncounterToEnd } from "#test/mystery-encounter/encounter-test-utils"; -import { GameManager } from "#test/testUtils/gameManager"; -import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils"; +import { GameManager } from "#test/test-utils/game-manager"; +import { initSceneWithoutEncounterPhase } from "#test/test-utils/game-manager-utils"; import { getPokemonSpecies } from "#utils/pokemon-utils"; import i18next from "i18next"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/mystery-encounter/encounters/berries-abound-encounter.test.ts b/test/mystery-encounter/encounters/berries-abound-encounter.test.ts index 5af89ebc02c..3d29c04cab7 100644 --- a/test/mystery-encounter/encounters/berries-abound-encounter.test.ts +++ b/test/mystery-encounter/encounters/berries-abound-encounter.test.ts @@ -17,8 +17,8 @@ import { runMysteryEncounterToEnd, skipBattleRunMysteryEncounterRewardsPhase, } from "#test/mystery-encounter/encounter-test-utils"; -import { GameManager } from "#test/testUtils/gameManager"; -import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils"; +import { GameManager } from "#test/test-utils/game-manager"; +import { initSceneWithoutEncounterPhase } from "#test/test-utils/game-manager-utils"; import { ModifierSelectUiHandler } from "#ui/modifier-select-ui-handler"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/mystery-encounter/encounters/bug-type-superfan-encounter.test.ts b/test/mystery-encounter/encounters/bug-type-superfan-encounter.test.ts index 80f4c00c2a6..205bf996815 100644 --- a/test/mystery-encounter/encounters/bug-type-superfan-encounter.test.ts +++ b/test/mystery-encounter/encounters/bug-type-superfan-encounter.test.ts @@ -20,8 +20,8 @@ import { runSelectMysteryEncounterOption, skipBattleRunMysteryEncounterRewardsPhase, } from "#test/mystery-encounter/encounter-test-utils"; -import { GameManager } from "#test/testUtils/gameManager"; -import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils"; +import { GameManager } from "#test/test-utils/game-manager"; +import { initSceneWithoutEncounterPhase } from "#test/test-utils/game-manager-utils"; import { ModifierSelectUiHandler } from "#ui/modifier-select-ui-handler"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/mystery-encounter/encounters/clowning-around-encounter.test.ts b/test/mystery-encounter/encounters/clowning-around-encounter.test.ts index af99834d082..b573701d568 100644 --- a/test/mystery-encounter/encounters/clowning-around-encounter.test.ts +++ b/test/mystery-encounter/encounters/clowning-around-encounter.test.ts @@ -31,8 +31,8 @@ import { runMysteryEncounterToEnd, skipBattleRunMysteryEncounterRewardsPhase, } from "#test/mystery-encounter/encounter-test-utils"; -import { GameManager } from "#test/testUtils/gameManager"; -import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils"; +import { GameManager } from "#test/test-utils/game-manager"; +import { initSceneWithoutEncounterPhase } from "#test/test-utils/game-manager-utils"; import type { OptionSelectUiHandler } from "#ui/option-select-ui-handler"; import type { PartyUiHandler } from "#ui/party-ui-handler"; import { getPokemonSpecies } from "#utils/pokemon-utils"; diff --git a/test/mystery-encounter/encounters/dancing-lessons-encounter.test.ts b/test/mystery-encounter/encounters/dancing-lessons-encounter.test.ts index 8ef499fe7f4..97d0ce31367 100644 --- a/test/mystery-encounter/encounters/dancing-lessons-encounter.test.ts +++ b/test/mystery-encounter/encounters/dancing-lessons-encounter.test.ts @@ -20,7 +20,7 @@ import { runSelectMysteryEncounterOption, skipBattleRunMysteryEncounterRewardsPhase, } from "#test/mystery-encounter/encounter-test-utils"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { ModifierSelectUiHandler } from "#ui/modifier-select-ui-handler"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/mystery-encounter/encounters/delibirdy-encounter.test.ts b/test/mystery-encounter/encounters/delibirdy-encounter.test.ts index 0fb6d2d09b8..16c726f1de6 100644 --- a/test/mystery-encounter/encounters/delibirdy-encounter.test.ts +++ b/test/mystery-encounter/encounters/delibirdy-encounter.test.ts @@ -26,7 +26,7 @@ import { runMysteryEncounterToEnd, runSelectMysteryEncounterOption, } from "#test/mystery-encounter/encounter-test-utils"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; const namespace = "mysteryEncounters/delibirdy"; diff --git a/test/mystery-encounter/encounters/department-store-sale-encounter.test.ts b/test/mystery-encounter/encounters/department-store-sale-encounter.test.ts index 807526d2683..3d84d70b47e 100644 --- a/test/mystery-encounter/encounters/department-store-sale-encounter.test.ts +++ b/test/mystery-encounter/encounters/department-store-sale-encounter.test.ts @@ -11,7 +11,7 @@ import * as MysteryEncounters from "#mystery-encounters/mystery-encounters"; import { CIVILIZATION_ENCOUNTER_BIOMES } from "#mystery-encounters/mystery-encounters"; import { SelectModifierPhase } from "#phases/select-modifier-phase"; import { runMysteryEncounterToEnd } from "#test/mystery-encounter/encounter-test-utils"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { ModifierSelectUiHandler } from "#ui/modifier-select-ui-handler"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/mystery-encounter/encounters/field-trip-encounter.test.ts b/test/mystery-encounter/encounters/field-trip-encounter.test.ts index 4390c80d255..8502137cc6e 100644 --- a/test/mystery-encounter/encounters/field-trip-encounter.test.ts +++ b/test/mystery-encounter/encounters/field-trip-encounter.test.ts @@ -11,7 +11,7 @@ import { FieldTripEncounter } from "#mystery-encounters/field-trip-encounter"; import * as MysteryEncounters from "#mystery-encounters/mystery-encounters"; import { SelectModifierPhase } from "#phases/select-modifier-phase"; import { runMysteryEncounterToEnd } from "#test/mystery-encounter/encounter-test-utils"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { ModifierSelectUiHandler } from "#ui/modifier-select-ui-handler"; import i18next from "i18next"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/mystery-encounter/encounters/fiery-fallout-encounter.test.ts b/test/mystery-encounter/encounters/fiery-fallout-encounter.test.ts index 1fb1cbfdbc8..8ec9b4cb345 100644 --- a/test/mystery-encounter/encounters/fiery-fallout-encounter.test.ts +++ b/test/mystery-encounter/encounters/fiery-fallout-encounter.test.ts @@ -25,8 +25,8 @@ import { runSelectMysteryEncounterOption, skipBattleRunMysteryEncounterRewardsPhase, } from "#test/mystery-encounter/encounter-test-utils"; -import { GameManager } from "#test/testUtils/gameManager"; -import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils"; +import { GameManager } from "#test/test-utils/game-manager"; +import { initSceneWithoutEncounterPhase } from "#test/test-utils/game-manager-utils"; import { getPokemonSpecies } from "#utils/pokemon-utils"; import i18next from "i18next"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/mystery-encounter/encounters/fight-or-flight-encounter.test.ts b/test/mystery-encounter/encounters/fight-or-flight-encounter.test.ts index 588c126852f..8149212f00f 100644 --- a/test/mystery-encounter/encounters/fight-or-flight-encounter.test.ts +++ b/test/mystery-encounter/encounters/fight-or-flight-encounter.test.ts @@ -18,8 +18,8 @@ import { runSelectMysteryEncounterOption, skipBattleRunMysteryEncounterRewardsPhase, } from "#test/mystery-encounter/encounter-test-utils"; -import { GameManager } from "#test/testUtils/gameManager"; -import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils"; +import { GameManager } from "#test/test-utils/game-manager"; +import { initSceneWithoutEncounterPhase } from "#test/test-utils/game-manager-utils"; import { ModifierSelectUiHandler } from "#ui/modifier-select-ui-handler"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/mystery-encounter/encounters/fun-and-games-encounter.test.ts b/test/mystery-encounter/encounters/fun-and-games-encounter.test.ts index 43102cbc80d..b66d0e95ad0 100644 --- a/test/mystery-encounter/encounters/fun-and-games-encounter.test.ts +++ b/test/mystery-encounter/encounters/fun-and-games-encounter.test.ts @@ -21,8 +21,8 @@ import { runMysteryEncounterToEnd, runSelectMysteryEncounterOption, } from "#test/mystery-encounter/encounter-test-utils"; -import { GameManager } from "#test/testUtils/gameManager"; -import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils"; +import { GameManager } from "#test/test-utils/game-manager"; +import { initSceneWithoutEncounterPhase } from "#test/test-utils/game-manager-utils"; import { ModifierSelectUiHandler } from "#ui/modifier-select-ui-handler"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/mystery-encounter/encounters/global-trade-system-encounter.test.ts b/test/mystery-encounter/encounters/global-trade-system-encounter.test.ts index 2a959df76f2..2ac55dabe1c 100644 --- a/test/mystery-encounter/encounters/global-trade-system-encounter.test.ts +++ b/test/mystery-encounter/encounters/global-trade-system-encounter.test.ts @@ -15,7 +15,7 @@ import * as MysteryEncounters from "#mystery-encounters/mystery-encounters"; import { CIVILIZATION_ENCOUNTER_BIOMES } from "#mystery-encounters/mystery-encounters"; import { SelectModifierPhase } from "#phases/select-modifier-phase"; import { runMysteryEncounterToEnd } from "#test/mystery-encounter/encounter-test-utils"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { ModifierSelectUiHandler } from "#ui/modifier-select-ui-handler"; import * as Utils from "#utils/common"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/mystery-encounter/encounters/lost-at-sea-encounter.test.ts b/test/mystery-encounter/encounters/lost-at-sea-encounter.test.ts index 2186fe43e23..d29f8fe6a82 100644 --- a/test/mystery-encounter/encounters/lost-at-sea-encounter.test.ts +++ b/test/mystery-encounter/encounters/lost-at-sea-encounter.test.ts @@ -13,8 +13,8 @@ import { runMysteryEncounterToEnd, runSelectMysteryEncounterOption, } from "#test/mystery-encounter/encounter-test-utils"; -import { GameManager } from "#test/testUtils/gameManager"; -import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils"; +import { GameManager } from "#test/test-utils/game-manager"; +import { initSceneWithoutEncounterPhase } from "#test/test-utils/game-manager-utils"; import { getPokemonSpecies } from "#utils/pokemon-utils"; import i18next from "i18next"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/mystery-encounter/encounters/mysterious-challengers-encounter.test.ts b/test/mystery-encounter/encounters/mysterious-challengers-encounter.test.ts index ee952f3809e..5412f269122 100644 --- a/test/mystery-encounter/encounters/mysterious-challengers-encounter.test.ts +++ b/test/mystery-encounter/encounters/mysterious-challengers-encounter.test.ts @@ -18,8 +18,8 @@ import { runMysteryEncounterToEnd, skipBattleRunMysteryEncounterRewardsPhase, } from "#test/mystery-encounter/encounter-test-utils"; -import { GameManager } from "#test/testUtils/gameManager"; -import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils"; +import { GameManager } from "#test/test-utils/game-manager"; +import { initSceneWithoutEncounterPhase } from "#test/test-utils/game-manager-utils"; import { TrainerConfig } from "#trainers/trainer-config"; import { TrainerPartyCompoundTemplate, TrainerPartyTemplate } from "#trainers/trainer-party-template"; import { ModifierSelectUiHandler } from "#ui/modifier-select-ui-handler"; diff --git a/test/mystery-encounter/encounters/part-timer-encounter.test.ts b/test/mystery-encounter/encounters/part-timer-encounter.test.ts index 1bbda8b77e0..63eea8bbca2 100644 --- a/test/mystery-encounter/encounters/part-timer-encounter.test.ts +++ b/test/mystery-encounter/encounters/part-timer-encounter.test.ts @@ -15,7 +15,7 @@ import { runMysteryEncounterToEnd, runSelectMysteryEncounterOption, } from "#test/mystery-encounter/encounter-test-utils"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; const namespace = "mysteryEncounters/partTimer"; diff --git a/test/mystery-encounter/encounters/safari-zone.test.ts b/test/mystery-encounter/encounters/safari-zone.test.ts index 252198139df..ec43dcfb69b 100644 --- a/test/mystery-encounter/encounters/safari-zone.test.ts +++ b/test/mystery-encounter/encounters/safari-zone.test.ts @@ -14,8 +14,8 @@ import { runMysteryEncounterToEnd, runSelectMysteryEncounterOption, } from "#test/mystery-encounter/encounter-test-utils"; -import { GameManager } from "#test/testUtils/gameManager"; -import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils"; +import { GameManager } from "#test/test-utils/game-manager"; +import { initSceneWithoutEncounterPhase } from "#test/test-utils/game-manager-utils"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; const namespace = "mysteryEncounters/safariZone"; diff --git a/test/mystery-encounter/encounters/teleporting-hijinks-encounter.test.ts b/test/mystery-encounter/encounters/teleporting-hijinks-encounter.test.ts index 6ecf3162607..43d497c57bb 100644 --- a/test/mystery-encounter/encounters/teleporting-hijinks-encounter.test.ts +++ b/test/mystery-encounter/encounters/teleporting-hijinks-encounter.test.ts @@ -16,8 +16,8 @@ import { runSelectMysteryEncounterOption, skipBattleRunMysteryEncounterRewardsPhase, } from "#test/mystery-encounter/encounter-test-utils"; -import { GameManager } from "#test/testUtils/gameManager"; -import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils"; +import { GameManager } from "#test/test-utils/game-manager"; +import { initSceneWithoutEncounterPhase } from "#test/test-utils/game-manager-utils"; import { ModifierSelectUiHandler } from "#ui/modifier-select-ui-handler"; import i18next from "i18next"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/mystery-encounter/encounters/the-expert-breeder-encounter.test.ts b/test/mystery-encounter/encounters/the-expert-breeder-encounter.test.ts index 471a26aa532..4556f7a7f45 100644 --- a/test/mystery-encounter/encounters/the-expert-breeder-encounter.test.ts +++ b/test/mystery-encounter/encounters/the-expert-breeder-encounter.test.ts @@ -19,8 +19,8 @@ import { runMysteryEncounterToEnd, skipBattleRunMysteryEncounterRewardsPhase, } from "#test/mystery-encounter/encounter-test-utils"; -import { GameManager } from "#test/testUtils/gameManager"; -import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils"; +import { GameManager } from "#test/test-utils/game-manager"; +import { initSceneWithoutEncounterPhase } from "#test/test-utils/game-manager-utils"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; const namespace = "mysteryEncounters/theExpertPokemonBreeder"; diff --git a/test/mystery-encounter/encounters/the-pokemon-salesman-encounter.test.ts b/test/mystery-encounter/encounters/the-pokemon-salesman-encounter.test.ts index 81329c5552f..611a103dab2 100644 --- a/test/mystery-encounter/encounters/the-pokemon-salesman-encounter.test.ts +++ b/test/mystery-encounter/encounters/the-pokemon-salesman-encounter.test.ts @@ -17,8 +17,8 @@ import { runMysteryEncounterToEnd, runSelectMysteryEncounterOption, } from "#test/mystery-encounter/encounter-test-utils"; -import { GameManager } from "#test/testUtils/gameManager"; -import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils"; +import { GameManager } from "#test/test-utils/game-manager"; +import { initSceneWithoutEncounterPhase } from "#test/test-utils/game-manager-utils"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; const namespace = "mysteryEncounters/thePokemonSalesman"; diff --git a/test/mystery-encounter/encounters/the-strong-stuff-encounter.test.ts b/test/mystery-encounter/encounters/the-strong-stuff-encounter.test.ts index 9a78cd99f93..a314a14485f 100644 --- a/test/mystery-encounter/encounters/the-strong-stuff-encounter.test.ts +++ b/test/mystery-encounter/encounters/the-strong-stuff-encounter.test.ts @@ -24,8 +24,8 @@ import { runMysteryEncounterToEnd, skipBattleRunMysteryEncounterRewardsPhase, } from "#test/mystery-encounter/encounter-test-utils"; -import { GameManager } from "#test/testUtils/gameManager"; -import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils"; +import { GameManager } from "#test/test-utils/game-manager"; +import { initSceneWithoutEncounterPhase } from "#test/test-utils/game-manager-utils"; import { ModifierSelectUiHandler } from "#ui/modifier-select-ui-handler"; import { getPokemonSpecies } from "#utils/pokemon-utils"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/mystery-encounter/encounters/the-winstrate-challenge-encounter.test.ts b/test/mystery-encounter/encounters/the-winstrate-challenge-encounter.test.ts index 0541826e569..ae2f9fd79ff 100644 --- a/test/mystery-encounter/encounters/the-winstrate-challenge-encounter.test.ts +++ b/test/mystery-encounter/encounters/the-winstrate-challenge-encounter.test.ts @@ -21,8 +21,8 @@ import { PartyHealPhase } from "#phases/party-heal-phase"; import { SelectModifierPhase } from "#phases/select-modifier-phase"; import { VictoryPhase } from "#phases/victory-phase"; import { runMysteryEncounterToEnd } from "#test/mystery-encounter/encounter-test-utils"; -import { GameManager } from "#test/testUtils/gameManager"; -import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils"; +import { GameManager } from "#test/test-utils/game-manager"; +import { initSceneWithoutEncounterPhase } from "#test/test-utils/game-manager-utils"; import { ModifierSelectUiHandler } from "#ui/modifier-select-ui-handler"; import { getPokemonSpecies } from "#utils/pokemon-utils"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/mystery-encounter/encounters/trash-to-treasure-encounter.test.ts b/test/mystery-encounter/encounters/trash-to-treasure-encounter.test.ts index 48b6ce79488..133fbfb10ba 100644 --- a/test/mystery-encounter/encounters/trash-to-treasure-encounter.test.ts +++ b/test/mystery-encounter/encounters/trash-to-treasure-encounter.test.ts @@ -27,8 +27,8 @@ import { runMysteryEncounterToEnd, skipBattleRunMysteryEncounterRewardsPhase, } from "#test/mystery-encounter/encounter-test-utils"; -import { GameManager } from "#test/testUtils/gameManager"; -import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils"; +import { GameManager } from "#test/test-utils/game-manager"; +import { initSceneWithoutEncounterPhase } from "#test/test-utils/game-manager-utils"; import { ModifierSelectUiHandler } from "#ui/modifier-select-ui-handler"; import * as Utils from "#utils/common"; import { getPokemonSpecies } from "#utils/pokemon-utils"; diff --git a/test/mystery-encounter/encounters/uncommon-breed-encounter.test.ts b/test/mystery-encounter/encounters/uncommon-breed-encounter.test.ts index a9ebfda496a..24d7960049e 100644 --- a/test/mystery-encounter/encounters/uncommon-breed-encounter.test.ts +++ b/test/mystery-encounter/encounters/uncommon-breed-encounter.test.ts @@ -24,8 +24,8 @@ import { runMysteryEncounterToEnd, runSelectMysteryEncounterOption, } from "#test/mystery-encounter/encounter-test-utils"; -import { GameManager } from "#test/testUtils/gameManager"; -import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils"; +import { GameManager } from "#test/test-utils/game-manager"; +import { initSceneWithoutEncounterPhase } from "#test/test-utils/game-manager-utils"; import { getPokemonSpecies } from "#utils/pokemon-utils"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/mystery-encounter/encounters/weird-dream-encounter.test.ts b/test/mystery-encounter/encounters/weird-dream-encounter.test.ts index f68818bbfe4..e9fcc9797d1 100644 --- a/test/mystery-encounter/encounters/weird-dream-encounter.test.ts +++ b/test/mystery-encounter/encounters/weird-dream-encounter.test.ts @@ -16,8 +16,8 @@ import { runMysteryEncounterToEnd, skipBattleRunMysteryEncounterRewardsPhase, } from "#test/mystery-encounter/encounter-test-utils"; -import { GameManager } from "#test/testUtils/gameManager"; -import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils"; +import { GameManager } from "#test/test-utils/game-manager"; +import { initSceneWithoutEncounterPhase } from "#test/test-utils/game-manager-utils"; import { ModifierSelectUiHandler } from "#ui/modifier-select-ui-handler"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/mystery-encounter/mystery-encounter-utils.test.ts b/test/mystery-encounter/mystery-encounter-utils.test.ts index 745b11b7e73..adcc3111319 100644 --- a/test/mystery-encounter/mystery-encounter-utils.test.ts +++ b/test/mystery-encounter/mystery-encounter-utils.test.ts @@ -18,8 +18,8 @@ import { } from "#mystery-encounters/encounter-pokemon-utils"; import { MysteryEncounter } from "#mystery-encounters/mystery-encounter"; import { MessagePhase } from "#phases/message-phase"; -import { GameManager } from "#test/testUtils/gameManager"; -import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils"; +import { GameManager } from "#test/test-utils/game-manager"; +import { initSceneWithoutEncounterPhase } from "#test/test-utils/game-manager-utils"; import { getPokemonSpecies } from "#utils/pokemon-utils"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/mystery-encounter/mystery-encounter.test.ts b/test/mystery-encounter/mystery-encounter.test.ts index c8ac7078788..71bc9aec008 100644 --- a/test/mystery-encounter/mystery-encounter.test.ts +++ b/test/mystery-encounter/mystery-encounter.test.ts @@ -2,7 +2,7 @@ import type { BattleScene } from "#app/battle-scene"; import { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { SpeciesId } from "#enums/species-id"; import { MysteryEncounterPhase } from "#phases/mystery-encounter-phases"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/phases/capture-phase.test.ts b/test/phases/capture-phase.test.ts new file mode 100644 index 00000000000..45a915ebb55 --- /dev/null +++ b/test/phases/capture-phase.test.ts @@ -0,0 +1,37 @@ +import { AbilityId } from "#enums/ability-id"; +import { MoveId } from "#enums/move-id"; +import { SpeciesId } from "#enums/species-id"; +import { GameManager } from "#test/test-utils/game-manager"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, it } from "vitest"; + +describe("Capture Phase", () => { + let phaserGame: Phaser.Game; + let game: GameManager; + + beforeAll(() => { + phaserGame = new Phaser.Game({ + type: Phaser.HEADLESS, + }); + }); + + afterEach(() => { + game.phaseInterceptor.restoreOg(); + }); + + beforeEach(() => { + game = new GameManager(phaserGame); + game.override + .ability(AbilityId.BALL_FETCH) + .battleStyle("single") + .criticalHits(false) + .enemySpecies(SpeciesId.MAGIKARP) + .enemyAbility(AbilityId.BALL_FETCH) + .enemyMoveset(MoveId.SPLASH) + .startingLevel(100) + .enemyLevel(100); + }); + + // TODO: write test and enable once the phase's logic has been refactored + it.todo("should reset the captured Pokemon's temporary data"); +}); diff --git a/test/phases/form-change-phase.test.ts b/test/phases/form-change-phase.test.ts index 4d3af280043..3caf824b252 100644 --- a/test/phases/form-change-phase.test.ts +++ b/test/phases/form-change-phase.test.ts @@ -4,7 +4,7 @@ import { MoveId } from "#enums/move-id"; import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; import { generateModifierType } from "#mystery-encounters/encounter-phase-utils"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/phases/frenzy-move-reset.test.ts b/test/phases/frenzy-move-reset.test.ts index c922a121526..93406ddd577 100644 --- a/test/phases/frenzy-move-reset.test.ts +++ b/test/phases/frenzy-move-reset.test.ts @@ -4,7 +4,7 @@ import { BattlerTagType } from "#enums/battler-tag-type"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/phases/game-over-phase.test.ts b/test/phases/game-over-phase.test.ts index d679b812fc0..201eebc5264 100644 --- a/test/phases/game-over-phase.test.ts +++ b/test/phases/game-over-phase.test.ts @@ -4,7 +4,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Unlockables } from "#enums/unlockables"; import { achvs } from "#system/achv"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/phases/learn-move-phase.test.ts b/test/phases/learn-move-phase.test.ts index b7e7175a46c..77902a0d959 100644 --- a/test/phases/learn-move-phase.test.ts +++ b/test/phases/learn-move-phase.test.ts @@ -3,7 +3,7 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { UiMode } from "#enums/ui-mode"; import { LearnMovePhase } from "#phases/learn-move-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/phases/mystery-encounter-phase.test.ts b/test/phases/mystery-encounter-phase.test.ts index 3c41028e4b7..ad71a4151ac 100644 --- a/test/phases/mystery-encounter-phase.test.ts +++ b/test/phases/mystery-encounter-phase.test.ts @@ -4,7 +4,7 @@ import { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { SpeciesId } from "#enums/species-id"; import { UiMode } from "#enums/ui-mode"; import { MysteryEncounterOptionSelectedPhase, MysteryEncounterPhase } from "#phases/mystery-encounter-phases"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import type { MessageUiHandler } from "#ui/message-ui-handler"; import type { MysteryEncounterUiHandler } from "#ui/mystery-encounter-ui-handler"; import i18next from "i18next"; diff --git a/test/phases/phases.test.ts b/test/phases/phases.test.ts index daa63fe2adc..27ee4114701 100644 --- a/test/phases/phases.test.ts +++ b/test/phases/phases.test.ts @@ -3,7 +3,7 @@ import { UiMode } from "#enums/ui-mode"; import { LoginPhase } from "#phases/login-phase"; import { TitlePhase } from "#phases/title-phase"; import { UnavailablePhase } from "#phases/unavailable-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/phases/select-modifier-phase.test.ts b/test/phases/select-modifier-phase.test.ts index 565fbe8e439..ae4cebb1866 100644 --- a/test/phases/select-modifier-phase.test.ts +++ b/test/phases/select-modifier-phase.test.ts @@ -10,8 +10,8 @@ import { PlayerPokemon } from "#field/pokemon"; import type { CustomModifierSettings } from "#modifiers/modifier-type"; import { ModifierTypeOption } from "#modifiers/modifier-type"; import { SelectModifierPhase } from "#phases/select-modifier-phase"; -import { GameManager } from "#test/testUtils/gameManager"; -import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils"; +import { GameManager } from "#test/test-utils/game-manager"; +import { initSceneWithoutEncounterPhase } from "#test/test-utils/game-manager-utils"; import { ModifierSelectUiHandler } from "#ui/modifier-select-ui-handler"; import { shiftCharCodes } from "#utils/common"; import { getPokemonSpecies } from "#utils/pokemon-utils"; diff --git a/test/plugins/api/pokerogue-account-api.test.ts b/test/plugins/api/pokerogue-account-api.test.ts index 578b6ba041a..b830289c773 100644 --- a/test/plugins/api/pokerogue-account-api.test.ts +++ b/test/plugins/api/pokerogue-account-api.test.ts @@ -1,8 +1,8 @@ import { PokerogueAccountApi } from "#api/pokerogue-account-api"; import { SESSION_ID_COOKIE_NAME } from "#app/constants"; -import { initServerForApiTests } from "#test/testUtils/testFileInitialization"; -import { getApiBaseUrl } from "#test/testUtils/testUtils"; -import type { AccountInfoResponse } from "#types/PokerogueAccountApi"; +import { initServerForApiTests } from "#test/test-utils/test-file-initialization"; +import { getApiBaseUrl } from "#test/test-utils/test-utils"; +import type { AccountInfoResponse } from "#types/api/pokerogue-account-api"; import * as CookieUtils from "#utils/cookies"; import * as cookies from "#utils/cookies"; import { HttpResponse, http } from "msw"; diff --git a/test/plugins/api/pokerogue-admin-api.test.ts b/test/plugins/api/pokerogue-admin-api.test.ts index e36f45801b6..a40fa23698f 100644 --- a/test/plugins/api/pokerogue-admin-api.test.ts +++ b/test/plugins/api/pokerogue-admin-api.test.ts @@ -1,6 +1,6 @@ import { PokerogueAdminApi } from "#api/pokerogue-admin-api"; -import { initServerForApiTests } from "#test/testUtils/testFileInitialization"; -import { getApiBaseUrl } from "#test/testUtils/testUtils"; +import { initServerForApiTests } from "#test/test-utils/test-file-initialization"; +import { getApiBaseUrl } from "#test/test-utils/test-utils"; import type { LinkAccountToDiscordIdRequest, LinkAccountToGoogledIdRequest, @@ -8,7 +8,7 @@ import type { SearchAccountResponse, UnlinkAccountFromDiscordIdRequest, UnlinkAccountFromGoogledIdRequest, -} from "#types/PokerogueAdminApi"; +} from "#types/api/pokerogue-admin-api"; import { HttpResponse, http } from "msw"; import type { SetupServerApi } from "msw/node"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/plugins/api/pokerogue-api.test.ts b/test/plugins/api/pokerogue-api.test.ts index b9ebbe0f685..afd7b3dd608 100644 --- a/test/plugins/api/pokerogue-api.test.ts +++ b/test/plugins/api/pokerogue-api.test.ts @@ -1,7 +1,7 @@ import { pokerogueApi } from "#api/pokerogue-api"; -import { initServerForApiTests } from "#test/testUtils/testFileInitialization"; -import { getApiBaseUrl } from "#test/testUtils/testUtils"; -import type { TitleStatsResponse } from "#types/PokerogueApi"; +import { initServerForApiTests } from "#test/test-utils/test-file-initialization"; +import { getApiBaseUrl } from "#test/test-utils/test-utils"; +import type { TitleStatsResponse } from "#types/api/pokerogue-api-types"; import { HttpResponse, http } from "msw"; import type { SetupServerApi } from "msw/node"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/plugins/api/pokerogue-daily-api.test.ts b/test/plugins/api/pokerogue-daily-api.test.ts index 6399c80781e..ef5dfddada5 100644 --- a/test/plugins/api/pokerogue-daily-api.test.ts +++ b/test/plugins/api/pokerogue-daily-api.test.ts @@ -1,7 +1,7 @@ import { PokerogueDailyApi } from "#api/pokerogue-daily-api"; -import { initServerForApiTests } from "#test/testUtils/testFileInitialization"; -import { getApiBaseUrl } from "#test/testUtils/testUtils"; -import type { GetDailyRankingsPageCountRequest, GetDailyRankingsRequest } from "#types/PokerogueDailyApi"; +import { initServerForApiTests } from "#test/test-utils/test-file-initialization"; +import { getApiBaseUrl } from "#test/test-utils/test-utils"; +import type { GetDailyRankingsPageCountRequest, GetDailyRankingsRequest } from "#types/api/pokerogue-daily-api"; import { type RankingEntry, ScoreboardCategory } from "#ui/daily-run-scoreboard"; import { HttpResponse, http } from "msw"; import type { SetupServerApi } from "msw/node"; diff --git a/test/plugins/api/pokerogue-savedata-api.test.ts b/test/plugins/api/pokerogue-savedata-api.test.ts index d465759bdfc..5dbaf9ff542 100644 --- a/test/plugins/api/pokerogue-savedata-api.test.ts +++ b/test/plugins/api/pokerogue-savedata-api.test.ts @@ -1,7 +1,7 @@ import { PokerogueSavedataApi } from "#api/pokerogue-savedata-api"; -import { initServerForApiTests } from "#test/testUtils/testFileInitialization"; -import { getApiBaseUrl } from "#test/testUtils/testUtils"; -import type { UpdateAllSavedataRequest } from "#types/PokerogueSavedataApi"; +import { initServerForApiTests } from "#test/test-utils/test-file-initialization"; +import { getApiBaseUrl } from "#test/test-utils/test-utils"; +import type { UpdateAllSavedataRequest } from "#types/api/pokerogue-save-data-api"; import { HttpResponse, http } from "msw"; import type { SetupServerApi } from "msw/node"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/plugins/api/pokerogue-session-savedata-api.test.ts b/test/plugins/api/pokerogue-session-savedata-api.test.ts index e95697ab72e..d7ee2703405 100644 --- a/test/plugins/api/pokerogue-session-savedata-api.test.ts +++ b/test/plugins/api/pokerogue-session-savedata-api.test.ts @@ -1,7 +1,7 @@ import { PokerogueSessionSavedataApi } from "#api/pokerogue-session-savedata-api"; import type { SessionSaveData } from "#system/game-data"; -import { initServerForApiTests } from "#test/testUtils/testFileInitialization"; -import { getApiBaseUrl } from "#test/testUtils/testUtils"; +import { initServerForApiTests } from "#test/test-utils/test-file-initialization"; +import { getApiBaseUrl } from "#test/test-utils/test-utils"; import type { ClearSessionSavedataRequest, ClearSessionSavedataResponse, @@ -9,7 +9,7 @@ import type { GetSessionSavedataRequest, NewClearSessionSavedataRequest, UpdateSessionSavedataRequest, -} from "#types/PokerogueSessionSavedataApi"; +} from "#types/api/pokerogue-session-save-data-api"; import { HttpResponse, http } from "msw"; import type { SetupServerApi } from "msw/node"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/plugins/api/pokerogue-system-savedata-api.test.ts b/test/plugins/api/pokerogue-system-savedata-api.test.ts index 0bec6dae16b..d6e4fe18eed 100644 --- a/test/plugins/api/pokerogue-system-savedata-api.test.ts +++ b/test/plugins/api/pokerogue-system-savedata-api.test.ts @@ -1,13 +1,13 @@ import { PokerogueSystemSavedataApi } from "#api/pokerogue-system-savedata-api"; import type { SystemSaveData } from "#system/game-data"; -import { initServerForApiTests } from "#test/testUtils/testFileInitialization"; -import { getApiBaseUrl } from "#test/testUtils/testUtils"; +import { initServerForApiTests } from "#test/test-utils/test-file-initialization"; +import { getApiBaseUrl } from "#test/test-utils/test-utils"; import type { GetSystemSavedataRequest, UpdateSystemSavedataRequest, VerifySystemSavedataRequest, VerifySystemSavedataResponse, -} from "#types/PokerogueSystemSavedataApi"; +} from "#types/api/pokerogue-system-save-data-api"; import { HttpResponse, http } from "msw"; import type { SetupServerApi } from "msw/node"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/reload.test.ts b/test/reload.test.ts index a1cdfcb392a..018a5e334ef 100644 --- a/test/reload.test.ts +++ b/test/reload.test.ts @@ -5,8 +5,8 @@ import { GameModes } from "#enums/game-modes"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { UiMode } from "#enums/ui-mode"; -import { GameManager } from "#test/testUtils/gameManager"; -import type { MockClock } from "#test/testUtils/mocks/mockClock"; +import { GameManager } from "#test/test-utils/game-manager"; +import type { MockClock } from "#test/test-utils/mocks/mock-clock"; import type { OptionSelectUiHandler } from "#ui/option-select-ui-handler"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/settingMenu/helpers/inGameManip.ts b/test/setting-menu/helpers/in-game-manip.ts similarity index 76% rename from test/settingMenu/helpers/inGameManip.ts rename to test/setting-menu/helpers/in-game-manip.ts index c19c6745300..2f4350bab5c 100644 --- a/test/settingMenu/helpers/inGameManip.ts +++ b/test/setting-menu/helpers/in-game-manip.ts @@ -1,5 +1,6 @@ -import { getIconForLatestInput, getSettingNameWithKeycode } from "#inputs/configHandler"; +import { getIconForLatestInput, getSettingNameWithKeycode } from "#inputs/config-handler"; import { SettingKeyboard } from "#system/settings-keyboard"; +import { toPascalSnakeCase } from "#utils/strings"; import { expect } from "vitest"; export class InGameManip { @@ -56,22 +57,11 @@ export class InGameManip { return this; } - normalizeSettingNameString(input) { - // Convert the input string to lower case - const lowerCasedInput = input.toLowerCase(); - - // Replace underscores with spaces, capitalize the first letter of each word, and join them back with underscores - const words = lowerCasedInput.split("_").map(word => word.charAt(0).toUpperCase() + word.slice(1)); - const result = words.join("_"); - - return result; - } - weShouldTriggerTheButton(settingName) { if (!settingName.includes("Button_")) { settingName = "Button_" + settingName; } - this.settingName = SettingKeyboard[this.normalizeSettingNameString(settingName)]; + this.settingName = SettingKeyboard[toPascalSnakeCase(settingName)]; expect(getSettingNameWithKeycode(this.config, this.keycode)).toEqual(this.settingName); return this; } diff --git a/test/settingMenu/helpers/menuManip.ts b/test/setting-menu/helpers/menu-manip.ts similarity index 98% rename from test/settingMenu/helpers/menuManip.ts rename to test/setting-menu/helpers/menu-manip.ts index 37c0f823559..276fef2f973 100644 --- a/test/settingMenu/helpers/menuManip.ts +++ b/test/setting-menu/helpers/menu-manip.ts @@ -9,7 +9,7 @@ import { getKeyWithKeycode, getKeyWithSettingName, getSettingNameWithKeycode, -} from "#inputs/configHandler"; +} from "#inputs/config-handler"; import { SettingKeyboard } from "#system/settings-keyboard"; import { expect } from "vitest"; @@ -29,6 +29,7 @@ export class MenuManip { this.specialCaseIcon = null; } + // TODO: Review this convertNameToButtonString(input) { // Check if the input starts with "Alt_Button" if (input.startsWith("Alt_Button")) { diff --git a/test/settingMenu/rebinding_setting.test.ts b/test/setting-menu/rebinding-setting.test.ts similarity index 99% rename from test/settingMenu/rebinding_setting.test.ts rename to test/setting-menu/rebinding-setting.test.ts index b738861c1ee..6c065a0dd3b 100644 --- a/test/settingMenu/rebinding_setting.test.ts +++ b/test/setting-menu/rebinding-setting.test.ts @@ -1,11 +1,11 @@ import type { InterfaceConfig } from "#app/inputs-controller"; import { Button } from "#enums/buttons"; import { Device } from "#enums/devices"; -import cfg_keyboard_qwerty from "#inputs/cfg_keyboard_qwerty"; -import { getKeyWithKeycode, getKeyWithSettingName } from "#inputs/configHandler"; +import cfg_keyboard_qwerty from "#inputs/cfg-keyboard-qwerty"; +import { getKeyWithKeycode, getKeyWithSettingName } from "#inputs/config-handler"; import { SettingKeyboard } from "#system/settings-keyboard"; -import { InGameManip } from "#test/settingMenu/helpers/inGameManip"; -import { MenuManip } from "#test/settingMenu/helpers/menuManip"; +import { InGameManip } from "#test/setting-menu/helpers/in-game-manip"; +import { MenuManip } from "#test/setting-menu/helpers/menu-manip"; import { deepCopy } from "#utils/data"; import { beforeEach, describe, expect, it } from "vitest"; diff --git a/test/sprites/pokemonSprite.test.ts b/test/sprites/pokemon-sprite.test.ts similarity index 99% rename from test/sprites/pokemonSprite.test.ts rename to test/sprites/pokemon-sprite.test.ts index 019dc51a8e2..bf945636a71 100644 --- a/test/sprites/pokemonSprite.test.ts +++ b/test/sprites/pokemon-sprite.test.ts @@ -1,4 +1,4 @@ -import { getAppRootDir } from "#test/sprites/spritesUtils"; +import { getAppRootDir } from "#test/sprites/sprites-utils"; import fs from "fs"; import path from "path"; import { beforeAll, describe, expect, it } from "vitest"; diff --git a/test/sprites/spritesUtils.ts b/test/sprites/sprites-utils.ts similarity index 100% rename from test/sprites/spritesUtils.ts rename to test/sprites/sprites-utils.ts diff --git a/test/system/game_data.test.ts b/test/system/game-data.test.ts similarity index 97% rename from test/system/game_data.test.ts rename to test/system/game-data.test.ts index 5daed0b2f1b..18775f310b7 100644 --- a/test/system/game_data.test.ts +++ b/test/system/game-data.test.ts @@ -4,7 +4,7 @@ import * as bypassLoginModule from "#app/global-vars/bypass-login"; import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import type { SessionSaveData } from "#system/game-data"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/testUtils/errorInterceptor.ts b/test/test-utils/error-interceptor.ts similarity index 100% rename from test/testUtils/errorInterceptor.ts rename to test/test-utils/error-interceptor.ts diff --git a/test/testUtils/fakeMobile.html b/test/test-utils/fakeMobile.html similarity index 100% rename from test/testUtils/fakeMobile.html rename to test/test-utils/fakeMobile.html diff --git a/test/testUtils/gameManagerUtils.ts b/test/test-utils/game-manager-utils.ts similarity index 100% rename from test/testUtils/gameManagerUtils.ts rename to test/test-utils/game-manager-utils.ts diff --git a/test/testUtils/gameManager.ts b/test/test-utils/game-manager.ts similarity index 94% rename from test/testUtils/gameManager.ts rename to test/test-utils/game-manager.ts index b6d0da49902..b81b077b2f2 100644 --- a/test/testUtils/gameManager.ts +++ b/test/test-utils/game-manager.ts @@ -30,22 +30,22 @@ import { TitlePhase } from "#phases/title-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; import { TurnInitPhase } from "#phases/turn-init-phase"; import { TurnStartPhase } from "#phases/turn-start-phase"; -import { ErrorInterceptor } from "#test/testUtils/errorInterceptor"; -import { generateStarter, waitUntil } from "#test/testUtils/gameManagerUtils"; -import { GameWrapper } from "#test/testUtils/gameWrapper"; -import { ChallengeModeHelper } from "#test/testUtils/helpers/challengeModeHelper"; -import { ClassicModeHelper } from "#test/testUtils/helpers/classicModeHelper"; -import { DailyModeHelper } from "#test/testUtils/helpers/dailyModeHelper"; -import { FieldHelper } from "#test/testUtils/helpers/field-helper"; -import { ModifierHelper } from "#test/testUtils/helpers/modifiersHelper"; -import { MoveHelper } from "#test/testUtils/helpers/moveHelper"; -import { OverridesHelper } from "#test/testUtils/helpers/overridesHelper"; -import { ReloadHelper } from "#test/testUtils/helpers/reloadHelper"; -import { SettingsHelper } from "#test/testUtils/helpers/settingsHelper"; -import type { InputsHandler } from "#test/testUtils/inputsHandler"; -import { MockFetch } from "#test/testUtils/mocks/mockFetch"; -import { PhaseInterceptor } from "#test/testUtils/phaseInterceptor"; -import { TextInterceptor } from "#test/testUtils/TextInterceptor"; +import { ErrorInterceptor } from "#test/test-utils/error-interceptor"; +import { generateStarter, waitUntil } from "#test/test-utils/game-manager-utils"; +import { GameWrapper } from "#test/test-utils/game-wrapper"; +import { ChallengeModeHelper } from "#test/test-utils/helpers/challenge-mode-helper"; +import { ClassicModeHelper } from "#test/test-utils/helpers/classic-mode-helper"; +import { DailyModeHelper } from "#test/test-utils/helpers/daily-mode-helper"; +import { FieldHelper } from "#test/test-utils/helpers/field-helper"; +import { ModifierHelper } from "#test/test-utils/helpers/modifiers-helper"; +import { MoveHelper } from "#test/test-utils/helpers/move-helper"; +import { OverridesHelper } from "#test/test-utils/helpers/overrides-helper"; +import { ReloadHelper } from "#test/test-utils/helpers/reload-helper"; +import { SettingsHelper } from "#test/test-utils/helpers/settings-helper"; +import type { InputsHandler } from "#test/test-utils/inputs-handler"; +import { MockFetch } from "#test/test-utils/mocks/mock-fetch"; +import { PhaseInterceptor } from "#test/test-utils/phase-interceptor"; +import { TextInterceptor } from "#test/test-utils/text-interceptor"; import type { BallUiHandler } from "#ui/ball-ui-handler"; import type { BattleMessageUiHandler } from "#ui/battle-message-ui-handler"; import type { CommandUiHandler } from "#ui/command-ui-handler"; @@ -124,7 +124,6 @@ export class GameManager { this.reload = new ReloadHelper(this); this.modifiers = new ModifierHelper(this); this.field = new FieldHelper(this); - this.override.sanitizeOverrides(); // Disables Mystery Encounters on all tests (can be overridden at test level) this.override.mysteryEncounterChance(0); diff --git a/test/testUtils/gameWrapper.ts b/test/test-utils/game-wrapper.ts similarity index 92% rename from test/testUtils/gameWrapper.ts rename to test/test-utils/game-wrapper.ts index b9665ffe071..1a906bf8492 100644 --- a/test/testUtils/gameWrapper.ts +++ b/test/test-utils/game-wrapper.ts @@ -6,14 +6,14 @@ import * as bypassLoginModule from "#app/global-vars/bypass-login"; import { MoveAnim } from "#data/battle-anims"; import { Pokemon } from "#field/pokemon"; import { version } from "#package.json"; -import { blobToString } from "#test/testUtils/gameManagerUtils"; -import { MockClock } from "#test/testUtils/mocks/mockClock"; -import { MockFetch } from "#test/testUtils/mocks/mockFetch"; -import { MockGameObjectCreator } from "#test/testUtils/mocks/mockGameObjectCreator"; -import { MockLoader } from "#test/testUtils/mocks/mockLoader"; -import { MockContainer } from "#test/testUtils/mocks/mocksContainer/mockContainer"; -import { MockTextureManager } from "#test/testUtils/mocks/mockTextureManager"; -import { MockTimedEventManager } from "#test/testUtils/mocks/mockTimedEventManager"; +import { blobToString } from "#test/test-utils/game-manager-utils"; +import { MockClock } from "#test/test-utils/mocks/mock-clock"; +import { MockFetch } from "#test/test-utils/mocks/mock-fetch"; +import { MockGameObjectCreator } from "#test/test-utils/mocks/mock-game-object-creator"; +import { MockLoader } from "#test/test-utils/mocks/mock-loader"; +import { MockTextureManager } from "#test/test-utils/mocks/mock-texture-manager"; +import { MockTimedEventManager } from "#test/test-utils/mocks/mock-timed-event-manager"; +import { MockContainer } from "#test/test-utils/mocks/mocks-container/mock-container"; import { PokedexMonContainer } from "#ui/pokedex-mon-container"; import { sessionIdKey } from "#utils/common"; import { setCookie } from "#utils/cookies"; diff --git a/test/testUtils/helpers/challengeModeHelper.ts b/test/test-utils/helpers/challenge-mode-helper.ts similarity index 95% rename from test/testUtils/helpers/challengeModeHelper.ts rename to test/test-utils/helpers/challenge-mode-helper.ts index 31b7c062d99..3952685a560 100644 --- a/test/testUtils/helpers/challengeModeHelper.ts +++ b/test/test-utils/helpers/challenge-mode-helper.ts @@ -8,8 +8,8 @@ import { CommandPhase } from "#phases/command-phase"; import { EncounterPhase } from "#phases/encounter-phase"; import { SelectStarterPhase } from "#phases/select-starter-phase"; import { TurnInitPhase } from "#phases/turn-init-phase"; -import { generateStarter } from "#test/testUtils/gameManagerUtils"; -import { GameManagerHelper } from "#test/testUtils/helpers/gameManagerHelper"; +import { generateStarter } from "#test/test-utils/game-manager-utils"; +import { GameManagerHelper } from "#test/test-utils/helpers/game-manager-helper"; import { copyChallenge } from "data/challenge"; /** diff --git a/test/testUtils/helpers/classicModeHelper.ts b/test/test-utils/helpers/classic-mode-helper.ts similarity index 96% rename from test/testUtils/helpers/classicModeHelper.ts rename to test/test-utils/helpers/classic-mode-helper.ts index 55b25623b5a..5d73dc07615 100644 --- a/test/testUtils/helpers/classicModeHelper.ts +++ b/test/test-utils/helpers/classic-mode-helper.ts @@ -9,8 +9,8 @@ import { CommandPhase } from "#phases/command-phase"; import { EncounterPhase } from "#phases/encounter-phase"; import { SelectStarterPhase } from "#phases/select-starter-phase"; import { TurnInitPhase } from "#phases/turn-init-phase"; -import { generateStarter } from "#test/testUtils/gameManagerUtils"; -import { GameManagerHelper } from "#test/testUtils/helpers/gameManagerHelper"; +import { generateStarter } from "#test/test-utils/game-manager-utils"; +import { GameManagerHelper } from "#test/test-utils/helpers/game-manager-helper"; /** * Helper to handle classic-mode specific operations. diff --git a/test/testUtils/helpers/dailyModeHelper.ts b/test/test-utils/helpers/daily-mode-helper.ts similarity index 96% rename from test/testUtils/helpers/dailyModeHelper.ts rename to test/test-utils/helpers/daily-mode-helper.ts index 214b6e4c5a4..7aa1e699118 100644 --- a/test/testUtils/helpers/dailyModeHelper.ts +++ b/test/test-utils/helpers/daily-mode-helper.ts @@ -6,7 +6,7 @@ import { CommandPhase } from "#phases/command-phase"; import { EncounterPhase } from "#phases/encounter-phase"; import { TitlePhase } from "#phases/title-phase"; import { TurnInitPhase } from "#phases/turn-init-phase"; -import { GameManagerHelper } from "#test/testUtils/helpers/gameManagerHelper"; +import { GameManagerHelper } from "#test/test-utils/helpers/game-manager-helper"; import type { SaveSlotSelectUiHandler } from "#ui/save-slot-select-ui-handler"; /** diff --git a/test/testUtils/helpers/field-helper.ts b/test/test-utils/helpers/field-helper.ts similarity index 98% rename from test/testUtils/helpers/field-helper.ts rename to test/test-utils/helpers/field-helper.ts index ca106804b85..35ca853d049 100644 --- a/test/testUtils/helpers/field-helper.ts +++ b/test/test-utils/helpers/field-helper.ts @@ -9,7 +9,7 @@ import type { BattlerIndex } from "#enums/battler-index"; import type { PokemonType } from "#enums/pokemon-type"; import { Stat } from "#enums/stat"; import type { EnemyPokemon, PlayerPokemon, Pokemon } from "#field/pokemon"; -import { GameManagerHelper } from "#test/testUtils/helpers/gameManagerHelper"; +import { GameManagerHelper } from "#test/test-utils/helpers/game-manager-helper"; import { expect, type MockInstance, vi } from "vitest"; /** Helper to manage pokemon */ diff --git a/test/testUtils/helpers/gameManagerHelper.ts b/test/test-utils/helpers/game-manager-helper.ts similarity index 75% rename from test/testUtils/helpers/gameManagerHelper.ts rename to test/test-utils/helpers/game-manager-helper.ts index 6db3819a5cb..eace4d9f5db 100644 --- a/test/testUtils/helpers/gameManagerHelper.ts +++ b/test/test-utils/helpers/game-manager-helper.ts @@ -1,4 +1,4 @@ -import type { GameManager } from "#test/testUtils/gameManager"; +import type { GameManager } from "#test/test-utils/game-manager"; /** * Base class for defining all game helpers. diff --git a/test/testUtils/helpers/modifiersHelper.ts b/test/test-utils/helpers/modifiers-helper.ts similarity index 96% rename from test/testUtils/helpers/modifiersHelper.ts rename to test/test-utils/helpers/modifiers-helper.ts index ff6e78c8a2f..bfda35427fa 100644 --- a/test/testUtils/helpers/modifiersHelper.ts +++ b/test/test-utils/helpers/modifiers-helper.ts @@ -1,6 +1,6 @@ import type { ModifierTypeKeys } from "#modifiers/modifier-type"; import { itemPoolChecks } from "#modifiers/modifier-type"; -import { GameManagerHelper } from "#test/testUtils/helpers/gameManagerHelper"; +import { GameManagerHelper } from "#test/test-utils/helpers/game-manager-helper"; import { expect } from "vitest"; export class ModifierHelper extends GameManagerHelper { diff --git a/test/testUtils/helpers/moveHelper.ts b/test/test-utils/helpers/move-helper.ts similarity index 91% rename from test/testUtils/helpers/moveHelper.ts rename to test/test-utils/helpers/move-helper.ts index 98a1c1664b4..15605edf31d 100644 --- a/test/testUtils/helpers/moveHelper.ts +++ b/test/test-utils/helpers/move-helper.ts @@ -11,8 +11,9 @@ import { PokemonMove } from "#moves/pokemon-move"; import type { CommandPhase } from "#phases/command-phase"; import type { EnemyCommandPhase } from "#phases/enemy-command-phase"; import { MoveEffectPhase } from "#phases/move-effect-phase"; -import { GameManagerHelper } from "#test/testUtils/helpers/gameManagerHelper"; -import { coerceArray, toReadableString } from "#utils/common"; +import { GameManagerHelper } from "#test/test-utils/helpers/game-manager-helper"; +import { coerceArray } from "#utils/common"; +import { toTitleCase } from "#utils/strings"; import type { MockInstance } from "vitest"; import { expect, vi } from "vitest"; @@ -66,12 +67,12 @@ export class MoveHelper extends GameManagerHelper { const movePosition = this.getMovePosition(pkmIndex, move); if (movePosition === -1) { expect.fail( - `MoveHelper.select called with move '${toReadableString(MoveId[move])}' not in moveset!` + - `\nBattler Index: ${toReadableString(BattlerIndex[pkmIndex])}` + + `MoveHelper.select called with move '${toTitleCase(MoveId[move])}' not in moveset!` + + `\nBattler Index: ${toTitleCase(BattlerIndex[pkmIndex])}` + `\nMoveset: [${this.game.scene .getPlayerParty() [pkmIndex].getMoveset() - .map(pm => toReadableString(MoveId[pm.moveId])) + .map(pm => toTitleCase(MoveId[pm.moveId])) .join(", ")}]`, ); } @@ -110,12 +111,12 @@ export class MoveHelper extends GameManagerHelper { const movePosition = this.getMovePosition(pkmIndex, move); if (movePosition === -1) { expect.fail( - `MoveHelper.selectWithTera called with move '${toReadableString(MoveId[move])}' not in moveset!` + - `\nBattler Index: ${toReadableString(BattlerIndex[pkmIndex])}` + + `MoveHelper.selectWithTera called with move '${toTitleCase(MoveId[move])}' not in moveset!` + + `\nBattler Index: ${toTitleCase(BattlerIndex[pkmIndex])}` + `\nMoveset: [${this.game.scene .getPlayerParty() [pkmIndex].getMoveset() - .map(pm => toReadableString(MoveId[pm.moveId])) + .map(pm => toTitleCase(MoveId[pm.moveId])) .join(", ")}]`, ); } @@ -209,12 +210,27 @@ export class MoveHelper extends GameManagerHelper { /** * Changes a pokemon's moveset to the given move(s). + * * Used when the normal moveset override can't be used (such as when it's necessary to check or update properties of the moveset). + * + * **Note**: Will disable the moveset override matching the pokemon's party. * @param pokemon - The {@linkcode Pokemon} being modified * @param moveset - The {@linkcode MoveId} (single or array) to change the Pokemon's moveset to. */ public changeMoveset(pokemon: Pokemon, moveset: MoveId | MoveId[]): void { + if (pokemon.isPlayer()) { + if (coerceArray(Overrides.MOVESET_OVERRIDE).length > 0) { + vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([]); + console.warn("Player moveset override disabled due to use of `game.move.changeMoveset`!"); + } + } else { + if (coerceArray(Overrides.OPP_MOVESET_OVERRIDE).length > 0) { + vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([]); + console.warn("Enemy moveset override disabled due to use of `game.move.changeMoveset`!"); + } + } moveset = coerceArray(moveset); + expect(moveset.length, "Cannot assign more than 4 moves to a moveset!").toBeLessThanOrEqual(4); pokemon.moveset = []; moveset.forEach(move => { pokemon.moveset.push(new PokemonMove(move)); diff --git a/test/testUtils/helpers/overridesHelper.ts b/test/test-utils/helpers/overrides-helper.ts similarity index 97% rename from test/testUtils/helpers/overridesHelper.ts rename to test/test-utils/helpers/overrides-helper.ts index 13e3dcc2f09..d67ceedf891 100644 --- a/test/testUtils/helpers/overridesHelper.ts +++ b/test/test-utils/helpers/overrides-helper.ts @@ -3,7 +3,7 @@ import type { NewArenaEvent } from "#events/battle-scene"; /** biome-ignore-end lint/correctness/noUnusedImports: tsdoc imports */ import type { BattleStyle, RandomTrainerOverride } from "#app/overrides"; -import Overrides, { defaultOverrides } from "#app/overrides"; +import Overrides from "#app/overrides"; import { AbilityId } from "#enums/ability-id"; import type { BattleType } from "#enums/battle-type"; import { BiomeId } from "#enums/biome-id"; @@ -17,9 +17,9 @@ import type { Unlockables } from "#enums/unlockables"; import { WeatherType } from "#enums/weather-type"; import type { ModifierOverride } from "#modifiers/modifier-type"; import type { Variant } from "#sprites/variant"; -import { GameManagerHelper } from "#test/testUtils/helpers/gameManagerHelper"; +import { GameManagerHelper } from "#test/test-utils/helpers/game-manager-helper"; import { coerceArray, shiftCharCodes } from "#utils/common"; -import { expect, vi } from "vitest"; +import { vi } from "vitest"; /** * Helper to handle overrides in tests @@ -667,14 +667,4 @@ export class OverridesHelper extends GameManagerHelper { private log(...params: any[]) { console.log("Overrides:", ...params); } - - public sanitizeOverrides(): void { - for (const key of Object.keys(defaultOverrides)) { - if (Overrides[key] !== defaultOverrides[key]) { - vi.spyOn(Overrides, key as any, "get").mockReturnValue(defaultOverrides[key]); - } - } - expect(Overrides).toEqual(defaultOverrides); - this.log("Sanitizing all overrides!"); - } } diff --git a/test/testUtils/helpers/reloadHelper.ts b/test/test-utils/helpers/reload-helper.ts similarity index 95% rename from test/testUtils/helpers/reloadHelper.ts rename to test/test-utils/helpers/reload-helper.ts index bc8adae6f28..a8ed0e21307 100644 --- a/test/testUtils/helpers/reloadHelper.ts +++ b/test/test-utils/helpers/reload-helper.ts @@ -4,8 +4,8 @@ import { CommandPhase } from "#phases/command-phase"; import { TitlePhase } from "#phases/title-phase"; import { TurnInitPhase } from "#phases/turn-init-phase"; import type { SessionSaveData } from "#system/game-data"; -import type { GameManager } from "#test/testUtils/gameManager"; -import { GameManagerHelper } from "#test/testUtils/helpers/gameManagerHelper"; +import type { GameManager } from "#test/test-utils/game-manager"; +import { GameManagerHelper } from "#test/test-utils/helpers/game-manager-helper"; import { vi } from "vitest"; /** diff --git a/test/testUtils/helpers/settingsHelper.ts b/test/test-utils/helpers/settings-helper.ts similarity index 94% rename from test/testUtils/helpers/settingsHelper.ts rename to test/test-utils/helpers/settings-helper.ts index 76db93c7de5..a26aa2de33c 100644 --- a/test/testUtils/helpers/settingsHelper.ts +++ b/test/test-utils/helpers/settings-helper.ts @@ -1,7 +1,7 @@ import { BattleStyle } from "#enums/battle-style"; import { ExpGainsSpeed } from "#enums/exp-gains-speed"; import { PlayerGender } from "#enums/player-gender"; -import { GameManagerHelper } from "#test/testUtils/helpers/gameManagerHelper"; +import { GameManagerHelper } from "#test/test-utils/helpers/game-manager-helper"; /** * Helper to handle settings for tests diff --git a/test/testUtils/inputsHandler.ts b/test/test-utils/inputs-handler.ts similarity index 93% rename from test/testUtils/inputsHandler.ts rename to test/test-utils/inputs-handler.ts index 6a0db37c9b6..b8b3224c31d 100644 --- a/test/testUtils/inputsHandler.ts +++ b/test/test-utils/inputs-handler.ts @@ -1,8 +1,8 @@ import type { BattleScene } from "#app/battle-scene"; import type { InputsController } from "#app/inputs-controller"; import { TouchControl } from "#app/touch-controls"; -import pad_xbox360 from "#inputs/pad_xbox360"; -import { holdOn } from "#test/testUtils/gameManagerUtils"; +import pad_xbox360 from "#inputs/pad-xbox360"; +import { holdOn } from "#test/test-utils/game-manager-utils"; import fs from "node:fs"; import { JSDOM } from "jsdom"; import Phaser from "phaser"; @@ -98,7 +98,7 @@ class Fakepad extends Phaser.Input.Gamepad.Gamepad { class FakeMobile { constructor() { - const fakeMobilePage = fs.readFileSync("././test/testUtils/fakeMobile.html", { encoding: "utf8", flag: "r" }); + const fakeMobilePage = fs.readFileSync("././test/test-utils/fakeMobile.html", { encoding: "utf8", flag: "r" }); const dom = new JSDOM(fakeMobilePage); Object.defineProperty(window, "document", { value: dom.window.document, diff --git a/test/testUtils/listenersManager.ts b/test/test-utils/listeners-manager.ts similarity index 100% rename from test/testUtils/listenersManager.ts rename to test/test-utils/listeners-manager.ts diff --git a/test/test-utils/matchers/to-equal-array-unsorted.ts b/test/test-utils/matchers/to-equal-array-unsorted.ts new file mode 100644 index 00000000000..0627623bbd9 --- /dev/null +++ b/test/test-utils/matchers/to-equal-array-unsorted.ts @@ -0,0 +1,43 @@ +import type { MatcherState, SyncExpectationResult } from "@vitest/expect"; + +/** + * Matcher to check if an array contains exactly the given items, disregarding order. + * @param received - The object to check. Should be an array of elements. + * @returns The result of the matching + */ +export function toEqualArrayUnsorted(this: MatcherState, received: unknown, expected: unknown): SyncExpectationResult { + if (!Array.isArray(received)) { + return { + pass: this.isNot, + message: () => `Expected an array, but got ${this.utils.stringify(received)}!`, + }; + } + + if (!Array.isArray(expected)) { + return { + pass: this.isNot, + message: () => `Expected to recieve an array, but got ${this.utils.stringify(expected)}!`, + }; + } + + if (received.length !== expected.length) { + return { + pass: this.isNot, + message: () => `Expected to recieve array of length ${received.length}, but got ${expected.length}!`, + actual: received, + expected, + }; + } + + const gotSorted = received.slice().sort(); + const wantSorted = expected.slice().sort(); + const pass = this.equals(gotSorted, wantSorted, [...this.customTesters, this.utils.iterableEquality]); + + return { + pass: this.isNot !== pass, + message: () => + `Expected ${this.utils.stringify(received)} to exactly equal ${this.utils.stringify(expected)} without order!`, + actual: gotSorted, + expected: wantSorted, + }; +} diff --git a/test/test-utils/matchers/to-have-types.ts b/test/test-utils/matchers/to-have-types.ts new file mode 100644 index 00000000000..d09f4fc5f76 --- /dev/null +++ b/test/test-utils/matchers/to-have-types.ts @@ -0,0 +1,64 @@ +import { PokemonType } from "#enums/pokemon-type"; +import { Pokemon } from "#field/pokemon"; +import type { MatcherState, SyncExpectationResult } from "@vitest/expect"; + +export interface toHaveTypesOptions { + /** + * Whether to enforce exact matches (`true`) or superset matches (`false`). + * @defaultValue `true` + */ + exact?: boolean; + /** + * Optional arguments to pass to {@linkcode Pokemon.getTypes}. + */ + args?: Parameters<(typeof Pokemon.prototype)["getTypes"]>; +} + +/** + * Matcher to check if an array contains exactly the given items, disregarding order. + * @param received - The object to check. Should be an array of one or more {@linkcode PokemonType}s. + * @param options - The {@linkcode toHaveTypesOptions | options} for this matcher + * @returns The result of the matching + */ +export function toHaveTypes( + this: MatcherState, + received: unknown, + expected: unknown, + options: toHaveTypesOptions = {}, +): SyncExpectationResult { + if (!(received instanceof Pokemon)) { + return { + pass: this.isNot, + message: () => `Expected a Pokemon, but got ${this.utils.stringify(received)}!`, + }; + } + + if (!Array.isArray(expected) || expected.length === 0) { + return { + pass: this.isNot, + message: () => `Expected to recieve an array with length >=1, but got ${this.utils.stringify(expected)}!`, + }; + } + + if (!expected.every((t): t is PokemonType => t in PokemonType)) { + return { + pass: this.isNot, + message: () => `Expected to recieve array of PokemonTypes but got ${this.utils.stringify(expected)}!`, + }; + } + + const gotSorted = pkmnTypeToStr(received.getTypes(...(options.args ?? []))); + const wantSorted = pkmnTypeToStr(expected.slice()); + const pass = this.equals(gotSorted, wantSorted, [...this.customTesters, this.utils.iterableEquality]); + + return { + pass: this.isNot !== pass, + message: () => `Expected ${received.name} to have types ${this.utils.stringify(wantSorted)}, but got ${gotSorted}!`, + actual: gotSorted, + expected: wantSorted, + }; +} + +function pkmnTypeToStr(p: PokemonType[]): string[] { + return p.sort().map(type => PokemonType[type]); +} diff --git a/test/testUtils/mocks/mockClock.ts b/test/test-utils/mocks/mock-clock.ts similarity index 100% rename from test/testUtils/mocks/mockClock.ts rename to test/test-utils/mocks/mock-clock.ts diff --git a/test/testUtils/mocks/mockConsoleLog.ts b/test/test-utils/mocks/mock-console-log.ts similarity index 100% rename from test/testUtils/mocks/mockConsoleLog.ts rename to test/test-utils/mocks/mock-console-log.ts diff --git a/test/testUtils/mocks/mockContextCanvas.ts b/test/test-utils/mocks/mock-context-canvas.ts similarity index 100% rename from test/testUtils/mocks/mockContextCanvas.ts rename to test/test-utils/mocks/mock-context-canvas.ts diff --git a/test/testUtils/mocks/mockFetch.ts b/test/test-utils/mocks/mock-fetch.ts similarity index 100% rename from test/testUtils/mocks/mockFetch.ts rename to test/test-utils/mocks/mock-fetch.ts diff --git a/test/testUtils/mocks/mockGameObjectCreator.ts b/test/test-utils/mocks/mock-game-object-creator.ts similarity index 72% rename from test/testUtils/mocks/mockGameObjectCreator.ts rename to test/test-utils/mocks/mock-game-object-creator.ts index cfb1051ec2f..3d97f40edab 100644 --- a/test/testUtils/mocks/mockGameObjectCreator.ts +++ b/test/test-utils/mocks/mock-game-object-creator.ts @@ -1,5 +1,5 @@ -import { MockGraphics } from "#test/testUtils/mocks/mocksContainer/mockGraphics"; -import type { MockTextureManager } from "#test/testUtils/mocks/mockTextureManager"; +import type { MockTextureManager } from "#test/test-utils/mocks/mock-texture-manager"; +import { MockGraphics } from "#test/test-utils/mocks/mocks-container/mock-graphics"; export class MockGameObjectCreator { private readonly textureManager: MockTextureManager; diff --git a/test/testUtils/mocks/mockGameObject.ts b/test/test-utils/mocks/mock-game-object.ts similarity index 100% rename from test/testUtils/mocks/mockGameObject.ts rename to test/test-utils/mocks/mock-game-object.ts diff --git a/test/testUtils/mocks/mockLoader.ts b/test/test-utils/mocks/mock-loader.ts similarity index 100% rename from test/testUtils/mocks/mockLoader.ts rename to test/test-utils/mocks/mock-loader.ts diff --git a/test/testUtils/mocks/mockLocalStorage.ts b/test/test-utils/mocks/mock-local-storage.ts similarity index 100% rename from test/testUtils/mocks/mockLocalStorage.ts rename to test/test-utils/mocks/mock-local-storage.ts diff --git a/test/testUtils/mocks/mockTextureManager.ts b/test/test-utils/mocks/mock-texture-manager.ts similarity index 75% rename from test/testUtils/mocks/mockTextureManager.ts rename to test/test-utils/mocks/mock-texture-manager.ts index b61a804bf55..54002ad3cbb 100644 --- a/test/testUtils/mocks/mockTextureManager.ts +++ b/test/test-utils/mocks/mock-texture-manager.ts @@ -1,15 +1,15 @@ -import type { MockGameObject } from "#test/testUtils/mocks/mockGameObject"; -import { MockBBCodeText } from "#test/testUtils/mocks/mocksContainer/mock-bbcode-text"; -import { MockInputText } from "#test/testUtils/mocks/mocksContainer/mock-input-text"; -import { MockContainer } from "#test/testUtils/mocks/mocksContainer/mockContainer"; -import { MockImage } from "#test/testUtils/mocks/mocksContainer/mockImage"; -import { MockNineslice } from "#test/testUtils/mocks/mocksContainer/mockNineslice"; -import { MockPolygon } from "#test/testUtils/mocks/mocksContainer/mockPolygon"; -import { MockRectangle } from "#test/testUtils/mocks/mocksContainer/mockRectangle"; -import { MockSprite } from "#test/testUtils/mocks/mocksContainer/mockSprite"; -import { MockText } from "#test/testUtils/mocks/mocksContainer/mockText"; -import { MockTexture } from "#test/testUtils/mocks/mocksContainer/mockTexture"; -import { MockVideoGameObject } from "#test/testUtils/mocks/mockVideoGameObject"; +import type { MockGameObject } from "#test/test-utils/mocks/mock-game-object"; +import { MockVideoGameObject } from "#test/test-utils/mocks/mock-video-game-object"; +import { MockBBCodeText } from "#test/test-utils/mocks/mocks-container/mock-bbcode-text"; +import { MockContainer } from "#test/test-utils/mocks/mocks-container/mock-container"; +import { MockImage } from "#test/test-utils/mocks/mocks-container/mock-image"; +import { MockInputText } from "#test/test-utils/mocks/mocks-container/mock-input-text"; +import { MockNineslice } from "#test/test-utils/mocks/mocks-container/mock-nineslice"; +import { MockPolygon } from "#test/test-utils/mocks/mocks-container/mock-polygon"; +import { MockRectangle } from "#test/test-utils/mocks/mocks-container/mock-rectangle"; +import { MockSprite } from "#test/test-utils/mocks/mocks-container/mock-sprite"; +import { MockText } from "#test/test-utils/mocks/mocks-container/mock-text"; +import { MockTexture } from "#test/test-utils/mocks/mocks-container/mock-texture"; /** * Stub class for Phaser.Textures.TextureManager diff --git a/test/testUtils/mocks/mockTimedEventManager.ts b/test/test-utils/mocks/mock-timed-event-manager.ts similarity index 100% rename from test/testUtils/mocks/mockTimedEventManager.ts rename to test/test-utils/mocks/mock-timed-event-manager.ts diff --git a/test/testUtils/mocks/mockVideoGameObject.ts b/test/test-utils/mocks/mock-video-game-object.ts similarity index 86% rename from test/testUtils/mocks/mockVideoGameObject.ts rename to test/test-utils/mocks/mock-video-game-object.ts index 40413f6f622..742e3a7d435 100644 --- a/test/testUtils/mocks/mockVideoGameObject.ts +++ b/test/test-utils/mocks/mock-video-game-object.ts @@ -1,4 +1,4 @@ -import type { MockGameObject } from "#test/testUtils/mocks/mockGameObject"; +import type { MockGameObject } from "#test/test-utils/mocks/mock-game-object"; /** Mocks video-related stuff */ export class MockVideoGameObject implements MockGameObject { diff --git a/test/testUtils/mocks/mocksContainer/mock-bbcode-text.ts b/test/test-utils/mocks/mocks-container/mock-bbcode-text.ts similarity index 68% rename from test/testUtils/mocks/mocksContainer/mock-bbcode-text.ts rename to test/test-utils/mocks/mocks-container/mock-bbcode-text.ts index 8df0e01a43e..90b6a54a517 100644 --- a/test/testUtils/mocks/mocksContainer/mock-bbcode-text.ts +++ b/test/test-utils/mocks/mocks-container/mock-bbcode-text.ts @@ -1,4 +1,4 @@ -import { MockText } from "#test/testUtils/mocks/mocksContainer/mockText"; +import { MockText } from "#test/test-utils/mocks/mocks-container/mock-text"; export class MockBBCodeText extends MockText { setMaxLines(_lines: number) {} diff --git a/test/testUtils/mocks/mocksContainer/mockContainer.ts b/test/test-utils/mocks/mocks-container/mock-container.ts similarity index 97% rename from test/testUtils/mocks/mocksContainer/mockContainer.ts rename to test/test-utils/mocks/mocks-container/mock-container.ts index df9aaab5888..dd19dc3259c 100644 --- a/test/testUtils/mocks/mocksContainer/mockContainer.ts +++ b/test/test-utils/mocks/mocks-container/mock-container.ts @@ -1,5 +1,5 @@ -import type { MockGameObject } from "#test/testUtils/mocks/mockGameObject"; -import type { MockTextureManager } from "#test/testUtils/mocks/mockTextureManager"; +import type { MockGameObject } from "#test/test-utils/mocks/mock-game-object"; +import type { MockTextureManager } from "#test/test-utils/mocks/mock-texture-manager"; import { coerceArray } from "#utils/common"; export class MockContainer implements MockGameObject { diff --git a/test/testUtils/mocks/mocksContainer/mockGraphics.ts b/test/test-utils/mocks/mocks-container/mock-graphics.ts similarity index 96% rename from test/testUtils/mocks/mocksContainer/mockGraphics.ts rename to test/test-utils/mocks/mocks-container/mock-graphics.ts index 6558cdf9fb1..1e1dfd38124 100644 --- a/test/testUtils/mocks/mocksContainer/mockGraphics.ts +++ b/test/test-utils/mocks/mocks-container/mock-graphics.ts @@ -1,4 +1,4 @@ -import type { MockGameObject } from "#test/testUtils/mocks/mockGameObject"; +import type { MockGameObject } from "#test/test-utils/mocks/mock-game-object"; export class MockGraphics implements MockGameObject { private scene; diff --git a/test/testUtils/mocks/mocksContainer/mockImage.ts b/test/test-utils/mocks/mocks-container/mock-image.ts similarity index 75% rename from test/testUtils/mocks/mocksContainer/mockImage.ts rename to test/test-utils/mocks/mocks-container/mock-image.ts index 830a22a369c..812e17657ed 100644 --- a/test/testUtils/mocks/mocksContainer/mockImage.ts +++ b/test/test-utils/mocks/mocks-container/mock-image.ts @@ -1,4 +1,4 @@ -import { MockContainer } from "#test/testUtils/mocks/mocksContainer/mockContainer"; +import { MockContainer } from "#test/test-utils/mocks/mocks-container/mock-container"; export class MockImage extends MockContainer { // biome-ignore lint/correctness/noUnusedPrivateClassMembers: this is intentional (?) diff --git a/test/testUtils/mocks/mocksContainer/mock-input-text.ts b/test/test-utils/mocks/mocks-container/mock-input-text.ts similarity index 87% rename from test/testUtils/mocks/mocksContainer/mock-input-text.ts rename to test/test-utils/mocks/mocks-container/mock-input-text.ts index 6826278aa1e..bc5e26fddc5 100644 --- a/test/testUtils/mocks/mocksContainer/mock-input-text.ts +++ b/test/test-utils/mocks/mocks-container/mock-input-text.ts @@ -1,4 +1,4 @@ -import { MockText } from "#test/testUtils/mocks/mocksContainer/mockText"; +import { MockText } from "#test/test-utils/mocks/mocks-container/mock-text"; export class MockInputText extends MockText { public inputType: string; diff --git a/test/testUtils/mocks/mocksContainer/mockNineslice.ts b/test/test-utils/mocks/mocks-container/mock-nineslice.ts similarity index 85% rename from test/testUtils/mocks/mocksContainer/mockNineslice.ts rename to test/test-utils/mocks/mocks-container/mock-nineslice.ts index 11983075cf7..6678a5fca65 100644 --- a/test/testUtils/mocks/mocksContainer/mockNineslice.ts +++ b/test/test-utils/mocks/mocks-container/mock-nineslice.ts @@ -1,4 +1,4 @@ -import { MockContainer } from "#test/testUtils/mocks/mocksContainer/mockContainer"; +import { MockContainer } from "#test/test-utils/mocks/mocks-container/mock-container"; export class MockNineslice extends MockContainer { private texture; diff --git a/test/testUtils/mocks/mocksContainer/mockPolygon.ts b/test/test-utils/mocks/mocks-container/mock-polygon.ts similarity index 64% rename from test/testUtils/mocks/mocksContainer/mockPolygon.ts rename to test/test-utils/mocks/mocks-container/mock-polygon.ts index 2426231193a..7fc13fd7a00 100644 --- a/test/testUtils/mocks/mocksContainer/mockPolygon.ts +++ b/test/test-utils/mocks/mocks-container/mock-polygon.ts @@ -1,4 +1,4 @@ -import { MockContainer } from "#test/testUtils/mocks/mocksContainer/mockContainer"; +import { MockContainer } from "#test/test-utils/mocks/mocks-container/mock-container"; export class MockPolygon extends MockContainer { constructor(textureManager, x, y, _content, _fillColor, _fillAlpha) { diff --git a/test/testUtils/mocks/mocksContainer/mockRectangle.ts b/test/test-utils/mocks/mocks-container/mock-rectangle.ts similarity index 96% rename from test/testUtils/mocks/mocksContainer/mockRectangle.ts rename to test/test-utils/mocks/mocks-container/mock-rectangle.ts index 1e38cd3af44..96c49dec692 100644 --- a/test/testUtils/mocks/mocksContainer/mockRectangle.ts +++ b/test/test-utils/mocks/mocks-container/mock-rectangle.ts @@ -1,4 +1,4 @@ -import type { MockGameObject } from "#test/testUtils/mocks/mockGameObject"; +import type { MockGameObject } from "#test/test-utils/mocks/mock-game-object"; import { coerceArray } from "#utils/common"; export class MockRectangle implements MockGameObject { diff --git a/test/testUtils/mocks/mocksContainer/mockSprite.ts b/test/test-utils/mocks/mocks-container/mock-sprite.ts similarity index 98% rename from test/testUtils/mocks/mocksContainer/mockSprite.ts rename to test/test-utils/mocks/mocks-container/mock-sprite.ts index 15995a59977..d5e11f5c4f9 100644 --- a/test/testUtils/mocks/mocksContainer/mockSprite.ts +++ b/test/test-utils/mocks/mocks-container/mock-sprite.ts @@ -1,4 +1,4 @@ -import type { MockGameObject } from "#test/testUtils/mocks/mockGameObject"; +import type { MockGameObject } from "#test/test-utils/mocks/mock-game-object"; import { coerceArray } from "#utils/common"; import Phaser from "phaser"; diff --git a/test/testUtils/mocks/mocksContainer/mockText.ts b/test/test-utils/mocks/mocks-container/mock-text.ts similarity index 99% rename from test/testUtils/mocks/mocksContainer/mockText.ts rename to test/test-utils/mocks/mocks-container/mock-text.ts index 58ae3650411..ad2fce80972 100644 --- a/test/testUtils/mocks/mocksContainer/mockText.ts +++ b/test/test-utils/mocks/mocks-container/mock-text.ts @@ -1,4 +1,4 @@ -import type { MockGameObject } from "#test/testUtils/mocks/mockGameObject"; +import type { MockGameObject } from "#test/test-utils/mocks/mock-game-object"; import { UI } from "#ui/ui"; export class MockText implements MockGameObject { diff --git a/test/testUtils/mocks/mocksContainer/mockTexture.ts b/test/test-utils/mocks/mocks-container/mock-texture.ts similarity index 86% rename from test/testUtils/mocks/mocksContainer/mockTexture.ts rename to test/test-utils/mocks/mocks-container/mock-texture.ts index af25941094b..3e6b8137676 100644 --- a/test/testUtils/mocks/mocksContainer/mockTexture.ts +++ b/test/test-utils/mocks/mocks-container/mock-texture.ts @@ -1,5 +1,5 @@ -import type { MockGameObject } from "#test/testUtils/mocks/mockGameObject"; -import type { MockTextureManager } from "#test/testUtils/mocks/mockTextureManager"; +import type { MockGameObject } from "#test/test-utils/mocks/mock-game-object"; +import type { MockTextureManager } from "#test/test-utils/mocks/mock-texture-manager"; /** * Stub for Phaser.Textures.Texture object diff --git a/test/testUtils/phaseInterceptor.ts b/test/test-utils/phase-interceptor.ts similarity index 99% rename from test/testUtils/phaseInterceptor.ts rename to test/test-utils/phase-interceptor.ts index cdf151c01af..e0675a722f9 100644 --- a/test/testUtils/phaseInterceptor.ts +++ b/test/test-utils/phase-interceptor.ts @@ -61,7 +61,7 @@ import { TurnStartPhase } from "#phases/turn-start-phase"; import { UnavailablePhase } from "#phases/unavailable-phase"; import { UnlockPhase } from "#phases/unlock-phase"; import { VictoryPhase } from "#phases/victory-phase"; -import { ErrorInterceptor } from "#test/testUtils/errorInterceptor"; +import { ErrorInterceptor } from "#test/test-utils/error-interceptor"; import type { PhaseClass, PhaseString } from "#types/phase-types"; import { UI } from "#ui/ui"; diff --git a/test/testUtils/saves/data_new.prsv b/test/test-utils/saves/data_new.prsv similarity index 100% rename from test/testUtils/saves/data_new.prsv rename to test/test-utils/saves/data_new.prsv diff --git a/test/testUtils/saves/data_pokedex_tests.prsv b/test/test-utils/saves/data_pokedex_tests.prsv similarity index 100% rename from test/testUtils/saves/data_pokedex_tests.prsv rename to test/test-utils/saves/data_pokedex_tests.prsv diff --git a/test/testUtils/saves/data_pokedex_tests_v2.prsv b/test/test-utils/saves/data_pokedex_tests_v2.prsv similarity index 100% rename from test/testUtils/saves/data_pokedex_tests_v2.prsv rename to test/test-utils/saves/data_pokedex_tests_v2.prsv diff --git a/test/testUtils/saves/everything.prsv b/test/test-utils/saves/everything.prsv similarity index 100% rename from test/testUtils/saves/everything.prsv rename to test/test-utils/saves/everything.prsv diff --git a/test/testUtils/testFileInitialization.ts b/test/test-utils/test-file-initialization.ts similarity index 56% rename from test/testUtils/testFileInitialization.ts rename to test/test-utils/test-file-initialization.ts index 98b49159d98..631d3f9146b 100644 --- a/test/testUtils/testFileInitialization.ts +++ b/test/test-utils/test-file-initialization.ts @@ -1,38 +1,46 @@ -import { initAbilities } from "#abilities/ability"; -import { initLoggedInUser } from "#app/account"; import { SESSION_ID_COOKIE_NAME } from "#app/constants"; -import { initBiomes } from "#balance/biomes"; -import { initEggMoves } from "#balance/egg-moves"; -import { initPokemonPrevolutions, initPokemonStarters } from "#balance/pokemon-evolutions"; -import { initPokemonForms } from "#data/pokemon-forms"; -import { initSpecies } from "#data/pokemon-species"; -import { initModifierPools } from "#modifiers/init-modifier-pools"; -import { initModifierTypes } from "#modifiers/modifier-type"; -import { initMoves } from "#moves/move"; -import { initMysteryEncounters } from "#mystery-encounters/mystery-encounters"; +import { initializeGame } from "#app/init/init"; import { initI18n } from "#plugins/i18n"; -import { initAchievements } from "#system/achv"; -import { initVouchers } from "#system/voucher"; -import { blobToString } from "#test/testUtils/gameManagerUtils"; -import { manageListeners } from "#test/testUtils/listenersManager"; -import { MockConsoleLog } from "#test/testUtils/mocks/mockConsoleLog"; -import { mockContext } from "#test/testUtils/mocks/mockContextCanvas"; -import { mockLocalStorage } from "#test/testUtils/mocks/mockLocalStorage"; -import { MockImage } from "#test/testUtils/mocks/mocksContainer/mockImage"; -import { initStatsKeys } from "#ui/game-stats-ui-handler"; +import { blobToString } from "#test/test-utils/game-manager-utils"; +import { manageListeners } from "#test/test-utils/listeners-manager"; +import { MockConsoleLog } from "#test/test-utils/mocks/mock-console-log"; +import { mockContext } from "#test/test-utils/mocks/mock-context-canvas"; +import { mockLocalStorage } from "#test/test-utils/mocks/mock-local-storage"; +import { MockImage } from "#test/test-utils/mocks/mocks-container/mock-image"; import { setCookie } from "#utils/cookies"; import Phaser from "phaser"; import BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext"; import InputText from "phaser3-rex-plugins/plugins/inputtext"; let wasInitialized = false; -/** - * An initialization function that is run at the beginning of every test file (via `beforeAll()`). - */ -export function initTestFile() { - // Set the timezone to UTC for tests. - process.env.TZ = "UTC"; +/** + * Run initialization code upon starting a new file, both per-suite and per-instance oncess. + */ +export function initTests(): void { + setupStubs(); + if (!wasInitialized) { + initTestFile(); + wasInitialized = true; + } + + manageListeners(); +} + +/** + * Initialize various values at the beginning of each testing instance. + */ +function initTestFile(): void { + initI18n(); + initializeGame(); +} + +/** + * Setup various stubs for testing. + * @todo Move this into a dedicated stub file instead of running it once per test instance + * @todo Investigate why this resets on new test suite start + */ +function setupStubs(): void { Object.defineProperty(window, "localStorage", { value: mockLocalStorage(), }); @@ -68,9 +76,9 @@ export function initTestFile() { /** * Sets this object's position relative to another object with a given offset - * @param guideObject {@linkcode Phaser.GameObjects.GameObject} to base the position off of - * @param x The relative x position - * @param y The relative y position + * @param guideObject - The {@linkcode Phaser.GameObjects.GameObject} to base the position off of + * @param x - The relative x position + * @param y - The relative y position */ const setPositionRelative = function (guideObject: any, x: number, y: number): any { const offsetX = guideObject.width * (-0.5 + (0.5 - guideObject.originX)); @@ -85,30 +93,6 @@ export function initTestFile() { Phaser.GameObjects.Text.prototype.setPositionRelative = setPositionRelative; Phaser.GameObjects.Rectangle.prototype.setPositionRelative = setPositionRelative; HTMLCanvasElement.prototype.getContext = () => mockContext; - - // Initialize all of these things if and only if they have not been initialized yet - if (!wasInitialized) { - wasInitialized = true; - initI18n(); - initModifierTypes(); - initModifierPools(); - initVouchers(); - initAchievements(); - initStatsKeys(); - initPokemonPrevolutions(); - initBiomes(); - initEggMoves(); - initPokemonForms(); - initSpecies(); - initMoves(); - initAbilities(); - initLoggedInUser(); - initMysteryEncounters(); - // init the pokemon starters for the pokedex - initPokemonStarters(); - } - - manageListeners(); } /** diff --git a/test/testUtils/testUtils.ts b/test/test-utils/test-utils.ts similarity index 100% rename from test/testUtils/testUtils.ts rename to test/test-utils/test-utils.ts diff --git a/test/testUtils/TextInterceptor.ts b/test/test-utils/text-interceptor.ts similarity index 100% rename from test/testUtils/TextInterceptor.ts rename to test/test-utils/text-interceptor.ts diff --git a/test/ui/battle_info.test.ts b/test/ui/battle-info.test.ts similarity index 96% rename from test/ui/battle_info.test.ts rename to test/ui/battle-info.test.ts index afc456c6430..8bdd61e05b0 100644 --- a/test/ui/battle_info.test.ts +++ b/test/ui/battle-info.test.ts @@ -3,7 +3,7 @@ import { ExpGainsSpeed } from "#enums/exp-gains-speed"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { ExpPhase } from "#phases/exp-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/ui/pokedex.test.ts b/test/ui/pokedex.test.ts index 1d81f19052c..217c1f09a3b 100644 --- a/test/ui/pokedex.test.ts +++ b/test/ui/pokedex.test.ts @@ -7,7 +7,7 @@ import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; import { UiMode } from "#enums/ui-mode"; import type { StarterAttributes } from "#system/game-data"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { FilterTextRow } from "#ui/filter-text"; import { PokedexPageUiHandler } from "#ui/pokedex-page-ui-handler"; import { PokedexUiHandler } from "#ui/pokedex-ui-handler"; @@ -193,7 +193,7 @@ describe("UI - Pokedex", () => { ***************************/ it("should filter to show only the pokemon with an ability when filtering by ability", async () => { - // await game.importData("test/testUtils/saves/everything.prsv"); + // await game.importData("test/test-utils/saves/everything.prsv"); const pokedexHandler = await runToOpenPokedex(); // Get name of overgrow @@ -301,7 +301,7 @@ describe("UI - Pokedex", () => { it("filtering for unlockable cost reduction only shows species with sufficient candies", async () => { // load the save file - await game.importData("./test/testUtils/saves/data_pokedex_tests.prsv"); + await game.importData("./test/test-utils/saves/data_pokedex_tests.prsv"); const pokedexHandler = await runToOpenPokedex(); // @ts-expect-error - `filterBar` is private @@ -330,7 +330,7 @@ describe("UI - Pokedex", () => { }); it("filtering by passive unlocked only shows species that have their passive", async () => { - await game.importData("./test/testUtils/saves/data_pokedex_tests.prsv"); + await game.importData("./test/test-utils/saves/data_pokedex_tests.prsv"); const pokedexHandler = await runToOpenPokedex(); // @ts-expect-error - `filterBar` is private @@ -347,7 +347,7 @@ describe("UI - Pokedex", () => { }); it("filtering for pokemon that can unlock passive shows only species with sufficient candies", async () => { - await game.importData("./test/testUtils/saves/data_pokedex_tests.prsv"); + await game.importData("./test/test-utils/saves/data_pokedex_tests.prsv"); const pokedexHandler = await runToOpenPokedex(); // @ts-expect-error - `filterBar` is private @@ -375,7 +375,7 @@ describe("UI - Pokedex", () => { }); it("filtering for pokemon that have any cost reduction shows only the species that have unlocked a cost reduction", async () => { - await game.importData("./test/testUtils/saves/data_pokedex_tests.prsv"); + await game.importData("./test/test-utils/saves/data_pokedex_tests.prsv"); const pokedexHandler = await runToOpenPokedex(); const expectedPokemon = new Set([SpeciesId.TREECKO, SpeciesId.CYNDAQUIL, SpeciesId.TOTODILE]); @@ -394,7 +394,7 @@ describe("UI - Pokedex", () => { }); it("filtering for pokemon that have a single cost reduction shows only the species that have unlocked a single cost reduction", async () => { - await game.importData("./test/testUtils/saves/data_pokedex_tests.prsv"); + await game.importData("./test/test-utils/saves/data_pokedex_tests.prsv"); const pokedexHandler = await runToOpenPokedex(); const expectedPokemon = new Set([SpeciesId.CYNDAQUIL, SpeciesId.TOTODILE]); @@ -414,7 +414,7 @@ describe("UI - Pokedex", () => { }); it("filtering for pokemon that have two cost reductions sorts only shows the species that have unlocked both cost reductions", async () => { - await game.importData("./test/testUtils/saves/data_pokedex_tests.prsv"); + await game.importData("./test/test-utils/saves/data_pokedex_tests.prsv"); const pokedexHandler = await runToOpenPokedex(); // @ts-expect-error - `filterBar` is private @@ -433,7 +433,7 @@ describe("UI - Pokedex", () => { }); it("filtering by shiny status shows the caught pokemon with the selected shiny tier", async () => { - await game.importData("./test/testUtils/saves/data_pokedex_tests.prsv"); + await game.importData("./test/test-utils/saves/data_pokedex_tests.prsv"); const pokedexHandler = await runToOpenPokedex(); // @ts-expect-error - `filterBar` is private const filter = pokedexHandler.filterBar.getFilter(DropDownColumn.CAUGHT); @@ -513,7 +513,7 @@ describe("UI - Pokedex", () => { ****************************/ it("should show caught battle form as caught", async () => { - await game.importData("./test/testUtils/saves/data_pokedex_tests_v2.prsv"); + await game.importData("./test/test-utils/saves/data_pokedex_tests_v2.prsv"); const pageHandler = await runToPokedexPage(getPokemonSpecies(SpeciesId.VENUSAUR), { form: 1 }); // @ts-expect-error - `species` is private @@ -528,7 +528,7 @@ describe("UI - Pokedex", () => { //TODO: check tint of the sprite it("should show uncaught battle form as seen", async () => { - await game.importData("./test/testUtils/saves/data_pokedex_tests_v2.prsv"); + await game.importData("./test/test-utils/saves/data_pokedex_tests_v2.prsv"); const pageHandler = await runToPokedexPage(getPokemonSpecies(SpeciesId.VENUSAUR), { form: 2 }); // @ts-expect-error - `species` is private diff --git a/test/ui/starter-select.test.ts b/test/ui/starter-select.test.ts index 63abc99174e..a8c6284cf3f 100644 --- a/test/ui/starter-select.test.ts +++ b/test/ui/starter-select.test.ts @@ -9,7 +9,7 @@ import { UiMode } from "#enums/ui-mode"; import { EncounterPhase } from "#phases/encounter-phase"; import { SelectStarterPhase } from "#phases/select-starter-phase"; import type { TitlePhase } from "#phases/title-phase"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import type { OptionSelectItem } from "#ui/abstact-option-select-ui-handler"; import type { OptionSelectUiHandler } from "#ui/option-select-ui-handler"; import type { SaveSlotSelectUiHandler } from "#ui/save-slot-select-ui-handler"; @@ -37,7 +37,7 @@ describe("UI - Starter select", () => { }); it("Bulbasaur - shiny - variant 2 male", async () => { - await game.importData("./test/testUtils/saves/everything.prsv"); + await game.importData("./test/test-utils/saves/everything.prsv"); const caughtCount = Object.keys(game.scene.gameData.dexData).filter(key => { const species = game.scene.gameData.dexData[key]; return species.caughtAttr !== 0n; @@ -97,7 +97,7 @@ describe("UI - Starter select", () => { }); it("Bulbasaur - shiny - variant 2 female hardy overgrow", async () => { - await game.importData("./test/testUtils/saves/everything.prsv"); + await game.importData("./test/test-utils/saves/everything.prsv"); const caughtCount = Object.keys(game.scene.gameData.dexData).filter(key => { const species = game.scene.gameData.dexData[key]; return species.caughtAttr !== 0n; @@ -159,7 +159,7 @@ describe("UI - Starter select", () => { }); it("Bulbasaur - shiny - variant 2 female lonely chlorophyl", async () => { - await game.importData("./test/testUtils/saves/everything.prsv"); + await game.importData("./test/test-utils/saves/everything.prsv"); const caughtCount = Object.keys(game.scene.gameData.dexData).filter(key => { const species = game.scene.gameData.dexData[key]; return species.caughtAttr !== 0n; @@ -224,7 +224,7 @@ describe("UI - Starter select", () => { }); it("Bulbasaur - shiny - variant 2 female", async () => { - await game.importData("./test/testUtils/saves/everything.prsv"); + await game.importData("./test/test-utils/saves/everything.prsv"); const caughtCount = Object.keys(game.scene.gameData.dexData).filter(key => { const species = game.scene.gameData.dexData[key]; return species.caughtAttr !== 0n; @@ -285,7 +285,7 @@ describe("UI - Starter select", () => { }); it("Bulbasaur - not shiny", async () => { - await game.importData("./test/testUtils/saves/everything.prsv"); + await game.importData("./test/test-utils/saves/everything.prsv"); const caughtCount = Object.keys(game.scene.gameData.dexData).filter(key => { const species = game.scene.gameData.dexData[key]; return species.caughtAttr !== 0n; @@ -345,7 +345,7 @@ describe("UI - Starter select", () => { }); it("Bulbasaur - shiny - variant 1", async () => { - await game.importData("./test/testUtils/saves/everything.prsv"); + await game.importData("./test/test-utils/saves/everything.prsv"); const caughtCount = Object.keys(game.scene.gameData.dexData).filter(key => { const species = game.scene.gameData.dexData[key]; return species.caughtAttr !== 0n; @@ -407,7 +407,7 @@ describe("UI - Starter select", () => { }); it("Bulbasaur - shiny - variant 0", async () => { - await game.importData("./test/testUtils/saves/everything.prsv"); + await game.importData("./test/test-utils/saves/everything.prsv"); const caughtCount = Object.keys(game.scene.gameData.dexData).filter(key => { const species = game.scene.gameData.dexData[key]; return species.caughtAttr !== 0n; @@ -468,7 +468,7 @@ describe("UI - Starter select", () => { }); it("Check if first pokemon in party is caterpie from gen 1 and 1rd row, 3rd column", async () => { - await game.importData("./test/testUtils/saves/everything.prsv"); + await game.importData("./test/test-utils/saves/everything.prsv"); const caughtCount = Object.keys(game.scene.gameData.dexData).filter(key => { const species = game.scene.gameData.dexData[key]; return species.caughtAttr !== 0n; @@ -532,7 +532,7 @@ describe("UI - Starter select", () => { }); it("Check if first pokemon in party is nidoran_m from gen 1 and 2nd row, 4th column (cursor (9+4)-1)", async () => { - await game.importData("./test/testUtils/saves/everything.prsv"); + await game.importData("./test/test-utils/saves/everything.prsv"); const caughtCount = Object.keys(game.scene.gameData.dexData).filter(key => { const species = game.scene.gameData.dexData[key]; return species.caughtAttr !== 0n; diff --git a/test/ui/transfer-item.test.ts b/test/ui/transfer-item.test.ts index f2b0a4f7d35..0d101b5b4ef 100644 --- a/test/ui/transfer-item.test.ts +++ b/test/ui/transfer-item.test.ts @@ -3,7 +3,7 @@ import { Button } from "#enums/buttons"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { UiMode } from "#enums/ui-mode"; -import { GameManager } from "#test/testUtils/gameManager"; +import { GameManager } from "#test/test-utils/game-manager"; import { ModifierSelectUiHandler } from "#ui/modifier-select-ui-handler"; import { PartyUiHandler, PartyUiMode } from "#ui/party-ui-handler"; import Phaser from "phaser"; diff --git a/test/ui/type-hints.test.ts b/test/ui/type-hints.test.ts index 8359c50c35d..f1f27322a64 100644 --- a/test/ui/type-hints.test.ts +++ b/test/ui/type-hints.test.ts @@ -3,8 +3,8 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { UiMode } from "#enums/ui-mode"; import { CommandPhase } from "#phases/command-phase"; -import { GameManager } from "#test/testUtils/gameManager"; -import type { MockText } from "#test/testUtils/mocks/mocksContainer/mockText"; +import { GameManager } from "#test/test-utils/game-manager"; +import type { MockText } from "#test/test-utils/mocks/mocks-container/mock-text"; import { FightUiHandler } from "#ui/fight-ui-handler"; import i18next from "i18next"; import Phaser from "phaser"; diff --git a/test/utils/strings.test.ts b/test/utils/strings.test.ts new file mode 100644 index 00000000000..3d6eb235ba8 --- /dev/null +++ b/test/utils/strings.test.ts @@ -0,0 +1,47 @@ +import { splitWords } from "#utils/strings"; +import { describe, expect, it } from "vitest"; + +interface testCase { + input: string; + words: string[]; +} + +const testCases: testCase[] = [ + { + input: "Lorem ipsum dolor sit amet", + words: ["Lorem", "ipsum", "dolor", "sit", "amet"], + }, + { + input: "consectetur-adipiscing-elit", + words: ["consectetur", "adipiscing", "elit"], + }, + { + input: "sed_do_eiusmod_tempor_incididunt_ut_labore", + words: ["sed", "do", "eiusmod", "tempor", "incididunt", "ut", "labore"], + }, + { + input: "Et Dolore Magna Aliqua", + words: ["Et", "Dolore", "Magna", "Aliqua"], + }, + { + input: "BIG_ANGRY_TRAINER", + words: ["BIG", "ANGRY", "TRAINER"], + }, + { + input: "ApplesBananasOrangesAndAPear", + words: ["Apples", "Bananas", "Oranges", "And", "A", "Pear"], + }, + { + input: "mysteryEncounters/anOfferYouCantRefuse", + words: ["mystery", "Encounters/an", "Offer", "You", "Cant", "Refuse"], + }, +]; + +describe("Utils - Casing -", () => { + describe("splitWords", () => { + it.each(testCases)("should split a string into its constituent words - $input", ({ input, words }) => { + const ret = splitWords(input); + expect(ret).toEqual(words); + }); + }); +}); diff --git a/test/vitest.setup.ts b/test/vitest.setup.ts index 6cf20219408..be35e18e2e9 100644 --- a/test/vitest.setup.ts +++ b/test/vitest.setup.ts @@ -1,5 +1,5 @@ import "vitest-canvas-mock"; -import { initTestFile } from "#test/testUtils/testFileInitialization"; +import { initTests } from "#test/test-utils/test-file-initialization"; import { afterAll, beforeAll, vi } from "vitest"; /** Set the timezone to UTC for tests. */ @@ -51,7 +51,7 @@ vi.mock("i18next", async importOriginal => { global.testFailed = false; beforeAll(() => { - initTestFile(); + initTests(); }); afterAll(() => { diff --git a/tsconfig.json b/tsconfig.json index b7ef84869e5..9aa06829789 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,11 +1,11 @@ { "compilerOptions": { - "target": "ES2020", - "module": "ES2020", + "target": "ES2023", + "module": "ES2022", // Modifying this option requires all values to be set manually because the defaults get overridden - // Values other than "ES2024.Promise" taken from https://github.com/microsoft/TypeScript/blob/main/src/lib/es2020.full.d.ts + // Values other than "ES2024.Promise" taken from https://github.com/microsoft/TypeScript/blob/main/src/lib/es2023.full.d.ts "lib": [ - "ES2020", + "ES2023", "ES2024.Promise", "DOM", "DOM.AsyncIterable", @@ -18,6 +18,7 @@ "esModuleInterop": true, "strictNullChecks": true, "sourceMap": false, + "checkJs": true, "strict": false, // TODO: Enable this eventually "rootDir": ".", "baseUrl": "./src", @@ -43,8 +44,8 @@ "#sprites/*": ["./sprites/*.ts"], "#system/*": [ "./system/settings/*.ts", - "./system/version_migration/versions/*.ts", - "./system/version_migration/*.ts", + "./system/version-migration/versions/*.ts", + "./system/version-migration/*.ts", "./system/*.ts" ], "#trainers/*": ["./data/trainers/*.ts"], diff --git a/tsdoc.json b/tsdoc.json index b4cbc9a62a5..689f7a96c5c 100644 --- a/tsdoc.json +++ b/tsdoc.json @@ -9,6 +9,10 @@ { "tagName": "@linkcode", "syntaxKind": "inline" + }, + { + "tagName": "@module", + "syntaxKind": "modifier" } ] } diff --git a/vitest.config.ts b/vitest.config.ts index 3900bc7b047..65c5427e591 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -5,8 +5,11 @@ import { defaultConfig } from "./vite.config"; export default defineProject(({ mode }) => ({ ...defaultConfig, test: { + env: { + TZ: "UTC", + }, testTimeout: 20000, - setupFiles: ["./test/fontFace.setup.ts", "./test/vitest.setup.ts"], + setupFiles: ["./test/font-face.setup.ts", "./test/vitest.setup.ts", "./test/matchers.setup.ts"], sequence: { sequencer: MySequencer, },