From efad0d1324368ca31cb0c799f97dc475bf375330 Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Tue, 15 Apr 2025 20:55:29 -0700 Subject: [PATCH 01/18] [GitHub] Use `.nvmrc` for pages workflow (#5666) --- .github/workflows/github-pages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml index b7d5fb95c1e..ce7c17e2db9 100644 --- a/.github/workflows/github-pages.yml +++ b/.github/workflows/github-pages.yml @@ -37,7 +37,7 @@ jobs: - name: Setup Node 22.14.1 uses: actions/setup-node@v4 with: - node-version: 22 + node-version-file: "pokerogue_docs/.nvmrc" - name: Checkout repository for Github Pages if: github.event_name == 'push' From ae588ebff907f17e38d2850ddc5bd07d8bce656a Mon Sep 17 00:00:00 2001 From: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Date: Wed, 16 Apr 2025 16:05:40 -0500 Subject: [PATCH 02/18] [Bug][Move] Struggle no longer gets STAB (#5643) * Struggle no longer gets STAB * Apply kev's suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --- src/field/pokemon.ts | 133 ++++++++++++++++++++---------------- test/moves/struggle.test.ts | 65 ++++++++++++++++++ 2 files changed, 139 insertions(+), 59 deletions(-) create mode 100644 test/moves/struggle.test.ts diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 22ede4260c3..cdd48f7d940 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -4151,6 +4151,62 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { return baseDamage; } + + /** Determine the STAB multiplier for a move used against this pokemon. + * + * @param source - The attacking {@linkcode Pokemon} + * @param move - The {@linkcode Move} used in the attack + * @param ignoreSourceAbility - If `true`, ignores the attacking Pokemon's ability effects + * @param simulated - If `true`, suppresses changes to game state during the calculation + * + * @returns The STAB multiplier for the move used against this Pokemon + */ + calculateStabMultiplier(source: Pokemon, move: Move, ignoreSourceAbility: boolean, simulated: boolean): number { + // If the move has the Typeless attribute, it doesn't get STAB (e.g. struggle) + if (move.hasAttr(TypelessAttr)) { + return 1; + } + const sourceTypes = source.getTypes(); + const sourceTeraType = source.getTeraType(); + const moveType = source.getMoveType(move); + const matchesSourceType = sourceTypes.includes(source.getMoveType(move)); + const stabMultiplier = new NumberHolder(1); + if (matchesSourceType && moveType !== PokemonType.STELLAR) { + stabMultiplier.value += 0.5; + } + + applyMoveAttrs( + CombinedPledgeStabBoostAttr, + source, + this, + move, + stabMultiplier, + ); + + if (!ignoreSourceAbility) { + applyAbAttrs(StabBoostAbAttr, source, null, simulated, stabMultiplier); + } + + if ( + source.isTerastallized && + sourceTeraType === moveType && + moveType !== PokemonType.STELLAR + ) { + stabMultiplier.value += 0.5; + } + + if ( + source.isTerastallized && + source.getTeraType() === PokemonType.STELLAR && + (!source.stellarTypesBoosted.includes(moveType) || + source.hasSpecies(Species.TERAPAGOS)) + ) { + stabMultiplier.value += matchesSourceType ? 0.5 : 0.2; + } + + return Math.min(stabMultiplier.value, 2.25); + } + /** * Calculates the damage of an attack made by another Pokemon against this Pokemon * @param source {@linkcode Pokemon} the attacking Pokemon @@ -4333,70 +4389,29 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { ? 1 : this.randSeedIntRange(85, 100) / 100; - const sourceTypes = source.getTypes(); - const sourceTeraType = source.getTeraType(); - const matchesSourceType = sourceTypes.includes(moveType); + /** A damage multiplier for when the attack is of the attacker's type and/or Tera type. */ - const stabMultiplier = new NumberHolder(1); - if (matchesSourceType && moveType !== PokemonType.STELLAR) { - stabMultiplier.value += 0.5; - } - - if (!ignoreSourceAbility) { - applyAbAttrs(StabBoostAbAttr, source, null, simulated, stabMultiplier); - } - - applyMoveAttrs( - CombinedPledgeStabBoostAttr, - source, - this, - move, - stabMultiplier, - ); - - if ( - source.isTerastallized && - sourceTeraType === moveType && - moveType !== PokemonType.STELLAR - ) { - stabMultiplier.value += 0.5; - } - - if ( - source.isTerastallized && - source.getTeraType() === PokemonType.STELLAR && - (!source.stellarTypesBoosted.includes(moveType) || - source.hasSpecies(Species.TERAPAGOS)) - ) { - if (matchesSourceType) { - stabMultiplier.value += 0.5; - } else { - stabMultiplier.value += 0.2; - } - } - - stabMultiplier.value = Math.min(stabMultiplier.value, 2.25); + const stabMultiplier = this.calculateStabMultiplier(source, move, ignoreSourceAbility, simulated); /** Halves damage if the attacker is using a physical attack while burned */ - const burnMultiplier = new NumberHolder(1); + let burnMultiplier = 1; if ( isPhysical && source.status && - source.status.effect === StatusEffect.BURN + source.status.effect === StatusEffect.BURN && + !move.hasAttr(BypassBurnDamageReductionAttr) ) { - if (!move.hasAttr(BypassBurnDamageReductionAttr)) { - const burnDamageReductionCancelled = new BooleanHolder(false); - if (!ignoreSourceAbility) { - applyAbAttrs( - BypassBurnDamageReductionAbAttr, - source, - burnDamageReductionCancelled, - simulated, - ); - } - if (!burnDamageReductionCancelled.value) { - burnMultiplier.value = 0.5; - } + const burnDamageReductionCancelled = new BooleanHolder(false); + if (!ignoreSourceAbility) { + applyAbAttrs( + BypassBurnDamageReductionAbAttr, + source, + burnDamageReductionCancelled, + simulated, + ); + } + if (!burnDamageReductionCancelled.value) { + burnMultiplier = 0.5; } } @@ -4447,9 +4462,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { glaiveRushMultiplier.value * criticalMultiplier.value * randomMultiplier * - stabMultiplier.value * + stabMultiplier * typeMultiplier * - burnMultiplier.value * + burnMultiplier * screenMultiplier.value * hitsTagMultiplier.value * mistyTerrainMultiplier, diff --git a/test/moves/struggle.test.ts b/test/moves/struggle.test.ts new file mode 100644 index 00000000000..6b566df9d54 --- /dev/null +++ b/test/moves/struggle.test.ts @@ -0,0 +1,65 @@ +import { Abilities } from "#enums/abilities"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; +import GameManager from "#test/testUtils/gameManager"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; + +describe("Moves - Struggle", () => { + 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 + .moveset([Moves.SPLASH]) + .ability(Abilities.BALL_FETCH) + .battleType("single") + .disableCrits() + .enemySpecies(Species.MAGIKARP) + .enemyAbility(Abilities.BALL_FETCH) + .enemyMoveset(Moves.SPLASH); + }); + + it("should not have its power boosted by adaptability or stab", async () => { + game.override.moveset([Moves.STRUGGLE]).ability(Abilities.ADAPTABILITY); + await game.classicMode.startBattle([Species.RATTATA]); + + const enemy = game.scene.getEnemyPokemon()!; + game.move.select(Moves.STRUGGLE); + + const stabSpy = vi.spyOn(enemy, "calculateStabMultiplier"); + + await game.phaseInterceptor.to("BerryPhase"); + + expect(stabSpy).toHaveReturnedWith(1); + + stabSpy.mockRestore(); + }); + + it("should ignore type effectiveness", async () => { + game.override.moveset([Moves.STRUGGLE]); + await game.classicMode.startBattle([Species.GASTLY]); + + const enemy = game.scene.getEnemyPokemon()!; + game.move.select(Moves.STRUGGLE); + + const moveEffectivenessSpy = vi.spyOn(enemy, "getMoveEffectiveness"); + + await game.phaseInterceptor.to("BerryPhase"); + + expect(moveEffectivenessSpy).toHaveReturnedWith(1); + + moveEffectivenessSpy.mockRestore(); + }); +}); From 8d311e65cf5dc65d807827a874f140c0f7b33ce4 Mon Sep 17 00:00:00 2001 From: damocleas Date: Wed, 16 Apr 2025 22:31:53 -0400 Subject: [PATCH 03/18] [Bug] [Ability] Fixed wrong Sheer Force interactions and multiplier from ~1.33 -> 1.3 (#5515) * sheer force #, sheer force and burning jealousy test fix, and move chance fixes * removed order up sheer force interaction mention and test - updated comments * remove electro shot from changes --- src/data/abilities/ability.ts | 4 ++-- src/data/moves/move.ts | 24 ++++++++++++------------ test/abilities/sheer_force.test.ts | 2 +- test/moves/burning_jealousy.test.ts | 2 +- test/moves/order_up.test.ts | 19 ------------------- 5 files changed, 16 insertions(+), 35 deletions(-) diff --git a/src/data/abilities/ability.ts b/src/data/abilities/ability.ts index 17a8eddf47f..43a6cd5901b 100644 --- a/src/data/abilities/ability.ts +++ b/src/data/abilities/ability.ts @@ -6702,8 +6702,8 @@ export function initAbilities() { .attr(PostDefendStealHeldItemAbAttr, (target, user, move) => move.hasFlag(MoveFlags.MAKES_CONTACT)) .condition(getSheerForceHitDisableAbCondition()), new Ability(Abilities.SHEER_FORCE, 5) - .attr(MovePowerBoostAbAttr, (user, target, move) => move.chance >= 1, 5461 / 4096) - .attr(MoveEffectChanceMultiplierAbAttr, 0), // Should disable life orb, eject button, red card, kee/maranga berry if they get implemented + .attr(MovePowerBoostAbAttr, (user, target, move) => move.chance >= 1, 1.3) + .attr(MoveEffectChanceMultiplierAbAttr, 0), // This attribute does not seem to function - Should disable life orb, eject button, red card, kee/maranga berry if they get implemented new Ability(Abilities.CONTRARY, 5) .attr(StatStageChangeMultiplierAbAttr, -1) .ignorable(), diff --git a/src/data/moves/move.ts b/src/data/moves/move.ts index 9546a6a40e5..c2dd0ec31ca 100644 --- a/src/data/moves/move.ts +++ b/src/data/moves/move.ts @@ -3466,8 +3466,7 @@ export class CutHpStatStageBoostAttr extends StatStageChangeAttr { /** * Attribute implementing the stat boosting effect of {@link https://bulbapedia.bulbagarden.net/wiki/Order_Up_(move) | Order Up}. * If the user has a Pokemon with {@link https://bulbapedia.bulbagarden.net/wiki/Commander_(Ability) | Commander} in their mouth, - * one of the user's stats are increased by 1 stage, depending on the "commanding" Pokemon's form. This effect does not respect - * effect chance, but Order Up itself may be boosted by Sheer Force. + * one of the user's stats are increased by 1 stage, depending on the "commanding" Pokemon's form. */ export class OrderUpStatBoostAttr extends MoveEffectAttr { constructor() { @@ -9726,7 +9725,7 @@ export function initMoves() { .ignoresProtect() .target(MoveTarget.BOTH_SIDES) .unimplemented(), - new AttackMove(Moves.SMACK_DOWN, PokemonType.ROCK, MoveCategory.PHYSICAL, 50, 100, 15, 100, 0, 5) + new AttackMove(Moves.SMACK_DOWN, PokemonType.ROCK, MoveCategory.PHYSICAL, 50, 100, 15, -1, 0, 5) .attr(FallDownAttr) .attr(AddBattlerTagAttr, BattlerTagType.INTERRUPTED) .attr(RemoveBattlerTagAttr, [ BattlerTagType.FLYING, BattlerTagType.FLOATING, BattlerTagType.TELEKINESIS ]) @@ -9893,7 +9892,7 @@ export function initMoves() { .attr(MovePowerMultiplierAttr, (user, target, move) => globalScene.arena.getTerrainType() === TerrainType.GRASSY && target.isGrounded() ? 0.5 : 1) .makesContact(false) .target(MoveTarget.ALL_NEAR_OTHERS), - new AttackMove(Moves.FROST_BREATH, PokemonType.ICE, MoveCategory.SPECIAL, 60, 90, 10, 100, 0, 5) + new AttackMove(Moves.FROST_BREATH, PokemonType.ICE, MoveCategory.SPECIAL, 60, 90, 10, -1, 0, 5) .attr(CritOnlyAttr), new AttackMove(Moves.DRAGON_TAIL, PokemonType.DRAGON, MoveCategory.PHYSICAL, 60, 90, 10, -1, -6, 5) .attr(ForceSwitchOutAttr, false, SwitchType.FORCE_SWITCH) @@ -10535,7 +10534,7 @@ export function initMoves() { .attr(AddArenaTagAttr, ArenaTagType.LIGHT_SCREEN, 5, false, true), new AttackMove(Moves.BADDY_BAD, PokemonType.DARK, MoveCategory.SPECIAL, 80, 95, 15, -1, 0, 7) .attr(AddArenaTagAttr, ArenaTagType.REFLECT, 5, false, true), - new AttackMove(Moves.SAPPY_SEED, PokemonType.GRASS, MoveCategory.PHYSICAL, 100, 90, 10, 100, 0, 7) + new AttackMove(Moves.SAPPY_SEED, PokemonType.GRASS, MoveCategory.PHYSICAL, 100, 90, 10, -1, 0, 7) .attr(LeechSeedAttr) .makesContact(false), new AttackMove(Moves.FREEZY_FROST, PokemonType.ICE, MoveCategory.SPECIAL, 100, 90, 10, -1, 0, 7) @@ -10863,7 +10862,7 @@ export function initMoves() { .attr(StatStageChangeAttr, [ Stat.SPD ], 1, true), new AttackMove(Moves.BITTER_MALICE, PokemonType.GHOST, MoveCategory.SPECIAL, 75, 100, 10, 100, 0, 8) .attr(StatStageChangeAttr, [ Stat.ATK ], -1), - new SelfStatusMove(Moves.SHELTER, PokemonType.STEEL, -1, 10, 100, 0, 8) + new SelfStatusMove(Moves.SHELTER, PokemonType.STEEL, -1, 10, -1, 0, 8) .attr(StatStageChangeAttr, [ Stat.DEF ], 2, true), new AttackMove(Moves.TRIPLE_ARROWS, PokemonType.FIGHTING, MoveCategory.PHYSICAL, 90, 100, 10, 30, 0, 8) .makesContact(false) @@ -11018,7 +11017,7 @@ export function initMoves() { .makesContact(false), new AttackMove(Moves.LUMINA_CRASH, PokemonType.PSYCHIC, MoveCategory.SPECIAL, 80, 100, 10, 100, 0, 9) .attr(StatStageChangeAttr, [ Stat.SPDEF ], -2), - new AttackMove(Moves.ORDER_UP, PokemonType.DRAGON, MoveCategory.PHYSICAL, 80, 100, 10, 100, 0, 9) + new AttackMove(Moves.ORDER_UP, PokemonType.DRAGON, MoveCategory.PHYSICAL, 80, 100, 10, -1, 0, 9) .attr(OrderUpStatBoostAttr) .makesContact(false), new AttackMove(Moves.JET_PUNCH, PokemonType.WATER, MoveCategory.PHYSICAL, 60, 100, 15, -1, 1, 9) @@ -11072,7 +11071,7 @@ export function initMoves() { .attr(CutHpStatStageBoostAttr, [ Stat.ATK, Stat.SPATK, Stat.SPD ], 2, 2), new AttackMove(Moves.KOWTOW_CLEAVE, PokemonType.DARK, MoveCategory.PHYSICAL, 85, -1, 10, -1, 0, 9) .slicingMove(), - new AttackMove(Moves.FLOWER_TRICK, PokemonType.GRASS, MoveCategory.PHYSICAL, 70, -1, 10, 100, 0, 9) + new AttackMove(Moves.FLOWER_TRICK, PokemonType.GRASS, MoveCategory.PHYSICAL, 70, -1, 10, -1, 0, 9) .attr(CritOnlyAttr) .makesContact(false), new AttackMove(Moves.TORCH_SONG, PokemonType.FIRE, MoveCategory.SPECIAL, 80, 100, 10, 100, 0, 9) @@ -11191,7 +11190,7 @@ export function initMoves() { .attr(StatusEffectAttr, StatusEffect.BURN) .target(MoveTarget.ALL_NEAR_ENEMIES) .triageMove(), - new AttackMove(Moves.SYRUP_BOMB, PokemonType.GRASS, MoveCategory.SPECIAL, 60, 85, 10, -1, 0, 9) + new AttackMove(Moves.SYRUP_BOMB, PokemonType.GRASS, MoveCategory.SPECIAL, 60, 85, 10, 100, 0, 9) .attr(AddBattlerTagAttr, BattlerTagType.SYRUP_BOMB, false, false, 3) .ballBombMove(), new AttackMove(Moves.IVY_CUDGEL, PokemonType.GRASS, MoveCategory.PHYSICAL, 100, 100, 10, -1, 0, 9) @@ -11209,7 +11208,8 @@ export function initMoves() { .partial(), /** Does not ignore abilities that affect stats, relevant in determining the move's category {@see TeraMoveCategoryAttr} */ new AttackMove(Moves.FICKLE_BEAM, PokemonType.DRAGON, MoveCategory.SPECIAL, 80, 100, 5, 30, 0, 9) .attr(PreMoveMessageAttr, doublePowerChanceMessageFunc) - .attr(DoublePowerChanceAttr), + .attr(DoublePowerChanceAttr) + .edgeCase(), // Should not interact with Sheer Force new SelfStatusMove(Moves.BURNING_BULWARK, PokemonType.FIRE, -1, 10, -1, 4, 9) .attr(ProtectAttr, BattlerTagType.BURNING_BULWARK) .condition(failIfLastCondition), @@ -11232,7 +11232,7 @@ export function initMoves() { new StatusMove(Moves.DRAGON_CHEER, PokemonType.DRAGON, -1, 15, -1, 0, 9) .attr(AddBattlerTagAttr, BattlerTagType.DRAGON_CHEER, false, true) .target(MoveTarget.NEAR_ALLY), - new AttackMove(Moves.ALLURING_VOICE, PokemonType.FAIRY, MoveCategory.SPECIAL, 80, 100, 10, -1, 0, 9) + new AttackMove(Moves.ALLURING_VOICE, PokemonType.FAIRY, MoveCategory.SPECIAL, 80, 100, 10, 100, 0, 9) .attr(AddBattlerTagIfBoostedAttr, BattlerTagType.CONFUSED) .soundBased(), new AttackMove(Moves.TEMPER_FLARE, PokemonType.FIRE, MoveCategory.PHYSICAL, 75, 100, 10, -1, 0, 9) @@ -11241,7 +11241,7 @@ export function initMoves() { .attr(MissEffectAttr, crashDamageFunc) .attr(NoEffectAttr, crashDamageFunc) .recklessMove(), - new AttackMove(Moves.PSYCHIC_NOISE, PokemonType.PSYCHIC, MoveCategory.SPECIAL, 75, 100, 10, -1, 0, 9) + new AttackMove(Moves.PSYCHIC_NOISE, PokemonType.PSYCHIC, MoveCategory.SPECIAL, 75, 100, 10, 100, 0, 9) .soundBased() .attr(AddBattlerTagAttr, BattlerTagType.HEAL_BLOCK, false, false, 2), new AttackMove(Moves.UPPER_HAND, PokemonType.FIGHTING, MoveCategory.PHYSICAL, 65, 100, 15, 100, 3, 9) diff --git a/test/abilities/sheer_force.test.ts b/test/abilities/sheer_force.test.ts index 4a1c20cde5c..fae089958a5 100644 --- a/test/abilities/sheer_force.test.ts +++ b/test/abilities/sheer_force.test.ts @@ -34,7 +34,7 @@ describe("Abilities - Sheer Force", () => { .disableCrits(); }); - const SHEER_FORCE_MULT = 5461 / 4096; + const SHEER_FORCE_MULT = 1.3; it("Sheer Force should boost the power of the move but disable secondary effects", async () => { game.override.moveset([Moves.AIR_SLASH]); diff --git a/test/moves/burning_jealousy.test.ts b/test/moves/burning_jealousy.test.ts index 60387df4226..04966b24206 100644 --- a/test/moves/burning_jealousy.test.ts +++ b/test/moves/burning_jealousy.test.ts @@ -89,7 +89,7 @@ describe("Moves - Burning Jealousy", () => { await game.phaseInterceptor.to("BerryPhase"); expect(allMoves[Moves.BURNING_JEALOUSY].calculateBattlePower).toHaveReturnedWith( - (allMoves[Moves.BURNING_JEALOUSY].power * 5461) / 4096, + allMoves[Moves.BURNING_JEALOUSY].power * 1.3, ); }); }); diff --git a/test/moves/order_up.test.ts b/test/moves/order_up.test.ts index 516f7f625a3..f25114c12de 100644 --- a/test/moves/order_up.test.ts +++ b/test/moves/order_up.test.ts @@ -65,23 +65,4 @@ describe("Moves - Order Up", () => { affectedStats.forEach(st => expect(dondozo.getStatStage(st)).toBe(st === stat ? 3 : 2)); }, ); - - it("should be boosted by Sheer Force while still applying a stat boost", async () => { - game.override.passiveAbility(Abilities.SHEER_FORCE).starterForms({ [Species.TATSUGIRI]: 0 }); - - await game.classicMode.startBattle([Species.TATSUGIRI, Species.DONDOZO]); - - const [tatsugiri, dondozo] = game.scene.getPlayerField(); - - expect(game.scene.triggerPokemonBattleAnim).toHaveBeenLastCalledWith(tatsugiri, PokemonAnimType.COMMANDER_APPLY); - expect(dondozo.getTag(BattlerTagType.COMMANDED)).toBeDefined(); - - game.move.select(Moves.ORDER_UP, 1, BattlerIndex.ENEMY); - expect(game.scene.currentBattle.turnCommands[0]?.skip).toBeTruthy(); - - await game.phaseInterceptor.to("BerryPhase", false); - - expect(dondozo.battleData.abilitiesApplied.includes(Abilities.SHEER_FORCE)).toBeTruthy(); - expect(dondozo.getStatStage(Stat.ATK)).toBe(3); - }); }); From b2bab46e1cd7b12363c9220835dcfc9b5f839b98 Mon Sep 17 00:00:00 2001 From: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Date: Wed, 16 Apr 2025 23:47:49 -0500 Subject: [PATCH 04/18] [Bug][Ability] Fix healer queueing its message when its ally is fainted (#5642) * Add check against faint status effect * Add tests for healer * Remove redundant portions of the tests * Fix broken test --- src/data/abilities/ability.ts | 4 +- test/abilities/healer.test.ts | 97 +++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 test/abilities/healer.test.ts diff --git a/src/data/abilities/ability.ts b/src/data/abilities/ability.ts index 43a6cd5901b..ab07d406868 100644 --- a/src/data/abilities/ability.ts +++ b/src/data/abilities/ability.ts @@ -4033,7 +4033,9 @@ export class PostTurnResetStatusAbAttr extends PostTurnAbAttr { } else { this.target = pokemon; } - return !isNullOrUndefined(this.target?.status); + + const effect = this.target?.status?.effect; + return !!effect && effect !== StatusEffect.FAINT; } override applyPostTurn(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): void { diff --git a/test/abilities/healer.test.ts b/test/abilities/healer.test.ts new file mode 100644 index 00000000000..35aa74209b4 --- /dev/null +++ b/test/abilities/healer.test.ts @@ -0,0 +1,97 @@ +import { Abilities } from "#enums/abilities"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; +import { StatusEffect } from "#enums/status-effect"; +import GameManager from "#test/testUtils/gameManager"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi, type MockInstance } from "vitest"; +import { isNullOrUndefined } from "#app/utils"; +import { PostTurnResetStatusAbAttr } from "#app/data/abilities/ability"; +import { allAbilities } from "#app/data/data-lists"; +import type Pokemon from "#app/field/pokemon"; + +describe("Abilities - Healer", () => { + let phaserGame: Phaser.Game; + let game: GameManager; + let healerAttrSpy: MockInstance; + let healerAttr: PostTurnResetStatusAbAttr; + + beforeAll(() => { + phaserGame = new Phaser.Game({ + type: Phaser.HEADLESS, + }); + }); + + afterEach(() => { + game.phaseInterceptor.restoreOg(); + healerAttrSpy.mockRestore(); + }); + + beforeEach(() => { + game = new GameManager(phaserGame); + game.override + .moveset([Moves.SPLASH]) + .ability(Abilities.BALL_FETCH) + .battleType("double") + .disableCrits() + .enemySpecies(Species.MAGIKARP) + .enemyAbility(Abilities.BALL_FETCH) + .enemyMoveset(Moves.SPLASH); + + healerAttr = allAbilities[Abilities.HEALER].getAttrs(PostTurnResetStatusAbAttr)[0]; + healerAttrSpy = vi + .spyOn(healerAttr, "getCondition") + .mockReturnValue((pokemon: Pokemon) => !isNullOrUndefined(pokemon.getAlly())); + }); + + it("should not queue a message phase for healing if the ally has fainted", async () => { + game.override.moveset([Moves.SPLASH, Moves.LUNAR_DANCE]); + await game.classicMode.startBattle([Species.MAGIKARP, Species.MAGIKARP]); + const user = game.scene.getPlayerPokemon()!; + // Only want one magikarp to have the ability. + vi.spyOn(user, "getAbility").mockReturnValue(allAbilities[Abilities.HEALER]); + game.move.select(Moves.SPLASH); + // faint the ally + game.move.select(Moves.LUNAR_DANCE, 1); + const abSpy = vi.spyOn(healerAttr, "canApplyPostTurn"); + await game.phaseInterceptor.to("TurnEndPhase"); + + // It's not enough to just test that the ally still has its status. + // We need to ensure that the ability failed to meet its condition + expect(abSpy).toHaveReturnedWith(false); + + // Explicitly restore the mock to ensure pollution doesn't happen + abSpy.mockRestore(); + }); + + it("should heal the status of an ally if the ally has a status", async () => { + await game.classicMode.startBattle([Species.MAGIKARP, Species.MAGIKARP]); + const [user, ally] = game.scene.getPlayerField(); + // Only want one magikarp to have the ability. + vi.spyOn(user, "getAbility").mockReturnValue(allAbilities[Abilities.HEALER]); + expect(ally.trySetStatus(StatusEffect.BURN)).toBe(true); + game.move.select(Moves.SPLASH); + game.move.select(Moves.SPLASH, 1); + + await game.phaseInterceptor.to("TurnEndPhase"); + await game.toNextTurn(); + + expect(ally.status?.effect, "status effect was not healed").toBeFalsy(); + }); + + // TODO: Healer is currently checked before the + it.todo("should heal a burn before its end of turn damage", async () => { + await game.classicMode.startBattle([Species.MAGIKARP, Species.MAGIKARP]); + const [user, ally] = game.scene.getPlayerField(); + // Only want one magikarp to have the ability. + vi.spyOn(user, "getAbility").mockReturnValue(allAbilities[Abilities.HEALER]); + expect(ally.trySetStatus(StatusEffect.BURN)).toBe(true); + game.move.select(Moves.SPLASH); + game.move.select(Moves.SPLASH, 1); + await game.phaseInterceptor.to("TurnEndPhase"); + await game.toNextTurn(); + + expect(ally.status?.effect, "status effect was not healed").toBeFalsy(); + expect(ally.hp).toBe(ally.getMaxHp()); + }); +}); From 45a2f426024e8221f4756f524f6bda93b5cc6a5f Mon Sep 17 00:00:00 2001 From: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Date: Thu, 17 Apr 2025 10:44:50 -0500 Subject: [PATCH 05/18] [Bug] Prevent game from hanging when loading in a new battle (#5676) --- src/field/pokemon.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index cdd48f7d940..ce36a40697b 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -840,12 +840,17 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { await Promise.allSettled(loadPromises); - // Wait for the assets we queued to load to finish loading, then... + // This must be initiated before we queue loading, otherwise the load could have finished before + // we reach the line of code that adds the listener, causing a deadlock. + const waitOnLoadPromise = new Promise(resolve => globalScene.load.once(Phaser.Loader.Events.COMPLETE, resolve)); + if (!globalScene.load.isLoading()) { globalScene.load.start(); } + + // Wait for the assets we queued to load to finish loading, then... // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises#creating_a_promise_around_an_old_callback_api - await new Promise(resolve => globalScene.load.once(Phaser.Loader.Events.COMPLETE, resolve)); + await waitOnLoadPromise; // With the sprites loaded, generate the animation frame information if (this.isPlayer()) { From eef8367caf028e84213924fa0673a9e58927991f Mon Sep 17 00:00:00 2001 From: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Date: Thu, 17 Apr 2025 11:57:30 -0500 Subject: [PATCH 06/18] [Bug] Fix experimental sprites not loading in starter select (#5664) [Bug][Sprite] Fix experimental variant sprites not being loaded in starter select screen --- src/data/pokemon-species.ts | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/data/pokemon-species.ts b/src/data/pokemon-species.ts index a27c00121dc..75ea07edd40 100644 --- a/src/data/pokemon-species.ts +++ b/src/data/pokemon-species.ts @@ -27,11 +27,12 @@ import { } from "#app/data/balance/pokemon-level-moves"; import type { Stat } from "#enums/stat"; import type { Variant, VariantSet } from "#app/sprites/variant"; -import { variantData } from "#app/sprites/variant"; +import { populateVariantColorCache, variantData } from "#app/sprites/variant"; import { speciesStarterCosts, POKERUS_STARTER_COUNT } from "#app/data/balance/starters"; import { SpeciesFormKey } from "#enums/species-form-key"; import { starterPassiveAbilities } from "#app/data/balance/passives"; import { loadPokemonVariantAssets } from "#app/sprites/pokemon-sprite"; +import { hasExpSprite } from "#app/sprites/sprite-utils"; export enum Region { NORMAL, @@ -388,8 +389,7 @@ export abstract class PokemonSpeciesForm { return `${/_[1-3]$/.test(spriteId) ? "variant/" : ""}${spriteId}`; } - /** Compute the sprite ID of the pokemon form. */ - getSpriteId(female: boolean, formIndex?: number, shiny?: boolean, variant = 0, back?: boolean): string { + getBaseSpriteKey(female: boolean, formIndex?: number): string { if (formIndex === undefined || this instanceof PokemonForm) { formIndex = this.formIndex; } @@ -400,7 +400,12 @@ export abstract class PokemonSpeciesForm { female && ![SpeciesFormKey.MEGA, SpeciesFormKey.GIGANTAMAX].includes(formSpriteKey as SpeciesFormKey); - const baseSpriteKey = `${showGenderDiffs ? "female__" : ""}${this.speciesId}${formSpriteKey ? `-${formSpriteKey}` : ""}`; + return `${showGenderDiffs ? "female__" : ""}${this.speciesId}${formSpriteKey ? `-${formSpriteKey}` : ""}`; + } + + /** Compute the sprite ID of the pokemon form. */ + getSpriteId(female: boolean, formIndex?: number, shiny?: boolean, variant = 0, back?: boolean): string { + const baseSpriteKey = this.getBaseSpriteKey(female, formIndex); let config = variantData; `${back ? "back__" : ""}${baseSpriteKey}`.split("__").map(p => (config ? (config = config[p]) : null)); @@ -597,10 +602,19 @@ export abstract class PokemonSpeciesForm { startLoad = false, back = false, ): Promise { + // We need to populate the color cache for this species' variant const spriteKey = this.getSpriteKey(female, formIndex, shiny, variant, back); globalScene.loadPokemonAtlas(spriteKey, this.getSpriteAtlasPath(female, formIndex, shiny, variant, back)); globalScene.load.audio(this.getCryKey(formIndex), `audio/${this.getCryKey(formIndex)}.m4a`); + const baseSpriteKey = this.getBaseSpriteKey(female, formIndex); + + // Force the variant color cache to be loaded for the form + await populateVariantColorCache( + "pkmn__" + baseSpriteKey, + globalScene.experimentalSprites && hasExpSprite(spriteKey), + baseSpriteKey, + ); return new Promise(resolve => { globalScene.load.once(Phaser.Loader.Events.COMPLETE, () => { const originalWarn = console.warn; From 3a46aae687142201aa3c42264c13b4865c5d561f Mon Sep 17 00:00:00 2001 From: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Date: Thu, 17 Apr 2025 15:25:38 -0500 Subject: [PATCH 07/18] [Bug] Fix beak blast: not applying if user faints and not respecting long reach (#5639) * Add test for beak blast applying after user faints * Rewrite tags for contact protected and check moveFlags.doesFlagEffectApply * Add test to beak blast ensuring a long reach user does not get burned * Re-add DamageProtectedTag to relevant inheritance chains * Move resetSummonData to faintPhase instead of pokemon.apply * Remove passing of grudge and destiny bond tags to faint phase --- src/data/abilities/ability.ts | 6 +- src/data/battler-tags.ts | 169 +++++++++++++++++--------------- src/field/pokemon.ts | 8 +- src/phases/faint-phase.ts | 31 ++---- src/phases/move-effect-phase.ts | 10 +- test/moves/beak_blast.test.ts | 31 +++++- 6 files changed, 136 insertions(+), 119 deletions(-) diff --git a/src/data/abilities/ability.ts b/src/data/abilities/ability.ts index ab07d406868..6cbb579d4e0 100644 --- a/src/data/abilities/ability.ts +++ b/src/data/abilities/ability.ts @@ -6701,7 +6701,7 @@ export function initAbilities() { new Ability(Abilities.BAD_DREAMS, 4) .attr(PostTurnHurtIfSleepingAbAttr), new Ability(Abilities.PICKPOCKET, 5) - .attr(PostDefendStealHeldItemAbAttr, (target, user, move) => move.hasFlag(MoveFlags.MAKES_CONTACT)) + .attr(PostDefendStealHeldItemAbAttr, (target, user, move) => move.doesFlagEffectApply({flag: MoveFlags.MAKES_CONTACT, user, target})) .condition(getSheerForceHitDisableAbCondition()), new Ability(Abilities.SHEER_FORCE, 5) .attr(MovePowerBoostAbAttr, (user, target, move) => move.chance >= 1, 1.3) @@ -7051,7 +7051,7 @@ export function initAbilities() { new Ability(Abilities.BATTERY, 7) .attr(AllyMoveCategoryPowerBoostAbAttr, [ MoveCategory.SPECIAL ], 1.3), new Ability(Abilities.FLUFFY, 7) - .attr(ReceivedMoveDamageMultiplierAbAttr, (target, user, move) => move.hasFlag(MoveFlags.MAKES_CONTACT), 0.5) + .attr(ReceivedMoveDamageMultiplierAbAttr, (target, user, move) => move.doesFlagEffectApply({flag: MoveFlags.MAKES_CONTACT, user, target}), 0.5) .attr(ReceivedMoveDamageMultiplierAbAttr, (target, user, move) => user.getMoveType(move) === PokemonType.FIRE, 2) .ignorable(), new Ability(Abilities.DAZZLING, 7) @@ -7060,7 +7060,7 @@ export function initAbilities() { new Ability(Abilities.SOUL_HEART, 7) .attr(PostKnockOutStatStageChangeAbAttr, Stat.SPATK, 1), new Ability(Abilities.TANGLING_HAIR, 7) - .attr(PostDefendStatStageChangeAbAttr, (target, user, move) => move.hasFlag(MoveFlags.MAKES_CONTACT), Stat.SPD, -1, false), + .attr(PostDefendStatStageChangeAbAttr, (target, user, move) => move.doesFlagEffectApply({flag: MoveFlags.MAKES_CONTACT, user, target}), Stat.SPD, -1, false), new Ability(Abilities.RECEIVER, 7) .attr(CopyFaintedAllyAbilityAbAttr) .uncopiable(), diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index 401fd9903d1..9b72f3083fd 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -52,6 +52,7 @@ export enum BattlerTagLapseType { MOVE_EFFECT, TURN_END, HIT, + /** Tag lapses AFTER_HIT, applying its effects even if the user faints */ AFTER_HIT, CUSTOM, } @@ -498,7 +499,13 @@ export class BeakBlastChargingTag extends BattlerTag { lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean { if (lapseType === BattlerTagLapseType.AFTER_HIT) { const phaseData = getMoveEffectPhaseData(pokemon); - if (phaseData?.move.hasFlag(MoveFlags.MAKES_CONTACT)) { + if ( + phaseData?.move.doesFlagEffectApply({ + flag: MoveFlags.MAKES_CONTACT, + user: phaseData.attacker, + target: pokemon, + }) + ) { phaseData.attacker.trySetStatus(StatusEffect.BURN, true, pokemon); } return true; @@ -1611,19 +1618,50 @@ export class ProtectedTag extends BattlerTag { } } -/** Base class for `BattlerTag`s that block damaging moves but not status moves */ -export class DamageProtectedTag extends ProtectedTag {} +/** Class for `BattlerTag`s that apply some effect when hit by a contact move */ +export class ContactProtectedTag extends ProtectedTag { + /** + * Function to call when a contact move hits the pokemon with this tag. + * @param _attacker - The pokemon using the contact move + * @param _user - The pokemon that is being attacked and has the tag + * @param _move - The move used by the attacker + */ + onContact(_attacker: Pokemon, _user: Pokemon) {} + + /** + * Lapse the tag and apply `onContact` if the move makes contact and + * `lapseType` is custom, respecting the move's flags and the pokemon's + * abilities, and whether the lapseType is custom. + * + * @param pokemon - The pokemon with the tag + * @param lapseType - The type of lapse to apply. If this is not {@linkcode BattlerTagLapseType.CUSTOM CUSTOM}, no effect will be applied. + * @returns Whether the tag continues to exist after the lapse. + */ + lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean { + const ret = super.lapse(pokemon, lapseType); + + const moveData = getMoveEffectPhaseData(pokemon); + if ( + lapseType === BattlerTagLapseType.CUSTOM && + moveData && + moveData.move.doesFlagEffectApply({ flag: MoveFlags.MAKES_CONTACT, user: moveData.attacker, target: pokemon }) + ) { + this.onContact(moveData.attacker, pokemon); + } + + return ret; + } +} /** * `BattlerTag` class for moves that block damaging moves damage the enemy if the enemy's move makes contact * Used by {@linkcode Moves.SPIKY_SHIELD} */ -export class ContactDamageProtectedTag extends ProtectedTag { +export class ContactDamageProtectedTag extends ContactProtectedTag { private damageRatio: number; constructor(sourceMove: Moves, damageRatio: number) { super(sourceMove, BattlerTagType.SPIKY_SHIELD); - this.damageRatio = damageRatio; } @@ -1636,22 +1674,46 @@ export class ContactDamageProtectedTag extends ProtectedTag { this.damageRatio = source.damageRatio; } - lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean { - const ret = super.lapse(pokemon, lapseType); - - if (lapseType === BattlerTagLapseType.CUSTOM) { - const effectPhase = globalScene.getCurrentPhase(); - if (effectPhase instanceof MoveEffectPhase && effectPhase.move.getMove().hasFlag(MoveFlags.MAKES_CONTACT)) { - const attacker = effectPhase.getPokemon(); - if (!attacker.hasAbilityWithAttr(BlockNonDirectDamageAbAttr)) { - attacker.damageAndUpdate(toDmgValue(attacker.getMaxHp() * (1 / this.damageRatio)), { - result: HitResult.INDIRECT, - }); - } - } + /** + * Damage the attacker by `this.damageRatio` of the target's max HP + * @param attacker - The pokemon using the contact move + * @param user - The pokemon that is being attacked and has the tag + */ + override onContact(attacker: Pokemon, user: Pokemon): void { + const cancelled = new BooleanHolder(false); + applyAbAttrs(BlockNonDirectDamageAbAttr, user, cancelled); + if (!cancelled.value) { + attacker.damageAndUpdate(toDmgValue(attacker.getMaxHp() * (1 / this.damageRatio)), { + result: HitResult.INDIRECT, + }); } + } +} - return ret; +/** Base class for `BattlerTag`s that block damaging moves but not status moves */ +export class DamageProtectedTag extends ContactProtectedTag {} + +export class ContactSetStatusProtectedTag extends DamageProtectedTag { + /** + * @param sourceMove The move that caused the tag to be applied + * @param tagType The type of the tag + * @param statusEffect The status effect to apply to the attacker + */ + constructor( + sourceMove: Moves, + tagType: BattlerTagType, + private statusEffect: StatusEffect, + ) { + super(sourceMove, tagType); + } + + /** + * Set the status effect on the attacker + * @param attacker - The pokemon using the contact move + * @param user - The pokemon that is being attacked and has the tag + */ + override onContact(attacker: Pokemon, user: Pokemon): void { + attacker.trySetStatus(this.statusEffect, true, user); } } @@ -1674,68 +1736,19 @@ export class ContactStatStageChangeProtectedTag extends DamageProtectedTag { * When given a battler tag or json representing one, load the data for it. * @param {BattlerTag | any} source A battler tag */ - loadTag(source: BattlerTag | any): void { + override loadTag(source: BattlerTag | any): void { super.loadTag(source); this.stat = source.stat; this.levels = source.levels; } - lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean { - const ret = super.lapse(pokemon, lapseType); - - if (lapseType === BattlerTagLapseType.CUSTOM) { - const effectPhase = globalScene.getCurrentPhase(); - if (effectPhase instanceof MoveEffectPhase && effectPhase.move.getMove().hasFlag(MoveFlags.MAKES_CONTACT)) { - const attacker = effectPhase.getPokemon(); - globalScene.unshiftPhase(new StatStageChangePhase(attacker.getBattlerIndex(), false, [this.stat], this.levels)); - } - } - - return ret; - } -} - -export class ContactPoisonProtectedTag extends ProtectedTag { - constructor(sourceMove: Moves) { - super(sourceMove, BattlerTagType.BANEFUL_BUNKER); - } - - lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean { - const ret = super.lapse(pokemon, lapseType); - - if (lapseType === BattlerTagLapseType.CUSTOM) { - const effectPhase = globalScene.getCurrentPhase(); - if (effectPhase instanceof MoveEffectPhase && effectPhase.move.getMove().hasFlag(MoveFlags.MAKES_CONTACT)) { - const attacker = effectPhase.getPokemon(); - attacker.trySetStatus(StatusEffect.POISON, true, pokemon); - } - } - - return ret; - } -} - -/** - * `BattlerTag` class for moves that block damaging moves and burn the enemy if the enemy's move makes contact - * Used by {@linkcode Moves.BURNING_BULWARK} - */ -export class ContactBurnProtectedTag extends DamageProtectedTag { - constructor(sourceMove: Moves) { - super(sourceMove, BattlerTagType.BURNING_BULWARK); - } - - lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean { - const ret = super.lapse(pokemon, lapseType); - - if (lapseType === BattlerTagLapseType.CUSTOM) { - const effectPhase = globalScene.getCurrentPhase(); - if (effectPhase instanceof MoveEffectPhase && effectPhase.move.getMove().hasFlag(MoveFlags.MAKES_CONTACT)) { - const attacker = effectPhase.getPokemon(); - attacker.trySetStatus(StatusEffect.BURN, true); - } - } - - return ret; + /** + * Initiate the stat stage change on the attacker + * @param attacker - The pokemon using the contact move + * @param user - The pokemon that is being attacked and has the tag + */ + override onContact(attacker: Pokemon, _user: Pokemon): void { + globalScene.unshiftPhase(new StatStageChangePhase(attacker.getBattlerIndex(), false, [this.stat], this.levels)); } } @@ -3518,9 +3531,9 @@ export function getBattlerTag( case BattlerTagType.SILK_TRAP: return new ContactStatStageChangeProtectedTag(sourceMove, tagType, Stat.SPD, -1); case BattlerTagType.BANEFUL_BUNKER: - return new ContactPoisonProtectedTag(sourceMove); + return new ContactSetStatusProtectedTag(sourceMove, tagType, StatusEffect.POISON); case BattlerTagType.BURNING_BULWARK: - return new ContactBurnProtectedTag(sourceMove); + return new ContactSetStatusProtectedTag(sourceMove, tagType, StatusEffect.BURN); case BattlerTagType.ENDURING: return new EnduringTag(tagType, BattlerTagLapseType.TURN_END, sourceMove); case BattlerTagType.ENDURE_TOKEN: diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index ce36a40697b..5ae7d227b3c 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -128,6 +128,7 @@ import { TarShotTag, AutotomizedTag, PowerTrickTag, + type GrudgeTag, } from "../data/battler-tags"; import { WeatherType } from "#enums/weather-type"; import { @@ -4754,15 +4755,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { new FaintPhase( this.getBattlerIndex(), false, - destinyTag, - grudgeTag, source, ), ); this.destroySubstitute(); this.lapseTag(BattlerTagType.COMMANDED); - this.resetSummonData(); } return result; @@ -4824,7 +4822,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { ); this.destroySubstitute(); this.lapseTag(BattlerTagType.COMMANDED); - this.resetSummonData(); } return damage; } @@ -4992,6 +4989,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { return false; } + /**@overload */ + getTag(tagType: BattlerTagType.GRUDGE): GrudgeTag | nil; + /** @overload */ getTag(tagType: BattlerTagType): BattlerTag | nil; diff --git a/src/phases/faint-phase.ts b/src/phases/faint-phase.ts index 01a556115a6..d1856c9331c 100644 --- a/src/phases/faint-phase.ts +++ b/src/phases/faint-phase.ts @@ -9,7 +9,6 @@ import { PostKnockOutAbAttr, PostVictoryAbAttr, } from "#app/data/abilities/ability"; -import type { DestinyBondTag, GrudgeTag } from "#app/data/battler-tags"; import { BattlerTagLapseType } from "#app/data/battler-tags"; import { battleSpecDialogue } from "#app/data/dialogue"; import { allMoves, PostVictoryStatStageChangeAttr } from "#app/data/moves/move"; @@ -32,6 +31,7 @@ import { ToggleDoublePositionPhase } from "./toggle-double-position-phase"; import { VictoryPhase } from "./victory-phase"; import { isNullOrUndefined } from "#app/utils"; import { FRIENDSHIP_LOSS_FROM_FAINT } from "#app/data/balance/starters"; +import { BattlerTagType } from "#enums/battler-tag-type"; export class FaintPhase extends PokemonPhase { /** @@ -39,33 +39,15 @@ export class FaintPhase extends PokemonPhase { */ private preventEndure: boolean; - /** - * Destiny Bond tag belonging to the currently fainting Pokemon, if applicable - */ - private destinyTag?: DestinyBondTag | null; - - /** - * Grudge tag belonging to the currently fainting Pokemon, if applicable - */ - private grudgeTag?: GrudgeTag | null; - /** * The source Pokemon that dealt fatal damage */ private source?: Pokemon; - constructor( - battlerIndex: BattlerIndex, - preventEndure = false, - destinyTag?: DestinyBondTag | null, - grudgeTag?: GrudgeTag | null, - source?: Pokemon, - ) { + constructor(battlerIndex: BattlerIndex, preventEndure = false, source?: Pokemon) { super(battlerIndex); this.preventEndure = preventEndure; - this.destinyTag = destinyTag; - this.grudgeTag = grudgeTag; this.source = source; } @@ -74,13 +56,12 @@ export class FaintPhase extends PokemonPhase { const faintPokemon = this.getPokemon(); - if (!isNullOrUndefined(this.destinyTag) && !isNullOrUndefined(this.source)) { - this.destinyTag.lapse(this.source, BattlerTagLapseType.CUSTOM); + if (this.source) { + faintPokemon.getTag(BattlerTagType.DESTINY_BOND)?.lapse(this.source, BattlerTagLapseType.CUSTOM); + faintPokemon.getTag(BattlerTagType.GRUDGE)?.lapse(faintPokemon, BattlerTagLapseType.CUSTOM, this.source); } - if (!isNullOrUndefined(this.grudgeTag) && !isNullOrUndefined(this.source)) { - this.grudgeTag.lapse(faintPokemon, BattlerTagLapseType.CUSTOM, this.source); - } + faintPokemon.resetSummonData(); if (!this.preventEndure) { const instantReviveModifier = globalScene.applyModifier( diff --git a/src/phases/move-effect-phase.ts b/src/phases/move-effect-phase.ts index af9f685eebe..3a4e5f32ede 100644 --- a/src/phases/move-effect-phase.ts +++ b/src/phases/move-effect-phase.ts @@ -627,18 +627,20 @@ export class MoveEffectPhase extends PokemonPhase { * @param hitResult - The {@linkcode HitResult} of the attempted move * @returns a `Promise` intended to be passed into a `then()` call. */ - protected applyOnGetHitAbEffects(user: Pokemon, target: Pokemon, hitResult: HitResult): void { + protected applyOnGetHitAbEffects(user: Pokemon, target: Pokemon, hitResult: HitResult) { + const hitsSubstitute = this.move.getMove().hitsSubstitute(user, target); if (!target.isFainted() || target.canApplyAbility()) { applyPostDefendAbAttrs(PostDefendAbAttr, target, user, this.move.getMove(), hitResult); - if (!this.move.getMove().hitsSubstitute(user, target)) { + if (!hitsSubstitute) { if (!user.isPlayer() && this.move.getMove() instanceof AttackMove) { globalScene.applyShuffledModifiers(EnemyAttackStatusEffectChanceModifier, false, target); } - - target.lapseTags(BattlerTagLapseType.AFTER_HIT); } } + if (!hitsSubstitute) { + target.lapseTags(BattlerTagLapseType.AFTER_HIT); + } } /** diff --git a/test/moves/beak_blast.test.ts b/test/moves/beak_blast.test.ts index 9f8b1e3d5c3..252b28448fd 100644 --- a/test/moves/beak_blast.test.ts +++ b/test/moves/beak_blast.test.ts @@ -38,7 +38,7 @@ describe("Moves - Beak Blast", () => { }); it("should add a charge effect that burns attackers on contact", async () => { - await game.startBattle([Species.BLASTOISE]); + await game.classicMode.startBattle([Species.BLASTOISE]); const leadPokemon = game.scene.getPlayerPokemon()!; const enemyPokemon = game.scene.getEnemyPokemon()!; @@ -55,7 +55,7 @@ describe("Moves - Beak Blast", () => { it("should still charge and burn opponents if the user is sleeping", async () => { game.override.statusEffect(StatusEffect.SLEEP); - await game.startBattle([Species.BLASTOISE]); + await game.classicMode.startBattle([Species.BLASTOISE]); const leadPokemon = game.scene.getPlayerPokemon()!; const enemyPokemon = game.scene.getEnemyPokemon()!; @@ -72,7 +72,7 @@ describe("Moves - Beak Blast", () => { it("should not burn attackers that don't make contact", async () => { game.override.enemyMoveset([Moves.WATER_GUN]); - await game.startBattle([Species.BLASTOISE]); + await game.classicMode.startBattle([Species.BLASTOISE]); const leadPokemon = game.scene.getPlayerPokemon()!; const enemyPokemon = game.scene.getEnemyPokemon()!; @@ -89,7 +89,7 @@ describe("Moves - Beak Blast", () => { it("should only hit twice with Multi-Lens", async () => { game.override.startingHeldItems([{ name: "MULTI_LENS", count: 1 }]); - await game.startBattle([Species.BLASTOISE]); + await game.classicMode.startBattle([Species.BLASTOISE]); const leadPokemon = game.scene.getPlayerPokemon()!; @@ -102,7 +102,7 @@ describe("Moves - Beak Blast", () => { it("should be blocked by Protect", async () => { game.override.enemyMoveset([Moves.PROTECT]); - await game.startBattle([Species.BLASTOISE]); + await game.classicMode.startBattle([Species.BLASTOISE]); const leadPokemon = game.scene.getPlayerPokemon()!; const enemyPokemon = game.scene.getEnemyPokemon()!; @@ -116,4 +116,25 @@ describe("Moves - Beak Blast", () => { expect(enemyPokemon.hp).toBe(enemyPokemon.getMaxHp()); expect(leadPokemon.getTag(BattlerTagType.BEAK_BLAST_CHARGING)).toBeUndefined(); }); + + it("should still burn the enemy if the user is knocked out", async () => { + game.override.ability(Abilities.BALL_FETCH); + await game.classicMode.startBattle([Species.MAGIKARP, Species.MAGIKARP]); + const enemyPokemon = game.scene.getEnemyPokemon()!; + const user = game.scene.getPlayerPokemon()!; + user.hp = 1; + game.move.select(Moves.BEAK_BLAST); + await game.phaseInterceptor.to("BerryPhase", false); + expect(enemyPokemon.status?.effect).toBe(StatusEffect.BURN); + }); + + it("should not burn a long reach enemy that hits the user with a contact move", async () => { + game.override.enemyAbility(Abilities.LONG_REACH); + game.override.enemyMoveset([Moves.FALSE_SWIPE]).enemyLevel(100); + await game.classicMode.startBattle([Species.MAGIKARP]); + game.move.select(Moves.BEAK_BLAST); + await game.phaseInterceptor.to("BerryPhase", false); + const enemyPokemon = game.scene.getEnemyPokemon()!; + expect(enemyPokemon.status?.effect).not.toBe(StatusEffect.BURN); + }); }); From b8b101119c66cfc67f16c842dbec11e1cc5ae3d4 Mon Sep 17 00:00:00 2001 From: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Date: Thu, 17 Apr 2025 15:31:57 -0500 Subject: [PATCH 08/18] [Bug][Sprite] Use floats for variant shader recolor comparison (#5668) * Use float values for comparison * Remove unused colorInt --- src/pipelines/glsl/spriteFragShader.frag | 36 ++++++++---------------- src/pipelines/glsl/spriteShader.vert | 1 - src/pipelines/sprite.ts | 8 +++--- src/utils.ts | 5 +++- 4 files changed, 20 insertions(+), 30 deletions(-) diff --git a/src/pipelines/glsl/spriteFragShader.frag b/src/pipelines/glsl/spriteFragShader.frag index 3765e595b70..03f8c8c27bc 100644 --- a/src/pipelines/glsl/spriteFragShader.frag +++ b/src/pipelines/glsl/spriteFragShader.frag @@ -31,9 +31,9 @@ uniform vec2 texSize; uniform float yOffset; uniform float yShadowOffset; uniform vec4 tone; -uniform ivec4 baseVariantColors[32]; +uniform vec4 baseVariantColors[32]; uniform vec4 variantColors[32]; -uniform ivec4 spriteColors[32]; +uniform vec4 spriteColors[32]; uniform ivec4 fusionSpriteColors[32]; const vec3 lumaF = vec3(.299, .587, .114); @@ -69,7 +69,6 @@ float hue2rgb(float f1, float f2, float hue) { vec3 rgb2hsl(vec3 color) { vec3 hsl; - float fmin = min(min(color.r, color.g), color.b); float fmax = max(max(color.r, color.g), color.b); float delta = fmax - fmin; @@ -152,34 +151,23 @@ vec3 hsv2rgb(vec3 c) { void main() { vec4 texture = texture2D(uMainSampler[0], outTexCoord); - ivec4 colorInt = ivec4(texture*255.0); - for (int i = 0; i < 32; i++) { - if (baseVariantColors[i][3] == 0) + if (baseVariantColors[i].a == 0.0) break; - // abs value is broken in this version of gles with highp - ivec3 diffs = ivec3( - (colorInt.r > baseVariantColors[i].r) ? colorInt.r - baseVariantColors[i].r : baseVariantColors[i].r - colorInt.r, - (colorInt.g > baseVariantColors[i].g) ? colorInt.g - baseVariantColors[i].g : baseVariantColors[i].g - colorInt.g, - (colorInt.b > baseVariantColors[i].b) ? colorInt.b - baseVariantColors[i].b : baseVariantColors[i].b - colorInt.b - ); - // Set color threshold to be within 3 points for each channel - bvec3 threshold = lessThan(diffs, ivec3(3)); - - if (texture.a > 0.0 && all(threshold)) { + if (texture.a > 0.0 && all(lessThan(abs(texture.rgb - baseVariantColors[i].rgb), vec3(1.0/255.0)))) { texture.rgb = variantColors[i].rgb; break; } } for (int i = 0; i < 32; i++) { - if (spriteColors[i][3] == 0) + if (spriteColors[i][3] == 0.0) break; - if (texture.a > 0.0 && colorInt.r == spriteColors[i].r && colorInt.g == spriteColors[i].g && colorInt.b == spriteColors[i].b) { - vec3 fusionColor = vec3(float(fusionSpriteColors[i].r) / 255.0, float(fusionSpriteColors[i].g) / 255.0, float(fusionSpriteColors[i].b) / 255.0); - vec3 bg = vec3(spriteColors[i].rgb) / 255.0; + if (texture.a > 0.0 && all(lessThan(abs(texture.rgb - spriteColors[i].rgb), vec3(1.0/255.0)))) { + vec3 fusionColor = vec3(fusionSpriteColors[i].rgb) / 255.0; + vec3 bg = spriteColors[i].rgb; float gray = (bg.r + bg.g + bg.b) / 3.0; - bg = vec3(gray, gray, gray); + bg = vec3(gray); vec3 fg = fusionColor; texture.rgb = mix(1.0 - 2.0 * (1.0 - bg) * (1.0 - fg), 2.0 * bg * fg, step(bg, vec3(0.5))); break; @@ -192,7 +180,7 @@ void main() { vec4 color = texture * texel; if (color.a > 0.0 && teraColor.r > 0.0 && teraColor.g > 0.0 && teraColor.b > 0.0) { - vec2 relUv = vec2((outTexCoord.x - texFrameUv.x) / (size.x / texSize.x), (outTexCoord.y - texFrameUv.y) / (size.y / texSize.y)); + vec2 relUv = (outTexCoord.xy - texFrameUv.xy) / (size.xy / texSize.xy); vec2 teraTexCoord = vec2(relUv.x * (size.x / 200.0), relUv.y * (size.y / 120.0)); vec4 teraCol = texture2D(uMainSampler[1], teraTexCoord); float floorValue = 86.0 / 255.0; @@ -265,8 +253,8 @@ void main() { if ((spriteY >= 0.9 && (color.a == 0.0 || yOverflow))) { float shadowSpriteY = (spriteY - 0.9) * (1.0 / 0.15); - if (distance(vec2(spriteX, shadowSpriteY), vec2(0.5, 0.5)) < 0.5) { - color = vec4(vec3(0.0, 0.0, 0.0), 0.5); + if (distance(vec2(spriteX, shadowSpriteY), vec2(0.5)) < 0.5) { + color = vec4(vec3(0.0), 0.5); } else if (yOverflow) { discard; } diff --git a/src/pipelines/glsl/spriteShader.vert b/src/pipelines/glsl/spriteShader.vert index 33743384b47..84e73834f49 100644 --- a/src/pipelines/glsl/spriteShader.vert +++ b/src/pipelines/glsl/spriteShader.vert @@ -11,7 +11,6 @@ attribute float inTintEffect; attribute vec4 inTint; varying vec2 outTexCoord; -varying vec2 outtexFrameUv; varying float outTexId; varying vec2 outPosition; varying float outTintEffect; diff --git a/src/pipelines/sprite.ts b/src/pipelines/sprite.ts index d97cae1662b..0aa9409617a 100644 --- a/src/pipelines/sprite.ts +++ b/src/pipelines/sprite.ts @@ -101,7 +101,7 @@ export default class SpritePipeline extends FieldSpritePipeline { flatSpriteColors.splice( flatSpriteColors.length, 0, - ...(c < spriteColors.length ? spriteColors[c] : emptyColors), + ...(c < spriteColors.length ? spriteColors[c].map(x => x / 255.0) : emptyColors), ); flatFusionSpriteColors.splice( flatFusionSpriteColors.length, @@ -110,7 +110,7 @@ export default class SpritePipeline extends FieldSpritePipeline { ); } - this.set4iv("spriteColors", flatSpriteColors.flat()); + this.set4fv("spriteColors", flatSpriteColors.flat()); this.set4iv("fusionSpriteColors", flatFusionSpriteColors.flat()); } } @@ -146,7 +146,7 @@ export default class SpritePipeline extends FieldSpritePipeline { if (c < baseColors.length) { const baseColor = Array.from(Object.values(rgbHexToRgba(baseColors[c]))); const variantColor = Array.from(Object.values(rgbHexToRgba(variantColors[variant][baseColors[c]]))); - flatBaseColors.splice(flatBaseColors.length, 0, ...baseColor); + flatBaseColors.splice(flatBaseColors.length, 0, ...baseColor.map(c => c / 255.0)); flatVariantColors.splice(flatVariantColors.length, 0, ...variantColor.map(c => c / 255.0)); } else { flatBaseColors.splice(flatBaseColors.length, 0, ...emptyColors); @@ -160,7 +160,7 @@ export default class SpritePipeline extends FieldSpritePipeline { } } - this.set4iv("baseVariantColors", flatBaseColors.flat()); + this.set4fv("baseVariantColors", flatBaseColors.flat()); this.set4fv("variantColors", flatVariantColors.flat()); } diff --git a/src/utils.ts b/src/utils.ts index 2f05e2724ff..ce9966c0d7f 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -405,8 +405,11 @@ export function deltaRgb(rgb1: number[], rgb2: number[]): number { return Math.ceil(Math.sqrt(2 * drp2 + 4 * dgp2 + 3 * dbp2 + (t * (drp2 - dbp2)) / 256)); } +// Extract out the rgb values from a hex string +const hexRegex = /^([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i; + export function rgbHexToRgba(hex: string) { - const color = hex.match(/^([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i) ?? ["000000", "00", "00", "00"]; + const color = hex.match(hexRegex) ?? ["000000", "00", "00", "00"]; return { r: Number.parseInt(color[1], 16), g: Number.parseInt(color[2], 16), From 82cd492117cf9a5c92d7b65322fcf34deac98a5a Mon Sep 17 00:00:00 2001 From: Lylian BALL <131535108+PyGaVS@users.noreply.github.com> Date: Fri, 18 Apr 2025 11:33:28 +0200 Subject: [PATCH 09/18] [Bug] Pokemon with illusion imitate the cry of the illusion (#5675) --- src/field/pokemon.ts | 9 ++++----- test/abilities/illusion.test.ts | 3 ++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 5ae7d227b3c..27c4edea297 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -1107,7 +1107,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { */ getSpeciesForm(ignoreOverride?: boolean, useIllusion: boolean = false): PokemonSpeciesForm { const species: PokemonSpecies = useIllusion && !!this.summonData?.illusion ? getPokemonSpecies(this.summonData?.illusion.species) : this.species; - const formIndex: integer = useIllusion && !!this.summonData?.illusion ? this.summonData?.illusion.formIndex : this.formIndex; if (!ignoreOverride && this.summonData?.speciesForm) { @@ -5282,13 +5281,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { sceneOverride?: BattleScene, ): AnySound { const scene = sceneOverride ?? globalScene; // TODO: is `sceneOverride` needed? - const cry = this.getSpeciesForm().cry(soundConfig); + const cry = this.getSpeciesForm(undefined, true).cry(soundConfig); let duration = cry.totalDuration * 1000; if ( this.fusionSpecies && - this.getSpeciesForm() !== this.getFusionSpeciesForm() + this.getSpeciesForm(undefined, true) !== this.getFusionSpeciesForm(undefined, true) ) { - let fusionCry = this.getFusionSpeciesForm().cry(soundConfig, true); + let fusionCry = this.getFusionSpeciesForm(undefined, true).cry(soundConfig, true); duration = Math.min(duration, fusionCry.totalDuration * 1000); fusionCry.destroy(); scene.time.delayedCall(fixedInt(Math.ceil(duration * 0.4)), () => { @@ -5298,7 +5297,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { cry, fixedInt(Math.ceil(duration * 0.2)), ); - fusionCry = this.getFusionSpeciesForm().cry( + fusionCry = this.getFusionSpeciesForm(undefined, true).cry( Object.assign( { seek: Math.max(fusionCry.totalDuration * 0.4, 0) }, soundConfig, diff --git a/test/abilities/illusion.test.ts b/test/abilities/illusion.test.ts index aa77aa701b2..bdb235f458b 100644 --- a/test/abilities/illusion.test.ts +++ b/test/abilities/illusion.test.ts @@ -7,6 +7,7 @@ import { Moves } from "#enums/moves"; import { Abilities } from "#enums/abilities"; import { PokeballType } from "#app/enums/pokeball"; import { Gender } from "#app/data/gender"; +import { BerryPhase } from "#app/phases/berry-phase"; describe("Abilities - Illusion", () => { let phaserGame: Phaser.Game; @@ -66,7 +67,7 @@ describe("Abilities - Illusion", () => { expect(!!zorua.summonData?.illusion).equals(false); }); - it("break if the ability is suppressed", async () => { + it("break with neutralizing gas", async () => { game.override.enemyAbility(Abilities.NEUTRALIZING_GAS); await game.classicMode.startBattle([Species.KOFFING]); From 54ce58411b18781acd32c41b7631c66c14000bfc Mon Sep 17 00:00:00 2001 From: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Date: Fri, 18 Apr 2025 04:35:46 -0500 Subject: [PATCH 10/18] [Bug] Fix forced switch bugs in enemy partner trainer battles (#5644) * Add isPartner method to trainer class * Ensure force switches cannot pull pokemon from the wrong trainer * Add override for battle type * Fixup tests and broken assumptions * Make move fail override semi-invuln check Bandaid fix because move effect phase does not allow for the move to fail if all of its conditions fail * Restore overrides * Apply kev's suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Fix illusion test battle type invocation * Update struggle and healer tests to use battleStyle --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --- src/battle-scene.ts | 33 ++-- src/battle.ts | 8 +- src/data/abilities/ability.ts | 8 +- src/data/challenge.ts | 3 +- src/data/moves/move.ts | 45 +++--- .../utils/encounter-phase-utils.ts | 3 +- src/enums/battle-type.ts | 6 + src/field/trainer.ts | 7 + src/overrides.ts | 28 +++- src/phases/command-phase.ts | 2 +- src/phases/encounter-phase.ts | 3 +- src/phases/faint-phase.ts | 2 +- src/phases/game-over-phase.ts | 2 +- src/phases/summon-phase.ts | 2 +- src/phases/title-phase.ts | 2 +- src/phases/victory-phase.ts | 3 +- src/system/game-data.ts | 2 +- src/system/pokemon-data.ts | 2 +- src/ui/fight-ui-handler.ts | 2 +- src/ui/run-history-ui-handler.ts | 2 +- src/ui/run-info-ui-handler.ts | 2 +- test/abilities/ability_duplication.test.ts | 2 +- test/abilities/ability_timing.test.ts | 2 +- test/abilities/analytic.test.ts | 4 +- test/abilities/arena_trap.test.ts | 4 +- test/abilities/aroma_veil.test.ts | 2 +- test/abilities/aura_break.test.ts | 2 +- test/abilities/battery.test.ts | 2 +- test/abilities/battle_bond.test.ts | 2 +- test/abilities/beast_boost.test.ts | 2 +- test/abilities/commander.test.ts | 2 +- test/abilities/competitive.test.ts | 2 +- test/abilities/contrary.test.ts | 2 +- test/abilities/corrosion.test.ts | 2 +- test/abilities/costar.test.ts | 2 +- test/abilities/dancer.test.ts | 2 +- test/abilities/defiant.test.ts | 2 +- test/abilities/desolate-land.test.ts | 8 +- test/abilities/disguise.test.ts | 2 +- test/abilities/dry_skin.test.ts | 2 +- test/abilities/early_bird.test.ts | 2 +- test/abilities/flash_fire.test.ts | 2 +- test/abilities/flower_gift.test.ts | 4 +- test/abilities/flower_veil.test.ts | 14 +- test/abilities/forecast.test.ts | 2 +- test/abilities/friend_guard.test.ts | 2 +- test/abilities/galvanize.test.ts | 2 +- test/abilities/good_as_gold.test.ts | 12 +- test/abilities/gorilla_tactics.test.ts | 2 +- test/abilities/gulp_missile.test.ts | 2 +- test/abilities/healer.test.ts | 2 +- test/abilities/heatproof.test.ts | 2 +- test/abilities/honey_gather.test.ts | 2 +- test/abilities/hustle.test.ts | 2 +- test/abilities/hyper_cutter.test.ts | 2 +- test/abilities/ice_face.test.ts | 2 +- test/abilities/illuminate.test.ts | 2 +- test/abilities/illusion.test.ts | 2 +- test/abilities/immunity.test.ts | 12 +- test/abilities/imposter.test.ts | 2 +- test/abilities/infiltrator.test.ts | 2 +- test/abilities/insomnia.test.ts | 12 +- test/abilities/intimidate.test.ts | 4 +- test/abilities/intrepid_sword.test.ts | 2 +- test/abilities/libero.test.ts | 2 +- test/abilities/lightningrod.test.ts | 2 +- test/abilities/limber.test.ts | 12 +- test/abilities/magic_bounce.test.ts | 12 +- test/abilities/magma_armor.test.ts | 12 +- test/abilities/mimicry.test.ts | 2 +- test/abilities/mirror_armor.test.ts | 10 +- test/abilities/mold_breaker.test.ts | 13 +- test/abilities/moody.test.ts | 2 +- test/abilities/moxie.test.ts | 4 +- test/abilities/mummy.test.ts | 2 +- test/abilities/mycelium_might.test.ts | 2 +- test/abilities/neutralizing_gas.test.ts | 8 +- test/abilities/no_guard.test.ts | 2 +- test/abilities/oblivious.test.ts | 20 +-- test/abilities/own_tempo.test.ts | 12 +- test/abilities/parental_bond.test.ts | 4 +- test/abilities/pastel_veil.test.ts | 2 +- test/abilities/perish_body.test.ts | 2 +- test/abilities/power_construct.test.ts | 2 +- test/abilities/power_spot.test.ts | 2 +- test/abilities/protean.test.ts | 2 +- test/abilities/protosynthesis.test.ts | 2 +- test/abilities/quick_draw.test.ts | 2 +- test/abilities/sand_spit.test.ts | 2 +- test/abilities/sand_veil.test.ts | 2 +- test/abilities/sap_sipper.test.ts | 2 +- test/abilities/schooling.test.ts | 2 +- test/abilities/screen_cleaner.test.ts | 2 +- test/abilities/seed_sower.test.ts | 2 +- test/abilities/serene_grace.test.ts | 2 +- test/abilities/sheer_force.test.ts | 2 +- test/abilities/shield_dust.test.ts | 2 +- test/abilities/shields_down.test.ts | 2 +- test/abilities/simple.test.ts | 2 +- test/abilities/speed_boost.test.ts | 2 +- test/abilities/stakeout.test.ts | 2 +- test/abilities/stall.test.ts | 2 +- test/abilities/steely_spirit.test.ts | 2 +- test/abilities/storm_drain.test.ts | 2 +- test/abilities/sturdy.test.ts | 2 +- test/abilities/super_luck.test.ts | 2 +- test/abilities/supreme_overlord.test.ts | 2 +- test/abilities/sweet_veil.test.ts | 2 +- test/abilities/synchronize.test.ts | 2 +- test/abilities/tera_shell.test.ts | 2 +- test/abilities/thermal_exchange.test.ts | 12 +- test/abilities/trace.test.ts | 2 +- test/abilities/unburden.test.ts | 6 +- test/abilities/unseen_fist.test.ts | 2 +- test/abilities/victory_star.test.ts | 2 +- test/abilities/vital_spirit.test.ts | 12 +- test/abilities/volt_absorb.test.ts | 2 +- test/abilities/wandering_spirit.test.ts | 2 +- test/abilities/water_bubble.test.ts | 12 +- test/abilities/water_veil.test.ts | 12 +- test/abilities/wimp_out.test.ts | 15 +- test/abilities/wind_power.test.ts | 2 +- test/abilities/wind_rider.test.ts | 2 +- test/abilities/wonder_skin.test.ts | 2 +- test/abilities/zen_mode.test.ts | 2 +- test/abilities/zero_to_hero.test.ts | 2 +- test/arena/arena_gravity.test.ts | 2 +- test/arena/grassy_terrain.test.ts | 2 +- test/arena/weather_fog.test.ts | 2 +- test/arena/weather_hail.test.ts | 2 +- test/arena/weather_sandstorm.test.ts | 4 +- test/arena/weather_strong_winds.test.ts | 2 +- test/battle/ability_swap.test.ts | 2 +- test/battle/battle-order.test.ts | 8 +- test/battle/battle.test.ts | 20 +-- test/battle/damage_calculation.test.ts | 2 +- test/battle/double_battle.test.ts | 2 +- test/battle/inverse_battle.test.ts | 2 +- test/battle/special_battle.test.ts | 18 +-- test/boss-pokemon.test.ts | 8 +- test/daily_mode.test.ts | 2 +- test/data/status_effect.test.ts | 4 +- test/escape-calculations.test.ts | 6 +- test/evolution.test.ts | 2 +- test/items/dire_hit.test.ts | 2 +- test/items/eviolite.test.ts | 2 +- test/items/exp_booster.test.ts | 2 +- test/items/grip_claw.test.ts | 4 +- test/items/leek.test.ts | 2 +- test/items/leftovers.test.ts | 2 +- test/items/light_ball.test.ts | 2 +- test/items/lock_capsule.test.ts | 2 +- test/items/metal_powder.test.ts | 2 +- test/items/multi_lens.test.ts | 6 +- test/items/mystical_rock.test.ts | 2 +- test/items/quick_powder.test.ts | 2 +- test/items/reviver_seed.test.ts | 2 +- test/items/scope_lens.test.ts | 2 +- test/items/temp_stat_stage_booster.test.ts | 2 +- test/items/thick_club.test.ts | 2 +- test/items/toxic_orb.test.ts | 2 +- test/moves/after_you.test.ts | 2 +- test/moves/alluring_voice.test.ts | 2 +- test/moves/aromatherapy.test.ts | 2 +- test/moves/assist.test.ts | 2 +- test/moves/astonish.test.ts | 2 +- test/moves/aurora_veil.test.ts | 6 +- test/moves/autotomize.test.ts | 2 +- test/moves/baddy_bad.test.ts | 2 +- test/moves/baneful_bunker.test.ts | 2 +- test/moves/baton_pass.test.ts | 2 +- test/moves/beak_blast.test.ts | 2 +- test/moves/beat_up.test.ts | 2 +- test/moves/burning_jealousy.test.ts | 4 +- test/moves/camouflage.test.ts | 2 +- test/moves/ceaseless_edge.test.ts | 2 +- test/moves/chilly_reception.test.ts | 6 +- test/moves/chloroblast.test.ts | 2 +- test/moves/copycat.test.ts | 2 +- test/moves/crafty_shield.test.ts | 2 +- test/moves/defog.test.ts | 2 +- test/moves/destiny_bond.test.ts | 6 +- test/moves/diamond_storm.test.ts | 4 +- test/moves/dig.test.ts | 2 +- test/moves/disable.test.ts | 2 +- test/moves/dive.test.ts | 2 +- test/moves/doodle.test.ts | 6 +- test/moves/double_team.test.ts | 2 +- test/moves/dragon_cheer.test.ts | 2 +- test/moves/dragon_rage.test.ts | 2 +- test/moves/dragon_tail.test.ts | 6 +- test/moves/dynamax_cannon.test.ts | 2 +- test/moves/electrify.test.ts | 2 +- test/moves/electro_shot.test.ts | 2 +- test/moves/encore.test.ts | 2 +- test/moves/endure.test.ts | 2 +- test/moves/entrainment.test.ts | 2 +- test/moves/fairy_lock.test.ts | 2 +- test/moves/fake_out.test.ts | 2 +- test/moves/false_swipe.test.ts | 2 +- test/moves/fell_stinger.test.ts | 8 +- test/moves/fissure.test.ts | 2 +- test/moves/flame_burst.test.ts | 2 +- test/moves/flower_shield.test.ts | 4 +- test/moves/fly.test.ts | 2 +- test/moves/focus_punch.test.ts | 2 +- test/moves/follow_me.test.ts | 2 +- test/moves/forests_curse.test.ts | 2 +- test/moves/freeze_dry.test.ts | 2 +- test/moves/freezy_frost.test.ts | 4 +- test/moves/fusion_bolt.test.ts | 2 +- test/moves/fusion_flare.test.ts | 2 +- test/moves/fusion_flare_bolt.test.ts | 2 +- test/moves/future_sight.test.ts | 2 +- test/moves/gastro_acid.test.ts | 4 +- test/moves/geomancy.test.ts | 2 +- test/moves/gigaton_hammer.test.ts | 2 +- test/moves/glaive_rush.test.ts | 2 +- test/moves/growth.test.ts | 2 +- test/moves/grudge.test.ts | 2 +- test/moves/guard_split.test.ts | 2 +- test/moves/guard_swap.test.ts | 2 +- test/moves/hard_press.test.ts | 2 +- test/moves/haze.test.ts | 2 +- test/moves/heal_bell.test.ts | 2 +- test/moves/heart_swap.test.ts | 2 +- test/moves/hyper_beam.test.ts | 2 +- test/moves/imprison.test.ts | 2 +- test/moves/instruct.test.ts | 22 +-- test/moves/jaw_lock.test.ts | 4 +- test/moves/lash_out.test.ts | 2 +- test/moves/last_respects.test.ts | 2 +- test/moves/light_screen.test.ts | 4 +- test/moves/lucky_chant.test.ts | 4 +- test/moves/lunar_blessing.test.ts | 2 +- test/moves/lunar_dance.test.ts | 2 +- test/moves/magic_coat.test.ts | 12 +- test/moves/magnet_rise.test.ts | 2 +- test/moves/make_it_rain.test.ts | 4 +- test/moves/mat_block.test.ts | 2 +- test/moves/metal_burst.test.ts | 2 +- test/moves/metronome.test.ts | 4 +- test/moves/mirror_move.test.ts | 4 +- test/moves/mist.test.ts | 2 +- test/moves/moongeist_beam.test.ts | 2 +- test/moves/multi_target.test.ts | 2 +- test/moves/nightmare.test.ts | 2 +- test/moves/obstruct.test.ts | 2 +- test/moves/octolock.test.ts | 2 +- test/moves/order_up.test.ts | 2 +- test/moves/parting_shot.test.ts | 2 +- test/moves/plasma_fists.test.ts | 6 +- test/moves/pledge_moves.test.ts | 4 +- test/moves/pollen_puff.test.ts | 4 +- test/moves/powder.test.ts | 10 +- test/moves/power_shift.test.ts | 2 +- test/moves/power_split.test.ts | 2 +- test/moves/power_swap.test.ts | 2 +- test/moves/power_trick.test.ts | 2 +- test/moves/protect.test.ts | 2 +- test/moves/psycho_shift.test.ts | 2 +- test/moves/purify.test.ts | 2 +- test/moves/quash.test.ts | 2 +- test/moves/quick_guard.test.ts | 4 +- test/moves/rage_fist.test.ts | 2 +- test/moves/rage_powder.test.ts | 2 +- test/moves/reflect.test.ts | 4 +- test/moves/reflect_type.test.ts | 2 +- test/moves/relic_song.test.ts | 2 +- test/moves/retaliate.test.ts | 2 +- test/moves/revival_blessing.test.ts | 6 +- test/moves/role_play.test.ts | 2 +- test/moves/rollout.test.ts | 2 +- test/moves/roost.test.ts | 2 +- test/moves/round.test.ts | 2 +- test/moves/safeguard.test.ts | 4 +- test/moves/scale_shot.test.ts | 2 +- test/moves/secret_power.test.ts | 4 +- test/moves/shed_tail.test.ts | 2 +- test/moves/shell_side_arm.test.ts | 2 +- test/moves/shell_trap.test.ts | 4 +- test/moves/simple_beam.test.ts | 2 +- test/moves/sketch.test.ts | 2 +- test/moves/skill_swap.test.ts | 2 +- test/moves/sleep_talk.test.ts | 2 +- test/moves/solar_beam.test.ts | 2 +- test/moves/sparkly_swirl.test.ts | 4 +- test/moves/speed_swap.test.ts | 2 +- test/moves/spikes.test.ts | 4 +- test/moves/spit_up.test.ts | 2 +- test/moves/spotlight.test.ts | 2 +- test/moves/steamroller.test.ts | 2 +- test/moves/stockpile.test.ts | 2 +- test/moves/struggle.test.ts | 2 +- test/moves/substitute.test.ts | 2 +- test/moves/swallow.test.ts | 2 +- test/moves/syrup_bomb.test.ts | 2 +- test/moves/tackle.test.ts | 2 +- test/moves/tail_whip.test.ts | 2 +- test/moves/tailwind.test.ts | 6 +- test/moves/tar_shot.test.ts | 2 +- test/moves/taunt.test.ts | 2 +- test/moves/telekinesis.test.ts | 2 +- test/moves/tera_blast.test.ts | 2 +- test/moves/tera_starstorm.test.ts | 4 +- test/moves/thousand_arrows.test.ts | 2 +- test/moves/throat_chop.test.ts | 2 +- test/moves/thunder_wave.test.ts | 2 +- test/moves/tidy_up.test.ts | 2 +- test/moves/torment.test.ts | 2 +- test/moves/toxic.test.ts | 2 +- test/moves/toxic_spikes.test.ts | 2 +- test/moves/transform.test.ts | 2 +- test/moves/trick_or_treat.test.ts | 2 +- test/moves/triple_arrows.test.ts | 2 +- test/moves/u_turn.test.ts | 2 +- test/moves/upper_hand.test.ts | 2 +- test/moves/whirlwind.test.ts | 66 +++++++- test/moves/wide_guard.test.ts | 2 +- test/moves/will_o_wisp.test.ts | 2 +- test/phases/form-change-phase.test.ts | 2 +- test/phases/frenzy-move-reset.test.ts | 2 +- test/phases/game-over-phase.test.ts | 2 +- test/reload.test.ts | 12 +- test/system/game_data.test.ts | 2 +- test/testUtils/gameManagerUtils.ts | 3 +- test/testUtils/helpers/overridesHelper.ts | 147 +++++++++++------- test/ui/battle_info.test.ts | 2 +- test/ui/transfer-item.test.ts | 2 +- test/ui/type-hints.test.ts | 4 +- 330 files changed, 757 insertions(+), 628 deletions(-) create mode 100644 src/enums/battle-type.ts diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 90f53d6a95e..0fe4c7f7e4f 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -77,7 +77,8 @@ import { } from "#app/data/abilities/ability"; import { allAbilities } from "./data/data-lists"; import type { FixedBattleConfig } from "#app/battle"; -import Battle, { BattleType } from "#app/battle"; +import Battle from "#app/battle"; +import { BattleType } from "#enums/battle-type"; import type { GameMode } from "#app/game-mode"; import { GameModes, getGameMode } from "#app/game-mode"; import FieldSpritePipeline from "#app/pipelines/field-sprite"; @@ -1338,22 +1339,27 @@ export default class BattleScene extends SceneBase { } else { if ( !this.gameMode.hasTrainers || + Overrides.BATTLE_TYPE_OVERRIDE === BattleType.WILD || (Overrides.DISABLE_STANDARD_TRAINERS_OVERRIDE && isNullOrUndefined(trainerData)) ) { newBattleType = BattleType.WILD; - } else if (battleType === undefined) { - newBattleType = this.gameMode.isWaveTrainer(newWaveIndex, this.arena) ? BattleType.TRAINER : BattleType.WILD; } else { - newBattleType = battleType; + newBattleType = + Overrides.BATTLE_TYPE_OVERRIDE ?? + battleType ?? + (this.gameMode.isWaveTrainer(newWaveIndex, this.arena) ? BattleType.TRAINER : BattleType.WILD); } if (newBattleType === BattleType.TRAINER) { - const trainerType = this.arena.randomTrainerType(newWaveIndex); + const trainerType = + Overrides.RANDOM_TRAINER_OVERRIDE?.trainerType ?? this.arena.randomTrainerType(newWaveIndex); let doubleTrainer = false; if (trainerConfigs[trainerType].doubleOnly) { doubleTrainer = true; } else if (trainerConfigs[trainerType].hasDouble) { - doubleTrainer = !randSeedInt(this.getDoubleBattleChance(newWaveIndex, playerField)); + doubleTrainer = + Overrides.RANDOM_TRAINER_OVERRIDE?.alwaysDouble || + !randSeedInt(this.getDoubleBattleChance(newWaveIndex, playerField)); // Add a check that special trainers can't be double except for tate and liza - they should use the normal double chance if ( trainerConfigs[trainerType].trainerTypeDouble && @@ -1373,7 +1379,10 @@ export default class BattleScene extends SceneBase { // Check for mystery encounter // Can only occur in place of a standard (non-boss) wild battle, waves 10-180 - if (this.isWaveMysteryEncounter(newBattleType, newWaveIndex) || newBattleType === BattleType.MYSTERY_ENCOUNTER) { + if ( + !Overrides.BATTLE_TYPE_OVERRIDE && + (this.isWaveMysteryEncounter(newBattleType, newWaveIndex) || newBattleType === BattleType.MYSTERY_ENCOUNTER) + ) { newBattleType = BattleType.MYSTERY_ENCOUNTER; // Reset to base spawn weight this.mysteryEncounterSaveData.encounterSpawnChance = BASE_MYSTERY_ENCOUNTER_SPAWN_WEIGHT; @@ -1383,9 +1392,9 @@ export default class BattleScene extends SceneBase { if (double === undefined && newWaveIndex > 1) { if (newBattleType === BattleType.WILD && !this.gameMode.isWaveFinal(newWaveIndex)) { newDouble = !randSeedInt(this.getDoubleBattleChance(newWaveIndex, playerField)); - } else if (newBattleType === BattleType.TRAINER) { - newDouble = newTrainer?.variant === TrainerVariant.DOUBLE; } + } else if (double === undefined && newBattleType === BattleType.TRAINER) { + newDouble = newTrainer?.variant === TrainerVariant.DOUBLE; } else if (!battleConfig) { newDouble = !!double; } @@ -1395,10 +1404,10 @@ export default class BattleScene extends SceneBase { newDouble = false; } - if (!isNullOrUndefined(Overrides.BATTLE_TYPE_OVERRIDE)) { + if (!isNullOrUndefined(Overrides.BATTLE_STYLE_OVERRIDE)) { let doubleOverrideForWave: "single" | "double" | null = null; - switch (Overrides.BATTLE_TYPE_OVERRIDE) { + switch (Overrides.BATTLE_STYLE_OVERRIDE) { case "double": doubleOverrideForWave = "double"; break; @@ -1418,7 +1427,7 @@ export default class BattleScene extends SceneBase { } /** * Override battles into single only if not fighting with trainers. - * @see {@link https://github.com/pagefaultgames/pokerogue/issues/1948 | GitHub Issue #1948} + * @see {@link https://github.com/pagefaultgames/pokerogue/issues/1948 GitHub Issue #1948} */ if (newBattleType !== BattleType.TRAINER && doubleOverrideForWave === "single") { newDouble = false; diff --git a/src/battle.ts b/src/battle.ts index fb5af223b8f..3e2f293065a 100644 --- a/src/battle.ts +++ b/src/battle.ts @@ -30,6 +30,7 @@ import { MysteryEncounterMode } from "#enums/mystery-encounter-mode"; import type { CustomModifierSettings } from "#app/modifier/modifier-type"; import { ModifierTier } from "#app/modifier/modifier-tier"; import type { MysteryEncounterType } from "#enums/mystery-encounter-type"; +import { BattleType } from "#enums/battle-type"; export enum ClassicFixedBossWaves { TOWN_YOUNGSTER = 5, @@ -54,13 +55,6 @@ export enum ClassicFixedBossWaves { RIVAL_6 = 195, } -export enum BattleType { - WILD, - TRAINER, - CLEAR, - MYSTERY_ENCOUNTER, -} - export enum BattlerIndex { ATTACKER = -1, PLAYER, diff --git a/src/data/abilities/ability.ts b/src/data/abilities/ability.ts index 6cbb579d4e0..a3bd9b728f5 100644 --- a/src/data/abilities/ability.ts +++ b/src/data/abilities/ability.ts @@ -30,7 +30,7 @@ import i18next from "i18next"; import { Command } from "#app/ui/command-ui-handler"; import { BerryModifierType } from "#app/modifier/modifier-type"; import { getPokeballName } from "#app/data/pokeball"; -import { BattleType } from "#app/battle"; +import { BattleType } from "#enums/battle-type"; import { MovePhase } from "#app/phases/move-phase"; import { PokemonHealPhase } from "#app/phases/pokemon-heal-phase"; import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase"; @@ -44,6 +44,7 @@ import { PokemonTransformPhase } from "#app/phases/pokemon-transform-phase"; import { allAbilities } from "#app/data/data-lists"; import { AbAttr } from "#app/data/abilities/ab-attrs/ab-attr"; import { Ability } from "#app/data/abilities/ability-class"; +import { TrainerVariant } from "#app/field/trainer"; // Enum imports import { Stat, type BattleStat , BATTLE_STATS, EFFECTIVE_STATS, getStatKey, type EffectiveStat } from "#enums/stat"; @@ -61,6 +62,7 @@ import { MoveFlags } from "#enums/MoveFlags"; import { MoveTarget } from "#enums/MoveTarget"; import { MoveCategory } from "#enums/MoveCategory"; + // Type imports import type { EnemyPokemon, PokemonMove } from "#app/field/pokemon"; import type Pokemon from "#app/field/pokemon"; @@ -5526,8 +5528,8 @@ class ForceSwitchOutHelper { const party = player ? globalScene.getPlayerParty() : globalScene.getEnemyParty(); return (!player && globalScene.currentBattle.battleType === BattleType.WILD) - || party.filter(p => p.isAllowedInBattle() - && (player || (p as EnemyPokemon).trainerSlot === (switchOutTarget as EnemyPokemon).trainerSlot)).length > globalScene.currentBattle.getBattlerCount(); + || party.filter(p => p.isAllowedInBattle() && !p.isOnField() + && (player || (p as EnemyPokemon).trainerSlot === (switchOutTarget as EnemyPokemon).trainerSlot)).length > 0; } /** diff --git a/src/data/challenge.ts b/src/data/challenge.ts index 51616c3f00f..cc5783ad1fb 100644 --- a/src/data/challenge.ts +++ b/src/data/challenge.ts @@ -8,7 +8,8 @@ import { speciesStarterCosts } from "#app/data/balance/starters"; import type Pokemon from "#app/field/pokemon"; import { PokemonMove } from "#app/field/pokemon"; import type { FixedBattleConfig } from "#app/battle"; -import { ClassicFixedBossWaves, BattleType, getRandomTrainerFunc } from "#app/battle"; +import { ClassicFixedBossWaves, getRandomTrainerFunc } from "#app/battle"; +import { BattleType } from "#enums/battle-type"; import Trainer, { TrainerVariant } from "#app/field/trainer"; import { PokemonType } from "#enums/pokemon-type"; import { Challenges } from "#enums/challenges"; diff --git a/src/data/moves/move.ts b/src/data/moves/move.ts index c2dd0ec31ca..6e5e09839c1 100644 --- a/src/data/moves/move.ts +++ b/src/data/moves/move.ts @@ -75,7 +75,7 @@ import { PreserveBerryModifier, } from "../../modifier/modifier"; import type { BattlerIndex } from "../../battle"; -import { BattleType } from "../../battle"; +import { BattleType } from "#enums/battle-type"; import { TerrainType } from "../terrain"; import { ModifierPoolType } from "#app/modifier/modifier-type"; import { Command } from "../../ui/command-ui-handler"; @@ -121,6 +121,7 @@ import { MoveFlags } from "#enums/MoveFlags"; import { MoveEffectTrigger } from "#enums/MoveEffectTrigger"; import { MultiHitType } from "#enums/MultiHitType"; import { invalidAssistMoves, invalidCopycatMoves, invalidMetronomeMoves, invalidMirrorMoveMoves, invalidSleepTalkMoves } from "./invalid-moves"; +import { TrainerVariant } from "#app/field/trainer"; type MoveConditionFunc = (user: Pokemon, target: Pokemon, move: Move) => boolean; type UserMoveConditionFunc = (user: Pokemon, move: Move) => boolean; @@ -6295,9 +6296,10 @@ export class ForceSwitchOutAttr extends MoveEffectAttr { return false; } else if (globalScene.currentBattle.battleType !== BattleType.WILD) { // Switch out logic for enemy trainers // Find indices of off-field Pokemon that are eligible to be switched into + const isPartnerTrainer = globalScene.currentBattle.trainer?.isPartner(); const eligibleNewIndices: number[] = []; globalScene.getEnemyParty().forEach((pokemon, index) => { - if (pokemon.isAllowedInBattle() && !pokemon.isOnField()) { + if (pokemon.isAllowedInBattle() && !pokemon.isOnField() && (!isPartnerTrainer || pokemon.trainerSlot === (switchOutTarget as EnemyPokemon).trainerSlot)) { eligibleNewIndices.push(index); } }); @@ -6347,15 +6349,6 @@ export class ForceSwitchOutAttr extends MoveEffectAttr { } } - if (globalScene.currentBattle.waveIndex % 10 === 0) { - return false; - } - - // Don't allow wild mons to flee with U-turn et al. - if (this.selfSwitch && !user.isPlayer() && move.category !== MoveCategory.STATUS) { - return false; - } - const allyPokemon = switchOutTarget.getAlly(); if (switchOutTarget.hp > 0) { @@ -6368,13 +6361,12 @@ export class ForceSwitchOutAttr extends MoveEffectAttr { } } - if (!allyPokemon?.isActive(true)) { - globalScene.clearEnemyHeldItemModifiers(); + // clear out enemy held item modifiers of the switch out target + globalScene.clearEnemyHeldItemModifiers(switchOutTarget); - if (switchOutTarget.hp) { + if (!allyPokemon?.isActive(true) && switchOutTarget.hp) { globalScene.pushPhase(new BattleEndPhase(false)); globalScene.pushPhase(new NewBattlePhase()); - } } } @@ -6393,6 +6385,7 @@ export class ForceSwitchOutAttr extends MoveEffectAttr { } } + getSwitchOutCondition(): MoveConditionFunc { return (user, target, move) => { const switchOutTarget = (this.selfSwitch ? user : target); @@ -6416,23 +6409,23 @@ export class ForceSwitchOutAttr extends MoveEffectAttr { const blockedByAbility = new BooleanHolder(false); applyAbAttrs(ForceSwitchOutImmunityAbAttr, target, blockedByAbility); - return !blockedByAbility.value; + if (blockedByAbility.value) { + return false; + } } + if (!player && globalScene.currentBattle.battleType === BattleType.WILD) { - if (this.isBatonPass()) { - return false; - } - // Don't allow wild opponents to flee on the boss stage since it can ruin a run early on - if (globalScene.currentBattle.waveIndex % 10 === 0) { - return false; - } + // wild pokemon cannot switch out with baton pass. + return !this.isBatonPass() + && globalScene.currentBattle.waveIndex % 10 !== 0 + // Don't allow wild mons to flee with U-turn et al. + && !(this.selfSwitch && MoveCategory.STATUS !== move.category); } const party = player ? globalScene.getPlayerParty() : globalScene.getEnemyParty(); - return (!player && !globalScene.currentBattle.battleType) - || party.filter(p => p.isAllowedInBattle() - && (player || (p as EnemyPokemon).trainerSlot === (switchOutTarget as EnemyPokemon).trainerSlot)).length > globalScene.currentBattle.getBattlerCount(); + return party.filter(p => p.isAllowedInBattle() && !p.isOnField() + && (player || (p as EnemyPokemon).trainerSlot === (switchOutTarget as EnemyPokemon).trainerSlot)).length > 0; }; } diff --git a/src/data/mystery-encounters/utils/encounter-phase-utils.ts b/src/data/mystery-encounters/utils/encounter-phase-utils.ts index a9f6b787878..69b0d81520a 100644 --- a/src/data/mystery-encounters/utils/encounter-phase-utils.ts +++ b/src/data/mystery-encounters/utils/encounter-phase-utils.ts @@ -1,5 +1,6 @@ import type Battle from "#app/battle"; -import { BattlerIndex, BattleType } from "#app/battle"; +import { BattlerIndex } from "#app/battle"; +import { BattleType } from "#enums/battle-type"; import { biomeLinks, BiomePoolTier } from "#app/data/balance/biomes"; import type MysteryEncounterOption from "#app/data/mystery-encounters/mystery-encounter-option"; import { diff --git a/src/enums/battle-type.ts b/src/enums/battle-type.ts new file mode 100644 index 00000000000..81cf89ef488 --- /dev/null +++ b/src/enums/battle-type.ts @@ -0,0 +1,6 @@ +export enum BattleType { + WILD, + TRAINER, + CLEAR, + MYSTERY_ENCOUNTER +} diff --git a/src/field/trainer.ts b/src/field/trainer.ts index 30cf43b54a1..1679e6f12e0 100644 --- a/src/field/trainer.ts +++ b/src/field/trainer.ts @@ -223,6 +223,13 @@ export default class Trainer extends Phaser.GameObjects.Container { return this.config.doubleOnly || this.variant === TrainerVariant.DOUBLE; } + /** + * Return whether the trainer is a duo, like Tate & Liza + */ + isPartner(): boolean { + return this.variant === TrainerVariant.DOUBLE; + } + getMixedBattleBgm(): string { return this.config.mixedBattleBgm; } diff --git a/src/overrides.ts b/src/overrides.ts index 21c72cd7b98..d36cfbfac98 100644 --- a/src/overrides.ts +++ b/src/overrides.ts @@ -15,11 +15,13 @@ import { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { PokeballType } from "#enums/pokeball"; import { PokemonType } from "#enums/pokemon-type"; import { Species } from "#enums/species"; -import { Stat } from "#enums/stat"; +import { BATTLE_STATS, Stat } from "#enums/stat"; import { StatusEffect } from "#enums/status-effect"; import { TimeOfDay } from "#enums/time-of-day"; import { VariantTier } from "#enums/variant-tier"; import { WeatherType } from "#enums/weather-type"; +import { TrainerType } from "#enums/trainer-type"; +import { BattleType } from "#enums/battle-type"; /** * This comment block exists to prevent IDEs from automatically removing unused imports @@ -41,7 +43,7 @@ import { WeatherType } from "#enums/weather-type"; * } * ``` */ -const overrides = {} satisfies Partial>; +const overrides = {} satisfies Partial>; /** * If you need to add Overrides values for local testing do that inside {@linkcode overrides} @@ -69,7 +71,7 @@ class DefaultOverrides { * * If `"odd-doubles"`, follow the `"double"` rule on odd wave numbers, and follow the `"single"` rule on even wave numbers. */ - readonly BATTLE_TYPE_OVERRIDE: BattleStyle | null = null; + readonly BATTLE_STYLE_OVERRIDE: BattleStyle | null = null; readonly STARTING_WAVE_OVERRIDE: number = 0; readonly STARTING_BIOME_OVERRIDE: Biome = Biome.TOWN; readonly ARENA_TINT_OVERRIDE: TimeOfDay | null = null; @@ -259,6 +261,16 @@ class DefaultOverrides { * If `true`, disable all non-scripted opponent trainer encounters. */ readonly DISABLE_STANDARD_TRAINERS_OVERRIDE: boolean = false; + + /** + * Set all non-scripted waves to use the selected battle type. + * + * Ignored if set to {@linkcode BattleType.TRAINER} and `DISABLE_STANDARD_TRAINERS_OVERRIDE` is `true`. + */ + readonly BATTLE_TYPE_OVERRIDE: Exclude | null = null; + + /** Force all random trainer types to be the provided type. */ + readonly RANDOM_TRAINER_OVERRIDE: RandomTrainerOverride | null = null; } export const defaultOverrides = new DefaultOverrides(); @@ -269,3 +281,13 @@ export default { } satisfies InstanceType; export type BattleStyle = "double" | "single" | "even-doubles" | "odd-doubles"; + +export type RandomTrainerOverride = { + /** The Type of trainer to force */ + trainerType: Exclude, + /* If the selected trainer type has a double version, it will always use its double version. */ + alwaysDouble?: boolean +} + +/** The type of the {@linkcode DefaultOverrides} class */ +export type OverridesType = typeof DefaultOverrides; \ No newline at end of file diff --git a/src/phases/command-phase.ts b/src/phases/command-phase.ts index 8691ac453ca..30343f92aa3 100644 --- a/src/phases/command-phase.ts +++ b/src/phases/command-phase.ts @@ -1,6 +1,6 @@ import { globalScene } from "#app/global-scene"; import type { TurnCommand } from "#app/battle"; -import { BattleType } from "#app/battle"; +import { BattleType } from "#enums/battle-type"; import type { EncoreTag } from "#app/data/battler-tags"; import { TrappedTag } from "#app/data/battler-tags"; import type { MoveTargetSet } from "#app/data/moves/move"; diff --git a/src/phases/encounter-phase.ts b/src/phases/encounter-phase.ts index 67236c1c041..c196608f91e 100644 --- a/src/phases/encounter-phase.ts +++ b/src/phases/encounter-phase.ts @@ -1,4 +1,5 @@ -import { BattlerIndex, BattleType } from "#app/battle"; +import { BattlerIndex } from "#app/battle"; +import { BattleType } from "#enums/battle-type"; import { globalScene } from "#app/global-scene"; import { PLAYER_PARTY_MAX_SIZE } from "#app/constants"; import { applyAbAttrs, SyncEncounterNatureAbAttr, applyPreSummonAbAttrs, PreSummonAbAttr } from "#app/data/abilities/ability"; diff --git a/src/phases/faint-phase.ts b/src/phases/faint-phase.ts index d1856c9331c..2719206a6cc 100644 --- a/src/phases/faint-phase.ts +++ b/src/phases/faint-phase.ts @@ -1,5 +1,5 @@ import type { BattlerIndex } from "#app/battle"; -import { BattleType } from "#app/battle"; +import { BattleType } from "#enums/battle-type"; import { globalScene } from "#app/global-scene"; import { applyPostFaintAbAttrs, diff --git a/src/phases/game-over-phase.ts b/src/phases/game-over-phase.ts index 1ccdc9c7106..9e79eafe88b 100644 --- a/src/phases/game-over-phase.ts +++ b/src/phases/game-over-phase.ts @@ -1,5 +1,5 @@ import { clientSessionId } from "#app/account"; -import { BattleType } from "#app/battle"; +import { BattleType } from "#enums/battle-type"; import { globalScene } from "#app/global-scene"; import { pokemonEvolutions } from "#app/data/balance/pokemon-evolutions"; import { getCharVariantFromDialogue } from "#app/data/dialogue"; diff --git a/src/phases/summon-phase.ts b/src/phases/summon-phase.ts index 60d45f19c0c..ee27fc28247 100644 --- a/src/phases/summon-phase.ts +++ b/src/phases/summon-phase.ts @@ -1,4 +1,4 @@ -import { BattleType } from "#app/battle"; +import { BattleType } from "#enums/battle-type"; import { getPokeballAtlasKey, getPokeballTintColor } from "#app/data/pokeball"; import { SpeciesFormChangeActiveTrigger } from "#app/data/pokemon-forms"; import { TrainerSlot } from "#enums/trainer-slot"; diff --git a/src/phases/title-phase.ts b/src/phases/title-phase.ts index 108366d4774..bc1b157e98e 100644 --- a/src/phases/title-phase.ts +++ b/src/phases/title-phase.ts @@ -1,5 +1,5 @@ import { loggedInUser } from "#app/account"; -import { BattleType } from "#app/battle"; +import { BattleType } from "#enums/battle-type"; import { fetchDailyRunSeed, getDailyRunStarters } from "#app/data/daily-run"; import { Gender } from "#app/data/gender"; import { getBiomeKey } from "#app/field/arena"; diff --git a/src/phases/victory-phase.ts b/src/phases/victory-phase.ts index 9f4412fe270..17b29f654e2 100644 --- a/src/phases/victory-phase.ts +++ b/src/phases/victory-phase.ts @@ -1,5 +1,6 @@ import type { BattlerIndex } from "#app/battle"; -import { BattleType, ClassicFixedBossWaves } from "#app/battle"; +import { ClassicFixedBossWaves } from "#app/battle"; +import { BattleType } from "#enums/battle-type"; import type { CustomModifierSettings } from "#app/modifier/modifier-type"; import { modifierTypes } from "#app/modifier/modifier-type"; import { BattleEndPhase } from "./battle-end-phase"; diff --git a/src/system/game-data.ts b/src/system/game-data.ts index 53146301666..698299845a3 100644 --- a/src/system/game-data.ts +++ b/src/system/game-data.ts @@ -15,7 +15,7 @@ import PersistentModifierData from "#app/system/modifier-data"; import ArenaData from "#app/system/arena-data"; import { Unlockables } from "#app/system/unlockables"; import { GameModes, getGameMode } from "#app/game-mode"; -import { BattleType } from "#app/battle"; +import { BattleType } from "#enums/battle-type"; import TrainerData from "#app/system/trainer-data"; import { trainerConfigs } from "#app/data/trainers/trainer-config"; import { resetSettings, setSetting, SettingKeys } from "#app/system/settings/settings"; diff --git a/src/system/pokemon-data.ts b/src/system/pokemon-data.ts index 97ce494a43a..00baad8cf12 100644 --- a/src/system/pokemon-data.ts +++ b/src/system/pokemon-data.ts @@ -1,4 +1,4 @@ -import { BattleType } from "../battle"; +import { BattleType } from "#enums/battle-type"; import { globalScene } from "#app/global-scene"; import type { Gender } from "../data/gender"; import type { Nature } from "#enums/nature"; diff --git a/src/ui/fight-ui-handler.ts b/src/ui/fight-ui-handler.ts index 27985629e3d..285a1dd36cc 100644 --- a/src/ui/fight-ui-handler.ts +++ b/src/ui/fight-ui-handler.ts @@ -14,7 +14,7 @@ import type { PokemonMove } from "#app/field/pokemon"; import type Pokemon from "#app/field/pokemon"; import type { CommandPhase } from "#app/phases/command-phase"; import MoveInfoOverlay from "./move-info-overlay"; -import { BattleType } from "#app/battle"; +import { BattleType } from "#enums/battle-type"; export default class FightUiHandler extends UiHandler implements InfoToggle { public static readonly MOVES_CONTAINER_NAME = "moves"; diff --git a/src/ui/run-history-ui-handler.ts b/src/ui/run-history-ui-handler.ts index ffc9d378d18..16aad7b8634 100644 --- a/src/ui/run-history-ui-handler.ts +++ b/src/ui/run-history-ui-handler.ts @@ -8,7 +8,7 @@ import type PokemonData from "../system/pokemon-data"; import MessageUiHandler from "./message-ui-handler"; import i18next from "i18next"; import { Button } from "../enums/buttons"; -import { BattleType } from "../battle"; +import { BattleType } from "#enums/battle-type"; import type { RunEntry } from "../system/game-data"; import { PlayerGender } from "#enums/player-gender"; import { TrainerVariant } from "../field/trainer"; diff --git a/src/ui/run-info-ui-handler.ts b/src/ui/run-info-ui-handler.ts index 47de6a1a64d..60667035147 100644 --- a/src/ui/run-info-ui-handler.ts +++ b/src/ui/run-info-ui-handler.ts @@ -9,7 +9,7 @@ import { formatLargeNumber, getPlayTimeString, formatMoney, formatFancyLargeNumb import type PokemonData from "../system/pokemon-data"; import i18next from "i18next"; import { Button } from "../enums/buttons"; -import { BattleType } from "../battle"; +import { BattleType } from "#enums/battle-type"; import { TrainerVariant } from "../field/trainer"; import { Challenges } from "#enums/challenges"; import { getLuckString, getLuckTextTint } from "../modifier/modifier-type"; diff --git a/test/abilities/ability_duplication.test.ts b/test/abilities/ability_duplication.test.ts index 08b74f682f2..de429045bb8 100644 --- a/test/abilities/ability_duplication.test.ts +++ b/test/abilities/ability_duplication.test.ts @@ -24,7 +24,7 @@ describe("Ability Duplication", () => { game = new GameManager(phaserGame); game.override .moveset([Moves.SPLASH]) - .battleType("single") + .battleStyle("single") .ability(Abilities.HUGE_POWER) .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset(Moves.SPLASH); diff --git a/test/abilities/ability_timing.test.ts b/test/abilities/ability_timing.test.ts index d59c4f7c38d..9df4fe0d1c9 100644 --- a/test/abilities/ability_timing.test.ts +++ b/test/abilities/ability_timing.test.ts @@ -27,7 +27,7 @@ describe("Ability Timing", () => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.INTIMIDATE) .ability(Abilities.BALL_FETCH); diff --git a/test/abilities/analytic.test.ts b/test/abilities/analytic.test.ts index e488b467ce0..1aadf2c0746 100644 --- a/test/abilities/analytic.test.ts +++ b/test/abilities/analytic.test.ts @@ -26,7 +26,7 @@ describe("Abilities - Analytic", () => { game.override .moveset([Moves.SPLASH, Moves.TACKLE]) .ability(Abilities.ANALYTIC) - .battleType("single") + .battleStyle("single") .disableCrits() .startingLevel(200) .enemyLevel(200) @@ -53,7 +53,7 @@ describe("Abilities - Analytic", () => { }); it("should increase damage only if the user moves last in doubles", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); await game.classicMode.startBattle([Species.GENGAR, Species.SHUCKLE]); const [enemy] = game.scene.getEnemyField(); diff --git a/test/abilities/arena_trap.test.ts b/test/abilities/arena_trap.test.ts index 3a5bad9c34b..f37b8a2859f 100644 --- a/test/abilities/arena_trap.test.ts +++ b/test/abilities/arena_trap.test.ts @@ -32,7 +32,7 @@ describe("Abilities - Arena Trap", () => { // TODO: Enable test when Issue #935 is addressed it.todo("should not allow grounded Pokémon to flee", async () => { - game.override.battleType("single"); + game.override.battleStyle("single"); await game.classicMode.startBattle(); @@ -61,7 +61,7 @@ describe("Abilities - Arena Trap", () => { */ it("should lift if pokemon with this ability leaves the field", async () => { game.override - .battleType("double") + .battleStyle("double") .enemyMoveset(Moves.SPLASH) .moveset([Moves.ROAR, Moves.SPLASH]) .ability(Abilities.BALL_FETCH); diff --git a/test/abilities/aroma_veil.test.ts b/test/abilities/aroma_veil.test.ts index af8a0233a60..38683bcb1e3 100644 --- a/test/abilities/aroma_veil.test.ts +++ b/test/abilities/aroma_veil.test.ts @@ -25,7 +25,7 @@ describe("Moves - Aroma Veil", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("double") + .battleStyle("double") .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset([Moves.HEAL_BLOCK, Moves.IMPRISON, Moves.SPLASH]) .enemySpecies(Species.SHUCKLE) diff --git a/test/abilities/aura_break.test.ts b/test/abilities/aura_break.test.ts index 86b6c69ec8b..523a2773c99 100644 --- a/test/abilities/aura_break.test.ts +++ b/test/abilities/aura_break.test.ts @@ -24,7 +24,7 @@ describe("Abilities - Aura Break", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.moveset([Moves.MOONBLAST, Moves.DARK_PULSE, Moves.MOONBLAST, Moves.DARK_PULSE]); game.override.enemyMoveset(Moves.SPLASH); game.override.enemyAbility(Abilities.AURA_BREAK); diff --git a/test/abilities/battery.test.ts b/test/abilities/battery.test.ts index cc7570c3d31..6a1f77f4b27 100644 --- a/test/abilities/battery.test.ts +++ b/test/abilities/battery.test.ts @@ -26,7 +26,7 @@ describe("Abilities - Battery", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.enemySpecies(Species.SHUCKLE); game.override.enemyAbility(Abilities.BALL_FETCH); game.override.moveset([Moves.TACKLE, Moves.BREAKING_SWIPE, Moves.SPLASH, Moves.DAZZLING_GLEAM]); diff --git a/test/abilities/battle_bond.test.ts b/test/abilities/battle_bond.test.ts index 6305d7dedc5..d599b3212f9 100644 --- a/test/abilities/battle_bond.test.ts +++ b/test/abilities/battle_bond.test.ts @@ -28,7 +28,7 @@ describe("Abilities - BATTLE BOND", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .startingWave(4) // Leads to arena reset on Wave 5 trainer battle .ability(Abilities.BATTLE_BOND) .starterForms({ [Species.GRENINJA]: ashForm }) diff --git a/test/abilities/beast_boost.test.ts b/test/abilities/beast_boost.test.ts index b307a9eeeba..a6b6ec0aacf 100644 --- a/test/abilities/beast_boost.test.ts +++ b/test/abilities/beast_boost.test.ts @@ -24,7 +24,7 @@ describe("Abilities - Beast Boost", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.BULBASAUR) .enemyAbility(Abilities.BEAST_BOOST) .ability(Abilities.BEAST_BOOST) diff --git a/test/abilities/commander.test.ts b/test/abilities/commander.test.ts index 9d16d474dd4..0e6cb1b9208 100644 --- a/test/abilities/commander.test.ts +++ b/test/abilities/commander.test.ts @@ -34,7 +34,7 @@ describe("Abilities - Commander", () => { .enemyLevel(100) .moveset([Moves.LIQUIDATION, Moves.MEMENTO, Moves.SPLASH, Moves.FLIP_TURN]) .ability(Abilities.COMMANDER) - .battleType("double") + .battleStyle("double") .disableCrits() .enemySpecies(Species.SNORLAX) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/abilities/competitive.test.ts b/test/abilities/competitive.test.ts index cad35be18f7..1e0b5fcf40e 100644 --- a/test/abilities/competitive.test.ts +++ b/test/abilities/competitive.test.ts @@ -25,7 +25,7 @@ describe("Abilities - Competitive", () => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.BEEDRILL) .enemyMoveset(Moves.TICKLE) .startingLevel(1) diff --git a/test/abilities/contrary.test.ts b/test/abilities/contrary.test.ts index 19041eb2801..929d620c232 100644 --- a/test/abilities/contrary.test.ts +++ b/test/abilities/contrary.test.ts @@ -23,7 +23,7 @@ describe("Abilities - Contrary", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.BULBASAUR) .enemyAbility(Abilities.CONTRARY) .ability(Abilities.INTIMIDATE) diff --git a/test/abilities/corrosion.test.ts b/test/abilities/corrosion.test.ts index b7f316fbe2d..c72aef9f0a3 100644 --- a/test/abilities/corrosion.test.ts +++ b/test/abilities/corrosion.test.ts @@ -23,7 +23,7 @@ describe("Abilities - Corrosion", () => { game = new GameManager(phaserGame); game.override .moveset([Moves.SPLASH]) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.GRIMER) .enemyAbility(Abilities.CORROSION) diff --git a/test/abilities/costar.test.ts b/test/abilities/costar.test.ts index c6a44bffe54..7b1e362689d 100644 --- a/test/abilities/costar.test.ts +++ b/test/abilities/costar.test.ts @@ -24,7 +24,7 @@ describe("Abilities - COSTAR", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.ability(Abilities.COSTAR); game.override.moveset([Moves.SPLASH, Moves.NASTY_PLOT]); game.override.enemyMoveset(Moves.SPLASH); diff --git a/test/abilities/dancer.test.ts b/test/abilities/dancer.test.ts index c296329473d..cdd1e3221e9 100644 --- a/test/abilities/dancer.test.ts +++ b/test/abilities/dancer.test.ts @@ -23,7 +23,7 @@ describe("Abilities - Dancer", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("double"); + game.override.battleStyle("double"); }); // Reference Link: https://bulbapedia.bulbagarden.net/wiki/Dancer_(Ability) diff --git a/test/abilities/defiant.test.ts b/test/abilities/defiant.test.ts index a73002d999c..d06aef4d785 100644 --- a/test/abilities/defiant.test.ts +++ b/test/abilities/defiant.test.ts @@ -25,7 +25,7 @@ describe("Abilities - Defiant", () => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.BEEDRILL) .enemyMoveset(Moves.TICKLE) .startingLevel(1) diff --git a/test/abilities/desolate-land.test.ts b/test/abilities/desolate-land.test.ts index bb0b152418d..d6f01f7aa5e 100644 --- a/test/abilities/desolate-land.test.ts +++ b/test/abilities/desolate-land.test.ts @@ -38,7 +38,7 @@ describe("Abilities - Desolate Land", () => { * is forcefully moved out of the field from moves such as Roar {@linkcode Moves.ROAR} */ it("should lift only when all pokemon with this ability leave the field", async () => { - game.override.battleType("double").enemyMoveset([Moves.SPLASH, Moves.ROAR]); + game.override.battleStyle("double").enemyMoveset([Moves.SPLASH, Moves.ROAR]); await game.classicMode.startBattle([Species.MAGCARGO, Species.MAGCARGO, Species.MAGIKARP, Species.MAGIKARP]); expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.HARSH_SUN); @@ -76,7 +76,7 @@ describe("Abilities - Desolate Land", () => { it("should lift when enemy faints", async () => { game.override - .battleType("single") + .battleStyle("single") .moveset([Moves.SHEER_COLD]) .ability(Abilities.NO_GUARD) .startingLevel(100) @@ -96,7 +96,7 @@ describe("Abilities - Desolate Land", () => { }); it("should lift when pokemon returns upon switching from double to single battle", async () => { - game.override.battleType("even-doubles").enemyMoveset([Moves.SPLASH, Moves.MEMENTO]).startingWave(12); + game.override.battleStyle("even-doubles").enemyMoveset([Moves.SPLASH, Moves.MEMENTO]).startingWave(12); await game.classicMode.startBattle([Species.MAGIKARP, Species.MAGCARGO]); expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.HARSH_SUN); @@ -117,7 +117,7 @@ describe("Abilities - Desolate Land", () => { it("should lift when enemy is captured", async () => { game.override - .battleType("single") + .battleStyle("single") .enemyMoveset([Moves.SPLASH]) .enemySpecies(Species.MAGCARGO) .enemyHasPassiveAbility(true); diff --git a/test/abilities/disguise.test.ts b/test/abilities/disguise.test.ts index a971f5c2733..fd8289312db 100644 --- a/test/abilities/disguise.test.ts +++ b/test/abilities/disguise.test.ts @@ -27,7 +27,7 @@ describe("Abilities - Disguise", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.MIMIKYU) .enemyMoveset(Moves.SPLASH) .starterSpecies(Species.REGIELEKI) diff --git a/test/abilities/dry_skin.test.ts b/test/abilities/dry_skin.test.ts index 9d8a29c431a..398d09393ab 100644 --- a/test/abilities/dry_skin.test.ts +++ b/test/abilities/dry_skin.test.ts @@ -22,7 +22,7 @@ describe("Abilities - Dry Skin", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .disableCrits() .enemyAbility(Abilities.DRY_SKIN) .enemyMoveset(Moves.SPLASH) diff --git a/test/abilities/early_bird.test.ts b/test/abilities/early_bird.test.ts index cc486672c95..0f298ba479d 100644 --- a/test/abilities/early_bird.test.ts +++ b/test/abilities/early_bird.test.ts @@ -27,7 +27,7 @@ describe("Abilities - Early Bird", () => { game.override .moveset([Moves.REST, Moves.BELLY_DRUM, Moves.SPLASH]) .ability(Abilities.EARLY_BIRD) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/abilities/flash_fire.test.ts b/test/abilities/flash_fire.test.ts index 3cec9cd9cb7..8d94d21adf8 100644 --- a/test/abilities/flash_fire.test.ts +++ b/test/abilities/flash_fire.test.ts @@ -27,7 +27,7 @@ describe("Abilities - Flash Fire", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .ability(Abilities.FLASH_FIRE) .enemyAbility(Abilities.BALL_FETCH) .startingLevel(20) diff --git a/test/abilities/flower_gift.test.ts b/test/abilities/flower_gift.test.ts index 8c7b32e7e33..f2b32dc4c80 100644 --- a/test/abilities/flower_gift.test.ts +++ b/test/abilities/flower_gift.test.ts @@ -47,7 +47,7 @@ describe("Abilities - Flower Gift", () => { allyAbility = Abilities.BALL_FETCH, enemyAbility = Abilities.BALL_FETCH, ): Promise<[number, number]> => { - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.moveset([Moves.SPLASH, Moves.SUNNY_DAY, move, Moves.HEAL_PULSE]); game.override.enemyMoveset([Moves.SPLASH, Moves.HEAL_PULSE]); const target_index = allyAttacker ? BattlerIndex.ENEMY : BattlerIndex.PLAYER_2; @@ -110,7 +110,7 @@ describe("Abilities - Flower Gift", () => { }); it("increases the ATK and SPDEF stat stages of the Pokémon with this Ability and its allies by 1.5× during Harsh Sunlight", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); await game.classicMode.startBattle([Species.CHERRIM, Species.MAGIKARP]); const [cherrim, magikarp] = game.scene.getPlayerField(); diff --git a/test/abilities/flower_veil.test.ts b/test/abilities/flower_veil.test.ts index 68242be3886..1fd7dbb3ed7 100644 --- a/test/abilities/flower_veil.test.ts +++ b/test/abilities/flower_veil.test.ts @@ -31,7 +31,7 @@ describe("Abilities - Flower Veil", () => { .moveset([Moves.SPLASH]) .enemySpecies(Species.BULBASAUR) .ability(Abilities.FLOWER_VEIL) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) @@ -63,7 +63,7 @@ describe("Abilities - Flower Veil", () => { }); it("should prevent drowsiness from yawn for a grass user and its grass allies", async () => { - game.override.enemyMoveset([Moves.YAWN]).moveset([Moves.SPLASH]).battleType("double"); + game.override.enemyMoveset([Moves.YAWN]).moveset([Moves.SPLASH]).battleStyle("double"); await game.classicMode.startBattle([Species.BULBASAUR, Species.BULBASAUR]); // Clear the ability of the ally to isolate the test @@ -81,7 +81,7 @@ describe("Abilities - Flower Veil", () => { }); it("should prevent status conditions from moves like Thunder Wave for a grass user and its grass allies", async () => { - game.override.enemyMoveset([Moves.THUNDER_WAVE]).moveset([Moves.SPLASH]).battleType("double"); + game.override.enemyMoveset([Moves.THUNDER_WAVE]).moveset([Moves.SPLASH]).battleStyle("double"); vi.spyOn(allMoves[Moves.THUNDER_WAVE], "accuracy", "get").mockReturnValue(100); await game.classicMode.startBattle([Species.BULBASAUR]); @@ -93,7 +93,7 @@ describe("Abilities - Flower Veil", () => { }); it("should not prevent status conditions for a non-grass user and its non-grass allies", async () => { - game.override.enemyMoveset([Moves.THUNDER_WAVE]).moveset([Moves.SPLASH]).battleType("double"); + game.override.enemyMoveset([Moves.THUNDER_WAVE]).moveset([Moves.SPLASH]).battleStyle("double"); await game.classicMode.startBattle([Species.MAGIKARP, Species.MAGIKARP]); const [user, ally] = game.scene.getPlayerField(); vi.spyOn(allMoves[Moves.THUNDER_WAVE], "accuracy", "get").mockReturnValue(100); @@ -113,7 +113,7 @@ describe("Abilities - Flower Veil", () => { *******************************************/ it("should prevent the status drops from enemies for the a grass user and its grass allies", async () => { - game.override.enemyMoveset([Moves.GROWL]).moveset([Moves.SPLASH]).battleType("double"); + game.override.enemyMoveset([Moves.GROWL]).moveset([Moves.SPLASH]).battleStyle("double"); await game.classicMode.startBattle([Species.BULBASAUR, Species.BULBASAUR]); const [user, ally] = game.scene.getPlayerField(); // Clear the ally ability to isolate the test @@ -126,7 +126,7 @@ describe("Abilities - Flower Veil", () => { }); it("should not prevent status drops for a non-grass user and its non-grass allies", async () => { - game.override.enemyMoveset([Moves.GROWL]).moveset([Moves.SPLASH]).battleType("double"); + game.override.enemyMoveset([Moves.GROWL]).moveset([Moves.SPLASH]).battleStyle("double"); await game.classicMode.startBattle([Species.MAGIKARP, Species.MAGIKARP]); const [user, ally] = game.scene.getPlayerField(); // Clear the ally ability to isolate the test @@ -139,7 +139,7 @@ describe("Abilities - Flower Veil", () => { }); it("should not prevent self-inflicted stat drops from moves like Close Combat for a user or its allies", async () => { - game.override.moveset([Moves.CLOSE_COMBAT]).battleType("double"); + game.override.moveset([Moves.CLOSE_COMBAT]).battleStyle("double"); await game.classicMode.startBattle([Species.BULBASAUR, Species.BULBASAUR]); const [user, ally] = game.scene.getPlayerField(); // Clear the ally ability to isolate the test diff --git a/test/abilities/forecast.test.ts b/test/abilities/forecast.test.ts index 675b9a8b59c..03b5d993a54 100644 --- a/test/abilities/forecast.test.ts +++ b/test/abilities/forecast.test.ts @@ -75,7 +75,7 @@ describe("Abilities - Forecast", () => { async () => { game.override .moveset([Moves.RAIN_DANCE, Moves.SUNNY_DAY, Moves.SNOWSCAPE, Moves.SPLASH]) - .battleType("double") + .battleStyle("double") .starterForms({ [Species.KYOGRE]: 1, [Species.GROUDON]: 1, diff --git a/test/abilities/friend_guard.test.ts b/test/abilities/friend_guard.test.ts index 474c89adaf1..302343c167b 100644 --- a/test/abilities/friend_guard.test.ts +++ b/test/abilities/friend_guard.test.ts @@ -26,7 +26,7 @@ describe("Moves - Friend Guard", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("double") + .battleStyle("double") .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset([Moves.TACKLE, Moves.SPLASH, Moves.DRAGON_RAGE]) .enemySpecies(Species.SHUCKLE) diff --git a/test/abilities/galvanize.test.ts b/test/abilities/galvanize.test.ts index c1e02c6c8d8..438ec498aa1 100644 --- a/test/abilities/galvanize.test.ts +++ b/test/abilities/galvanize.test.ts @@ -27,7 +27,7 @@ describe("Abilities - Galvanize", () => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .startingLevel(100) .ability(Abilities.GALVANIZE) .moveset([Moves.TACKLE, Moves.REVELATION_DANCE, Moves.FURY_SWIPES]) diff --git a/test/abilities/good_as_gold.test.ts b/test/abilities/good_as_gold.test.ts index 4c4741a331f..944c1d1bca1 100644 --- a/test/abilities/good_as_gold.test.ts +++ b/test/abilities/good_as_gold.test.ts @@ -32,7 +32,7 @@ describe("Abilities - Good As Gold", () => { game.override .moveset([Moves.SPLASH]) .ability(Abilities.GOOD_AS_GOLD) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) @@ -63,7 +63,7 @@ describe("Abilities - Good As Gold", () => { }); it("should not block any status moves that target the field, one side, or all pokemon", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.enemyMoveset([Moves.STEALTH_ROCK, Moves.HAZE]); game.override.moveset([Moves.SWORDS_DANCE, Moves.SAFEGUARD]); await game.classicMode.startBattle([Species.MAGIKARP, Species.FEEBAS]); @@ -85,7 +85,7 @@ describe("Abilities - Good As Gold", () => { }); it("should not block field targeted effects in singles", async () => { - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.enemyMoveset([Moves.SPIKES]); await game.classicMode.startBattle([Species.MAGIKARP]); @@ -96,7 +96,7 @@ describe("Abilities - Good As Gold", () => { }); it("should block the ally's helping hand", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.moveset([Moves.HELPING_HAND, Moves.TACKLE]); await game.classicMode.startBattle([Species.MAGIKARP, Species.FEEBAS]); @@ -108,7 +108,7 @@ describe("Abilities - Good As Gold", () => { }); it("should block the ally's heal bell, but only if the good as gold user is on the field", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.moveset([Moves.HEAL_BELL, Moves.SPLASH]); game.override.statusEffect(StatusEffect.BURN); await game.classicMode.startBattle([Species.MAGIKARP, Species.FEEBAS, Species.ABRA]); @@ -130,7 +130,7 @@ describe("Abilities - Good As Gold", () => { }); it("should not block field targeted effects like rain dance", async () => { - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.enemyMoveset([Moves.RAIN_DANCE]); game.override.weather(WeatherType.NONE); await game.classicMode.startBattle([Species.MAGIKARP]); diff --git a/test/abilities/gorilla_tactics.test.ts b/test/abilities/gorilla_tactics.test.ts index 48dab262b82..edaf1669809 100644 --- a/test/abilities/gorilla_tactics.test.ts +++ b/test/abilities/gorilla_tactics.test.ts @@ -23,7 +23,7 @@ describe("Abilities - Gorilla Tactics", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset([Moves.SPLASH, Moves.DISABLE]) .enemySpecies(Species.MAGIKARP) diff --git a/test/abilities/gulp_missile.test.ts b/test/abilities/gulp_missile.test.ts index 8ebd583d3ab..4db2ae4190d 100644 --- a/test/abilities/gulp_missile.test.ts +++ b/test/abilities/gulp_missile.test.ts @@ -42,7 +42,7 @@ describe("Abilities - Gulp Missile", () => { game = new GameManager(phaserGame); game.override .disableCrits() - .battleType("single") + .battleStyle("single") .moveset([Moves.SURF, Moves.DIVE, Moves.SPLASH, Moves.SUBSTITUTE]) .enemySpecies(Species.SNORLAX) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/abilities/healer.test.ts b/test/abilities/healer.test.ts index 35aa74209b4..d06c4680e36 100644 --- a/test/abilities/healer.test.ts +++ b/test/abilities/healer.test.ts @@ -32,7 +32,7 @@ describe("Abilities - Healer", () => { game.override .moveset([Moves.SPLASH]) .ability(Abilities.BALL_FETCH) - .battleType("double") + .battleStyle("double") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/abilities/heatproof.test.ts b/test/abilities/heatproof.test.ts index fa065d1ed03..f2fabf953d6 100644 --- a/test/abilities/heatproof.test.ts +++ b/test/abilities/heatproof.test.ts @@ -25,7 +25,7 @@ describe("Abilities - Heatproof", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.CHARMANDER) .enemyAbility(Abilities.HEATPROOF) diff --git a/test/abilities/honey_gather.test.ts b/test/abilities/honey_gather.test.ts index bea5c25c878..a74a40c9c1e 100644 --- a/test/abilities/honey_gather.test.ts +++ b/test/abilities/honey_gather.test.ts @@ -28,7 +28,7 @@ describe("Abilities - Honey Gather", () => { .startingLevel(100) .ability(Abilities.HONEY_GATHER) .passiveAbility(Abilities.RUN_AWAY) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/abilities/hustle.test.ts b/test/abilities/hustle.test.ts index 40197cf9e97..bf2889eab63 100644 --- a/test/abilities/hustle.test.ts +++ b/test/abilities/hustle.test.ts @@ -27,7 +27,7 @@ describe("Abilities - Hustle", () => { .ability(Abilities.HUSTLE) .moveset([Moves.TACKLE, Moves.GIGA_DRAIN, Moves.FISSURE]) .disableCrits() - .battleType("single") + .battleStyle("single") .enemyMoveset(Moves.SPLASH) .enemySpecies(Species.SHUCKLE) .enemyAbility(Abilities.BALL_FETCH); diff --git a/test/abilities/hyper_cutter.test.ts b/test/abilities/hyper_cutter.test.ts index fe5623e4e0f..99a9db28025 100644 --- a/test/abilities/hyper_cutter.test.ts +++ b/test/abilities/hyper_cutter.test.ts @@ -23,7 +23,7 @@ describe("Abilities - Hyper Cutter", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .moveset([Moves.SAND_ATTACK, Moves.NOBLE_ROAR, Moves.DEFOG, Moves.OCTOLOCK]) .ability(Abilities.BALL_FETCH) .enemySpecies(Species.SHUCKLE) diff --git a/test/abilities/ice_face.test.ts b/test/abilities/ice_face.test.ts index e85794928d6..38269c29af1 100644 --- a/test/abilities/ice_face.test.ts +++ b/test/abilities/ice_face.test.ts @@ -30,7 +30,7 @@ describe("Abilities - Ice Face", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.enemySpecies(Species.EISCUE); game.override.enemyAbility(Abilities.ICE_FACE); game.override.moveset([Moves.TACKLE, Moves.ICE_BEAM, Moves.TOXIC_THREAD, Moves.HAIL]); diff --git a/test/abilities/illuminate.test.ts b/test/abilities/illuminate.test.ts index 6518fec989b..ba26ed3b7af 100644 --- a/test/abilities/illuminate.test.ts +++ b/test/abilities/illuminate.test.ts @@ -29,7 +29,7 @@ describe("Abilities - Illuminate", () => { }); it("should prevent ACC stat stage from being lowered", async () => { - game.override.battleType("single"); + game.override.battleStyle("single"); await game.classicMode.startBattle(); diff --git a/test/abilities/illusion.test.ts b/test/abilities/illusion.test.ts index bdb235f458b..382d7d74a08 100644 --- a/test/abilities/illusion.test.ts +++ b/test/abilities/illusion.test.ts @@ -25,7 +25,7 @@ describe("Abilities - Illusion", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.enemySpecies(Species.ZORUA); game.override.enemyAbility(Abilities.ILLUSION); game.override.enemyMoveset(Moves.TACKLE); diff --git a/test/abilities/immunity.test.ts b/test/abilities/immunity.test.ts index 51e9598720b..dd9026cac50 100644 --- a/test/abilities/immunity.test.ts +++ b/test/abilities/immunity.test.ts @@ -23,9 +23,9 @@ describe("Abilities - Immunity", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .moveset([ Moves.SPLASH ]) + .moveset([Moves.SPLASH]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) @@ -33,12 +33,12 @@ describe("Abilities - Immunity", () => { }); it("should remove poison when gained", async () => { - game.override.ability(Abilities.IMMUNITY) + game.override + .ability(Abilities.IMMUNITY) .enemyAbility(Abilities.BALL_FETCH) .moveset(Moves.SKILL_SWAP) - .enemyMoveset(Moves.SPLASH), - - await game.classicMode.startBattle([ Species.FEEBAS ]); + .enemyMoveset(Moves.SPLASH); + await game.classicMode.startBattle([Species.FEEBAS]); const enemy = game.scene.getEnemyPokemon(); enemy?.trySetStatus(StatusEffect.POISON); expect(enemy?.status?.effect).toBe(StatusEffect.POISON); diff --git a/test/abilities/imposter.test.ts b/test/abilities/imposter.test.ts index 2c7302d04b7..b5e902f442f 100644 --- a/test/abilities/imposter.test.ts +++ b/test/abilities/imposter.test.ts @@ -25,7 +25,7 @@ describe("Abilities - Imposter", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.MEW) .enemyLevel(200) .enemyAbility(Abilities.BEAST_BOOST) diff --git a/test/abilities/infiltrator.test.ts b/test/abilities/infiltrator.test.ts index 6278439651c..10353f35391 100644 --- a/test/abilities/infiltrator.test.ts +++ b/test/abilities/infiltrator.test.ts @@ -30,7 +30,7 @@ describe("Abilities - Infiltrator", () => { game.override .moveset([Moves.TACKLE, Moves.WATER_GUN, Moves.SPORE, Moves.BABY_DOLL_EYES]) .ability(Abilities.INFILTRATOR) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.SNORLAX) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/abilities/insomnia.test.ts b/test/abilities/insomnia.test.ts index 91fdc3fc668..49765a641b0 100644 --- a/test/abilities/insomnia.test.ts +++ b/test/abilities/insomnia.test.ts @@ -23,9 +23,9 @@ describe("Abilities - Insomnia", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .moveset([ Moves.SPLASH ]) + .moveset([Moves.SPLASH]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) @@ -33,12 +33,12 @@ describe("Abilities - Insomnia", () => { }); it("should remove sleep when gained", async () => { - game.override.ability(Abilities.INSOMNIA) + game.override + .ability(Abilities.INSOMNIA) .enemyAbility(Abilities.BALL_FETCH) .moveset(Moves.SKILL_SWAP) - .enemyMoveset(Moves.SPLASH), - - await game.classicMode.startBattle([ Species.FEEBAS ]); + .enemyMoveset(Moves.SPLASH); + await game.classicMode.startBattle([Species.FEEBAS]); const enemy = game.scene.getEnemyPokemon(); enemy?.trySetStatus(StatusEffect.SLEEP); expect(enemy?.status?.effect).toBe(StatusEffect.SLEEP); diff --git a/test/abilities/intimidate.test.ts b/test/abilities/intimidate.test.ts index 53286d354c8..2888c575b0d 100644 --- a/test/abilities/intimidate.test.ts +++ b/test/abilities/intimidate.test.ts @@ -25,7 +25,7 @@ describe("Abilities - Intimidate", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.RATTATA) .enemyAbility(Abilities.INTIMIDATE) .enemyPassiveAbility(Abilities.HYDRATION) @@ -65,7 +65,7 @@ describe("Abilities - Intimidate", () => { }, 20000); it("should lower ATK stat stage by 1 for every enemy Pokemon in a double battle on entry", async () => { - game.override.battleType("double").startingWave(3); + game.override.battleStyle("double").startingWave(3); await game.classicMode.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]); game.onNextPrompt( "CheckSwitchPhase", diff --git a/test/abilities/intrepid_sword.test.ts b/test/abilities/intrepid_sword.test.ts index 28d0cd02c7f..b30ae4a9bd0 100644 --- a/test/abilities/intrepid_sword.test.ts +++ b/test/abilities/intrepid_sword.test.ts @@ -22,7 +22,7 @@ describe("Abilities - Intrepid Sword", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.enemySpecies(Species.ZACIAN); game.override.enemyAbility(Abilities.INTREPID_SWORD); game.override.ability(Abilities.INTREPID_SWORD); diff --git a/test/abilities/libero.test.ts b/test/abilities/libero.test.ts index 22abf1c248f..2e3668813c5 100644 --- a/test/abilities/libero.test.ts +++ b/test/abilities/libero.test.ts @@ -29,7 +29,7 @@ describe("Abilities - Libero", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.ability(Abilities.LIBERO); game.override.startingLevel(100); game.override.enemySpecies(Species.RATTATA); diff --git a/test/abilities/lightningrod.test.ts b/test/abilities/lightningrod.test.ts index 986899353ff..21a03baf12b 100644 --- a/test/abilities/lightningrod.test.ts +++ b/test/abilities/lightningrod.test.ts @@ -26,7 +26,7 @@ describe("Abilities - Lightningrod", () => { game.override .moveset([Moves.SPLASH, Moves.SHOCK_WAVE]) .ability(Abilities.BALL_FETCH) - .battleType("double") + .battleStyle("double") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/abilities/limber.test.ts b/test/abilities/limber.test.ts index 2b167cc155f..4cdaa86f44c 100644 --- a/test/abilities/limber.test.ts +++ b/test/abilities/limber.test.ts @@ -23,9 +23,9 @@ describe("Abilities - Limber", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .moveset([ Moves.SPLASH ]) + .moveset([Moves.SPLASH]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) @@ -33,12 +33,12 @@ describe("Abilities - Limber", () => { }); it("should remove paralysis when gained", async () => { - game.override.ability(Abilities.LIMBER) + game.override + .ability(Abilities.LIMBER) .enemyAbility(Abilities.BALL_FETCH) .moveset(Moves.SKILL_SWAP) - .enemyMoveset(Moves.SPLASH), - - await game.classicMode.startBattle([ Species.FEEBAS ]); + .enemyMoveset(Moves.SPLASH); + await game.classicMode.startBattle([Species.FEEBAS]); const enemy = game.scene.getEnemyPokemon(); enemy?.trySetStatus(StatusEffect.PARALYSIS); expect(enemy?.status?.effect).toBe(StatusEffect.PARALYSIS); diff --git a/test/abilities/magic_bounce.test.ts b/test/abilities/magic_bounce.test.ts index 7886ac5fd5c..11131640a0f 100644 --- a/test/abilities/magic_bounce.test.ts +++ b/test/abilities/magic_bounce.test.ts @@ -30,7 +30,7 @@ describe("Abilities - Magic Bounce", () => { game = new GameManager(phaserGame); game.override .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .moveset([Moves.GROWL, Moves.SPLASH]) .disableCrits() .enemySpecies(Species.MAGIKARP) @@ -60,7 +60,7 @@ describe("Abilities - Magic Bounce", () => { }); it("should individually bounce back multi-target moves", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.moveset([Moves.GROWL, Moves.SPLASH]); await game.classicMode.startBattle([Species.MAGIKARP, Species.MAGIKARP]); @@ -114,7 +114,7 @@ describe("Abilities - Magic Bounce", () => { }); it("should bounce back a spread status move against both pokemon", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.moveset([Moves.GROWL, Moves.SPLASH]); game.override.enemyMoveset([Moves.SPLASH]); await game.classicMode.startBattle([Species.MAGIKARP, Species.MAGIKARP]); @@ -127,7 +127,7 @@ describe("Abilities - Magic Bounce", () => { }); it("should only bounce spikes back once in doubles when both targets have magic bounce", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); await game.classicMode.startBattle([Species.MAGIKARP]); game.override.moveset([Moves.SPIKES]); @@ -227,7 +227,7 @@ describe("Abilities - Magic Bounce", () => { // TODO: stomping tantrum should consider moves that were bounced. it.todo("should cause stomping tantrum to double in power when the last move was bounced", async () => { - game.override.battleType("single"); + game.override.battleStyle("single"); await game.classicMode.startBattle([Species.MAGIKARP]); game.override.moveset([Moves.STOMPING_TANTRUM, Moves.CHARM]); @@ -309,7 +309,7 @@ describe("Abilities - Magic Bounce", () => { }); it("should always apply the leftmost available target's magic bounce when bouncing moves like sticky webs in doubles", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.moveset([Moves.STICKY_WEB, Moves.SPLASH, Moves.TRICK_ROOM]); await game.classicMode.startBattle([Species.MAGIKARP, Species.MAGIKARP]); diff --git a/test/abilities/magma_armor.test.ts b/test/abilities/magma_armor.test.ts index b1d62f948d2..c5af522ca6f 100644 --- a/test/abilities/magma_armor.test.ts +++ b/test/abilities/magma_armor.test.ts @@ -23,9 +23,9 @@ describe("Abilities - Magma Armor", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .moveset([ Moves.SPLASH ]) + .moveset([Moves.SPLASH]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) @@ -33,12 +33,12 @@ describe("Abilities - Magma Armor", () => { }); it("should remove freeze when gained", async () => { - game.override.ability(Abilities.MAGMA_ARMOR) + game.override + .ability(Abilities.MAGMA_ARMOR) .enemyAbility(Abilities.BALL_FETCH) .moveset(Moves.SKILL_SWAP) - .enemyMoveset(Moves.SPLASH), - - await game.classicMode.startBattle([ Species.FEEBAS ]); + .enemyMoveset(Moves.SPLASH); + await game.classicMode.startBattle([Species.FEEBAS]); const enemy = game.scene.getEnemyPokemon(); enemy?.trySetStatus(StatusEffect.FREEZE); expect(enemy?.status?.effect).toBe(StatusEffect.FREEZE); diff --git a/test/abilities/mimicry.test.ts b/test/abilities/mimicry.test.ts index df6f7905c83..598f5790aa8 100644 --- a/test/abilities/mimicry.test.ts +++ b/test/abilities/mimicry.test.ts @@ -25,7 +25,7 @@ describe("Abilities - Mimicry", () => { game.override .moveset([Moves.SPLASH]) .ability(Abilities.MIMICRY) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyMoveset(Moves.SPLASH); diff --git a/test/abilities/mirror_armor.test.ts b/test/abilities/mirror_armor.test.ts index 6b0c3f10c84..bd61f39ba75 100644 --- a/test/abilities/mirror_armor.test.ts +++ b/test/abilities/mirror_armor.test.ts @@ -27,7 +27,7 @@ describe("Ability - Mirror Armor", () => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.RATTATA) .enemyMoveset([Moves.SPLASH, Moves.STICKY_WEB, Moves.TICKLE, Moves.OCTOLOCK]) .enemyAbility(Abilities.BALL_FETCH) @@ -71,7 +71,7 @@ describe("Ability - Mirror Armor", () => { }); it("Player side + double battle Intimidate - opponents each lose -2 atk", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.ability(Abilities.MIRROR_ARMOR); game.override.enemyAbility(Abilities.INTIMIDATE); await game.classicMode.startBattle([Species.BULBASAUR, Species.CHARMANDER]); @@ -93,7 +93,7 @@ describe("Ability - Mirror Armor", () => { }); it("Enemy side + double battle Intimidate - players each lose -2 atk", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.enemyAbility(Abilities.MIRROR_ARMOR); game.override.ability(Abilities.INTIMIDATE); await game.classicMode.startBattle([Species.BULBASAUR, Species.CHARMANDER]); @@ -134,7 +134,7 @@ describe("Ability - Mirror Armor", () => { }); it("Player side + double battle Intimidate + Tickle - opponents each lose -3 atk, -1 def", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.ability(Abilities.MIRROR_ARMOR); game.override.enemyAbility(Abilities.INTIMIDATE); await game.classicMode.startBattle([Species.BULBASAUR, Species.CHARMANDER]); @@ -288,7 +288,7 @@ describe("Ability - Mirror Armor", () => { }); it("Double battle + sticky web applied player side - player switches out and enemy 1 should lose -1 speed", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.ability(Abilities.MIRROR_ARMOR); await game.classicMode.startBattle([Species.BULBASAUR, Species.CHARMANDER, Species.SQUIRTLE]); diff --git a/test/abilities/mold_breaker.test.ts b/test/abilities/mold_breaker.test.ts index 8f050a68d76..ba33909364f 100644 --- a/test/abilities/mold_breaker.test.ts +++ b/test/abilities/mold_breaker.test.ts @@ -24,9 +24,9 @@ describe("Abilities - Mold Breaker", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .moveset([ Moves.SPLASH ]) + .moveset([Moves.SPLASH]) .ability(Abilities.MOLD_BREAKER) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) @@ -34,17 +34,18 @@ describe("Abilities - Mold Breaker", () => { }); it("should turn off the ignore abilities arena variable after the user's move", async () => { - game.override.enemyMoveset(Moves.SPLASH) + game.override + .enemyMoveset(Moves.SPLASH) .ability(Abilities.MOLD_BREAKER) - .moveset([ Moves.ERUPTION ]) + .moveset([Moves.ERUPTION]) .startingLevel(100) .enemyLevel(2); - await game.classicMode.startBattle([ Species.MAGIKARP ]); + await game.classicMode.startBattle([Species.MAGIKARP]); const enemy = game.scene.getEnemyPokemon()!; expect(enemy.isFainted()).toBe(false); game.move.select(Moves.SPLASH); - await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]); + await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]); await game.phaseInterceptor.to("MoveEndPhase", true); expect(globalScene.arena.ignoreAbilities).toBe(false); }); diff --git a/test/abilities/moody.test.ts b/test/abilities/moody.test.ts index da24899a4b0..9b658820391 100644 --- a/test/abilities/moody.test.ts +++ b/test/abilities/moody.test.ts @@ -24,7 +24,7 @@ describe("Abilities - Moody", () => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.RATTATA) .enemyAbility(Abilities.BALL_FETCH) .ability(Abilities.MOODY) diff --git a/test/abilities/moxie.test.ts b/test/abilities/moxie.test.ts index ec93aebd2c0..bccdeda2b93 100644 --- a/test/abilities/moxie.test.ts +++ b/test/abilities/moxie.test.ts @@ -27,7 +27,7 @@ describe("Abilities - Moxie", () => { beforeEach(() => { game = new GameManager(phaserGame); const moveToUse = Moves.AERIAL_ACE; - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.MOXIE); game.override.ability(Abilities.MOXIE); @@ -54,7 +54,7 @@ describe("Abilities - Moxie", () => { it.todo( "should raise ATK stat stage by 1 when defeating an ally Pokemon", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); const moveToUse = Moves.AERIAL_ACE; await game.startBattle([Species.MIGHTYENA, Species.MIGHTYENA]); diff --git a/test/abilities/mummy.test.ts b/test/abilities/mummy.test.ts index 0971353c14d..c53b0b33598 100644 --- a/test/abilities/mummy.test.ts +++ b/test/abilities/mummy.test.ts @@ -24,7 +24,7 @@ describe("Abilities - Mummy", () => { game.override .moveset([Moves.SPLASH]) .ability(Abilities.MUMMY) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/abilities/mycelium_might.test.ts b/test/abilities/mycelium_might.test.ts index 8c7796ec736..4a5700045fa 100644 --- a/test/abilities/mycelium_might.test.ts +++ b/test/abilities/mycelium_might.test.ts @@ -24,7 +24,7 @@ describe("Abilities - Mycelium Might", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.disableCrits(); game.override.enemySpecies(Species.SHUCKLE); game.override.enemyAbility(Abilities.CLEAR_BODY); diff --git a/test/abilities/neutralizing_gas.test.ts b/test/abilities/neutralizing_gas.test.ts index 56a663db403..32c61b72e4d 100644 --- a/test/abilities/neutralizing_gas.test.ts +++ b/test/abilities/neutralizing_gas.test.ts @@ -31,7 +31,7 @@ describe("Abilities - Neutralizing Gas", () => { game.override .moveset([Moves.SPLASH]) .ability(Abilities.NEUTRALIZING_GAS) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) @@ -105,7 +105,7 @@ describe("Abilities - Neutralizing Gas", () => { }); it("should only deactivate when all setters are off the field", async () => { - game.override.enemyMoveset([Moves.ENTRAINMENT, Moves.SPLASH]).battleType("double"); + game.override.enemyMoveset([Moves.ENTRAINMENT, Moves.SPLASH]).battleStyle("double"); await game.classicMode.startBattle([Species.ACCELGOR, Species.ACCELGOR]); game.move.select(Moves.SPLASH, 0); @@ -148,7 +148,7 @@ describe("Abilities - Neutralizing Gas", () => { }); it("should deactivate upon catching a wild pokemon", async () => { - game.override.battleType("single").enemyAbility(Abilities.NEUTRALIZING_GAS).ability(Abilities.BALL_FETCH); + game.override.battleStyle("single").enemyAbility(Abilities.NEUTRALIZING_GAS).ability(Abilities.BALL_FETCH); await game.classicMode.startBattle([Species.MAGIKARP]); expect(game.scene.arena.getTag(ArenaTagType.NEUTRALIZING_GAS)).toBeDefined(); @@ -174,7 +174,7 @@ describe("Abilities - Neutralizing Gas", () => { }); it("should not activate abilities of pokemon no longer on the field", async () => { - game.override.battleType("single").ability(Abilities.NEUTRALIZING_GAS).enemyAbility(Abilities.DELTA_STREAM); + game.override.battleStyle("single").ability(Abilities.NEUTRALIZING_GAS).enemyAbility(Abilities.DELTA_STREAM); await game.classicMode.startBattle([Species.MAGIKARP]); const enemy = game.scene.getEnemyPokemon()!; diff --git a/test/abilities/no_guard.test.ts b/test/abilities/no_guard.test.ts index 41b8fbd27b9..b34007bc700 100644 --- a/test/abilities/no_guard.test.ts +++ b/test/abilities/no_guard.test.ts @@ -33,7 +33,7 @@ describe("Abilities - No Guard", () => { }); it("should make moves always hit regardless of move accuracy", async () => { - game.override.battleType("single"); + game.override.battleStyle("single"); await game.classicMode.startBattle([Species.REGIELEKI]); diff --git a/test/abilities/oblivious.test.ts b/test/abilities/oblivious.test.ts index d5089ef6a72..a86899ec9c6 100644 --- a/test/abilities/oblivious.test.ts +++ b/test/abilities/oblivious.test.ts @@ -23,9 +23,9 @@ describe("Abilities - Oblivious", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .moveset([ Moves.SPLASH ]) + .moveset([Moves.SPLASH]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) @@ -33,12 +33,12 @@ describe("Abilities - Oblivious", () => { }); it("should remove taunt when gained", async () => { - game.override.ability(Abilities.OBLIVIOUS) + game.override + .ability(Abilities.OBLIVIOUS) .enemyAbility(Abilities.BALL_FETCH) .moveset(Moves.SKILL_SWAP) - .enemyMoveset(Moves.SPLASH), - - await game.classicMode.startBattle([ Species.FEEBAS ]); + .enemyMoveset(Moves.SPLASH); + await game.classicMode.startBattle([Species.FEEBAS]); const enemy = game.scene.getEnemyPokemon(); enemy?.addTag(BattlerTagType.TAUNT); expect(enemy?.getTag(BattlerTagType.TAUNT)).toBeTruthy(); @@ -50,12 +50,12 @@ describe("Abilities - Oblivious", () => { }); it("should remove infatuation when gained", async () => { - game.override.ability(Abilities.OBLIVIOUS) + game.override + .ability(Abilities.OBLIVIOUS) .enemyAbility(Abilities.BALL_FETCH) .moveset(Moves.SKILL_SWAP) - .enemyMoveset(Moves.SPLASH), - - await game.classicMode.startBattle([ Species.FEEBAS ]); + .enemyMoveset(Moves.SPLASH); + await game.classicMode.startBattle([Species.FEEBAS]); const enemy = game.scene.getEnemyPokemon(); vi.spyOn(enemy!, "isOppositeGender").mockReturnValue(true); enemy?.addTag(BattlerTagType.INFATUATED, 5, Moves.JUDGMENT, game.scene.getPlayerPokemon()?.id); // sourceID needs to be defined diff --git a/test/abilities/own_tempo.test.ts b/test/abilities/own_tempo.test.ts index 936b4311b20..b2f2c2f3030 100644 --- a/test/abilities/own_tempo.test.ts +++ b/test/abilities/own_tempo.test.ts @@ -23,9 +23,9 @@ describe("Abilities - Own Tempo", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .moveset([ Moves.SPLASH ]) + .moveset([Moves.SPLASH]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) @@ -33,12 +33,12 @@ describe("Abilities - Own Tempo", () => { }); it("should remove confusion when gained", async () => { - game.override.ability(Abilities.OWN_TEMPO) + game.override + .ability(Abilities.OWN_TEMPO) .enemyAbility(Abilities.BALL_FETCH) .moveset(Moves.SKILL_SWAP) - .enemyMoveset(Moves.SPLASH), - - await game.classicMode.startBattle([ Species.FEEBAS ]); + .enemyMoveset(Moves.SPLASH); + await game.classicMode.startBattle([Species.FEEBAS]); const enemy = game.scene.getEnemyPokemon(); enemy?.addTag(BattlerTagType.CONFUSED); expect(enemy?.getTag(BattlerTagType.CONFUSED)).toBeTruthy(); diff --git a/test/abilities/parental_bond.test.ts b/test/abilities/parental_bond.test.ts index 2aa24e78d6e..d81486e7316 100644 --- a/test/abilities/parental_bond.test.ts +++ b/test/abilities/parental_bond.test.ts @@ -26,7 +26,7 @@ describe("Abilities - Parental Bond", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.disableCrits(); game.override.ability(Abilities.PARENTAL_BOND); game.override.enemySpecies(Species.SNORLAX); @@ -167,7 +167,7 @@ describe("Abilities - Parental Bond", () => { }); it("should not apply to multi-target moves", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.moveset([Moves.EARTHQUAKE]); game.override.passiveAbility(Abilities.LEVITATE); diff --git a/test/abilities/pastel_veil.test.ts b/test/abilities/pastel_veil.test.ts index 65e391b7c22..4ae9763c4a6 100644 --- a/test/abilities/pastel_veil.test.ts +++ b/test/abilities/pastel_veil.test.ts @@ -26,7 +26,7 @@ describe("Abilities - Pastel Veil", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("double") + .battleStyle("double") .moveset([Moves.TOXIC_THREAD, Moves.SPLASH]) .enemyAbility(Abilities.BALL_FETCH) .enemySpecies(Species.SUNKERN) diff --git a/test/abilities/perish_body.test.ts b/test/abilities/perish_body.test.ts index 424d35e2542..27e76cb52ad 100644 --- a/test/abilities/perish_body.test.ts +++ b/test/abilities/perish_body.test.ts @@ -21,7 +21,7 @@ describe("Abilities - Perish Song", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.disableCrits(); game.override.enemySpecies(Species.MAGIKARP); diff --git a/test/abilities/power_construct.test.ts b/test/abilities/power_construct.test.ts index c253f2ae4df..0ff90a2c0df 100644 --- a/test/abilities/power_construct.test.ts +++ b/test/abilities/power_construct.test.ts @@ -25,7 +25,7 @@ describe("Abilities - POWER CONSTRUCT", () => { beforeEach(() => { game = new GameManager(phaserGame); const moveToUse = Moves.SPLASH; - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.ability(Abilities.POWER_CONSTRUCT); game.override.moveset([moveToUse]); game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); diff --git a/test/abilities/power_spot.test.ts b/test/abilities/power_spot.test.ts index e29b5ecf775..3e4f79d7445 100644 --- a/test/abilities/power_spot.test.ts +++ b/test/abilities/power_spot.test.ts @@ -26,7 +26,7 @@ describe("Abilities - Power Spot", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.moveset([Moves.TACKLE, Moves.BREAKING_SWIPE, Moves.SPLASH, Moves.DAZZLING_GLEAM]); game.override.enemyMoveset(Moves.SPLASH); game.override.enemySpecies(Species.SHUCKLE); diff --git a/test/abilities/protean.test.ts b/test/abilities/protean.test.ts index 574033bb13f..efa6f33fe00 100644 --- a/test/abilities/protean.test.ts +++ b/test/abilities/protean.test.ts @@ -29,7 +29,7 @@ describe("Abilities - Protean", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.ability(Abilities.PROTEAN); game.override.startingLevel(100); game.override.enemySpecies(Species.RATTATA); diff --git a/test/abilities/protosynthesis.test.ts b/test/abilities/protosynthesis.test.ts index 882474b7cef..e312ebd572c 100644 --- a/test/abilities/protosynthesis.test.ts +++ b/test/abilities/protosynthesis.test.ts @@ -27,7 +27,7 @@ describe("Abilities - Protosynthesis", () => { game.override .moveset([Moves.SPLASH, Moves.TACKLE]) .ability(Abilities.PROTOSYNTHESIS) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/abilities/quick_draw.test.ts b/test/abilities/quick_draw.test.ts index 1277fd5d3cb..0d3171e947e 100644 --- a/test/abilities/quick_draw.test.ts +++ b/test/abilities/quick_draw.test.ts @@ -24,7 +24,7 @@ describe("Abilities - Quick Draw", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.starterSpecies(Species.MAGIKARP); game.override.ability(Abilities.QUICK_DRAW); diff --git a/test/abilities/sand_spit.test.ts b/test/abilities/sand_spit.test.ts index 6896c286eed..2b655f92466 100644 --- a/test/abilities/sand_spit.test.ts +++ b/test/abilities/sand_spit.test.ts @@ -22,7 +22,7 @@ describe("Abilities - Sand Spit", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.disableCrits(); game.override.enemySpecies(Species.MAGIKARP); diff --git a/test/abilities/sand_veil.test.ts b/test/abilities/sand_veil.test.ts index c7b12a11c0e..b82c79c681b 100644 --- a/test/abilities/sand_veil.test.ts +++ b/test/abilities/sand_veil.test.ts @@ -34,7 +34,7 @@ describe("Abilities - Sand Veil", () => { game.override.enemyMoveset([Moves.TWISTER, Moves.TWISTER, Moves.TWISTER, Moves.TWISTER]); game.override.startingLevel(100); game.override.enemyLevel(100); - game.override.weather(WeatherType.SANDSTORM).battleType("double"); + game.override.weather(WeatherType.SANDSTORM).battleStyle("double"); }); test("ability should increase the evasiveness of the source", async () => { diff --git a/test/abilities/sap_sipper.test.ts b/test/abilities/sap_sipper.test.ts index f4f02844cbc..2157177b84c 100644 --- a/test/abilities/sap_sipper.test.ts +++ b/test/abilities/sap_sipper.test.ts @@ -29,7 +29,7 @@ describe("Abilities - Sap Sipper", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .disableCrits() .ability(Abilities.SAP_SIPPER) .enemySpecies(Species.RATTATA) diff --git a/test/abilities/schooling.test.ts b/test/abilities/schooling.test.ts index 35244b08e4c..803b4d2062a 100644 --- a/test/abilities/schooling.test.ts +++ b/test/abilities/schooling.test.ts @@ -25,7 +25,7 @@ describe("Abilities - SCHOOLING", () => { beforeEach(() => { game = new GameManager(phaserGame); const moveToUse = Moves.SPLASH; - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.ability(Abilities.SCHOOLING); game.override.moveset([moveToUse]); game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); diff --git a/test/abilities/screen_cleaner.test.ts b/test/abilities/screen_cleaner.test.ts index d8be1d64697..840291f6420 100644 --- a/test/abilities/screen_cleaner.test.ts +++ b/test/abilities/screen_cleaner.test.ts @@ -24,7 +24,7 @@ describe("Abilities - Screen Cleaner", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.ability(Abilities.SCREEN_CLEANER); game.override.enemySpecies(Species.SHUCKLE); }); diff --git a/test/abilities/seed_sower.test.ts b/test/abilities/seed_sower.test.ts index d78007f7500..d8edbe59857 100644 --- a/test/abilities/seed_sower.test.ts +++ b/test/abilities/seed_sower.test.ts @@ -22,7 +22,7 @@ describe("Abilities - Seed Sower", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.disableCrits(); game.override.enemySpecies(Species.MAGIKARP); diff --git a/test/abilities/serene_grace.test.ts b/test/abilities/serene_grace.test.ts index 65ca96acbbc..2547971a4b8 100644 --- a/test/abilities/serene_grace.test.ts +++ b/test/abilities/serene_grace.test.ts @@ -26,7 +26,7 @@ describe("Abilities - Serene Grace", () => { game = new GameManager(phaserGame); game.override .disableCrits() - .battleType("single") + .battleStyle("single") .ability(Abilities.SERENE_GRACE) .moveset([Moves.AIR_SLASH]) .enemySpecies(Species.ALOLA_GEODUDE) diff --git a/test/abilities/sheer_force.test.ts b/test/abilities/sheer_force.test.ts index fae089958a5..ce3232a1869 100644 --- a/test/abilities/sheer_force.test.ts +++ b/test/abilities/sheer_force.test.ts @@ -26,7 +26,7 @@ describe("Abilities - Sheer Force", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .ability(Abilities.SHEER_FORCE) .enemySpecies(Species.ONIX) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/abilities/shield_dust.test.ts b/test/abilities/shield_dust.test.ts index 257ebe885df..4f6783eb66a 100644 --- a/test/abilities/shield_dust.test.ts +++ b/test/abilities/shield_dust.test.ts @@ -31,7 +31,7 @@ describe("Abilities - Shield Dust", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.enemySpecies(Species.ONIX); game.override.enemyAbility(Abilities.SHIELD_DUST); game.override.startingLevel(100); diff --git a/test/abilities/shields_down.test.ts b/test/abilities/shields_down.test.ts index 4bdf22869cb..2f9d2fb1f97 100644 --- a/test/abilities/shields_down.test.ts +++ b/test/abilities/shields_down.test.ts @@ -26,7 +26,7 @@ describe("Abilities - SHIELDS DOWN", () => { beforeEach(() => { game = new GameManager(phaserGame); const moveToUse = Moves.SPLASH; - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.ability(Abilities.SHIELDS_DOWN); game.override.moveset([moveToUse]); game.override.enemyMoveset([Moves.TACKLE]); diff --git a/test/abilities/simple.test.ts b/test/abilities/simple.test.ts index b6c5fd116c0..1f084b1bf4c 100644 --- a/test/abilities/simple.test.ts +++ b/test/abilities/simple.test.ts @@ -23,7 +23,7 @@ describe("Abilities - Simple", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.BULBASAUR) .enemyAbility(Abilities.SIMPLE) .ability(Abilities.INTIMIDATE) diff --git a/test/abilities/speed_boost.test.ts b/test/abilities/speed_boost.test.ts index fa20e74108f..45ee54ffb07 100644 --- a/test/abilities/speed_boost.test.ts +++ b/test/abilities/speed_boost.test.ts @@ -27,7 +27,7 @@ describe("Abilities - Speed Boost", () => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.SHUCKLE) .enemyAbility(Abilities.BALL_FETCH) .enemyLevel(100) diff --git a/test/abilities/stakeout.test.ts b/test/abilities/stakeout.test.ts index b464b3f1dfc..b3a7bdbf287 100644 --- a/test/abilities/stakeout.test.ts +++ b/test/abilities/stakeout.test.ts @@ -26,7 +26,7 @@ describe("Abilities - Stakeout", () => { game.override .moveset([Moves.SPLASH, Moves.SURF]) .ability(Abilities.STAKEOUT) - .battleType("single") + .battleStyle("single") .disableCrits() .startingLevel(100) .enemyLevel(100) diff --git a/test/abilities/stall.test.ts b/test/abilities/stall.test.ts index 5b67e5f4b7a..68b3fdedcd8 100644 --- a/test/abilities/stall.test.ts +++ b/test/abilities/stall.test.ts @@ -22,7 +22,7 @@ describe("Abilities - Stall", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.disableCrits(); game.override.enemySpecies(Species.REGIELEKI); game.override.enemyAbility(Abilities.STALL); diff --git a/test/abilities/steely_spirit.test.ts b/test/abilities/steely_spirit.test.ts index eb5e7aac601..be759724c3a 100644 --- a/test/abilities/steely_spirit.test.ts +++ b/test/abilities/steely_spirit.test.ts @@ -28,7 +28,7 @@ describe("Abilities - Steely Spirit", () => { beforeEach(() => { ironHeadPower = allMoves[moveToCheck].power; game = new GameManager(phaserGame); - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.enemySpecies(Species.SHUCKLE); game.override.enemyAbility(Abilities.BALL_FETCH); game.override.moveset([Moves.IRON_HEAD, Moves.SPLASH]); diff --git a/test/abilities/storm_drain.test.ts b/test/abilities/storm_drain.test.ts index 58ff477fa43..0cbad796ad8 100644 --- a/test/abilities/storm_drain.test.ts +++ b/test/abilities/storm_drain.test.ts @@ -26,7 +26,7 @@ describe("Abilities - Storm Drain", () => { game.override .moveset([Moves.SPLASH, Moves.WATER_GUN]) .ability(Abilities.BALL_FETCH) - .battleType("double") + .battleStyle("double") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/abilities/sturdy.test.ts b/test/abilities/sturdy.test.ts index 7b7254cff15..bda8c6d1e35 100644 --- a/test/abilities/sturdy.test.ts +++ b/test/abilities/sturdy.test.ts @@ -24,7 +24,7 @@ describe("Abilities - Sturdy", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.starterSpecies(Species.LUCARIO); game.override.startingLevel(100); diff --git a/test/abilities/super_luck.test.ts b/test/abilities/super_luck.test.ts index bc9524de801..9e0b6485734 100644 --- a/test/abilities/super_luck.test.ts +++ b/test/abilities/super_luck.test.ts @@ -24,7 +24,7 @@ describe("Abilities - Super Luck", () => { game.override .moveset([Moves.TACKLE]) .ability(Abilities.SUPER_LUCK) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/abilities/supreme_overlord.test.ts b/test/abilities/supreme_overlord.test.ts index a71bf0a9354..8af0a0ac37c 100644 --- a/test/abilities/supreme_overlord.test.ts +++ b/test/abilities/supreme_overlord.test.ts @@ -31,7 +31,7 @@ describe("Abilities - Supreme Overlord", () => { basePower = move.power; game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.MAGIKARP) .enemyLevel(100) .startingLevel(1) diff --git a/test/abilities/sweet_veil.test.ts b/test/abilities/sweet_veil.test.ts index 650ee53a474..e609aa6e7d2 100644 --- a/test/abilities/sweet_veil.test.ts +++ b/test/abilities/sweet_veil.test.ts @@ -25,7 +25,7 @@ describe("Abilities - Sweet Veil", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.moveset([Moves.SPLASH, Moves.REST, Moves.YAWN]); game.override.enemySpecies(Species.MAGIKARP); game.override.enemyAbility(Abilities.BALL_FETCH); diff --git a/test/abilities/synchronize.test.ts b/test/abilities/synchronize.test.ts index 95ebf96f2fd..783201d7a5b 100644 --- a/test/abilities/synchronize.test.ts +++ b/test/abilities/synchronize.test.ts @@ -24,7 +24,7 @@ describe("Abilities - Synchronize", () => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .startingLevel(100) .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.SYNCHRONIZE) diff --git a/test/abilities/tera_shell.test.ts b/test/abilities/tera_shell.test.ts index a99ecfd4ce1..c387da30166 100644 --- a/test/abilities/tera_shell.test.ts +++ b/test/abilities/tera_shell.test.ts @@ -24,7 +24,7 @@ describe("Abilities - Tera Shell", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .ability(Abilities.TERA_SHELL) .moveset([Moves.SPLASH]) .enemySpecies(Species.SNORLAX) diff --git a/test/abilities/thermal_exchange.test.ts b/test/abilities/thermal_exchange.test.ts index 124c1dba286..c33b296d5ae 100644 --- a/test/abilities/thermal_exchange.test.ts +++ b/test/abilities/thermal_exchange.test.ts @@ -23,9 +23,9 @@ describe("Abilities - Thermal Exchange", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .moveset([ Moves.SPLASH ]) + .moveset([Moves.SPLASH]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) @@ -33,12 +33,12 @@ describe("Abilities - Thermal Exchange", () => { }); it("should remove burn when gained", async () => { - game.override.ability(Abilities.THERMAL_EXCHANGE) + game.override + .ability(Abilities.THERMAL_EXCHANGE) .enemyAbility(Abilities.BALL_FETCH) .moveset(Moves.SKILL_SWAP) - .enemyMoveset(Moves.SPLASH), - - await game.classicMode.startBattle([ Species.FEEBAS ]); + .enemyMoveset(Moves.SPLASH); + await game.classicMode.startBattle([Species.FEEBAS]); const enemy = game.scene.getEnemyPokemon(); enemy?.trySetStatus(StatusEffect.BURN); expect(enemy?.status?.effect).toBe(StatusEffect.BURN); diff --git a/test/abilities/trace.test.ts b/test/abilities/trace.test.ts index 5d569208d33..7ec8d62ab51 100644 --- a/test/abilities/trace.test.ts +++ b/test/abilities/trace.test.ts @@ -25,7 +25,7 @@ describe("Abilities - Trace", () => { game.override .moveset([Moves.SPLASH]) .ability(Abilities.TRACE) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/abilities/unburden.test.ts b/test/abilities/unburden.test.ts index 769e078faf8..2af889d1da4 100644 --- a/test/abilities/unburden.test.ts +++ b/test/abilities/unburden.test.ts @@ -41,7 +41,7 @@ describe("Abilities - Unburden", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .startingLevel(1) .ability(Abilities.UNBURDEN) .moveset([Moves.SPLASH, Moves.KNOCK_OFF, Moves.PLUCK, Moves.FALSE_SWIPE]) @@ -231,7 +231,7 @@ describe("Abilities - Unburden", () => { }); it("should deactivate temporarily when a neutralizing gas user is on the field", async () => { - game.override.battleType("double").ability(Abilities.NONE); // Disable ability override so that we can properly set abilities below + game.override.battleStyle("double").ability(Abilities.NONE); // Disable ability override so that we can properly set abilities below await game.classicMode.startBattle([Species.TREECKO, Species.MEOWTH, Species.WEEZING]); const [treecko, _meowth, weezing] = game.scene.getPlayerParty(); @@ -359,7 +359,7 @@ describe("Abilities - Unburden", () => { // test for `.bypassFaint()` - doubles it("shouldn't persist when revived by revival blessing if activated while fainting", async () => { game.override - .battleType("double") + .battleStyle("double") .enemyMoveset([Moves.SPLASH, Moves.THIEF]) .moveset([Moves.SPLASH, Moves.REVIVAL_BLESSING]) .startingHeldItems([{ name: "WIDE_LENS" }]); diff --git a/test/abilities/unseen_fist.test.ts b/test/abilities/unseen_fist.test.ts index 459bb00628c..6c14e82fc39 100644 --- a/test/abilities/unseen_fist.test.ts +++ b/test/abilities/unseen_fist.test.ts @@ -24,7 +24,7 @@ describe("Abilities - Unseen Fist", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.starterSpecies(Species.URSHIFU); game.override.enemySpecies(Species.SNORLAX); game.override.enemyMoveset([Moves.PROTECT, Moves.PROTECT, Moves.PROTECT, Moves.PROTECT]); diff --git a/test/abilities/victory_star.test.ts b/test/abilities/victory_star.test.ts index 92db522871a..f3c0b5ad6b7 100644 --- a/test/abilities/victory_star.test.ts +++ b/test/abilities/victory_star.test.ts @@ -25,7 +25,7 @@ describe("Abilities - Victory Star", () => { game = new GameManager(phaserGame); game.override .moveset([Moves.TACKLE, Moves.SPLASH]) - .battleType("double") + .battleStyle("double") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/abilities/vital_spirit.test.ts b/test/abilities/vital_spirit.test.ts index 3a53c3f520e..bb274310cc0 100644 --- a/test/abilities/vital_spirit.test.ts +++ b/test/abilities/vital_spirit.test.ts @@ -23,9 +23,9 @@ describe("Abilities - Vital Spirit", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .moveset([ Moves.SPLASH ]) + .moveset([Moves.SPLASH]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) @@ -33,12 +33,12 @@ describe("Abilities - Vital Spirit", () => { }); it("should remove sleep when gained", async () => { - game.override.ability(Abilities.INSOMNIA) + game.override + .ability(Abilities.INSOMNIA) .enemyAbility(Abilities.BALL_FETCH) .moveset(Moves.SKILL_SWAP) - .enemyMoveset(Moves.SPLASH), - - await game.classicMode.startBattle([ Species.FEEBAS ]); + .enemyMoveset(Moves.SPLASH); + await game.classicMode.startBattle([Species.FEEBAS]); const enemy = game.scene.getEnemyPokemon(); enemy?.trySetStatus(StatusEffect.SLEEP); expect(enemy?.status?.effect).toBe(StatusEffect.SLEEP); diff --git a/test/abilities/volt_absorb.test.ts b/test/abilities/volt_absorb.test.ts index 10735f31987..920c822eb90 100644 --- a/test/abilities/volt_absorb.test.ts +++ b/test/abilities/volt_absorb.test.ts @@ -26,7 +26,7 @@ describe("Abilities - Volt Absorb", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.disableCrits(); }); diff --git a/test/abilities/wandering_spirit.test.ts b/test/abilities/wandering_spirit.test.ts index 375faa41972..639241aecc8 100644 --- a/test/abilities/wandering_spirit.test.ts +++ b/test/abilities/wandering_spirit.test.ts @@ -25,7 +25,7 @@ describe("Abilities - Wandering Spirit", () => { game.override .moveset([Moves.SPLASH]) .ability(Abilities.WANDERING_SPIRIT) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/abilities/water_bubble.test.ts b/test/abilities/water_bubble.test.ts index 0b85a5814da..c1e2acbd468 100644 --- a/test/abilities/water_bubble.test.ts +++ b/test/abilities/water_bubble.test.ts @@ -23,9 +23,9 @@ describe("Abilities - Water Bubble", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .moveset([ Moves.SPLASH ]) + .moveset([Moves.SPLASH]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) @@ -33,12 +33,12 @@ describe("Abilities - Water Bubble", () => { }); it("should remove burn when gained", async () => { - game.override.ability(Abilities.THERMAL_EXCHANGE) + game.override + .ability(Abilities.THERMAL_EXCHANGE) .enemyAbility(Abilities.BALL_FETCH) .moveset(Moves.SKILL_SWAP) - .enemyMoveset(Moves.SPLASH), - - await game.classicMode.startBattle([ Species.FEEBAS ]); + .enemyMoveset(Moves.SPLASH); + await game.classicMode.startBattle([Species.FEEBAS]); const enemy = game.scene.getEnemyPokemon(); enemy?.trySetStatus(StatusEffect.BURN); expect(enemy?.status?.effect).toBe(StatusEffect.BURN); diff --git a/test/abilities/water_veil.test.ts b/test/abilities/water_veil.test.ts index 38c9a05600b..8e187ad8e58 100644 --- a/test/abilities/water_veil.test.ts +++ b/test/abilities/water_veil.test.ts @@ -23,9 +23,9 @@ describe("Abilities - Water Veil", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .moveset([ Moves.SPLASH ]) + .moveset([Moves.SPLASH]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) @@ -33,12 +33,12 @@ describe("Abilities - Water Veil", () => { }); it("should remove burn when gained", async () => { - game.override.ability(Abilities.THERMAL_EXCHANGE) + game.override + .ability(Abilities.THERMAL_EXCHANGE) .enemyAbility(Abilities.BALL_FETCH) .moveset(Moves.SKILL_SWAP) - .enemyMoveset(Moves.SPLASH), - - await game.classicMode.startBattle([ Species.FEEBAS ]); + .enemyMoveset(Moves.SPLASH); + await game.classicMode.startBattle([Species.FEEBAS]); const enemy = game.scene.getEnemyPokemon(); enemy?.trySetStatus(StatusEffect.BURN); expect(enemy?.status?.effect).toBe(StatusEffect.BURN); diff --git a/test/abilities/wimp_out.test.ts b/test/abilities/wimp_out.test.ts index 294025a10e7..c46675376c1 100644 --- a/test/abilities/wimp_out.test.ts +++ b/test/abilities/wimp_out.test.ts @@ -31,7 +31,7 @@ describe("Abilities - Wimp Out", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .ability(Abilities.WIMP_OUT) .enemySpecies(Species.NINJASK) .enemyPassiveAbility(Abilities.NO_GUARD) @@ -342,7 +342,7 @@ describe("Abilities - Wimp Out", () => { }); it("Wimp Out activating should not cancel a double battle", async () => { - game.override.battleType("double").enemyAbility(Abilities.WIMP_OUT).enemyMoveset([Moves.SPLASH]).enemyLevel(1); + game.override.battleStyle("double").enemyAbility(Abilities.WIMP_OUT).enemyMoveset([Moves.SPLASH]).enemyLevel(1); await game.classicMode.startBattle([Species.WIMPOD, Species.TYRUNT]); const enemyLeadPokemon = game.scene.getEnemyParty()[0]; const enemySecPokemon = game.scene.getEnemyParty()[1]; @@ -508,7 +508,7 @@ describe("Abilities - Wimp Out", () => { .moveset([Moves.MATCHA_GOTCHA, Moves.FALSE_SWIPE]) .startingLevel(50) .enemyLevel(1) - .battleType("double") + .battleStyle("double") .startingWave(wave); await game.classicMode.startBattle([Species.RAICHU, Species.PIKACHU]); const [wimpod0, wimpod1] = game.scene.getEnemyField(); @@ -534,12 +534,12 @@ describe("Abilities - Wimp Out", () => { .enemyAbility(Abilities.WIMP_OUT) .startingLevel(50) .enemyLevel(1) - .enemyMoveset([ Moves.SPLASH, Moves.ENDURE ]) - .battleType("double") - .moveset([ Moves.DRAGON_ENERGY, Moves.SPLASH ]) + .enemyMoveset([Moves.SPLASH, Moves.ENDURE]) + .battleStyle("double") + .moveset([Moves.DRAGON_ENERGY, Moves.SPLASH]) .startingWave(wave); - await game.classicMode.startBattle([ Species.REGIDRAGO, Species.MAGIKARP ]); + await game.classicMode.startBattle([Species.REGIDRAGO, Species.MAGIKARP]); // turn 1 game.move.select(Moves.DRAGON_ENERGY, 0); @@ -549,6 +549,5 @@ describe("Abilities - Wimp Out", () => { await game.phaseInterceptor.to("SelectModifierPhase"); expect(game.scene.currentBattle.waveIndex).toBe(wave + 1); - }); }); diff --git a/test/abilities/wind_power.test.ts b/test/abilities/wind_power.test.ts index b28ac3362eb..66c72d454ab 100644 --- a/test/abilities/wind_power.test.ts +++ b/test/abilities/wind_power.test.ts @@ -23,7 +23,7 @@ describe("Abilities - Wind Power", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.enemySpecies(Species.SHIFTRY); game.override.enemyAbility(Abilities.WIND_POWER); game.override.moveset([Moves.TAILWIND, Moves.SPLASH, Moves.PETAL_BLIZZARD, Moves.SANDSTORM]); diff --git a/test/abilities/wind_rider.test.ts b/test/abilities/wind_rider.test.ts index 8fdae1b24ec..f8301aa03fc 100644 --- a/test/abilities/wind_rider.test.ts +++ b/test/abilities/wind_rider.test.ts @@ -23,7 +23,7 @@ describe("Abilities - Wind Rider", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.SHIFTRY) .enemyAbility(Abilities.WIND_RIDER) .moveset([Moves.TAILWIND, Moves.SPLASH, Moves.PETAL_BLIZZARD, Moves.SANDSTORM]) diff --git a/test/abilities/wonder_skin.test.ts b/test/abilities/wonder_skin.test.ts index 18d5be36aef..d039ba1e6a7 100644 --- a/test/abilities/wonder_skin.test.ts +++ b/test/abilities/wonder_skin.test.ts @@ -23,7 +23,7 @@ describe("Abilities - Wonder Skin", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.moveset([Moves.TACKLE, Moves.CHARM]); game.override.ability(Abilities.BALL_FETCH); game.override.enemySpecies(Species.SHUCKLE); diff --git a/test/abilities/zen_mode.test.ts b/test/abilities/zen_mode.test.ts index d552d8c88ca..1eb27a8f6c7 100644 --- a/test/abilities/zen_mode.test.ts +++ b/test/abilities/zen_mode.test.ts @@ -26,7 +26,7 @@ describe("Abilities - ZEN MODE", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/abilities/zero_to_hero.test.ts b/test/abilities/zero_to_hero.test.ts index 4565aa3e8b2..2cdc516dc6b 100644 --- a/test/abilities/zero_to_hero.test.ts +++ b/test/abilities/zero_to_hero.test.ts @@ -27,7 +27,7 @@ describe("Abilities - ZERO TO HERO", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .moveset(Moves.SPLASH) .enemyMoveset(Moves.SPLASH) .enemyAbility(Abilities.BALL_FETCH); diff --git a/test/arena/arena_gravity.test.ts b/test/arena/arena_gravity.test.ts index a5ce84667f0..0ce5ac0ea4c 100644 --- a/test/arena/arena_gravity.test.ts +++ b/test/arena/arena_gravity.test.ts @@ -26,7 +26,7 @@ describe("Arena - Gravity", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .moveset([Moves.TACKLE, Moves.GRAVITY, Moves.FISSURE]) .ability(Abilities.UNNERVE) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/arena/grassy_terrain.test.ts b/test/arena/grassy_terrain.test.ts index d92fb24be5a..f8ca07bd65e 100644 --- a/test/arena/grassy_terrain.test.ts +++ b/test/arena/grassy_terrain.test.ts @@ -22,7 +22,7 @@ describe("Arena - Grassy Terrain", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .disableCrits() .enemyLevel(1) .enemySpecies(Species.SHUCKLE) diff --git a/test/arena/weather_fog.test.ts b/test/arena/weather_fog.test.ts index 784c4886648..b1edf75704b 100644 --- a/test/arena/weather_fog.test.ts +++ b/test/arena/weather_fog.test.ts @@ -24,7 +24,7 @@ describe("Weather - Fog", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.weather(WeatherType.FOG).battleType("single"); + game.override.weather(WeatherType.FOG).battleStyle("single"); game.override.moveset([Moves.TACKLE]); game.override.ability(Abilities.BALL_FETCH); game.override.enemyAbility(Abilities.BALL_FETCH); diff --git a/test/arena/weather_hail.test.ts b/test/arena/weather_hail.test.ts index 7af2edf26f2..2fa4f71d8ca 100644 --- a/test/arena/weather_hail.test.ts +++ b/test/arena/weather_hail.test.ts @@ -24,7 +24,7 @@ describe("Weather - Hail", () => { game = new GameManager(phaserGame); game.override .weather(WeatherType.HAIL) - .battleType("single") + .battleStyle("single") .moveset(Moves.SPLASH) .enemyMoveset(Moves.SPLASH) .enemySpecies(Species.MAGIKARP); diff --git a/test/arena/weather_sandstorm.test.ts b/test/arena/weather_sandstorm.test.ts index d43983c4c01..e7620f6cf30 100644 --- a/test/arena/weather_sandstorm.test.ts +++ b/test/arena/weather_sandstorm.test.ts @@ -25,7 +25,7 @@ describe("Weather - Sandstorm", () => { game = new GameManager(phaserGame); game.override .weather(WeatherType.SANDSTORM) - .battleType("single") + .battleStyle("single") .moveset(Moves.SPLASH) .enemyMoveset(Moves.SPLASH) .enemySpecies(Species.MAGIKARP); @@ -60,7 +60,7 @@ describe("Weather - Sandstorm", () => { it("does not inflict damage to Rock, Ground and Steel type Pokemon", async () => { game.override - .battleType("double") + .battleStyle("double") .enemySpecies(Species.SANDSHREW) .ability(Abilities.BALL_FETCH) .enemyAbility(Abilities.BALL_FETCH); diff --git a/test/arena/weather_strong_winds.test.ts b/test/arena/weather_strong_winds.test.ts index 3a9235d9eb9..9fcdb18c872 100644 --- a/test/arena/weather_strong_winds.test.ts +++ b/test/arena/weather_strong_winds.test.ts @@ -24,7 +24,7 @@ describe("Weather - Strong Winds", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.startingLevel(10); game.override.enemySpecies(Species.TAILLOW); game.override.enemyAbility(Abilities.DELTA_STREAM); diff --git a/test/battle/ability_swap.test.ts b/test/battle/ability_swap.test.ts index 215321f26c2..c9f91df3a48 100644 --- a/test/battle/ability_swap.test.ts +++ b/test/battle/ability_swap.test.ts @@ -26,7 +26,7 @@ describe("Test Ability Swapping", () => { game.override .moveset([Moves.SPLASH]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/battle/battle-order.test.ts b/test/battle/battle-order.test.ts index 012f1ecd4bd..43fa1e59c14 100644 --- a/test/battle/battle-order.test.ts +++ b/test/battle/battle-order.test.ts @@ -24,7 +24,7 @@ describe("Battle order", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.enemySpecies(Species.MEWTWO); game.override.enemyAbility(Abilities.INSOMNIA); game.override.ability(Abilities.INSOMNIA); @@ -70,7 +70,7 @@ describe("Battle order", () => { }, 20000); it("double - both opponents faster than player 50/50 vs 150/150", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); await game.startBattle([Species.BULBASAUR, Species.BLASTOISE]); const playerPokemon = game.scene.getPlayerField(); @@ -94,7 +94,7 @@ describe("Battle order", () => { }, 20000); it("double - speed tie except 1 - 100/100 vs 100/150", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); await game.startBattle([Species.BULBASAUR, Species.BLASTOISE]); const playerPokemon = game.scene.getPlayerField(); @@ -118,7 +118,7 @@ describe("Battle order", () => { }, 20000); it("double - speed tie 100/150 vs 100/150", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); await game.startBattle([Species.BULBASAUR, Species.BLASTOISE]); const playerPokemon = game.scene.getPlayerField(); diff --git a/test/battle/battle.test.ts b/test/battle/battle.test.ts index 36d197d1289..51304c7d5dd 100644 --- a/test/battle/battle.test.ts +++ b/test/battle/battle.test.ts @@ -94,7 +94,7 @@ describe("Test Battle Phase", () => { game.override.starterSpecies(Species.MEWTWO); game.override.enemySpecies(Species.RATTATA); game.override.startingLevel(2000); - game.override.startingWave(3).battleType("single"); + game.override.startingWave(3).battleStyle("single"); game.override.moveset([Moves.TACKLE]); game.override.enemyAbility(Abilities.HYDRATION); game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); @@ -111,7 +111,7 @@ describe("Test Battle Phase", () => { game.override.moveset([Moves.TACKLE]); game.override.enemyAbility(Abilities.HYDRATION); game.override.enemyMoveset([Moves.TAIL_WHIP, Moves.TAIL_WHIP, Moves.TAIL_WHIP, Moves.TAIL_WHIP]); - game.override.battleType("single"); + game.override.battleStyle("single"); await game.startBattle(); game.move.select(Moves.TACKLE); await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(TurnInitPhase, false); @@ -203,7 +203,7 @@ describe("Test Battle Phase", () => { }, 20000); it("2vs1", async () => { - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.enemySpecies(Species.MIGHTYENA); game.override.enemyAbility(Abilities.HYDRATION); game.override.ability(Abilities.HYDRATION); @@ -213,7 +213,7 @@ describe("Test Battle Phase", () => { }, 20000); it("1vs1", async () => { - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.enemySpecies(Species.MIGHTYENA); game.override.enemyAbility(Abilities.HYDRATION); game.override.ability(Abilities.HYDRATION); @@ -223,7 +223,7 @@ describe("Test Battle Phase", () => { }, 20000); it("2vs2", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.enemySpecies(Species.MIGHTYENA); game.override.enemyAbility(Abilities.HYDRATION); game.override.ability(Abilities.HYDRATION); @@ -234,7 +234,7 @@ describe("Test Battle Phase", () => { }, 20000); it("4vs2", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.enemySpecies(Species.MIGHTYENA); game.override.enemyAbility(Abilities.HYDRATION); game.override.ability(Abilities.HYDRATION); @@ -246,7 +246,7 @@ describe("Test Battle Phase", () => { it("kill opponent pokemon", async () => { const moveToUse = Moves.SPLASH; - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.starterSpecies(Species.MEWTWO); game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.HYDRATION); @@ -266,7 +266,7 @@ describe("Test Battle Phase", () => { it("to next turn", async () => { const moveToUse = Moves.SPLASH; - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.starterSpecies(Species.MEWTWO); game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.HYDRATION); @@ -285,7 +285,7 @@ describe("Test Battle Phase", () => { it("does not set new weather if staying in same biome", async () => { const moveToUse = Moves.SPLASH; game.override - .battleType("single") + .battleStyle("single") .starterSpecies(Species.MEWTWO) .enemySpecies(Species.RATTATA) .enemyAbility(Abilities.HYDRATION) @@ -309,7 +309,7 @@ describe("Test Battle Phase", () => { it("does not force switch if active pokemon faints at same time as enemy mon and is revived in post-battle", async () => { const moveToUse = Moves.TAKE_DOWN; game.override - .battleType("single") + .battleStyle("single") .starterSpecies(Species.SAWK) .enemySpecies(Species.RATTATA) .startingWave(1) diff --git a/test/battle/damage_calculation.test.ts b/test/battle/damage_calculation.test.ts index dab1fc81caa..e8b3b65bd29 100644 --- a/test/battle/damage_calculation.test.ts +++ b/test/battle/damage_calculation.test.ts @@ -26,7 +26,7 @@ describe("Battle Mechanics - Damage Calculation", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.SNORLAX) .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset(Moves.SPLASH) diff --git a/test/battle/double_battle.test.ts b/test/battle/double_battle.test.ts index 21d27573d22..a30d55aac3d 100644 --- a/test/battle/double_battle.test.ts +++ b/test/battle/double_battle.test.ts @@ -33,7 +33,7 @@ describe("Double Battles", () => { // double-battle player's pokemon both fainted in same round, then revive one, and next double battle summons two player's pokemon successfully. // (There were bugs that either only summon one when can summon two, player stuck in switchPhase etc) it("3v2 edge case: player summons 2 pokemon on the next battle after being fainted and revived", async () => { - game.override.battleType("double").enemyMoveset(Moves.SPLASH).moveset(Moves.SPLASH); + game.override.battleStyle("double").enemyMoveset(Moves.SPLASH).moveset(Moves.SPLASH); await game.startBattle([Species.BULBASAUR, Species.CHARIZARD, Species.SQUIRTLE]); game.move.select(Moves.SPLASH); diff --git a/test/battle/inverse_battle.test.ts b/test/battle/inverse_battle.test.ts index 83109c35740..f8afa3518a9 100644 --- a/test/battle/inverse_battle.test.ts +++ b/test/battle/inverse_battle.test.ts @@ -30,7 +30,7 @@ describe("Inverse Battle", () => { game.challengeMode.addChallenge(Challenges.INVERSE_BATTLE, 1, 1); game.override - .battleType("single") + .battleStyle("single") .starterSpecies(Species.FEEBAS) .ability(Abilities.BALL_FETCH) .enemySpecies(Species.MAGIKARP) diff --git a/test/battle/special_battle.test.ts b/test/battle/special_battle.test.ts index cf7f3733484..46dd8eaa010 100644 --- a/test/battle/special_battle.test.ts +++ b/test/battle/special_battle.test.ts @@ -32,63 +32,63 @@ describe("Test Battle Phase", () => { }); it("startBattle 2vs1 boss", async () => { - game.override.battleType("single").startingWave(10); + game.override.battleStyle("single").startingWave(10); await game.startBattle([Species.BLASTOISE, Species.CHARIZARD]); expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND); expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); }, 20000); it("startBattle 2vs2 boss", async () => { - game.override.battleType("double").startingWave(10); + game.override.battleStyle("double").startingWave(10); await game.startBattle([Species.BLASTOISE, Species.CHARIZARD]); expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND); expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); }, 20000); it("startBattle 2vs2 trainer", async () => { - game.override.battleType("double").startingWave(5); + game.override.battleStyle("double").startingWave(5); await game.startBattle([Species.BLASTOISE, Species.CHARIZARD]); expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND); expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); }, 20000); it("startBattle 2vs1 trainer", async () => { - game.override.battleType("single").startingWave(5); + game.override.battleStyle("single").startingWave(5); await game.startBattle([Species.BLASTOISE, Species.CHARIZARD]); expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND); expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); }, 20000); it("startBattle 2vs1 rival", async () => { - game.override.battleType("single").startingWave(8); + game.override.battleStyle("single").startingWave(8); await game.startBattle([Species.BLASTOISE, Species.CHARIZARD]); expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND); expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); }, 20000); it("startBattle 2vs2 rival", async () => { - game.override.battleType("double").startingWave(8); + game.override.battleStyle("double").startingWave(8); await game.startBattle([Species.BLASTOISE, Species.CHARIZARD]); expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND); expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); }, 20000); it("startBattle 1vs1 trainer", async () => { - game.override.battleType("single").startingWave(5); + game.override.battleStyle("single").startingWave(5); await game.startBattle([Species.BLASTOISE]); expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND); expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); }, 20000); it("startBattle 2vs2 trainer", async () => { - game.override.battleType("double").startingWave(5); + game.override.battleStyle("double").startingWave(5); await game.startBattle([Species.BLASTOISE, Species.CHARIZARD]); expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND); expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); }, 20000); it("startBattle 4vs2 trainer", async () => { - game.override.battleType("double").startingWave(5); + game.override.battleStyle("double").startingWave(5); await game.startBattle([Species.BLASTOISE, Species.CHARIZARD, Species.DARKRAI, Species.GABITE]); expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND); expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); diff --git a/test/boss-pokemon.test.ts b/test/boss-pokemon.test.ts index 6b150de2d2b..9df69da09b7 100644 --- a/test/boss-pokemon.test.ts +++ b/test/boss-pokemon.test.ts @@ -26,7 +26,7 @@ describe("Boss Pokemon / Shields", () => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .disableTrainerWaves() .disableCrits() .enemySpecies(Species.RATTATA) @@ -63,7 +63,7 @@ describe("Boss Pokemon / Shields", () => { }); it("should reduce the number of shields if we are in a double battle", async () => { - game.override.battleType("double").startingWave(150); // Floor 150 > 2 shields / 3 health segments + game.override.battleStyle("double").startingWave(150); // Floor 150 > 2 shields / 3 health segments await game.classicMode.startBattle([Species.MEWTWO]); @@ -105,7 +105,7 @@ describe("Boss Pokemon / Shields", () => { }); it("breaking multiple shields at once requires extra damage", async () => { - game.override.battleType("double").enemyHealthSegments(5); + game.override.battleStyle("double").enemyHealthSegments(5); await game.classicMode.startBattle([Species.MEWTWO]); @@ -140,7 +140,7 @@ describe("Boss Pokemon / Shields", () => { it("the number of stat stage boosts is consistent when several shields are broken at once", async () => { const shieldsToBreak = 4; - game.override.battleType("double").enemyHealthSegments(shieldsToBreak + 1); + game.override.battleStyle("double").enemyHealthSegments(shieldsToBreak + 1); await game.classicMode.startBattle([Species.MEWTWO]); diff --git a/test/daily_mode.test.ts b/test/daily_mode.test.ts index c530fca61a6..6b95543fb3b 100644 --- a/test/daily_mode.test.ts +++ b/test/daily_mode.test.ts @@ -57,7 +57,7 @@ describe("Shop modifications", async () => { game.override .startingWave(9) .startingBiome(Biome.ICE_CAVE) - .battleType("single") + .battleStyle("single") .startingLevel(100) // Avoid levelling up .disableTrainerWaves() .moveset([Moves.SPLASH]) diff --git a/test/data/status_effect.test.ts b/test/data/status_effect.test.ts index 0fd2daa308b..111136bf0a2 100644 --- a/test/data/status_effect.test.ts +++ b/test/data/status_effect.test.ts @@ -358,7 +358,7 @@ describe("Status Effects", () => { game.override .moveset([Moves.SPLASH]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) @@ -414,7 +414,7 @@ describe("Status Effects", () => { game.override .moveset([Moves.SPLASH]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/escape-calculations.test.ts b/test/escape-calculations.test.ts index b4504c7359c..d591bdec9fc 100644 --- a/test/escape-calculations.test.ts +++ b/test/escape-calculations.test.ts @@ -25,7 +25,7 @@ describe("Escape chance calculations", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.BULBASAUR) .enemyAbility(Abilities.INSOMNIA) .ability(Abilities.INSOMNIA); @@ -97,7 +97,7 @@ describe("Escape chance calculations", () => { }, 20000); it("double non-boss opponent", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); await game.classicMode.startBattle([Species.BULBASAUR, Species.ABOMASNOW]); const playerPokemon = game.scene.getPlayerField(); @@ -262,7 +262,7 @@ describe("Escape chance calculations", () => { }, 20000); it("double boss opponent", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.startingWave(10); await game.classicMode.startBattle([Species.BULBASAUR, Species.ABOMASNOW]); diff --git a/test/evolution.test.ts b/test/evolution.test.ts index dd6795bf161..68d02402eac 100644 --- a/test/evolution.test.ts +++ b/test/evolution.test.ts @@ -28,7 +28,7 @@ describe("Evolution", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.enemySpecies(Species.MAGIKARP); game.override.enemyAbility(Abilities.BALL_FETCH); diff --git a/test/items/dire_hit.test.ts b/test/items/dire_hit.test.ts index 038d88ddc73..f6197e097c2 100644 --- a/test/items/dire_hit.test.ts +++ b/test/items/dire_hit.test.ts @@ -36,7 +36,7 @@ describe("Items - Dire Hit", () => { .enemyMoveset(Moves.SPLASH) .moveset([Moves.POUND]) .startingHeldItems([{ name: "DIRE_HIT" }]) - .battleType("single") + .battleStyle("single") .disableCrits(); }, 20000); diff --git a/test/items/eviolite.test.ts b/test/items/eviolite.test.ts index 2b82e2145e9..43fd6a795bb 100644 --- a/test/items/eviolite.test.ts +++ b/test/items/eviolite.test.ts @@ -22,7 +22,7 @@ describe("Items - Eviolite", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single").startingHeldItems([{ name: "EVIOLITE" }]); + game.override.battleStyle("single").startingHeldItems([{ name: "EVIOLITE" }]); }); it("should provide 50% boost to DEF and SPDEF for unevolved, unfused pokemon", async () => { diff --git a/test/items/exp_booster.test.ts b/test/items/exp_booster.test.ts index 2b1308f1afb..3fe31e5c202 100644 --- a/test/items/exp_booster.test.ts +++ b/test/items/exp_booster.test.ts @@ -24,7 +24,7 @@ describe("EXP Modifier Items", () => { game.override.enemyAbility(Abilities.BALL_FETCH); game.override.ability(Abilities.BALL_FETCH); - game.override.battleType("single"); + game.override.battleStyle("single"); }); it("EXP booster items stack multiplicatively", async () => { diff --git a/test/items/grip_claw.test.ts b/test/items/grip_claw.test.ts index aa7c23ca43d..2396a7ca072 100644 --- a/test/items/grip_claw.test.ts +++ b/test/items/grip_claw.test.ts @@ -27,7 +27,7 @@ describe("Items - Grip Claw", () => { game = new GameManager(phaserGame); game.override - .battleType("double") + .battleStyle("double") .moveset([Moves.TACKLE, Moves.SPLASH, Moves.ATTRACT]) .startingHeldItems([{ name: "GRIP_CLAW", count: 1 }]) .enemySpecies(Species.SNORLAX) @@ -101,7 +101,7 @@ describe("Items - Grip Claw", () => { it("should not allow Pollen Puff to steal items when healing ally", async () => { game.override - .battleType("double") + .battleStyle("double") .moveset([Moves.POLLEN_PUFF, Moves.ENDURE]) .startingHeldItems([ { name: "GRIP_CLAW", count: 1 }, diff --git a/test/items/leek.test.ts b/test/items/leek.test.ts index afb31a5f9fa..5f9be882bc1 100644 --- a/test/items/leek.test.ts +++ b/test/items/leek.test.ts @@ -29,7 +29,7 @@ describe("Items - Leek", () => { .startingHeldItems([{ name: "LEEK" }]) .moveset([Moves.TACKLE]) .disableCrits() - .battleType("single"); + .battleStyle("single"); }); it("should raise CRIT stage by 2 when held by FARFETCHD", async () => { diff --git a/test/items/leftovers.test.ts b/test/items/leftovers.test.ts index ad22e9c3cae..19739703f19 100644 --- a/test/items/leftovers.test.ts +++ b/test/items/leftovers.test.ts @@ -23,7 +23,7 @@ describe("Items - Leftovers", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.startingLevel(2000); game.override.ability(Abilities.UNNERVE); game.override.moveset([Moves.SPLASH]); diff --git a/test/items/light_ball.test.ts b/test/items/light_ball.test.ts index 1f5227142eb..e85fb1b602b 100644 --- a/test/items/light_ball.test.ts +++ b/test/items/light_ball.test.ts @@ -25,7 +25,7 @@ describe("Items - Light Ball", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); }); it("LIGHT_BALL activates in battle correctly", async () => { diff --git a/test/items/lock_capsule.test.ts b/test/items/lock_capsule.test.ts index 4e4182b3038..9cc6046307e 100644 --- a/test/items/lock_capsule.test.ts +++ b/test/items/lock_capsule.test.ts @@ -25,7 +25,7 @@ describe("Items - Lock Capsule", () => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .startingLevel(200) .moveset([Moves.SURF]) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/items/metal_powder.test.ts b/test/items/metal_powder.test.ts index ed96d3c498b..37686710848 100644 --- a/test/items/metal_powder.test.ts +++ b/test/items/metal_powder.test.ts @@ -25,7 +25,7 @@ describe("Items - Metal Powder", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); }); it("METAL_POWDER activates in battle correctly", async () => { diff --git a/test/items/multi_lens.test.ts b/test/items/multi_lens.test.ts index 176e8213f55..ff6154b8283 100644 --- a/test/items/multi_lens.test.ts +++ b/test/items/multi_lens.test.ts @@ -27,7 +27,7 @@ describe("Items - Multi Lens", () => { .moveset([Moves.TACKLE, Moves.TRAILBLAZE, Moves.TACHYON_CUTTER, Moves.FUTURE_SIGHT]) .ability(Abilities.BALL_FETCH) .startingHeldItems([{ name: "MULTI_LENS" }]) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.SNORLAX) .enemyAbility(Abilities.BALL_FETCH) @@ -99,7 +99,7 @@ describe("Items - Multi Lens", () => { }); it("should enhance multi-target moves", async () => { - game.override.battleType("double").moveset([Moves.SWIFT, Moves.SPLASH]); + game.override.battleStyle("double").moveset([Moves.SWIFT, Moves.SPLASH]); await game.classicMode.startBattle([Species.MAGIKARP, Species.FEEBAS]); @@ -213,7 +213,7 @@ describe("Items - Multi Lens", () => { }); it("should not allow Pollen Puff to heal ally more than once", async () => { - game.override.battleType("double").moveset([Moves.POLLEN_PUFF, Moves.ENDURE]); + game.override.battleStyle("double").moveset([Moves.POLLEN_PUFF, Moves.ENDURE]); await game.classicMode.startBattle([Species.BULBASAUR, Species.OMANYTE]); const [, rightPokemon] = game.scene.getPlayerField(); diff --git a/test/items/mystical_rock.test.ts b/test/items/mystical_rock.test.ts index 0558bc21fe1..59119ce8611 100644 --- a/test/items/mystical_rock.test.ts +++ b/test/items/mystical_rock.test.ts @@ -29,7 +29,7 @@ describe("Items - Mystical Rock", () => { .enemyAbility(Abilities.BALL_FETCH) .moveset([Moves.SUNNY_DAY, Moves.GRASSY_TERRAIN]) .startingHeldItems([{ name: "MYSTICAL_ROCK", count: 2 }]) - .battleType("single"); + .battleStyle("single"); }); it("should increase weather duration by +2 turns per stack", async () => { diff --git a/test/items/quick_powder.test.ts b/test/items/quick_powder.test.ts index 7115cad8cd1..6937d6093f3 100644 --- a/test/items/quick_powder.test.ts +++ b/test/items/quick_powder.test.ts @@ -25,7 +25,7 @@ describe("Items - Quick Powder", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); }); it("QUICK_POWDER activates in battle correctly", async () => { diff --git a/test/items/reviver_seed.test.ts b/test/items/reviver_seed.test.ts index c06f354a94a..c109794d3d2 100644 --- a/test/items/reviver_seed.test.ts +++ b/test/items/reviver_seed.test.ts @@ -28,7 +28,7 @@ describe("Items - Reviver Seed", () => { game.override .moveset([Moves.SPLASH, Moves.TACKLE, Moves.ENDURE]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/items/scope_lens.test.ts b/test/items/scope_lens.test.ts index abd5cd7e75c..4d2fd63f87b 100644 --- a/test/items/scope_lens.test.ts +++ b/test/items/scope_lens.test.ts @@ -27,7 +27,7 @@ describe("Items - Scope Lens", () => { .enemyMoveset(Moves.SPLASH) .moveset([Moves.POUND]) .startingHeldItems([{ name: "SCOPE_LENS" }]) - .battleType("single") + .battleStyle("single") .disableCrits(); }, 20000); diff --git a/test/items/temp_stat_stage_booster.test.ts b/test/items/temp_stat_stage_booster.test.ts index 6417f898e3e..ccbabf01ccb 100644 --- a/test/items/temp_stat_stage_booster.test.ts +++ b/test/items/temp_stat_stage_booster.test.ts @@ -30,7 +30,7 @@ describe("Items - Temporary Stat Stage Boosters", () => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.SHUCKLE) .enemyMoveset(Moves.SPLASH) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/items/thick_club.test.ts b/test/items/thick_club.test.ts index 69ca316d455..9e9cd2e2ec8 100644 --- a/test/items/thick_club.test.ts +++ b/test/items/thick_club.test.ts @@ -25,7 +25,7 @@ describe("Items - Thick Club", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); }); it("THICK_CLUB activates in battle correctly", async () => { diff --git a/test/items/toxic_orb.test.ts b/test/items/toxic_orb.test.ts index 57e6b651b66..d02679e17c1 100644 --- a/test/items/toxic_orb.test.ts +++ b/test/items/toxic_orb.test.ts @@ -24,7 +24,7 @@ describe("Items - Toxic orb", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.MAGIKARP) .ability(Abilities.BALL_FETCH) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/moves/after_you.test.ts b/test/moves/after_you.test.ts index fde19b87b5d..3fa7c9ceb0a 100644 --- a/test/moves/after_you.test.ts +++ b/test/moves/after_you.test.ts @@ -25,7 +25,7 @@ describe("Moves - After You", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("double") + .battleStyle("double") .enemyLevel(5) .enemySpecies(Species.PIKACHU) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/moves/alluring_voice.test.ts b/test/moves/alluring_voice.test.ts index 777078e4786..240e008f311 100644 --- a/test/moves/alluring_voice.test.ts +++ b/test/moves/alluring_voice.test.ts @@ -25,7 +25,7 @@ describe("Moves - Alluring Voice", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.ICE_SCALES) diff --git a/test/moves/aromatherapy.test.ts b/test/moves/aromatherapy.test.ts index fe7a008249f..c361f4e8bbd 100644 --- a/test/moves/aromatherapy.test.ts +++ b/test/moves/aromatherapy.test.ts @@ -26,7 +26,7 @@ describe("Moves - Aromatherapy", () => { game.override .moveset([Moves.AROMATHERAPY, Moves.SPLASH]) .statusEffect(StatusEffect.BURN) - .battleType("double") + .battleStyle("double") .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset(Moves.SPLASH); }); diff --git a/test/moves/assist.test.ts b/test/moves/assist.test.ts index 68322a7f193..d0385399811 100644 --- a/test/moves/assist.test.ts +++ b/test/moves/assist.test.ts @@ -29,7 +29,7 @@ describe("Moves - Assist", () => { // because the normal moveset override doesn't allow for accurate testing of moveset changes game.override .ability(Abilities.BALL_FETCH) - .battleType("double") + .battleStyle("double") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyLevel(100) diff --git a/test/moves/astonish.test.ts b/test/moves/astonish.test.ts index 53922060ae6..1713df1de15 100644 --- a/test/moves/astonish.test.ts +++ b/test/moves/astonish.test.ts @@ -27,7 +27,7 @@ describe("Moves - Astonish", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.moveset([Moves.ASTONISH, Moves.SPLASH]); game.override.enemySpecies(Species.BLASTOISE); game.override.enemyAbility(Abilities.INSOMNIA); diff --git a/test/moves/aurora_veil.test.ts b/test/moves/aurora_veil.test.ts index 31f6497bae5..ef53b69b4e4 100644 --- a/test/moves/aurora_veil.test.ts +++ b/test/moves/aurora_veil.test.ts @@ -35,7 +35,7 @@ describe("Moves - Aurora Veil", () => { beforeEach(() => { game = new GameManager(phaserGame); globalScene = game.scene; - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.ability(Abilities.NONE); game.override.moveset([Moves.ABSORB, Moves.ROCK_SLIDE, Moves.TACKLE]); game.override.enemyLevel(100); @@ -62,7 +62,7 @@ describe("Moves - Aurora Veil", () => { }); it("reduces damage of physical attacks by a third in a double battle", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); const moveToUse = Moves.ROCK_SLIDE; await game.classicMode.startBattle([Species.SHUCKLE, Species.SHUCKLE]); @@ -98,7 +98,7 @@ describe("Moves - Aurora Veil", () => { }); it("reduces damage of special attacks by a third in a double battle", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); const moveToUse = Moves.DAZZLING_GLEAM; await game.classicMode.startBattle([Species.SHUCKLE, Species.SHUCKLE]); diff --git a/test/moves/autotomize.test.ts b/test/moves/autotomize.test.ts index 62ef185dea8..08e55f242bc 100644 --- a/test/moves/autotomize.test.ts +++ b/test/moves/autotomize.test.ts @@ -24,7 +24,7 @@ describe("Moves - Autotomize", () => { game = new GameManager(phaserGame); game.override .moveset([Moves.AUTOTOMIZE, Moves.KINGS_SHIELD, Moves.FALSE_SWIPE]) - .battleType("single") + .battleStyle("single") .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset(Moves.SPLASH); }); diff --git a/test/moves/baddy_bad.test.ts b/test/moves/baddy_bad.test.ts index cba13c7ac68..ed6c9239eea 100644 --- a/test/moves/baddy_bad.test.ts +++ b/test/moves/baddy_bad.test.ts @@ -22,7 +22,7 @@ describe("Moves - Baddy Bad", () => { game = new GameManager(phaserGame); game.override .moveset([Moves.SPLASH]) - .battleType("single") + .battleStyle("single") .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset(Moves.SPLASH) diff --git a/test/moves/baneful_bunker.test.ts b/test/moves/baneful_bunker.test.ts index 4624d77dc42..4d0d7237c00 100644 --- a/test/moves/baneful_bunker.test.ts +++ b/test/moves/baneful_bunker.test.ts @@ -24,7 +24,7 @@ describe("Moves - Baneful Bunker", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.moveset(Moves.SLASH); diff --git a/test/moves/baton_pass.test.ts b/test/moves/baton_pass.test.ts index 9db6ec7c518..143ed285023 100644 --- a/test/moves/baton_pass.test.ts +++ b/test/moves/baton_pass.test.ts @@ -25,7 +25,7 @@ describe("Moves - Baton Pass", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) .moveset([Moves.BATON_PASS, Moves.NASTY_PLOT, Moves.SPLASH]) diff --git a/test/moves/beak_blast.test.ts b/test/moves/beak_blast.test.ts index 252b28448fd..45841cecd52 100644 --- a/test/moves/beak_blast.test.ts +++ b/test/moves/beak_blast.test.ts @@ -27,7 +27,7 @@ describe("Moves - Beak Blast", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .ability(Abilities.UNNERVE) .moveset([Moves.BEAK_BLAST]) .enemySpecies(Species.SNORLAX) diff --git a/test/moves/beat_up.test.ts b/test/moves/beat_up.test.ts index 7e67f2ea363..ad6cad40d32 100644 --- a/test/moves/beat_up.test.ts +++ b/test/moves/beat_up.test.ts @@ -23,7 +23,7 @@ describe("Moves - Beat Up", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.enemySpecies(Species.SNORLAX); game.override.enemyLevel(100); diff --git a/test/moves/burning_jealousy.test.ts b/test/moves/burning_jealousy.test.ts index 04966b24206..ea02bf5f4f5 100644 --- a/test/moves/burning_jealousy.test.ts +++ b/test/moves/burning_jealousy.test.ts @@ -25,7 +25,7 @@ describe("Moves - Burning Jealousy", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.ICE_SCALES) @@ -50,7 +50,7 @@ describe("Moves - Burning Jealousy", () => { }); it("should still burn the opponent if their stat stages were both raised and lowered in the same turn", async () => { - game.override.starterSpecies(0).battleType("double"); + game.override.starterSpecies(0).battleStyle("double"); await game.classicMode.startBattle([Species.FEEBAS, Species.ABRA]); const enemy = game.scene.getEnemyPokemon()!; diff --git a/test/moves/camouflage.test.ts b/test/moves/camouflage.test.ts index 0bbab6a629a..38cdef80fc1 100644 --- a/test/moves/camouflage.test.ts +++ b/test/moves/camouflage.test.ts @@ -27,7 +27,7 @@ describe("Moves - Camouflage", () => { game.override .moveset([Moves.CAMOUFLAGE]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.REGIELEKI) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/moves/ceaseless_edge.test.ts b/test/moves/ceaseless_edge.test.ts index d54f1bd9f21..72e552bef6f 100644 --- a/test/moves/ceaseless_edge.test.ts +++ b/test/moves/ceaseless_edge.test.ts @@ -26,7 +26,7 @@ describe("Moves - Ceaseless Edge", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.RUN_AWAY); game.override.enemyPassiveAbility(Abilities.RUN_AWAY); diff --git a/test/moves/chilly_reception.test.ts b/test/moves/chilly_reception.test.ts index 39342a921b6..56da5dd400c 100644 --- a/test/moves/chilly_reception.test.ts +++ b/test/moves/chilly_reception.test.ts @@ -24,7 +24,7 @@ describe("Moves - Chilly Reception", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .moveset([Moves.CHILLY_RECEPTION, Moves.SNOWSCAPE]) .enemyMoveset(Array(4).fill(Moves.SPLASH)) .enemyAbility(Abilities.BALL_FETCH) @@ -70,7 +70,7 @@ describe("Moves - Chilly Reception", () => { // enemy uses another move and weather doesn't change it("check case - enemy not selecting chilly reception doesn't change weather ", async () => { game.override - .battleType("single") + .battleStyle("single") .enemyMoveset([Moves.CHILLY_RECEPTION, Moves.TACKLE]) .moveset(Array(4).fill(Moves.SPLASH)); @@ -85,7 +85,7 @@ describe("Moves - Chilly Reception", () => { it("enemy trainer - expected behavior ", async () => { game.override - .battleType("single") + .battleStyle("single") .startingWave(8) .enemyMoveset(Array(4).fill(Moves.CHILLY_RECEPTION)) .enemySpecies(Species.MAGIKARP) diff --git a/test/moves/chloroblast.test.ts b/test/moves/chloroblast.test.ts index f08eca100c4..175227bbd5e 100644 --- a/test/moves/chloroblast.test.ts +++ b/test/moves/chloroblast.test.ts @@ -24,7 +24,7 @@ describe("Moves - Chloroblast", () => { game.override .moveset([Moves.CHLOROBLAST]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/moves/copycat.test.ts b/test/moves/copycat.test.ts index 0d9b0951f89..2e6e8098835 100644 --- a/test/moves/copycat.test.ts +++ b/test/moves/copycat.test.ts @@ -31,7 +31,7 @@ describe("Moves - Copycat", () => { game.override .moveset([Moves.COPYCAT, Moves.SPIKY_SHIELD, Moves.SWORDS_DANCE, Moves.SPLASH]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .starterSpecies(Species.FEEBAS) .enemySpecies(Species.MAGIKARP) diff --git a/test/moves/crafty_shield.test.ts b/test/moves/crafty_shield.test.ts index 3a2df6a3446..c61e6d3848a 100644 --- a/test/moves/crafty_shield.test.ts +++ b/test/moves/crafty_shield.test.ts @@ -26,7 +26,7 @@ describe("Moves - Crafty Shield", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.moveset([Moves.CRAFTY_SHIELD, Moves.SPLASH, Moves.SWORDS_DANCE]); diff --git a/test/moves/defog.test.ts b/test/moves/defog.test.ts index 64904e964c4..58631150b6f 100644 --- a/test/moves/defog.test.ts +++ b/test/moves/defog.test.ts @@ -25,7 +25,7 @@ describe("Moves - Defog", () => { game.override .moveset([Moves.MIST, Moves.SAFEGUARD, Moves.SPLASH]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.SHUCKLE) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/moves/destiny_bond.test.ts b/test/moves/destiny_bond.test.ts index c39d40427ad..6e6446f464f 100644 --- a/test/moves/destiny_bond.test.ts +++ b/test/moves/destiny_bond.test.ts @@ -33,7 +33,7 @@ describe("Moves - Destiny Bond", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .ability(Abilities.UNNERVE) // Pre-emptively prevent flakiness from opponent berries .enemySpecies(Species.RATTATA) .enemyAbility(Abilities.RUN_AWAY) @@ -157,7 +157,7 @@ describe("Moves - Destiny Bond", () => { }); it("should not KO an ally", async () => { - game.override.moveset([Moves.DESTINY_BOND, Moves.CRUNCH]).battleType("double"); + game.override.moveset([Moves.DESTINY_BOND, Moves.CRUNCH]).battleStyle("double"); await game.classicMode.startBattle([Species.SHEDINJA, Species.BULBASAUR, Species.SQUIRTLE]); const enemyPokemon0 = game.scene.getEnemyField()[0]; @@ -201,7 +201,7 @@ describe("Moves - Destiny Bond", () => { }); it("should not cause a crash if the user is KO'd by Pledge moves", async () => { - game.override.moveset([Moves.GRASS_PLEDGE, Moves.WATER_PLEDGE]).battleType("double"); + game.override.moveset([Moves.GRASS_PLEDGE, Moves.WATER_PLEDGE]).battleStyle("double"); await game.classicMode.startBattle(defaultParty); const enemyPokemon0 = game.scene.getEnemyField()[0]; diff --git a/test/moves/diamond_storm.test.ts b/test/moves/diamond_storm.test.ts index 2363122f0d7..9ba62bbc52d 100644 --- a/test/moves/diamond_storm.test.ts +++ b/test/moves/diamond_storm.test.ts @@ -25,14 +25,14 @@ describe("Moves - Diamond Storm", () => { game = new GameManager(phaserGame); game.override .moveset([Moves.DIAMOND_STORM]) - .battleType("single") + .battleStyle("single") .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset(Moves.SPLASH); }); it("should only increase defense once even if hitting 2 pokemon", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); const diamondStorm = allMoves[Moves.DIAMOND_STORM]; vi.spyOn(diamondStorm, "chance", "get").mockReturnValue(100); vi.spyOn(diamondStorm, "accuracy", "get").mockReturnValue(100); diff --git a/test/moves/dig.test.ts b/test/moves/dig.test.ts index 81339111656..a53456ec083 100644 --- a/test/moves/dig.test.ts +++ b/test/moves/dig.test.ts @@ -27,7 +27,7 @@ describe("Moves - Dig", () => { game = new GameManager(phaserGame); game.override .moveset(Moves.DIG) - .battleType("single") + .battleStyle("single") .startingLevel(100) .enemySpecies(Species.SNORLAX) .enemyLevel(100) diff --git a/test/moves/disable.test.ts b/test/moves/disable.test.ts index fdfb748df9d..d21716145a4 100644 --- a/test/moves/disable.test.ts +++ b/test/moves/disable.test.ts @@ -23,7 +23,7 @@ describe("Moves - Disable", () => { beforeEach(async () => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .ability(Abilities.BALL_FETCH) .enemyAbility(Abilities.BALL_FETCH) .moveset([Moves.DISABLE, Moves.SPLASH]) diff --git a/test/moves/dive.test.ts b/test/moves/dive.test.ts index d7b53701a25..f33dc69b55f 100644 --- a/test/moves/dive.test.ts +++ b/test/moves/dive.test.ts @@ -27,7 +27,7 @@ describe("Moves - Dive", () => { game = new GameManager(phaserGame); game.override .moveset(Moves.DIVE) - .battleType("single") + .battleStyle("single") .startingLevel(100) .enemySpecies(Species.SNORLAX) .enemyLevel(100) diff --git a/test/moves/doodle.test.ts b/test/moves/doodle.test.ts index 822e415c918..25dc0ddaede 100644 --- a/test/moves/doodle.test.ts +++ b/test/moves/doodle.test.ts @@ -26,7 +26,7 @@ describe("Moves - Doodle", () => { game.override .moveset([Moves.SPLASH, Moves.DOODLE]) .ability(Abilities.ADAPTABILITY) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) @@ -43,7 +43,7 @@ describe("Moves - Doodle", () => { }); it("should copy the opponent's ability to itself and its ally in doubles", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); await game.classicMode.startBattle([Species.FEEBAS, Species.MAGIKARP]); game.move.select(Moves.DOODLE, 0, BattlerIndex.ENEMY); @@ -55,7 +55,7 @@ describe("Moves - Doodle", () => { }); it("should activate post-summon abilities", async () => { - game.override.battleType("double").enemyAbility(Abilities.INTIMIDATE); + game.override.battleStyle("double").enemyAbility(Abilities.INTIMIDATE); await game.classicMode.startBattle([Species.FEEBAS, Species.MAGIKARP]); diff --git a/test/moves/double_team.test.ts b/test/moves/double_team.test.ts index f6791573132..8eac6be11f4 100644 --- a/test/moves/double_team.test.ts +++ b/test/moves/double_team.test.ts @@ -23,7 +23,7 @@ describe("Moves - Double Team", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.moveset([Moves.DOUBLE_TEAM]); game.override.disableCrits(); game.override.ability(Abilities.BALL_FETCH); diff --git a/test/moves/dragon_cheer.test.ts b/test/moves/dragon_cheer.test.ts index 30d5af3a51b..dcf7f13eb65 100644 --- a/test/moves/dragon_cheer.test.ts +++ b/test/moves/dragon_cheer.test.ts @@ -23,7 +23,7 @@ describe("Moves - Dragon Cheer", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("double") + .battleStyle("double") .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset(Moves.SPLASH) .enemyLevel(20) diff --git a/test/moves/dragon_rage.test.ts b/test/moves/dragon_rage.test.ts index 99d66421463..188c1511f37 100644 --- a/test/moves/dragon_rage.test.ts +++ b/test/moves/dragon_rage.test.ts @@ -31,7 +31,7 @@ describe("Moves - Dragon Rage", () => { beforeEach(async () => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.starterSpecies(Species.SNORLAX); game.override.moveset([Moves.DRAGON_RAGE]); diff --git a/test/moves/dragon_tail.test.ts b/test/moves/dragon_tail.test.ts index 37e8aa2fe1b..31e5560d4e0 100644 --- a/test/moves/dragon_tail.test.ts +++ b/test/moves/dragon_tail.test.ts @@ -28,7 +28,7 @@ describe("Moves - Dragon Tail", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .moveset([Moves.DRAGON_TAIL, Moves.SPLASH, Moves.FLAMETHROWER]) .enemySpecies(Species.WAILORD) .enemyMoveset(Moves.SPLASH) @@ -73,7 +73,7 @@ describe("Moves - Dragon Tail", () => { }); it("should proceed without crashing in a double battle", async () => { - game.override.battleType("double").enemyMoveset(Moves.SPLASH).enemyAbility(Abilities.ROUGH_SKIN); + game.override.battleStyle("double").enemyMoveset(Moves.SPLASH).enemyAbility(Abilities.ROUGH_SKIN); await game.classicMode.startBattle([Species.DRATINI, Species.DRATINI, Species.WAILORD, Species.WAILORD]); const leadPokemon = game.scene.getPlayerParty()[0]!; @@ -102,7 +102,7 @@ describe("Moves - Dragon Tail", () => { }); it("should redirect targets upon opponent flee", async () => { - game.override.battleType("double").enemyMoveset(Moves.SPLASH).enemyAbility(Abilities.ROUGH_SKIN); + game.override.battleStyle("double").enemyMoveset(Moves.SPLASH).enemyAbility(Abilities.ROUGH_SKIN); await game.classicMode.startBattle([Species.DRATINI, Species.DRATINI, Species.WAILORD, Species.WAILORD]); const leadPokemon = game.scene.getPlayerParty()[0]!; diff --git a/test/moves/dynamax_cannon.test.ts b/test/moves/dynamax_cannon.test.ts index 9cf3106b9c1..94f07ae500f 100644 --- a/test/moves/dynamax_cannon.test.ts +++ b/test/moves/dynamax_cannon.test.ts @@ -34,7 +34,7 @@ describe("Moves - Dynamax Cannon", () => { // Note that, for Waves 1-10, the level cap is 10 game.override.startingWave(1); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.disableCrits(); game.override.enemySpecies(Species.MAGIKARP); diff --git a/test/moves/electrify.test.ts b/test/moves/electrify.test.ts index 69e7504b406..25529e0b552 100644 --- a/test/moves/electrify.test.ts +++ b/test/moves/electrify.test.ts @@ -25,7 +25,7 @@ describe("Moves - Electrify", () => { game = new GameManager(phaserGame); game.override .moveset(Moves.ELECTRIFY) - .battleType("single") + .battleStyle("single") .startingLevel(100) .enemySpecies(Species.SNORLAX) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/moves/electro_shot.test.ts b/test/moves/electro_shot.test.ts index 05ab9c24a7c..0122bf04281 100644 --- a/test/moves/electro_shot.test.ts +++ b/test/moves/electro_shot.test.ts @@ -27,7 +27,7 @@ describe("Moves - Electro Shot", () => { game = new GameManager(phaserGame); game.override .moveset(Moves.ELECTRO_SHOT) - .battleType("single") + .battleStyle("single") .startingLevel(100) .enemySpecies(Species.SNORLAX) .enemyLevel(100) diff --git a/test/moves/encore.test.ts b/test/moves/encore.test.ts index 43b9eb6a77f..519e7860c04 100644 --- a/test/moves/encore.test.ts +++ b/test/moves/encore.test.ts @@ -27,7 +27,7 @@ describe("Moves - Encore", () => { game.override .moveset([Moves.SPLASH, Moves.ENCORE]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/moves/endure.test.ts b/test/moves/endure.test.ts index 8fbb2272ece..190a689f46e 100644 --- a/test/moves/endure.test.ts +++ b/test/moves/endure.test.ts @@ -25,7 +25,7 @@ describe("Moves - Endure", () => { .moveset([Moves.THUNDER, Moves.BULLET_SEED, Moves.TOXIC, Moves.SHEER_COLD]) .ability(Abilities.SKILL_LINK) .startingLevel(100) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.NO_GUARD) diff --git a/test/moves/entrainment.test.ts b/test/moves/entrainment.test.ts index b2a0baf3e27..31a8ffcab85 100644 --- a/test/moves/entrainment.test.ts +++ b/test/moves/entrainment.test.ts @@ -25,7 +25,7 @@ describe("Moves - Entrainment", () => { game.override .moveset([Moves.SPLASH, Moves.ENTRAINMENT]) .ability(Abilities.ADAPTABILITY) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/moves/fairy_lock.test.ts b/test/moves/fairy_lock.test.ts index a47143add4f..e967221bcae 100644 --- a/test/moves/fairy_lock.test.ts +++ b/test/moves/fairy_lock.test.ts @@ -26,7 +26,7 @@ describe("Moves - Fairy Lock", () => { game.override .moveset([Moves.FAIRY_LOCK, Moves.SPLASH]) .ability(Abilities.BALL_FETCH) - .battleType("double") + .battleStyle("double") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/moves/fake_out.test.ts b/test/moves/fake_out.test.ts index 929c760ee5b..cbce16270e0 100644 --- a/test/moves/fake_out.test.ts +++ b/test/moves/fake_out.test.ts @@ -21,7 +21,7 @@ describe("Moves - Fake Out", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.CORVIKNIGHT) .moveset([Moves.FAKE_OUT, Moves.SPLASH]) .enemyMoveset(Moves.SPLASH) diff --git a/test/moves/false_swipe.test.ts b/test/moves/false_swipe.test.ts index 4fb5b81ef67..d6743477cae 100644 --- a/test/moves/false_swipe.test.ts +++ b/test/moves/false_swipe.test.ts @@ -26,7 +26,7 @@ describe("Moves - False Swipe", () => { .moveset([Moves.FALSE_SWIPE]) .ability(Abilities.BALL_FETCH) .startingLevel(1000) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/moves/fell_stinger.test.ts b/test/moves/fell_stinger.test.ts index 2ffa44c5a3a..11731d8a06f 100644 --- a/test/moves/fell_stinger.test.ts +++ b/test/moves/fell_stinger.test.ts @@ -27,7 +27,7 @@ describe("Moves - Fell Stinger", () => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .moveset([Moves.FELL_STINGER, Moves.SALT_CURE, Moves.BIND, Moves.LEECH_SEED]) .startingLevel(50) .disableCrits() @@ -99,7 +99,7 @@ describe("Moves - Fell Stinger", () => { }); it("should not grant stat boost if enemy is KO'd by Salt Cure", async () => { - game.override.battleType("double").startingLevel(5); + game.override.battleStyle("double").startingLevel(5); const saltCure = allMoves[Moves.SALT_CURE]; const fellStinger = allMoves[Moves.FELL_STINGER]; vi.spyOn(saltCure, "accuracy", "get").mockReturnValue(100); @@ -124,7 +124,7 @@ describe("Moves - Fell Stinger", () => { }); it("should not grant stat boost if enemy dies to Bind or a similar effect", async () => { - game.override.battleType("double").startingLevel(5); + game.override.battleStyle("double").startingLevel(5); vi.spyOn(allMoves[Moves.BIND], "accuracy", "get").mockReturnValue(100); vi.spyOn(allMoves[Moves.FELL_STINGER], "power", "get").mockReturnValue(50000); @@ -147,7 +147,7 @@ describe("Moves - Fell Stinger", () => { }); it("should not grant stat boost if enemy dies to Leech Seed", async () => { - game.override.battleType("double").startingLevel(5); + game.override.battleStyle("double").startingLevel(5); vi.spyOn(allMoves[Moves.LEECH_SEED], "accuracy", "get").mockReturnValue(100); vi.spyOn(allMoves[Moves.FELL_STINGER], "power", "get").mockReturnValue(50000); diff --git a/test/moves/fissure.test.ts b/test/moves/fissure.test.ts index 63de58eb2e7..be6be079cf0 100644 --- a/test/moves/fissure.test.ts +++ b/test/moves/fissure.test.ts @@ -28,7 +28,7 @@ describe("Moves - Fissure", () => { beforeEach(async () => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.disableCrits(); game.override.starterSpecies(Species.SNORLAX); diff --git a/test/moves/flame_burst.test.ts b/test/moves/flame_burst.test.ts index a39c27d37b3..fb92537a238 100644 --- a/test/moves/flame_burst.test.ts +++ b/test/moves/flame_burst.test.ts @@ -35,7 +35,7 @@ describe("Moves - Flame Burst", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.moveset([Moves.FLAME_BURST, Moves.SPLASH]); game.override.disableCrits(); game.override.ability(Abilities.UNNERVE); diff --git a/test/moves/flower_shield.test.ts b/test/moves/flower_shield.test.ts index b66847651c1..4840c6f018f 100644 --- a/test/moves/flower_shield.test.ts +++ b/test/moves/flower_shield.test.ts @@ -28,7 +28,7 @@ describe("Moves - Flower Shield", () => { game = new GameManager(phaserGame); game.override.ability(Abilities.NONE); game.override.enemyAbility(Abilities.NONE); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.moveset([Moves.FLOWER_SHIELD, Moves.SPLASH]); game.override.enemyMoveset(Moves.SPLASH); }); @@ -51,7 +51,7 @@ describe("Moves - Flower Shield", () => { }); it("raises DEF stat stage by 1 for all Grass-type Pokemon on the field by one stage - double battle", async () => { - game.override.enemySpecies(Species.MAGIKARP).startingBiome(Biome.GRASS).battleType("double"); + game.override.enemySpecies(Species.MAGIKARP).startingBiome(Biome.GRASS).battleStyle("double"); await game.startBattle([Species.CHERRIM, Species.MAGIKARP]); const field = game.scene.getField(true); diff --git a/test/moves/fly.test.ts b/test/moves/fly.test.ts index 0bd7d22b2a7..f200e976704 100644 --- a/test/moves/fly.test.ts +++ b/test/moves/fly.test.ts @@ -28,7 +28,7 @@ describe("Moves - Fly", () => { game = new GameManager(phaserGame); game.override .moveset(Moves.FLY) - .battleType("single") + .battleStyle("single") .startingLevel(100) .enemySpecies(Species.SNORLAX) .enemyLevel(100) diff --git a/test/moves/focus_punch.test.ts b/test/moves/focus_punch.test.ts index 2dc5f20f2bf..e05eb008af7 100644 --- a/test/moves/focus_punch.test.ts +++ b/test/moves/focus_punch.test.ts @@ -28,7 +28,7 @@ describe("Moves - Focus Punch", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .ability(Abilities.UNNERVE) .moveset([Moves.FOCUS_PUNCH]) .enemySpecies(Species.GROUDON) diff --git a/test/moves/follow_me.test.ts b/test/moves/follow_me.test.ts index eeb11b36f24..68c4f111bb1 100644 --- a/test/moves/follow_me.test.ts +++ b/test/moves/follow_me.test.ts @@ -24,7 +24,7 @@ describe("Moves - Follow Me", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.starterSpecies(Species.AMOONGUSS); game.override.ability(Abilities.BALL_FETCH); game.override.enemySpecies(Species.SNORLAX); diff --git a/test/moves/forests_curse.test.ts b/test/moves/forests_curse.test.ts index 8850b92662d..f363fdbd19d 100644 --- a/test/moves/forests_curse.test.ts +++ b/test/moves/forests_curse.test.ts @@ -25,7 +25,7 @@ describe("Moves - Forest's Curse", () => { game.override .moveset([Moves.FORESTS_CURSE, Moves.TRICK_OR_TREAT]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/moves/freeze_dry.test.ts b/test/moves/freeze_dry.test.ts index 8cab56ddfd2..62168afb960 100644 --- a/test/moves/freeze_dry.test.ts +++ b/test/moves/freeze_dry.test.ts @@ -24,7 +24,7 @@ describe("Moves - Freeze-Dry", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset(Moves.SPLASH) diff --git a/test/moves/freezy_frost.test.ts b/test/moves/freezy_frost.test.ts index c1ac4054e70..4eb3114a5ba 100644 --- a/test/moves/freezy_frost.test.ts +++ b/test/moves/freezy_frost.test.ts @@ -24,7 +24,7 @@ describe("Moves - Freezy Frost", () => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.RATTATA) .enemyLevel(100) .enemyMoveset([Moves.HOWL, Moves.HOWL, Moves.HOWL, Moves.HOWL]) @@ -71,7 +71,7 @@ describe("Moves - Freezy Frost", () => { }); it("should clear all stat changes in double battle", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); await game.classicMode.startBattle([Species.SHUCKLE, Species.RATTATA]); const [leftPlayer, rightPlayer] = game.scene.getPlayerField(); const [leftOpp, rightOpp] = game.scene.getEnemyField(); diff --git a/test/moves/fusion_bolt.test.ts b/test/moves/fusion_bolt.test.ts index fc47a0f04be..33498a857a9 100644 --- a/test/moves/fusion_bolt.test.ts +++ b/test/moves/fusion_bolt.test.ts @@ -30,7 +30,7 @@ describe("Moves - Fusion Bolt", () => { game.override.enemyAbility(Abilities.ROUGH_SKIN); game.override.enemyMoveset([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.startingWave(97); game.override.disableCrits(); }); diff --git a/test/moves/fusion_flare.test.ts b/test/moves/fusion_flare.test.ts index 17653cf58bc..61bb126a75a 100644 --- a/test/moves/fusion_flare.test.ts +++ b/test/moves/fusion_flare.test.ts @@ -30,7 +30,7 @@ describe("Moves - Fusion Flare", () => { game.override.enemySpecies(Species.RATTATA); game.override.enemyMoveset([Moves.REST, Moves.REST, Moves.REST, Moves.REST]); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.startingWave(97); game.override.disableCrits(); }); diff --git a/test/moves/fusion_flare_bolt.test.ts b/test/moves/fusion_flare_bolt.test.ts index c340aeea63f..697ac57e739 100644 --- a/test/moves/fusion_flare_bolt.test.ts +++ b/test/moves/fusion_flare_bolt.test.ts @@ -39,7 +39,7 @@ describe("Moves - Fusion Flare and Fusion Bolt", () => { game.override.enemySpecies(Species.RESHIRAM); game.override.enemyMoveset([Moves.REST, Moves.REST, Moves.REST, Moves.REST]); - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.startingWave(97); game.override.disableCrits(); diff --git a/test/moves/future_sight.test.ts b/test/moves/future_sight.test.ts index 40a940447e4..48be2451195 100644 --- a/test/moves/future_sight.test.ts +++ b/test/moves/future_sight.test.ts @@ -24,7 +24,7 @@ describe("Moves - Future Sight", () => { game.override .startingLevel(50) .moveset([Moves.FUTURE_SIGHT, Moves.SPLASH]) - .battleType("single") + .battleStyle("single") .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.STURDY) .enemyMoveset(Moves.SPLASH); diff --git a/test/moves/gastro_acid.test.ts b/test/moves/gastro_acid.test.ts index c9f2428845e..8247d29c0a0 100644 --- a/test/moves/gastro_acid.test.ts +++ b/test/moves/gastro_acid.test.ts @@ -22,7 +22,7 @@ describe("Moves - Gastro Acid", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.startingLevel(1); game.override.enemyLevel(100); game.override.ability(Abilities.NONE); @@ -61,7 +61,7 @@ describe("Moves - Gastro Acid", () => { }); it("fails if used on an enemy with an already-suppressed ability", async () => { - game.override.battleType("single"); + game.override.battleStyle("single"); await game.startBattle(); diff --git a/test/moves/geomancy.test.ts b/test/moves/geomancy.test.ts index 34281c96c60..51659f01b12 100644 --- a/test/moves/geomancy.test.ts +++ b/test/moves/geomancy.test.ts @@ -26,7 +26,7 @@ describe("Moves - Geomancy", () => { game = new GameManager(phaserGame); game.override .moveset(Moves.GEOMANCY) - .battleType("single") + .battleStyle("single") .startingLevel(100) .enemySpecies(Species.SNORLAX) .enemyLevel(100) diff --git a/test/moves/gigaton_hammer.test.ts b/test/moves/gigaton_hammer.test.ts index a6f7438a0a2..6275e5d2dcb 100644 --- a/test/moves/gigaton_hammer.test.ts +++ b/test/moves/gigaton_hammer.test.ts @@ -22,7 +22,7 @@ describe("Moves - Gigaton Hammer", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.MAGIKARP) .starterSpecies(Species.FEEBAS) .moveset([Moves.GIGATON_HAMMER]) diff --git a/test/moves/glaive_rush.test.ts b/test/moves/glaive_rush.test.ts index d3531b172e2..3c2bcea7884 100644 --- a/test/moves/glaive_rush.test.ts +++ b/test/moves/glaive_rush.test.ts @@ -23,7 +23,7 @@ describe("Moves - Glaive Rush", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/moves/growth.test.ts b/test/moves/growth.test.ts index 926593a4f72..37cd84638ba 100644 --- a/test/moves/growth.test.ts +++ b/test/moves/growth.test.ts @@ -24,7 +24,7 @@ describe("Moves - Growth", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.enemyAbility(Abilities.MOXIE); game.override.ability(Abilities.INSOMNIA); game.override.moveset([Moves.GROWTH]); diff --git a/test/moves/grudge.test.ts b/test/moves/grudge.test.ts index 161fa38edd2..ecde5351d6d 100644 --- a/test/moves/grudge.test.ts +++ b/test/moves/grudge.test.ts @@ -25,7 +25,7 @@ describe("Moves - Grudge", () => { game.override .moveset([Moves.EMBER, Moves.SPLASH]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.SHEDINJA) .enemyAbility(Abilities.WONDER_GUARD) diff --git a/test/moves/guard_split.test.ts b/test/moves/guard_split.test.ts index 5db07e4e82c..d182e94b203 100644 --- a/test/moves/guard_split.test.ts +++ b/test/moves/guard_split.test.ts @@ -24,7 +24,7 @@ describe("Moves - Guard Split", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemyAbility(Abilities.NONE) .enemySpecies(Species.MEW) .enemyLevel(200) diff --git a/test/moves/guard_swap.test.ts b/test/moves/guard_swap.test.ts index be824672f32..2076f92ccb1 100644 --- a/test/moves/guard_swap.test.ts +++ b/test/moves/guard_swap.test.ts @@ -24,7 +24,7 @@ describe("Moves - Guard Swap", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset(Moves.SPLASH) .enemySpecies(Species.INDEEDEE) diff --git a/test/moves/hard_press.test.ts b/test/moves/hard_press.test.ts index 8891f0bf0e2..8fe768cb8e4 100644 --- a/test/moves/hard_press.test.ts +++ b/test/moves/hard_press.test.ts @@ -27,7 +27,7 @@ describe("Moves - Hard Press", () => { beforeEach(() => { moveToCheck = allMoves[Moves.HARD_PRESS]; game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.ability(Abilities.BALL_FETCH); game.override.enemySpecies(Species.MUNCHLAX); game.override.enemyAbility(Abilities.BALL_FETCH); diff --git a/test/moves/haze.test.ts b/test/moves/haze.test.ts index d890678b466..4ddb6d1c7c5 100644 --- a/test/moves/haze.test.ts +++ b/test/moves/haze.test.ts @@ -23,7 +23,7 @@ describe("Moves - Haze", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.enemySpecies(Species.RATTATA); game.override.enemyLevel(100); diff --git a/test/moves/heal_bell.test.ts b/test/moves/heal_bell.test.ts index 4c0148bfd04..8ffb602c24f 100644 --- a/test/moves/heal_bell.test.ts +++ b/test/moves/heal_bell.test.ts @@ -26,7 +26,7 @@ describe("Moves - Heal Bell", () => { game.override .moveset([Moves.HEAL_BELL, Moves.SPLASH]) .statusEffect(StatusEffect.BURN) - .battleType("double") + .battleStyle("double") .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset(Moves.SPLASH); }); diff --git a/test/moves/heart_swap.test.ts b/test/moves/heart_swap.test.ts index a3d892cd518..009db731951 100644 --- a/test/moves/heart_swap.test.ts +++ b/test/moves/heart_swap.test.ts @@ -24,7 +24,7 @@ describe("Moves - Heart Swap", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset(Moves.SPLASH) .enemySpecies(Species.INDEEDEE) diff --git a/test/moves/hyper_beam.test.ts b/test/moves/hyper_beam.test.ts index 5cd54e9b46a..5b370f49e4c 100644 --- a/test/moves/hyper_beam.test.ts +++ b/test/moves/hyper_beam.test.ts @@ -26,7 +26,7 @@ describe("Moves - Hyper Beam", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.ability(Abilities.BALL_FETCH); game.override.enemySpecies(Species.SNORLAX); game.override.enemyAbility(Abilities.BALL_FETCH); diff --git a/test/moves/imprison.test.ts b/test/moves/imprison.test.ts index 89ef9981040..cefbaa52cad 100644 --- a/test/moves/imprison.test.ts +++ b/test/moves/imprison.test.ts @@ -23,7 +23,7 @@ describe("Moves - Imprison", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset([Moves.IMPRISON, Moves.SPLASH, Moves.GROWL]) .enemySpecies(Species.SHUCKLE) diff --git a/test/moves/instruct.test.ts b/test/moves/instruct.test.ts index 079c8803ddc..c5650d7bbd5 100644 --- a/test/moves/instruct.test.ts +++ b/test/moves/instruct.test.ts @@ -32,7 +32,7 @@ describe("Moves - Instruct", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.SHUCKLE) .enemyAbility(Abilities.NO_GUARD) .enemyLevel(100) @@ -89,7 +89,7 @@ describe("Moves - Instruct", () => { }); it("should repeat ally's attack on enemy", async () => { - game.override.battleType("double").enemyMoveset(Moves.SPLASH); + game.override.battleStyle("double").enemyMoveset(Moves.SPLASH); await game.classicMode.startBattle([Species.AMOONGUSS, Species.SHUCKLE]); const [amoonguss, shuckle] = game.scene.getPlayerField(); @@ -122,7 +122,7 @@ describe("Moves - Instruct", () => { }); it("should add moves to move queue for copycat", async () => { - game.override.battleType("double").moveset(Moves.INSTRUCT).enemyLevel(5); + game.override.battleStyle("double").moveset(Moves.INSTRUCT).enemyLevel(5); await game.classicMode.startBattle([Species.AMOONGUSS]); const [enemy1, enemy2] = game.scene.getEnemyField()!; @@ -179,7 +179,7 @@ describe("Moves - Instruct", () => { }); it("should redirect attacking moves if enemy faints", async () => { - game.override.battleType("double").enemyMoveset(Moves.SPLASH).enemySpecies(Species.MAGIKARP).enemyLevel(1); + game.override.battleStyle("double").enemyMoveset(Moves.SPLASH).enemySpecies(Species.MAGIKARP).enemyLevel(1); await game.classicMode.startBattle([Species.HISUI_ELECTRODE, Species.KOMMO_O]); const [electrode, kommo_o] = game.scene.getPlayerField()!; @@ -201,7 +201,7 @@ describe("Moves - Instruct", () => { expect(karp2.isFainted()).toBe(true); }); it("should allow for dancer copying of instructed dance move", async () => { - game.override.battleType("double").enemyMoveset([Moves.INSTRUCT, Moves.SPLASH]).enemyLevel(1000); + game.override.battleStyle("double").enemyMoveset([Moves.INSTRUCT, Moves.SPLASH]).enemyLevel(1000); await game.classicMode.startBattle([Species.ORICORIO, Species.VOLCARONA]); const [oricorio, volcarona] = game.scene.getPlayerField(); @@ -256,7 +256,7 @@ describe("Moves - Instruct", () => { }); it("should attempt to call enemy's disabled move, but move use itself should fail", async () => { - game.override.moveset([Moves.INSTRUCT, Moves.DISABLE]).battleType("double"); + game.override.moveset([Moves.INSTRUCT, Moves.DISABLE]).battleStyle("double"); await game.classicMode.startBattle([Species.AMOONGUSS, Species.DROWZEE]); const [enemy1, enemy2] = game.scene.getEnemyField(); @@ -372,7 +372,7 @@ describe("Moves - Instruct", () => { it("should respect moves' original priority for psychic terrain", async () => { game.override - .battleType("double") + .battleStyle("double") .moveset([Moves.QUICK_ATTACK, Moves.SPLASH, Moves.INSTRUCT]) .enemyMoveset([Moves.SPLASH, Moves.PSYCHIC_TERRAIN]); await game.classicMode.startBattle([Species.BANETTE, Species.KLEFKI]); @@ -395,7 +395,7 @@ describe("Moves - Instruct", () => { }); it("should still work w/ prankster in psychic terrain", async () => { - game.override.battleType("double").enemyMoveset([Moves.SPLASH, Moves.PSYCHIC_TERRAIN]); + game.override.battleStyle("double").enemyMoveset([Moves.SPLASH, Moves.PSYCHIC_TERRAIN]); await game.classicMode.startBattle([Species.BANETTE, Species.KLEFKI]); const [banette, klefki] = game.scene.getPlayerField()!; @@ -419,7 +419,7 @@ describe("Moves - Instruct", () => { it("should cause spread moves to correctly hit targets in doubles after singles", async () => { game.override - .battleType("even-doubles") + .battleStyle("even-doubles") .moveset([Moves.BREAKING_SWIPE, Moves.INSTRUCT, Moves.SPLASH]) .enemyMoveset(Moves.SONIC_BOOM) .enemySpecies(Species.AXEW) @@ -446,7 +446,7 @@ describe("Moves - Instruct", () => { it("should cause AoE moves to correctly hit everyone in doubles after singles", async () => { game.override - .battleType("even-doubles") + .battleStyle("even-doubles") .moveset([Moves.BRUTAL_SWING, Moves.INSTRUCT, Moves.SPLASH]) .enemySpecies(Species.AXEW) .enemyMoveset(Moves.SONIC_BOOM) @@ -504,7 +504,7 @@ describe("Moves - Instruct", () => { it("should cause multi-hit moves to hit the appropriate number of times in doubles", async () => { game.override - .battleType("double") + .battleStyle("double") .enemyAbility(Abilities.SKILL_LINK) .moveset([Moves.SPLASH, Moves.INSTRUCT]) .enemyMoveset([Moves.BULLET_SEED, Moves.SPLASH]) diff --git a/test/moves/jaw_lock.test.ts b/test/moves/jaw_lock.test.ts index fc71397e624..71896dc3b62 100644 --- a/test/moves/jaw_lock.test.ts +++ b/test/moves/jaw_lock.test.ts @@ -29,7 +29,7 @@ describe("Moves - Jaw Lock", () => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.SNORLAX) .enemyAbility(Abilities.INSOMNIA) .enemyMoveset(Moves.SPLASH) @@ -107,7 +107,7 @@ describe("Moves - Jaw Lock", () => { }); it("should not trap other targets after the first target is trapped", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); await game.startBattle([Species.CHARMANDER, Species.BULBASAUR]); diff --git a/test/moves/lash_out.test.ts b/test/moves/lash_out.test.ts index 8395633f5c0..c80a8ce348a 100644 --- a/test/moves/lash_out.test.ts +++ b/test/moves/lash_out.test.ts @@ -24,7 +24,7 @@ describe("Moves - Lash Out", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.FUR_COAT) diff --git a/test/moves/last_respects.test.ts b/test/moves/last_respects.test.ts index ccab8a43415..a69ecb2e989 100644 --- a/test/moves/last_respects.test.ts +++ b/test/moves/last_respects.test.ts @@ -31,7 +31,7 @@ describe("Moves - Last Respects", () => { move = allMoves[Moves.LAST_RESPECTS]; basePower = move.power; game.override - .battleType("single") + .battleStyle("single") .disableCrits() .moveset([Moves.LAST_RESPECTS, Moves.EXPLOSION, Moves.LUNAR_DANCE]) .ability(Abilities.BALL_FETCH) diff --git a/test/moves/light_screen.test.ts b/test/moves/light_screen.test.ts index 9cc6944ed3e..12aeb29577a 100644 --- a/test/moves/light_screen.test.ts +++ b/test/moves/light_screen.test.ts @@ -34,7 +34,7 @@ describe("Moves - Light Screen", () => { beforeEach(() => { game = new GameManager(phaserGame); globalScene = game.scene; - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.ability(Abilities.NONE); game.override.moveset([Moves.ABSORB, Moves.DAZZLING_GLEAM, Moves.TACKLE]); game.override.enemyLevel(100); @@ -61,7 +61,7 @@ describe("Moves - Light Screen", () => { }); it("reduces damage of special attacks by a third in a double battle", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); const moveToUse = Moves.DAZZLING_GLEAM; await game.classicMode.startBattle([Species.SHUCKLE, Species.SHUCKLE]); diff --git a/test/moves/lucky_chant.test.ts b/test/moves/lucky_chant.test.ts index 21802574e79..e2a28a7bbe3 100644 --- a/test/moves/lucky_chant.test.ts +++ b/test/moves/lucky_chant.test.ts @@ -25,7 +25,7 @@ describe("Moves - Lucky Chant", () => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .moveset([Moves.LUCKY_CHANT, Moves.SPLASH, Moves.FOLLOW_ME]) .enemySpecies(Species.SNORLAX) .enemyAbility(Abilities.INSOMNIA) @@ -54,7 +54,7 @@ describe("Moves - Lucky Chant", () => { }); it("should prevent critical hits against the user's ally", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); await game.startBattle([Species.CHARIZARD, Species.BLASTOISE]); diff --git a/test/moves/lunar_blessing.test.ts b/test/moves/lunar_blessing.test.ts index d97e6c978eb..ee35107fccd 100644 --- a/test/moves/lunar_blessing.test.ts +++ b/test/moves/lunar_blessing.test.ts @@ -22,7 +22,7 @@ describe("Moves - Lunar Blessing", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.enemySpecies(Species.SHUCKLE); game.override.enemyMoveset(Moves.SPLASH); diff --git a/test/moves/lunar_dance.test.ts b/test/moves/lunar_dance.test.ts index d3dceba087c..30abe765291 100644 --- a/test/moves/lunar_dance.test.ts +++ b/test/moves/lunar_dance.test.ts @@ -25,7 +25,7 @@ describe("Moves - Lunar Dance", () => { game = new GameManager(phaserGame); game.override .statusEffect(StatusEffect.BURN) - .battleType("double") + .battleStyle("double") .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset(Moves.SPLASH); }); diff --git a/test/moves/magic_coat.test.ts b/test/moves/magic_coat.test.ts index 2cc8dea8938..23deef97318 100644 --- a/test/moves/magic_coat.test.ts +++ b/test/moves/magic_coat.test.ts @@ -30,7 +30,7 @@ describe("Moves - Magic Coat", () => { game = new GameManager(phaserGame); game.override .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) @@ -82,7 +82,7 @@ describe("Moves - Magic Coat", () => { }); it("should individually bounce back multi-target moves when used by both targets in doubles", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.moveset([Moves.GROWL, Moves.SPLASH]); await game.classicMode.startBattle([Species.MAGIKARP, Species.MAGIKARP]); @@ -95,7 +95,7 @@ describe("Moves - Magic Coat", () => { }); it("should bounce back a spread status move against both pokemon", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.moveset([Moves.GROWL, Moves.SPLASH]); game.override.enemyMoveset([Moves.SPLASH, Moves.MAGIC_COAT]); await game.classicMode.startBattle([Species.MAGIKARP, Species.MAGIKARP]); @@ -121,7 +121,7 @@ describe("Moves - Magic Coat", () => { }); it("should not bounce back a move that was just bounced", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.ability(Abilities.MAGIC_BOUNCE); game.override.moveset([Moves.GROWL, Moves.MAGIC_COAT]); game.override.enemyMoveset([Moves.SPLASH, Moves.MAGIC_COAT]); @@ -159,7 +159,7 @@ describe("Moves - Magic Coat", () => { }); it("should only bounce spikes back once when both targets use magic coat in doubles", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); await game.classicMode.startBattle([Species.MAGIKARP]); game.override.moveset([Moves.SPIKES]); @@ -206,7 +206,7 @@ describe("Moves - Magic Coat", () => { // TODO: stomping tantrum should consider moves that were bounced. it.todo("should cause stomping tantrum to double in power when the last move was bounced", async () => { - game.override.battleType("single"); + game.override.battleStyle("single"); await game.classicMode.startBattle([Species.MAGIKARP]); game.override.moveset([Moves.STOMPING_TANTRUM, Moves.CHARM]); diff --git a/test/moves/magnet_rise.test.ts b/test/moves/magnet_rise.test.ts index 725bbb99276..62ad0c88091 100644 --- a/test/moves/magnet_rise.test.ts +++ b/test/moves/magnet_rise.test.ts @@ -23,7 +23,7 @@ describe("Moves - Magnet Rise", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.starterSpecies(Species.MAGNEZONE); game.override.enemySpecies(Species.RATTATA); game.override.enemyMoveset([Moves.DRILL_RUN, Moves.DRILL_RUN, Moves.DRILL_RUN, Moves.DRILL_RUN]); diff --git a/test/moves/make_it_rain.test.ts b/test/moves/make_it_rain.test.ts index 38460d99e63..4d94537bcec 100644 --- a/test/moves/make_it_rain.test.ts +++ b/test/moves/make_it_rain.test.ts @@ -24,7 +24,7 @@ describe("Moves - Make It Rain", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.moveset([Moves.MAKE_IT_RAIN, Moves.SPLASH]); game.override.enemySpecies(Species.SNORLAX); game.override.enemyAbility(Abilities.INSOMNIA); @@ -48,7 +48,7 @@ describe("Moves - Make It Rain", () => { it("should apply effects even if the target faints", async () => { game.override.enemyLevel(1); // ensures the enemy will faint - game.override.battleType("single"); + game.override.battleStyle("single"); await game.startBattle([Species.CHARIZARD]); diff --git a/test/moves/mat_block.test.ts b/test/moves/mat_block.test.ts index ddfa29a53da..9ed0f497af9 100644 --- a/test/moves/mat_block.test.ts +++ b/test/moves/mat_block.test.ts @@ -26,7 +26,7 @@ describe("Moves - Mat Block", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.moveset([Moves.MAT_BLOCK, Moves.SPLASH]); diff --git a/test/moves/metal_burst.test.ts b/test/moves/metal_burst.test.ts index 2cbc999436f..7fa5434dc58 100644 --- a/test/moves/metal_burst.test.ts +++ b/test/moves/metal_burst.test.ts @@ -27,7 +27,7 @@ describe("Moves - Metal Burst", () => { .moveset([Moves.METAL_BURST, Moves.FISSURE, Moves.PRECIPICE_BLADES]) .ability(Abilities.PURE_POWER) .startingLevel(10) - .battleType("double") + .battleStyle("double") .disableCrits() .enemySpecies(Species.PICHU) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/moves/metronome.test.ts b/test/moves/metronome.test.ts index 80f32a3a6fb..bf177fb1a93 100644 --- a/test/moves/metronome.test.ts +++ b/test/moves/metronome.test.ts @@ -30,7 +30,7 @@ describe("Moves - Metronome", () => { game = new GameManager(phaserGame); game.override .moveset([Moves.METRONOME, Moves.SPLASH]) - .battleType("single") + .battleStyle("single") .startingLevel(100) .starterSpecies(Species.REGIELEKI) .enemyLevel(100) @@ -79,7 +79,7 @@ describe("Moves - Metronome", () => { }); it("should only target ally for Aromatic Mist", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); await game.classicMode.startBattle([Species.REGIELEKI, Species.RATTATA]); const [leftPlayer, rightPlayer] = game.scene.getPlayerField(); const [leftOpp, rightOpp] = game.scene.getEnemyField(); diff --git a/test/moves/mirror_move.test.ts b/test/moves/mirror_move.test.ts index 9178410adb2..438c594d839 100644 --- a/test/moves/mirror_move.test.ts +++ b/test/moves/mirror_move.test.ts @@ -27,7 +27,7 @@ describe("Moves - Mirror Move", () => { game.override .moveset([Moves.MIRROR_MOVE, Moves.SPLASH]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) @@ -35,7 +35,7 @@ describe("Moves - Mirror Move", () => { }); it("should use the last move that the target used on the user", async () => { - game.override.battleType("double").enemyMoveset([Moves.TACKLE, Moves.GROWL]); + game.override.battleStyle("double").enemyMoveset([Moves.TACKLE, Moves.GROWL]); await game.classicMode.startBattle([Species.FEEBAS, Species.MAGIKARP]); game.move.select(Moves.MIRROR_MOVE, 0, BattlerIndex.ENEMY); // target's last move is Tackle, enemy should receive damage from Mirror Move copying Tackle diff --git a/test/moves/mist.test.ts b/test/moves/mist.test.ts index 2deb6f9b90d..70cdf5b55a0 100644 --- a/test/moves/mist.test.ts +++ b/test/moves/mist.test.ts @@ -25,7 +25,7 @@ describe("Moves - Mist", () => { game.override .moveset([Moves.MIST, Moves.SPLASH]) .ability(Abilities.BALL_FETCH) - .battleType("double") + .battleStyle("double") .disableCrits() .enemySpecies(Species.SNORLAX) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/moves/moongeist_beam.test.ts b/test/moves/moongeist_beam.test.ts index 117fe513e17..82a2567377b 100644 --- a/test/moves/moongeist_beam.test.ts +++ b/test/moves/moongeist_beam.test.ts @@ -26,7 +26,7 @@ describe("Moves - Moongeist Beam", () => { .moveset([Moves.MOONGEIST_BEAM, Moves.METRONOME]) .ability(Abilities.BALL_FETCH) .startingLevel(200) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.STURDY) diff --git a/test/moves/multi_target.test.ts b/test/moves/multi_target.test.ts index 5d33c7860cb..fccf650416c 100644 --- a/test/moves/multi_target.test.ts +++ b/test/moves/multi_target.test.ts @@ -25,7 +25,7 @@ describe("Multi-target damage reduction", () => { game = new GameManager(phaserGame); game.override .disableCrits() - .battleType("double") + .battleStyle("double") .enemyLevel(100) .startingLevel(100) .enemySpecies(Species.POLIWAG) diff --git a/test/moves/nightmare.test.ts b/test/moves/nightmare.test.ts index e1cef0084ee..044856ae33d 100644 --- a/test/moves/nightmare.test.ts +++ b/test/moves/nightmare.test.ts @@ -24,7 +24,7 @@ describe("Moves - Nightmare", () => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.RATTATA) .enemyMoveset(Moves.SPLASH) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/moves/obstruct.test.ts b/test/moves/obstruct.test.ts index d8e3a949f08..f35a5964bcb 100644 --- a/test/moves/obstruct.test.ts +++ b/test/moves/obstruct.test.ts @@ -22,7 +22,7 @@ describe("Moves - Obstruct", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.MAGIKARP) .enemyMoveset(Moves.TACKLE) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/moves/octolock.test.ts b/test/moves/octolock.test.ts index c9c5fd42f7e..fb57d0bfad5 100644 --- a/test/moves/octolock.test.ts +++ b/test/moves/octolock.test.ts @@ -25,7 +25,7 @@ describe("Moves - Octolock", () => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.MAGIKARP) .enemyMoveset(Moves.SPLASH) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/moves/order_up.test.ts b/test/moves/order_up.test.ts index f25114c12de..701d0489c25 100644 --- a/test/moves/order_up.test.ts +++ b/test/moves/order_up.test.ts @@ -29,7 +29,7 @@ describe("Moves - Order Up", () => { game.override .moveset(Moves.ORDER_UP) .ability(Abilities.COMMANDER) - .battleType("double") + .battleStyle("double") .disableCrits() .enemySpecies(Species.SNORLAX) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/moves/parting_shot.test.ts b/test/moves/parting_shot.test.ts index 699d960f882..a65c1a5b3a5 100644 --- a/test/moves/parting_shot.test.ts +++ b/test/moves/parting_shot.test.ts @@ -26,7 +26,7 @@ describe("Moves - Parting Shot", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.moveset([Moves.PARTING_SHOT, Moves.SPLASH]); game.override.enemyMoveset(Moves.SPLASH); game.override.startingLevel(5); diff --git a/test/moves/plasma_fists.test.ts b/test/moves/plasma_fists.test.ts index fe19ab4a460..b6a5ceaed68 100644 --- a/test/moves/plasma_fists.test.ts +++ b/test/moves/plasma_fists.test.ts @@ -25,7 +25,7 @@ describe("Moves - Plasma Fists", () => { game = new GameManager(phaserGame); game.override .moveset([Moves.PLASMA_FISTS, Moves.TACKLE]) - .battleType("double") + .battleStyle("double") .startingLevel(100) .enemySpecies(Species.DUSCLOPS) .enemyAbility(Abilities.BALL_FETCH) @@ -56,7 +56,7 @@ describe("Moves - Plasma Fists", () => { }); it("should not affect Normal-type attacks boosted by Pixilate", async () => { - game.override.battleType("single").enemyAbility(Abilities.PIXILATE); + game.override.battleStyle("single").enemyAbility(Abilities.PIXILATE); await game.classicMode.startBattle([Species.ONIX]); @@ -74,7 +74,7 @@ describe("Moves - Plasma Fists", () => { }); it("should affect moves that become Normal type due to Normalize", async () => { - game.override.battleType("single").enemyAbility(Abilities.NORMALIZE).enemyMoveset(Moves.WATER_GUN); + game.override.battleStyle("single").enemyAbility(Abilities.NORMALIZE).enemyMoveset(Moves.WATER_GUN); await game.classicMode.startBattle([Species.DUSCLOPS]); diff --git a/test/moves/pledge_moves.test.ts b/test/moves/pledge_moves.test.ts index ee9e0b8b154..b3d13a27b83 100644 --- a/test/moves/pledge_moves.test.ts +++ b/test/moves/pledge_moves.test.ts @@ -30,7 +30,7 @@ describe("Moves - Pledge Moves", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("double") + .battleStyle("double") .startingLevel(100) .moveset([Moves.FIRE_PLEDGE, Moves.GRASS_PLEDGE, Moves.WATER_PLEDGE, Moves.SPLASH]) .enemySpecies(Species.SNORLAX) @@ -86,7 +86,7 @@ describe("Moves - Pledge Moves", () => { }); it("Fire Pledge - should not combine with an enemy's Pledge move", async () => { - game.override.battleType("single").enemyMoveset(Moves.GRASS_PLEDGE); + game.override.battleStyle("single").enemyMoveset(Moves.GRASS_PLEDGE); await game.classicMode.startBattle([Species.CHARIZARD]); diff --git a/test/moves/pollen_puff.test.ts b/test/moves/pollen_puff.test.ts index 3af3ea1f41d..31d5950b47d 100644 --- a/test/moves/pollen_puff.test.ts +++ b/test/moves/pollen_puff.test.ts @@ -25,7 +25,7 @@ describe("Moves - Pollen Puff", () => { game.override .moveset([Moves.POLLEN_PUFF]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) @@ -33,7 +33,7 @@ describe("Moves - Pollen Puff", () => { }); it("should not heal more than once when the user has a source of multi-hit", async () => { - game.override.battleType("double").moveset([Moves.POLLEN_PUFF, Moves.ENDURE]).ability(Abilities.PARENTAL_BOND); + game.override.battleStyle("double").moveset([Moves.POLLEN_PUFF, Moves.ENDURE]).ability(Abilities.PARENTAL_BOND); await game.classicMode.startBattle([Species.BULBASAUR, Species.OMANYTE]); const [_, rightPokemon] = game.scene.getPlayerField(); diff --git a/test/moves/powder.test.ts b/test/moves/powder.test.ts index 522b0b74ca7..6f7a6add054 100644 --- a/test/moves/powder.test.ts +++ b/test/moves/powder.test.ts @@ -27,7 +27,7 @@ describe("Moves - Powder", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override .enemySpecies(Species.SNORLAX) @@ -150,7 +150,7 @@ describe("Moves - Powder", () => { }); it("should cancel Fire-type moves generated by the target's Dancer ability", async () => { - game.override.battleType("double").enemySpecies(Species.BLASTOISE).enemyAbility(Abilities.DANCER); + game.override.battleStyle("double").enemySpecies(Species.BLASTOISE).enemyAbility(Abilities.DANCER); await game.classicMode.startBattle([Species.CHARIZARD, Species.CHARIZARD]); @@ -227,7 +227,7 @@ describe("Moves - Powder", () => { }); it("should cancel Grass Pledge if used after ally's Fire Pledge", async () => { - game.override.enemyMoveset([Moves.FIRE_PLEDGE, Moves.GRASS_PLEDGE]).battleType("double"); + game.override.enemyMoveset([Moves.FIRE_PLEDGE, Moves.GRASS_PLEDGE]).battleStyle("double"); await game.classicMode.startBattle([Species.CHARIZARD, Species.CHARIZARD]); const enemyPokemon = game.scene.getEnemyPokemon()!; @@ -244,7 +244,7 @@ describe("Moves - Powder", () => { }); it("should cancel Fire Pledge if used before ally's Water Pledge", async () => { - game.override.enemyMoveset([Moves.FIRE_PLEDGE, Moves.WATER_PLEDGE]).battleType("double"); + game.override.enemyMoveset([Moves.FIRE_PLEDGE, Moves.WATER_PLEDGE]).battleStyle("double"); await game.classicMode.startBattle([Species.CHARIZARD, Species.CHARIZARD]); const enemyPokemon = game.scene.getEnemyPokemon()!; @@ -261,7 +261,7 @@ describe("Moves - Powder", () => { }); it("should NOT cancel Fire Pledge if used after ally's Water Pledge", async () => { - game.override.enemyMoveset([Moves.FIRE_PLEDGE, Moves.WATER_PLEDGE]).battleType("double"); + game.override.enemyMoveset([Moves.FIRE_PLEDGE, Moves.WATER_PLEDGE]).battleStyle("double"); await game.classicMode.startBattle([Species.CHARIZARD, Species.CHARIZARD]); const enemyPokemon = game.scene.getEnemyPokemon()!; diff --git a/test/moves/power_shift.test.ts b/test/moves/power_shift.test.ts index fbc6d732d30..0fee044f5ad 100644 --- a/test/moves/power_shift.test.ts +++ b/test/moves/power_shift.test.ts @@ -23,7 +23,7 @@ describe("Moves - Power Shift", () => { game = new GameManager(phaserGame); game.override .moveset([Moves.POWER_SHIFT, Moves.BULK_UP]) - .battleType("single") + .battleStyle("single") .ability(Abilities.BALL_FETCH) .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset(Moves.SPLASH); diff --git a/test/moves/power_split.test.ts b/test/moves/power_split.test.ts index 9150a707ad5..f15275fce9e 100644 --- a/test/moves/power_split.test.ts +++ b/test/moves/power_split.test.ts @@ -24,7 +24,7 @@ describe("Moves - Power Split", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemyAbility(Abilities.NONE) .enemySpecies(Species.MEW) .enemyLevel(200) diff --git a/test/moves/power_swap.test.ts b/test/moves/power_swap.test.ts index d6f5e782e66..5f6aa022a51 100644 --- a/test/moves/power_swap.test.ts +++ b/test/moves/power_swap.test.ts @@ -24,7 +24,7 @@ describe("Moves - Power Swap", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset(Moves.SPLASH) .enemySpecies(Species.INDEEDEE) diff --git a/test/moves/power_trick.test.ts b/test/moves/power_trick.test.ts index 0cd849bbcc5..181eeca81bc 100644 --- a/test/moves/power_trick.test.ts +++ b/test/moves/power_trick.test.ts @@ -25,7 +25,7 @@ describe("Moves - Power Trick", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset(Moves.SPLASH) .enemySpecies(Species.MEW) diff --git a/test/moves/protect.test.ts b/test/moves/protect.test.ts index d50c490f7d3..183430f8654 100644 --- a/test/moves/protect.test.ts +++ b/test/moves/protect.test.ts @@ -27,7 +27,7 @@ describe("Moves - Protect", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.moveset([Moves.PROTECT]); game.override.enemySpecies(Species.SNORLAX); diff --git a/test/moves/psycho_shift.test.ts b/test/moves/psycho_shift.test.ts index 0a82189d201..678742906c7 100644 --- a/test/moves/psycho_shift.test.ts +++ b/test/moves/psycho_shift.test.ts @@ -26,7 +26,7 @@ describe("Moves - Psycho Shift", () => { .moveset([Moves.PSYCHO_SHIFT]) .ability(Abilities.BALL_FETCH) .statusEffect(StatusEffect.POISON) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyLevel(20) diff --git a/test/moves/purify.test.ts b/test/moves/purify.test.ts index 30d9df8ff67..191539d8cec 100644 --- a/test/moves/purify.test.ts +++ b/test/moves/purify.test.ts @@ -25,7 +25,7 @@ describe("Moves - Purify", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.starterSpecies(Species.PYUKUMUKU); game.override.startingLevel(10); diff --git a/test/moves/quash.test.ts b/test/moves/quash.test.ts index f85dbd89517..5bf8271320b 100644 --- a/test/moves/quash.test.ts +++ b/test/moves/quash.test.ts @@ -25,7 +25,7 @@ describe("Moves - Quash", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("double") + .battleStyle("double") .enemyLevel(1) .enemySpecies(Species.SLOWPOKE) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/moves/quick_guard.test.ts b/test/moves/quick_guard.test.ts index 22d4a5078ac..d9970ce64fa 100644 --- a/test/moves/quick_guard.test.ts +++ b/test/moves/quick_guard.test.ts @@ -25,7 +25,7 @@ describe("Moves - Quick Guard", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.moveset([Moves.QUICK_GUARD, Moves.SPLASH, Moves.FOLLOW_ME]); @@ -84,7 +84,7 @@ describe("Moves - Quick Guard", () => { }); test("should fail if the user is the last to move in the turn", async () => { - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.enemyMoveset([Moves.QUICK_GUARD]); await game.classicMode.startBattle([Species.CHARIZARD]); diff --git a/test/moves/rage_fist.test.ts b/test/moves/rage_fist.test.ts index f44901c5aba..687d805da78 100644 --- a/test/moves/rage_fist.test.ts +++ b/test/moves/rage_fist.test.ts @@ -27,7 +27,7 @@ describe("Moves - Rage Fist", () => { move = allMoves[Moves.RAGE_FIST]; game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .moveset([Moves.RAGE_FIST, Moves.SPLASH, Moves.SUBSTITUTE]) .startingLevel(100) .enemyLevel(1) diff --git a/test/moves/rage_powder.test.ts b/test/moves/rage_powder.test.ts index ab05ae2e0bc..284b558f842 100644 --- a/test/moves/rage_powder.test.ts +++ b/test/moves/rage_powder.test.ts @@ -22,7 +22,7 @@ describe("Moves - Rage Powder", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.enemySpecies(Species.SNORLAX); game.override.startingLevel(100); game.override.enemyLevel(100); diff --git a/test/moves/reflect.test.ts b/test/moves/reflect.test.ts index ac879a7cc2b..473b46bf097 100644 --- a/test/moves/reflect.test.ts +++ b/test/moves/reflect.test.ts @@ -34,7 +34,7 @@ describe("Moves - Reflect", () => { beforeEach(() => { game = new GameManager(phaserGame); globalScene = game.scene; - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.ability(Abilities.NONE); game.override.moveset([Moves.ABSORB, Moves.ROCK_SLIDE, Moves.TACKLE]); game.override.enemyLevel(100); @@ -60,7 +60,7 @@ describe("Moves - Reflect", () => { }); it("reduces damage of physical attacks by a third in a double battle", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); const moveToUse = Moves.ROCK_SLIDE; await game.classicMode.startBattle([Species.SHUCKLE, Species.SHUCKLE]); diff --git a/test/moves/reflect_type.test.ts b/test/moves/reflect_type.test.ts index 78371d35475..efd58bfeadf 100644 --- a/test/moves/reflect_type.test.ts +++ b/test/moves/reflect_type.test.ts @@ -22,7 +22,7 @@ describe("Moves - Reflect Type", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.ability(Abilities.BALL_FETCH).battleType("single").disableCrits().enemyAbility(Abilities.BALL_FETCH); + game.override.ability(Abilities.BALL_FETCH).battleStyle("single").disableCrits().enemyAbility(Abilities.BALL_FETCH); }); it("will make the user Normal/Grass if targetting a typeless Pokemon affected by Forest's Curse", async () => { diff --git a/test/moves/relic_song.test.ts b/test/moves/relic_song.test.ts index d8f1373b4c0..86195e81a24 100644 --- a/test/moves/relic_song.test.ts +++ b/test/moves/relic_song.test.ts @@ -24,7 +24,7 @@ describe("Moves - Relic Song", () => { game = new GameManager(phaserGame); game.override .moveset([Moves.RELIC_SONG, Moves.SPLASH]) - .battleType("single") + .battleStyle("single") .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset(Moves.SPLASH) .enemySpecies(Species.MAGIKARP) diff --git a/test/moves/retaliate.test.ts b/test/moves/retaliate.test.ts index e916c9ffeaa..9ad7cd7853b 100644 --- a/test/moves/retaliate.test.ts +++ b/test/moves/retaliate.test.ts @@ -26,7 +26,7 @@ describe("Moves - Retaliate", () => { retaliate = allMoves[Moves.RETALIATE]; game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.SNORLAX) .enemyMoveset([Moves.RETALIATE, Moves.RETALIATE, Moves.RETALIATE, Moves.RETALIATE]) .enemyLevel(100) diff --git a/test/moves/revival_blessing.test.ts b/test/moves/revival_blessing.test.ts index 87be20f60ad..860ce5524d4 100644 --- a/test/moves/revival_blessing.test.ts +++ b/test/moves/revival_blessing.test.ts @@ -27,7 +27,7 @@ describe("Moves - Revival Blessing", () => { game.override .moveset([Moves.SPLASH, Moves.REVIVAL_BLESSING, Moves.MEMENTO]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) @@ -88,7 +88,7 @@ describe("Moves - Revival Blessing", () => { it("should revive a player pokemon and immediately send it back out if used in the same turn it fainted in doubles", async () => { game.override - .battleType("double") + .battleStyle("double") .enemyMoveset([Moves.SPLASH, Moves.FISSURE]) .enemyAbility(Abilities.NO_GUARD) .enemyLevel(100); @@ -116,7 +116,7 @@ describe("Moves - Revival Blessing", () => { }); it("should not summon multiple pokemon to the same slot when reviving the enemy ally in doubles", async () => { - game.override.battleType("double").enemyMoveset([Moves.REVIVAL_BLESSING]).moveset([Moves.SPLASH]).startingWave(25); // 2nd rival battle - must have 3+ pokemon + game.override.battleStyle("double").enemyMoveset([Moves.REVIVAL_BLESSING]).moveset([Moves.SPLASH]).startingWave(25); // 2nd rival battle - must have 3+ pokemon await game.classicMode.startBattle([Species.ARCEUS, Species.GIRATINA]); const enemyFainting = game.scene.getEnemyField()[0]; diff --git a/test/moves/role_play.test.ts b/test/moves/role_play.test.ts index 2a899b6e987..d4893212003 100644 --- a/test/moves/role_play.test.ts +++ b/test/moves/role_play.test.ts @@ -25,7 +25,7 @@ describe("Moves - Role Play", () => { game.override .moveset([Moves.SPLASH, Moves.ROLE_PLAY]) .ability(Abilities.ADAPTABILITY) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/moves/rollout.test.ts b/test/moves/rollout.test.ts index 89270c2dfc7..b477fd8274f 100644 --- a/test/moves/rollout.test.ts +++ b/test/moves/rollout.test.ts @@ -24,7 +24,7 @@ describe("Moves - Rollout", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.disableCrits(); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.starterSpecies(Species.RATTATA); game.override.ability(Abilities.BALL_FETCH); game.override.enemySpecies(Species.BIDOOF); diff --git a/test/moves/roost.test.ts b/test/moves/roost.test.ts index a52b81085c8..e55c76ca220 100644 --- a/test/moves/roost.test.ts +++ b/test/moves/roost.test.ts @@ -25,7 +25,7 @@ describe("Moves - Roost", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.enemySpecies(Species.RELICANTH); game.override.startingLevel(100); game.override.enemyLevel(100); diff --git a/test/moves/round.test.ts b/test/moves/round.test.ts index 82f080a25ea..a58efb730f8 100644 --- a/test/moves/round.test.ts +++ b/test/moves/round.test.ts @@ -27,7 +27,7 @@ describe("Moves - Round", () => { game.override .moveset([Moves.SPLASH, Moves.ROUND]) .ability(Abilities.BALL_FETCH) - .battleType("double") + .battleStyle("double") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/moves/safeguard.test.ts b/test/moves/safeguard.test.ts index 675c74f28d0..7804b63f5c5 100644 --- a/test/moves/safeguard.test.ts +++ b/test/moves/safeguard.test.ts @@ -26,7 +26,7 @@ describe("Moves - Safeguard", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.DRATINI) .enemyMoveset([Moves.SAFEGUARD]) .enemyAbility(Abilities.BALL_FETCH) @@ -71,7 +71,7 @@ describe("Moves - Safeguard", () => { }); it("protects ally from status", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); await game.classicMode.startBattle(); diff --git a/test/moves/scale_shot.test.ts b/test/moves/scale_shot.test.ts index 2be632adb54..4731ccf9574 100644 --- a/test/moves/scale_shot.test.ts +++ b/test/moves/scale_shot.test.ts @@ -30,7 +30,7 @@ describe("Moves - Scale Shot", () => { game = new GameManager(phaserGame); game.override .moveset([Moves.SCALE_SHOT]) - .battleType("single") + .battleStyle("single") .disableCrits() .ability(Abilities.NO_GUARD) .passiveAbility(Abilities.SKILL_LINK) diff --git a/test/moves/secret_power.test.ts b/test/moves/secret_power.test.ts index d769b112b70..cbc0cded28b 100644 --- a/test/moves/secret_power.test.ts +++ b/test/moves/secret_power.test.ts @@ -33,7 +33,7 @@ describe("Moves - Secret Power", () => { game.override .moveset([Moves.SECRET_POWER]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyLevel(60) @@ -65,7 +65,7 @@ describe("Moves - Secret Power", () => { .moveset([Moves.FIRE_PLEDGE, Moves.WATER_PLEDGE, Moves.SECRET_POWER, Moves.SPLASH]) .ability(Abilities.SERENE_GRACE) .enemyMoveset([Moves.SPLASH]) - .battleType("double"); + .battleStyle("double"); await game.classicMode.startBattle([Species.BLASTOISE, Species.CHARIZARD]); const sereneGraceAttr = allAbilities[Abilities.SERENE_GRACE].getAttrs(MoveEffectChanceMultiplierAbAttr)[0]; diff --git a/test/moves/shed_tail.test.ts b/test/moves/shed_tail.test.ts index 6744c4e9ed8..845399f6c27 100644 --- a/test/moves/shed_tail.test.ts +++ b/test/moves/shed_tail.test.ts @@ -25,7 +25,7 @@ describe("Moves - Shed Tail", () => { game = new GameManager(phaserGame); game.override .moveset([Moves.SHED_TAIL]) - .battleType("single") + .battleStyle("single") .enemySpecies(Species.SNORLAX) .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset(Moves.SPLASH); diff --git a/test/moves/shell_side_arm.test.ts b/test/moves/shell_side_arm.test.ts index a5b065b76cb..e43bf6db037 100644 --- a/test/moves/shell_side_arm.test.ts +++ b/test/moves/shell_side_arm.test.ts @@ -30,7 +30,7 @@ describe("Moves - Shell Side Arm", () => { game = new GameManager(phaserGame); game.override .moveset([Moves.SHELL_SIDE_ARM, Moves.SPLASH]) - .battleType("single") + .battleStyle("single") .startingLevel(100) .enemyLevel(100) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/moves/shell_trap.test.ts b/test/moves/shell_trap.test.ts index 2df94cdb828..f6501c2cd9e 100644 --- a/test/moves/shell_trap.test.ts +++ b/test/moves/shell_trap.test.ts @@ -27,7 +27,7 @@ describe("Moves - Shell Trap", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("double") + .battleStyle("double") .moveset([Moves.SHELL_TRAP, Moves.SPLASH, Moves.BULLDOZE]) .enemySpecies(Species.SNORLAX) .enemyMoveset([Moves.RAZOR_LEAF]) @@ -128,7 +128,7 @@ describe("Moves - Shell Trap", () => { }); it("should not activate from a subsequent physical attack", async () => { - game.override.battleType("single"); + game.override.battleStyle("single"); vi.spyOn(allMoves[Moves.RAZOR_LEAF], "priority", "get").mockReturnValue(-4); await game.startBattle([Species.CHARIZARD]); diff --git a/test/moves/simple_beam.test.ts b/test/moves/simple_beam.test.ts index ce86f42671e..225fda28083 100644 --- a/test/moves/simple_beam.test.ts +++ b/test/moves/simple_beam.test.ts @@ -24,7 +24,7 @@ describe("Moves - Simple Beam", () => { game.override .moveset([Moves.SPLASH, Moves.SIMPLE_BEAM]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/moves/sketch.test.ts b/test/moves/sketch.test.ts index dfbf2eca713..c9755189a71 100644 --- a/test/moves/sketch.test.ts +++ b/test/moves/sketch.test.ts @@ -27,7 +27,7 @@ describe("Moves - Sketch", () => { game = new GameManager(phaserGame); game.override .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.SHUCKLE) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/moves/skill_swap.test.ts b/test/moves/skill_swap.test.ts index f807a85eaf6..562e4bb56ed 100644 --- a/test/moves/skill_swap.test.ts +++ b/test/moves/skill_swap.test.ts @@ -25,7 +25,7 @@ describe("Moves - Skill Swap", () => { game.override .moveset([Moves.SPLASH, Moves.SKILL_SWAP]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/moves/sleep_talk.test.ts b/test/moves/sleep_talk.test.ts index d31eff34a7a..cbe3b6d7d3a 100644 --- a/test/moves/sleep_talk.test.ts +++ b/test/moves/sleep_talk.test.ts @@ -28,7 +28,7 @@ describe("Moves - Sleep Talk", () => { .moveset([Moves.SPLASH, Moves.SLEEP_TALK]) .statusEffect(StatusEffect.SLEEP) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/moves/solar_beam.test.ts b/test/moves/solar_beam.test.ts index dffd4f210e5..49605a70c66 100644 --- a/test/moves/solar_beam.test.ts +++ b/test/moves/solar_beam.test.ts @@ -27,7 +27,7 @@ describe("Moves - Solar Beam", () => { game = new GameManager(phaserGame); game.override .moveset(Moves.SOLAR_BEAM) - .battleType("single") + .battleStyle("single") .startingLevel(100) .enemySpecies(Species.SNORLAX) .enemyLevel(100) diff --git a/test/moves/sparkly_swirl.test.ts b/test/moves/sparkly_swirl.test.ts index 6cd357c7e0e..b9df302933c 100644 --- a/test/moves/sparkly_swirl.test.ts +++ b/test/moves/sparkly_swirl.test.ts @@ -34,7 +34,7 @@ describe("Moves - Sparkly Swirl", () => { }); it("should cure status effect of the user, its ally, and all party pokemon", async () => { - game.override.battleType("double").statusEffect(StatusEffect.BURN); + game.override.battleStyle("double").statusEffect(StatusEffect.BURN); await game.classicMode.startBattle([Species.RATTATA, Species.RATTATA, Species.RATTATA]); const [leftPlayer, rightPlayer, partyPokemon] = game.scene.getPlayerParty(); const leftOpp = game.scene.getEnemyPokemon()!; @@ -58,7 +58,7 @@ describe("Moves - Sparkly Swirl", () => { }); it("should not cure status effect of the target/target's allies", async () => { - game.override.battleType("double").enemyStatusEffect(StatusEffect.BURN); + game.override.battleStyle("double").enemyStatusEffect(StatusEffect.BURN); await game.classicMode.startBattle([Species.RATTATA, Species.RATTATA]); const [leftOpp, rightOpp] = game.scene.getEnemyField(); diff --git a/test/moves/speed_swap.test.ts b/test/moves/speed_swap.test.ts index a1385ce5386..2b010885e34 100644 --- a/test/moves/speed_swap.test.ts +++ b/test/moves/speed_swap.test.ts @@ -24,7 +24,7 @@ describe("Moves - Speed Swap", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemyAbility(Abilities.NONE) .enemyMoveset(Moves.SPLASH) .enemySpecies(Species.MEW) diff --git a/test/moves/spikes.test.ts b/test/moves/spikes.test.ts index 76af15777bb..3dfa398d7d6 100644 --- a/test/moves/spikes.test.ts +++ b/test/moves/spikes.test.ts @@ -23,7 +23,7 @@ describe("Moves - Spikes", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) .ability(Abilities.BALL_FETCH) @@ -81,7 +81,7 @@ describe("Moves - Spikes", () => { it("should work when all targets fainted", async () => { game.override.enemySpecies(Species.DIGLETT); - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.startingLevel(50); await game.classicMode.startBattle([Species.RAYQUAZA, Species.ROWLET]); diff --git a/test/moves/spit_up.test.ts b/test/moves/spit_up.test.ts index d71647bda52..c034117bc64 100644 --- a/test/moves/spit_up.test.ts +++ b/test/moves/spit_up.test.ts @@ -32,7 +32,7 @@ describe("Moves - Spit Up", () => { spitUp = allMoves[Moves.SPIT_UP]; game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.enemySpecies(Species.RATTATA); game.override.enemyMoveset(Moves.SPLASH); diff --git a/test/moves/spotlight.test.ts b/test/moves/spotlight.test.ts index 91705dbb2fa..2c4f652e408 100644 --- a/test/moves/spotlight.test.ts +++ b/test/moves/spotlight.test.ts @@ -22,7 +22,7 @@ describe("Moves - Spotlight", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.starterSpecies(Species.AMOONGUSS); game.override.enemySpecies(Species.SNORLAX); game.override.startingLevel(100); diff --git a/test/moves/steamroller.test.ts b/test/moves/steamroller.test.ts index ba96928e01d..b32b4551c81 100644 --- a/test/moves/steamroller.test.ts +++ b/test/moves/steamroller.test.ts @@ -25,7 +25,7 @@ describe("Moves - Steamroller", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.moveset([Moves.STEAMROLLER]).battleType("single").enemyAbility(Abilities.BALL_FETCH); + game.override.moveset([Moves.STEAMROLLER]).battleStyle("single").enemyAbility(Abilities.BALL_FETCH); }); it("should always hit a minimzed target with double damage", async () => { diff --git a/test/moves/stockpile.test.ts b/test/moves/stockpile.test.ts index 033f24d5229..4b8f51c32b2 100644 --- a/test/moves/stockpile.test.ts +++ b/test/moves/stockpile.test.ts @@ -27,7 +27,7 @@ describe("Moves - Stockpile", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.enemySpecies(Species.RATTATA); game.override.enemyMoveset(Moves.SPLASH); diff --git a/test/moves/struggle.test.ts b/test/moves/struggle.test.ts index 6b566df9d54..61c6cd23e10 100644 --- a/test/moves/struggle.test.ts +++ b/test/moves/struggle.test.ts @@ -24,7 +24,7 @@ describe("Moves - Struggle", () => { game.override .moveset([Moves.SPLASH]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/moves/substitute.test.ts b/test/moves/substitute.test.ts index 23f7f4af4b9..2e82078418b 100644 --- a/test/moves/substitute.test.ts +++ b/test/moves/substitute.test.ts @@ -36,7 +36,7 @@ describe("Moves - Substitute", () => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .moveset([Moves.SUBSTITUTE, Moves.SWORDS_DANCE, Moves.TACKLE, Moves.SPLASH]) .enemySpecies(Species.SNORLAX) .enemyAbility(Abilities.INSOMNIA) diff --git a/test/moves/swallow.test.ts b/test/moves/swallow.test.ts index baa03801079..d548522068b 100644 --- a/test/moves/swallow.test.ts +++ b/test/moves/swallow.test.ts @@ -27,7 +27,7 @@ describe("Moves - Swallow", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.enemySpecies(Species.RATTATA); game.override.enemyMoveset(Moves.SPLASH); diff --git a/test/moves/syrup_bomb.test.ts b/test/moves/syrup_bomb.test.ts index 1e193793d82..8e9134497d0 100644 --- a/test/moves/syrup_bomb.test.ts +++ b/test/moves/syrup_bomb.test.ts @@ -25,7 +25,7 @@ describe("Moves - SYRUP BOMB", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.SNORLAX) .enemyAbility(Abilities.BALL_FETCH) .ability(Abilities.BALL_FETCH) diff --git a/test/moves/tackle.test.ts b/test/moves/tackle.test.ts index 44fc698ec62..162836cd181 100644 --- a/test/moves/tackle.test.ts +++ b/test/moves/tackle.test.ts @@ -24,7 +24,7 @@ describe("Moves - Tackle", () => { beforeEach(() => { game = new GameManager(phaserGame); const moveToUse = Moves.TACKLE; - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.enemySpecies(Species.MAGIKARP); game.override.startingLevel(1); game.override.startingWave(97); diff --git a/test/moves/tail_whip.test.ts b/test/moves/tail_whip.test.ts index 41c39ab22ca..2d3ade2691d 100644 --- a/test/moves/tail_whip.test.ts +++ b/test/moves/tail_whip.test.ts @@ -25,7 +25,7 @@ describe("Moves - Tail whip", () => { beforeEach(() => { game = new GameManager(phaserGame); const moveToUse = Moves.TAIL_WHIP; - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.INSOMNIA); game.override.ability(Abilities.INSOMNIA); diff --git a/test/moves/tailwind.test.ts b/test/moves/tailwind.test.ts index 591b94408ce..40bae67b514 100644 --- a/test/moves/tailwind.test.ts +++ b/test/moves/tailwind.test.ts @@ -25,7 +25,7 @@ describe("Moves - Tailwind", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("double") + .battleStyle("double") .moveset([Moves.TAILWIND, Moves.SPLASH]) .enemyMoveset(Moves.SPLASH) .enemyAbility(Abilities.BALL_FETCH) @@ -54,7 +54,7 @@ describe("Moves - Tailwind", () => { }); it("lasts for 4 turns", async () => { - game.override.battleType("single"); + game.override.battleStyle("single"); await game.classicMode.startBattle([Species.MAGIKARP]); @@ -77,7 +77,7 @@ describe("Moves - Tailwind", () => { }); it("does not affect the opposing side", async () => { - game.override.battleType("single"); + game.override.battleStyle("single"); await game.classicMode.startBattle([Species.MAGIKARP]); diff --git a/test/moves/tar_shot.test.ts b/test/moves/tar_shot.test.ts index ac3ba534446..68f19e3ab51 100644 --- a/test/moves/tar_shot.test.ts +++ b/test/moves/tar_shot.test.ts @@ -24,7 +24,7 @@ describe("Moves - Tar Shot", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset(Moves.SPLASH) .enemySpecies(Species.TANGELA) diff --git a/test/moves/taunt.test.ts b/test/moves/taunt.test.ts index adc1434c7dd..e0bb13c61fb 100644 --- a/test/moves/taunt.test.ts +++ b/test/moves/taunt.test.ts @@ -23,7 +23,7 @@ describe("Moves - Taunt", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset([Moves.TAUNT, Moves.SPLASH]) .enemySpecies(Species.SHUCKLE) diff --git a/test/moves/telekinesis.test.ts b/test/moves/telekinesis.test.ts index 1355cb975f3..d11cc0861f0 100644 --- a/test/moves/telekinesis.test.ts +++ b/test/moves/telekinesis.test.ts @@ -27,7 +27,7 @@ describe("Moves - Telekinesis", () => { game = new GameManager(phaserGame); game.override .moveset([Moves.TELEKINESIS, Moves.TACKLE, Moves.MUD_SHOT, Moves.SMACK_DOWN]) - .battleType("single") + .battleStyle("single") .enemySpecies(Species.SNORLAX) .enemyLevel(60) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/moves/tera_blast.test.ts b/test/moves/tera_blast.test.ts index c1a2b999fa0..5dc3a914a2e 100644 --- a/test/moves/tera_blast.test.ts +++ b/test/moves/tera_blast.test.ts @@ -34,7 +34,7 @@ describe("Moves - Tera Blast", () => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .disableCrits() .starterSpecies(Species.FEEBAS) .moveset([Moves.TERA_BLAST]) diff --git a/test/moves/tera_starstorm.test.ts b/test/moves/tera_starstorm.test.ts index 9f97b2a51aa..5ae0c575599 100644 --- a/test/moves/tera_starstorm.test.ts +++ b/test/moves/tera_starstorm.test.ts @@ -25,7 +25,7 @@ describe("Moves - Tera Starstorm", () => { game = new GameManager(phaserGame); game.override .moveset([Moves.TERA_STARSTORM, Moves.SPLASH]) - .battleType("double") + .battleStyle("double") .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset(Moves.SPLASH) .enemyLevel(30) @@ -33,7 +33,7 @@ describe("Moves - Tera Starstorm", () => { }); it("changes type to Stellar when used by Terapagos in its Stellar Form", async () => { - game.override.battleType("single"); + game.override.battleStyle("single"); await game.classicMode.startBattle([Species.TERAPAGOS]); const terapagos = game.scene.getPlayerPokemon()!; diff --git a/test/moves/thousand_arrows.test.ts b/test/moves/thousand_arrows.test.ts index 109fc2c6936..7259fda8560 100644 --- a/test/moves/thousand_arrows.test.ts +++ b/test/moves/thousand_arrows.test.ts @@ -24,7 +24,7 @@ describe("Moves - Thousand Arrows", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.enemySpecies(Species.TOGETIC); game.override.startingLevel(100); game.override.enemyLevel(100); diff --git a/test/moves/throat_chop.test.ts b/test/moves/throat_chop.test.ts index 755e60fe425..aaae9c0f5bb 100644 --- a/test/moves/throat_chop.test.ts +++ b/test/moves/throat_chop.test.ts @@ -24,7 +24,7 @@ describe("Moves - Throat Chop", () => { game = new GameManager(phaserGame); game.override .moveset(Array(4).fill(Moves.GROWL)) - .battleType("single") + .battleStyle("single") .ability(Abilities.BALL_FETCH) .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset(Array(4).fill(Moves.THROAT_CHOP)) diff --git a/test/moves/thunder_wave.test.ts b/test/moves/thunder_wave.test.ts index 9f907e38b62..abfb5828d3b 100644 --- a/test/moves/thunder_wave.test.ts +++ b/test/moves/thunder_wave.test.ts @@ -24,7 +24,7 @@ describe("Moves - Thunder Wave", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .starterSpecies(Species.PIKACHU) .moveset([Moves.THUNDER_WAVE]) .enemyMoveset(Moves.SPLASH); diff --git a/test/moves/tidy_up.test.ts b/test/moves/tidy_up.test.ts index 9d98feb13f5..ba7a1e07959 100644 --- a/test/moves/tidy_up.test.ts +++ b/test/moves/tidy_up.test.ts @@ -26,7 +26,7 @@ describe("Moves - Tidy Up", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.enemySpecies(Species.MAGIKARP); game.override.enemyAbility(Abilities.BALL_FETCH); game.override.enemyMoveset(Moves.SPLASH); diff --git a/test/moves/torment.test.ts b/test/moves/torment.test.ts index 75143053321..d06837d2806 100644 --- a/test/moves/torment.test.ts +++ b/test/moves/torment.test.ts @@ -24,7 +24,7 @@ describe("Moves - Torment", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset([Moves.TORMENT, Moves.SPLASH]) .enemySpecies(Species.SHUCKLE) diff --git a/test/moves/toxic.test.ts b/test/moves/toxic.test.ts index f2b1f82fe02..f908d27ec7e 100644 --- a/test/moves/toxic.test.ts +++ b/test/moves/toxic.test.ts @@ -23,7 +23,7 @@ describe("Moves - Toxic", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("single").moveset(Moves.TOXIC).enemySpecies(Species.MAGIKARP).enemyMoveset(Moves.SPLASH); + game.override.battleStyle("single").moveset(Moves.TOXIC).enemySpecies(Species.MAGIKARP).enemyMoveset(Moves.SPLASH); }); it("should be guaranteed to hit if user is Poison-type", async () => { diff --git a/test/moves/toxic_spikes.test.ts b/test/moves/toxic_spikes.test.ts index d457ec5cb56..624db27bb92 100644 --- a/test/moves/toxic_spikes.test.ts +++ b/test/moves/toxic_spikes.test.ts @@ -28,7 +28,7 @@ describe("Moves - Toxic Spikes", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .startingWave(5) .enemySpecies(Species.RATTATA) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/moves/transform.test.ts b/test/moves/transform.test.ts index d37decf28f4..5bcb7c7ed4c 100644 --- a/test/moves/transform.test.ts +++ b/test/moves/transform.test.ts @@ -26,7 +26,7 @@ describe("Moves - Transform", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.MEW) .enemyLevel(200) .enemyAbility(Abilities.BEAST_BOOST) diff --git a/test/moves/trick_or_treat.test.ts b/test/moves/trick_or_treat.test.ts index 108028f3008..3b32e09f72d 100644 --- a/test/moves/trick_or_treat.test.ts +++ b/test/moves/trick_or_treat.test.ts @@ -25,7 +25,7 @@ describe("Moves - Trick Or Treat", () => { game.override .moveset([Moves.FORESTS_CURSE, Moves.TRICK_OR_TREAT]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/moves/triple_arrows.test.ts b/test/moves/triple_arrows.test.ts index eb434b25815..58ce8a9c528 100644 --- a/test/moves/triple_arrows.test.ts +++ b/test/moves/triple_arrows.test.ts @@ -32,7 +32,7 @@ describe("Moves - Triple Arrows", () => { game.override .ability(Abilities.BALL_FETCH) .moveset([Moves.TRIPLE_ARROWS]) - .battleType("single") + .battleStyle("single") .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.STURDY) .enemyMoveset(Moves.SPLASH); diff --git a/test/moves/u_turn.test.ts b/test/moves/u_turn.test.ts index f1d212f3f47..68bb7fe05c1 100644 --- a/test/moves/u_turn.test.ts +++ b/test/moves/u_turn.test.ts @@ -23,7 +23,7 @@ describe("Moves - U-turn", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .enemySpecies(Species.GENGAR) .startingLevel(90) .startingWave(97) diff --git a/test/moves/upper_hand.test.ts b/test/moves/upper_hand.test.ts index ecfd9f0735c..66359a94ccb 100644 --- a/test/moves/upper_hand.test.ts +++ b/test/moves/upper_hand.test.ts @@ -26,7 +26,7 @@ describe("Moves - Upper Hand", () => { game.override .moveset(Moves.UPPER_HAND) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/moves/whirlwind.test.ts b/test/moves/whirlwind.test.ts index d6124b6c766..b0ca1783f2f 100644 --- a/test/moves/whirlwind.test.ts +++ b/test/moves/whirlwind.test.ts @@ -10,6 +10,9 @@ import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { Status } from "#app/data/status-effect"; import { StatusEffect } from "#enums/status-effect"; +import { BattlerIndex } from "#app/battle"; +import { BattleType } from "#enums/battle-type"; +import { TrainerType } from "#enums/trainer-type"; describe("Moves - Whirlwind", () => { let phaserGame: Phaser.Game; @@ -28,8 +31,8 @@ describe("Moves - Whirlwind", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") - .moveset(Moves.SPLASH) + .battleStyle("single") + .moveset([Moves.SPLASH]) .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset([Moves.SPLASH, Moves.WHIRLWIND]) .enemySpecies(Species.PIDGEY); @@ -41,7 +44,8 @@ describe("Moves - Whirlwind", () => { { move: Moves.SKY_DROP, name: "Sky Drop" }, ])("should not hit a flying target: $name (=$move)", async ({ move }) => { game.override.moveset([move]); - await game.classicMode.startBattle([Species.STARAPTOR]); + // Must have a pokemon in the back so that the move misses instead of fails. + await game.classicMode.startBattle([Species.STARAPTOR, Species.MAGIKARP]); const staraptor = game.scene.getPlayerPokemon()!; @@ -156,4 +160,60 @@ describe("Moves - Whirlwind", () => { expect(lapras.isOnField()).toBe(true); expect(eevee.isOnField()).toBe(false); }); + + it("should not pull in the other trainer's pokemon in a partner trainer battle", async () => { + game.override + .battleType(BattleType.TRAINER) + .randomTrainer({ + trainerType: TrainerType.BREEDER, + alwaysDouble: true, + }) + .enemyMoveset([Moves.SPLASH, Moves.LUNAR_DANCE]) + .moveset([Moves.WHIRLWIND, Moves.SPLASH]); + await game.classicMode.startBattle([Species.MAGIKARP, Species.TOTODILE]); + + // expect the enemy to have at least 4 pokemon, necessary for this check to even work + expect(game.scene.getEnemyParty().length, "enemy must have exactly 4 pokemon").toBe(4); + + const user = game.scene.getPlayerPokemon()!; + + console.log(user.getMoveset(false)); + + game.move.select(Moves.SPLASH); + game.move.select(Moves.SPLASH); + await game.forceEnemyMove(Moves.MEMENTO); + await game.forceEnemyMove(Moves.SPLASH); + await game.toNextTurn(); + + // Get the enemy pokemon id so we can check if is the same after switch. + const enemy_id = game.scene.getEnemyPokemon()!.id; + + // Hit the enemy that fainted with whirlwind. + game.move.select(Moves.WHIRLWIND, 0, BattlerIndex.ENEMY); + game.move.select(Moves.SPLASH, 1); + + await game.forceEnemyMove(Moves.SPLASH); + await game.forceEnemyMove(Moves.SPLASH); + + await game.toNextTurn(); + + // Expect the enemy pokemon to not have switched out. + expect(game.scene.getEnemyPokemon()!.id).toBe(enemy_id); + }); + + it("should force a wild pokemon to flee", async () => { + game.override + .battleType(BattleType.WILD) + .moveset([Moves.WHIRLWIND, Moves.SPLASH]) + .enemyMoveset(Moves.SPLASH) + .ability(Abilities.BALL_FETCH); + await game.classicMode.startBattle([Species.MAGIKARP]); + + const user = game.scene.getPlayerPokemon()!; + + game.move.select(Moves.WHIRLWIND); + await game.phaseInterceptor.to("BerryPhase"); + + expect(user.getLastXMoves(1)[0].result).toBe(MoveResult.SUCCESS); + }); }); diff --git a/test/moves/wide_guard.test.ts b/test/moves/wide_guard.test.ts index c466f104f67..85ebad806d7 100644 --- a/test/moves/wide_guard.test.ts +++ b/test/moves/wide_guard.test.ts @@ -25,7 +25,7 @@ describe("Moves - Wide Guard", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("double"); + game.override.battleStyle("double"); game.override.moveset([Moves.WIDE_GUARD, Moves.SPLASH, Moves.SURF]); diff --git a/test/moves/will_o_wisp.test.ts b/test/moves/will_o_wisp.test.ts index 0d19fec954c..b4e4975896b 100644 --- a/test/moves/will_o_wisp.test.ts +++ b/test/moves/will_o_wisp.test.ts @@ -26,7 +26,7 @@ describe("Moves - Will-O-Wisp", () => { game.override .moveset([Moves.WILL_O_WISP, Moves.SPLASH]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/phases/form-change-phase.test.ts b/test/phases/form-change-phase.test.ts index deac21ed0dd..974c64d9e5a 100644 --- a/test/phases/form-change-phase.test.ts +++ b/test/phases/form-change-phase.test.ts @@ -27,7 +27,7 @@ describe("Form Change Phase", () => { game.override .moveset([Moves.SPLASH]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemySpecies(Species.MAGIKARP) .enemyAbility(Abilities.BALL_FETCH) diff --git a/test/phases/frenzy-move-reset.test.ts b/test/phases/frenzy-move-reset.test.ts index 2f628f8a8c4..6d3ec767722 100644 --- a/test/phases/frenzy-move-reset.test.ts +++ b/test/phases/frenzy-move-reset.test.ts @@ -25,7 +25,7 @@ describe("Frenzy Move Reset", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .battleType("single") + .battleStyle("single") .disableCrits() .starterSpecies(Species.MAGIKARP) .moveset(Moves.THRASH) diff --git a/test/phases/game-over-phase.test.ts b/test/phases/game-over-phase.test.ts index 438efc85167..40473a022cb 100644 --- a/test/phases/game-over-phase.test.ts +++ b/test/phases/game-over-phase.test.ts @@ -27,7 +27,7 @@ describe("Game Over Phase", () => { game.override .moveset([Moves.MEMENTO, Moves.ICE_BEAM, Moves.SPLASH]) .ability(Abilities.BALL_FETCH) - .battleType("single") + .battleStyle("single") .disableCrits() .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset(Moves.SPLASH) diff --git a/test/reload.test.ts b/test/reload.test.ts index f54885eccfb..c69c0f9f484 100644 --- a/test/reload.test.ts +++ b/test/reload.test.ts @@ -48,7 +48,7 @@ describe("Reload", () => { it("should not have RNG inconsistencies after a biome switch", async () => { game.override .startingWave(10) - .battleType("single") + .battleStyle("single") .startingLevel(100) // Avoid levelling up .disableTrainerWaves() .moveset([Moves.SPLASH]) @@ -81,7 +81,7 @@ describe("Reload", () => { game.override .startingWave(10) .startingBiome(Biome.ICE_CAVE) // Will lead to Snowy Forest with randomly generated weather - .battleType("single") + .battleStyle("single") .startingLevel(100) // Avoid levelling up .disableTrainerWaves() .moveset([Moves.SPLASH]) @@ -116,7 +116,7 @@ describe("Reload", () => { }, 20000); it("should not have RNG inconsistencies at a Daily run double battle", async () => { - game.override.battleType("double"); + game.override.battleStyle("double"); await game.dailyMode.startBattle(); const preReloadRngState = Phaser.Math.RND.state(); @@ -129,7 +129,7 @@ describe("Reload", () => { }, 20000); it("should not have RNG inconsistencies at a Daily run Gym Leader fight", async () => { - game.override.battleType("single").startingWave(40); + game.override.battleStyle("single").startingWave(40); await game.dailyMode.startBattle(); const preReloadRngState = Phaser.Math.RND.state(); @@ -142,7 +142,7 @@ describe("Reload", () => { }, 20000); it("should not have RNG inconsistencies at a Daily run regular trainer fight", async () => { - game.override.battleType("single").startingWave(45); + game.override.battleStyle("single").startingWave(45); await game.dailyMode.startBattle(); const preReloadRngState = Phaser.Math.RND.state(); @@ -155,7 +155,7 @@ describe("Reload", () => { }, 20000); it("should not have RNG inconsistencies at a Daily run wave 50 Boss fight", async () => { - game.override.battleType("single").startingWave(50); + game.override.battleStyle("single").startingWave(50); await game.runToFinalBossEncounter([Species.BULBASAUR], GameModes.DAILY); const preReloadRngState = Phaser.Math.RND.state(); diff --git a/test/system/game_data.test.ts b/test/system/game_data.test.ts index 93e615711c4..94e82949fe6 100644 --- a/test/system/game_data.test.ts +++ b/test/system/game_data.test.ts @@ -22,7 +22,7 @@ describe("System - Game Data", () => { game = new GameManager(phaserGame); game.override .moveset([Moves.SPLASH]) - .battleType("single") + .battleStyle("single") .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset(Moves.SPLASH); }); diff --git a/test/testUtils/gameManagerUtils.ts b/test/testUtils/gameManagerUtils.ts index 11636bd66b4..9e9c8f15f96 100644 --- a/test/testUtils/gameManagerUtils.ts +++ b/test/testUtils/gameManagerUtils.ts @@ -1,4 +1,5 @@ -import Battle, { BattleType } from "#app/battle"; +import Battle from "#app/battle"; +import { BattleType } from "#enums/battle-type"; import type BattleScene from "#app/battle-scene"; import { getDailyRunStarters } from "#app/data/daily-run"; import { Gender } from "#app/data/gender"; diff --git a/test/testUtils/helpers/overridesHelper.ts b/test/testUtils/helpers/overridesHelper.ts index 0ed1511255b..d570a1a4195 100644 --- a/test/testUtils/helpers/overridesHelper.ts +++ b/test/testUtils/helpers/overridesHelper.ts @@ -15,6 +15,8 @@ import type { WeatherType } from "#enums/weather-type"; import { expect, vi } from "vitest"; import { GameManagerHelper } from "./gameManagerHelper"; import { shiftCharCodes } from "#app/utils"; +import type { RandomTrainerOverride } from "#app/overrides"; +import type { BattleType } from "#enums/battle-type"; /** * Helper to handle overrides in tests @@ -28,7 +30,7 @@ export class OverridesHelper extends GameManagerHelper { /** * Override the starting biome * @warning Any event listeners that are attached to [NewArenaEvent](events\battle-scene.ts) may need to be handled down the line - * @param biome the biome to set + * @param biome - The biome to set */ public startingBiome(biome: Biome): this { this.game.scene.newArena(biome); @@ -37,8 +39,8 @@ export class OverridesHelper extends GameManagerHelper { } /** - * Override the starting wave (index) - * @param wave the wave (index) to set. Classic: `1`-`200` + * Override the starting wave index + * @param wave - The wave to set. Classic: `1`-`200` * @returns `this` */ public startingWave(wave: number): this { @@ -48,8 +50,8 @@ export class OverridesHelper extends GameManagerHelper { } /** - * Override the player (pokemon) starting level - * @param level the (pokemon) level to set + * Override the player pokemon's starting level + * @param level - The level to set * @returns `this` */ public startingLevel(level: Species | number): this { @@ -60,7 +62,7 @@ export class OverridesHelper extends GameManagerHelper { /** * Override the XP Multiplier - * @param value the XP multiplier to set + * @param value - The XP multiplier to set * @returns `this` */ public xpMultiplier(value: number): this { @@ -71,7 +73,7 @@ export class OverridesHelper extends GameManagerHelper { /** * Override the wave level cap - * @param cap the level cap value to set; 0 uses normal level caps and negative values + * @param cap - The level cap value to set; 0 uses normal level caps and negative values * disable it completely * @returns `this` */ @@ -90,8 +92,8 @@ export class OverridesHelper extends GameManagerHelper { } /** - * Override the player (pokemon) starting held items - * @param items the items to hold + * Override the player pokemon's starting held items + * @param items - The items to hold * @returns `this` */ public startingHeldItems(items: ModifierOverride[]): this { @@ -101,8 +103,8 @@ export class OverridesHelper extends GameManagerHelper { } /** - * Override the player (pokemon) {@linkcode Species | species} - * @param species the (pokemon) {@linkcode Species | species} to set + * Override the player pokemon's {@linkcode Species | species} + * @param species - The {@linkcode Species | species} to set * @returns `this` */ public starterSpecies(species: Species | number): this { @@ -112,7 +114,7 @@ export class OverridesHelper extends GameManagerHelper { } /** - * Override the player (pokemon) to be a random fusion + * Override the player pokemon to be a random fusion * @returns `this` */ public enableStarterFusion(): this { @@ -122,8 +124,8 @@ export class OverridesHelper extends GameManagerHelper { } /** - * Override the player (pokemon) fusion species - * @param species the fusion species to set + * Override the player pokemon's fusion species + * @param species - The fusion species to set * @returns `this` */ public starterFusionSpecies(species: Species | number): this { @@ -133,8 +135,8 @@ export class OverridesHelper extends GameManagerHelper { } /** - * Override the player (pokemons) forms - * @param forms the (pokemon) forms to set + * Override the player pokemon's forms + * @param forms - The forms to set * @returns `this` */ public starterForms(forms: Partial>): this { @@ -148,7 +150,7 @@ export class OverridesHelper extends GameManagerHelper { /** * Override the player's starting modifiers - * @param modifiers the modifiers to set + * @param modifiers - The modifiers to set * @returns `this` */ public startingModifier(modifiers: ModifierOverride[]): this { @@ -158,8 +160,8 @@ export class OverridesHelper extends GameManagerHelper { } /** - * Override the player (pokemon) {@linkcode Abilities | ability}. - * @param ability the (pokemon) {@linkcode Abilities | ability} to set + * Override the player pokemon's {@linkcode Abilities | ability}. + * @param ability - The {@linkcode Abilities | ability} to set * @returns `this` */ public ability(ability: Abilities): this { @@ -169,8 +171,8 @@ export class OverridesHelper extends GameManagerHelper { } /** - * Override the player (pokemon) **passive** {@linkcode Abilities | ability} - * @param passiveAbility the (pokemon) **passive** {@linkcode Abilities | ability} to set + * Override the player pokemon's **passive** {@linkcode Abilities | ability} + * @param passiveAbility - The **passive** {@linkcode Abilities | ability} to set * @returns `this` */ public passiveAbility(passiveAbility: Abilities): this { @@ -180,8 +182,8 @@ export class OverridesHelper extends GameManagerHelper { } /** - * Forces the status of the player (pokemon) **passive** {@linkcode Abilities | ability} - * @param hasPassiveAbility forces the passive to be active if `true`, inactive if `false` + * Forces the status of the player pokemon **passive** {@linkcode Abilities | ability} + * @param hasPassiveAbility - Forces the passive to be active if `true`, inactive if `false` * @returns `this` */ public hasPassiveAbility(hasPassiveAbility: boolean | null): this { @@ -194,8 +196,8 @@ export class OverridesHelper extends GameManagerHelper { return this; } /** - * Override the player (pokemon) {@linkcode Moves | moves}set - * @param moveset the {@linkcode Moves | moves}set to set + * Override the player pokemon's {@linkcode Moves | moves}set + * @param moveset - The {@linkcode Moves | moves}set to set * @returns `this` */ public moveset(moveset: Moves | Moves[]): this { @@ -209,8 +211,8 @@ export class OverridesHelper extends GameManagerHelper { } /** - * Override the player (pokemon) {@linkcode StatusEffect | status-effect} - * @param statusEffect the {@linkcode StatusEffect | status-effect} to set + * Override the player pokemon's {@linkcode StatusEffect | status-effect} + * @param statusEffect - The {@linkcode StatusEffect | status-effect} to set * @returns */ public statusEffect(statusEffect: StatusEffect): this { @@ -229,6 +231,19 @@ export class OverridesHelper extends GameManagerHelper { return this; } + /** + * Override the trainer chosen when a random trainer is selected. + * + * Does not force the battle to be a trainer battle. + * @see {@linkcode setBattleType} + * @returns `this` + */ + public randomTrainer(trainer: RandomTrainerOverride | null): this { + vi.spyOn(Overrides, "RANDOM_TRAINER_OVERRIDE", "get").mockReturnValue(trainer); + this.log("Partner battle is forced!"); + return this; + } + /** * Override each wave to not have critical hits * @returns `this` @@ -240,8 +255,8 @@ export class OverridesHelper extends GameManagerHelper { } /** - * Override the {@linkcode WeatherType | weather (type)} - * @param type {@linkcode WeatherType | weather type} to set + * Override the {@linkcode WeatherType | weather type} + * @param type - The {@linkcode WeatherType | weather type} to set * @returns `this` */ public weather(type: WeatherType): this { @@ -252,7 +267,7 @@ export class OverridesHelper extends GameManagerHelper { /** * Override the seed - * @param seed the seed to set + * @param seed - The seed to set * @returns `this` */ public seed(seed: string): this { @@ -264,20 +279,36 @@ export class OverridesHelper extends GameManagerHelper { } /** - * Override the battle type (e.g., single or double). - * @see {@linkcode Overrides.BATTLE_TYPE_OVERRIDE} - * @param battleType battle type to set + * Override the battle style (e.g., single or double). + * @see {@linkcode Overrides.BATTLE_STYLE_OVERRIDE} + * @param battleStyle - The battle style to set * @returns `this` */ - public battleType(battleType: BattleStyle | null): this { - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue(battleType); - this.log(battleType === null ? "Battle type override disabled!" : `Battle type set to ${battleType}!`); + public battleStyle(battleStyle: BattleStyle | null): this { + vi.spyOn(Overrides, "BATTLE_STYLE_OVERRIDE", "get").mockReturnValue(battleStyle); + this.log(battleStyle === null ? "Battle type override disabled!" : `Battle type set to ${battleStyle}!`); return this; } /** - * Override the enemy (pokemon) {@linkcode Species | species} - * @param species the (pokemon) {@linkcode Species | species} to set + * Override the battle type (e.g., WILD, or Trainer) for non-scripted battles. + * @see {@linkcode Overrides.BATTLE_TYPE_OVERRIDE} + * @param battleType - The battle type to set + * @returns `this` + */ + public battleType(battleType: Exclude): this { + vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue(battleType); + this.log( + battleType === null + ? "Battle type override disabled!" + : `Battle type set to ${battleType[battleType]} (=${battleType})!`, + ); + return this; + } + + /** + * Override the {@linkcode Species | species} of enemy pokemon + * @param species - The {@linkcode Species | species} to set * @returns `this` */ public enemySpecies(species: Species | number): this { @@ -287,7 +318,7 @@ export class OverridesHelper extends GameManagerHelper { } /** - * Override the enemy (pokemon) to be a random fusion + * Override the enemy pokemon to be a random fusion * @returns `this` */ public enableEnemyFusion(): this { @@ -297,8 +328,8 @@ export class OverridesHelper extends GameManagerHelper { } /** - * Override the enemy (pokemon) fusion species - * @param species the fusion species to set + * Override the enemy pokemon fusion species + * @param species - The fusion species to set * @returns `this` */ public enemyFusionSpecies(species: Species | number): this { @@ -308,8 +339,8 @@ export class OverridesHelper extends GameManagerHelper { } /** - * Override the enemy (pokemon) {@linkcode Abilities | ability} - * @param ability the (pokemon) {@linkcode Abilities | ability} to set + * Override the {@linkcode Abilities | ability} of enemy pokemon + * @param ability - The {@linkcode Abilities | ability} to set * @returns `this` */ public enemyAbility(ability: Abilities): this { @@ -319,8 +350,8 @@ export class OverridesHelper extends GameManagerHelper { } /** - * Override the enemy (pokemon) **passive** {@linkcode Abilities | ability} - * @param passiveAbility the (pokemon) **passive** {@linkcode Abilities | ability} to set + * Override the **passive** {@linkcode Abilities | ability} of enemy pokemon + * @param passiveAbility - The **passive** {@linkcode Abilities | ability} to set * @returns `this` */ public enemyPassiveAbility(passiveAbility: Abilities): this { @@ -330,8 +361,8 @@ export class OverridesHelper extends GameManagerHelper { } /** - * Forces the status of the enemy (pokemon) **passive** {@linkcode Abilities | ability} - * @param hasPassiveAbility forces the passive to be active if `true`, inactive if `false` + * Forces the status of the enemy pokemon **passive** {@linkcode Abilities | ability} + * @param hasPassiveAbility - Forces the passive to be active if `true`, inactive if `false` * @returns `this` */ public enemyHasPassiveAbility(hasPassiveAbility: boolean | null): this { @@ -345,8 +376,8 @@ export class OverridesHelper extends GameManagerHelper { } /** - * Override the enemy (pokemon) {@linkcode Moves | moves}set - * @param moveset the {@linkcode Moves | moves}set to set + * Override the {@linkcode Moves | move}set of enemy pokemon + * @param moveset - The {@linkcode Moves | move}set to set * @returns `this` */ public enemyMoveset(moveset: Moves | Moves[]): this { @@ -360,8 +391,8 @@ export class OverridesHelper extends GameManagerHelper { } /** - * Override the enemy (pokemon) level - * @param level the level to set + * Override the level of enemy pokemon + * @param level - The level to set * @returns `this` */ public enemyLevel(level: number): this { @@ -371,8 +402,8 @@ export class OverridesHelper extends GameManagerHelper { } /** - * Override the enemy (pokemon) {@linkcode StatusEffect | status-effect} - * @param statusEffect the {@linkcode StatusEffect | status-effect} to set + * Override the enemy {@linkcode StatusEffect | status-effect} for enemy pokemon + * @param statusEffect - The {@linkcode StatusEffect | status-effect} to set * @returns */ public enemyStatusEffect(statusEffect: StatusEffect): this { @@ -394,7 +425,7 @@ export class OverridesHelper extends GameManagerHelper { /** * Gives the player access to an Unlockable. - * @param unlockable The Unlockable(s) to enable. + * @param unlockable - The Unlockable(s) to enable. * @returns `this` */ public enableUnlockable(unlockable: Unlockables[]): this { @@ -405,7 +436,7 @@ export class OverridesHelper extends GameManagerHelper { /** * Override the items rolled at the end of a battle - * @param items the items to be rolled + * @param items - The items to be rolled * @returns `this` */ public itemRewards(items: ModifierOverride[]): this { @@ -463,8 +494,8 @@ export class OverridesHelper extends GameManagerHelper { } /** - * Override the enemy (Pokemon) to have the given amount of health segments - * @param healthSegments the number of segments to give + * Override the enemy Pokemon to have the given amount of health segments + * @param healthSegments - The number of segments to give * - `0` (default): the health segments will be handled like in the game based on wave, level and species * - `1`: the Pokemon will not be a boss * - `2`+: the Pokemon will be a boss with the given number of health segments @@ -493,7 +524,7 @@ export class OverridesHelper extends GameManagerHelper { /** * Override the encounter chance for a mystery encounter. - * @param percentage the encounter chance in % + * @param percentage - The encounter chance in % * @returns `this` */ public mysteryEncounterChance(percentage: number): this { diff --git a/test/ui/battle_info.test.ts b/test/ui/battle_info.test.ts index 4c6274d5efb..c4548adc49c 100644 --- a/test/ui/battle_info.test.ts +++ b/test/ui/battle_info.test.ts @@ -32,7 +32,7 @@ describe("UI - Battle Info", () => { game = new GameManager(phaserGame); game.override .moveset([Moves.GUILLOTINE, Moves.SPLASH]) - .battleType("single") + .battleStyle("single") .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset(Moves.SPLASH) .enemySpecies(Species.CATERPIE); diff --git a/test/ui/transfer-item.test.ts b/test/ui/transfer-item.test.ts index 476f0744436..cbbdc1d50ee 100644 --- a/test/ui/transfer-item.test.ts +++ b/test/ui/transfer-item.test.ts @@ -26,7 +26,7 @@ describe("UI - Transfer Items", () => { beforeEach(async () => { game = new GameManager(phaserGame); - game.override.battleType("single"); + game.override.battleStyle("single"); game.override.startingLevel(100); game.override.startingWave(1); game.override.startingHeldItems([ diff --git a/test/ui/type-hints.test.ts b/test/ui/type-hints.test.ts index fa7532fb674..fcb71186448 100644 --- a/test/ui/type-hints.test.ts +++ b/test/ui/type-hints.test.ts @@ -27,12 +27,12 @@ describe("UI - Type Hints", () => { beforeEach(async () => { game = new GameManager(phaserGame); game.settings.typeHints(true); //activate type hints - game.override.battleType("single").startingLevel(100).startingWave(1).enemyMoveset(Moves.SPLASH); + game.override.battleStyle("single").startingLevel(100).startingWave(1).enemyMoveset(Moves.SPLASH); }); it("check immunity color", async () => { game.override - .battleType("single") + .battleStyle("single") .startingLevel(100) .startingWave(1) .enemySpecies(Species.FLORGES) From a6e87c84382765a1922e675b2301eeb9b825e4a9 Mon Sep 17 00:00:00 2001 From: damocleas Date: Fri, 18 Apr 2025 22:25:05 -0400 Subject: [PATCH 11/18] [Bug] [Move] Supercell Slam now hits Minimized targets for double damage and can't miss (#5680) Added AlwaysHitMinimizeAttr and HitsTagForDoubleDamageAttr to Supercell Slam for Minimize --- src/data/moves/move.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/data/moves/move.ts b/src/data/moves/move.ts index 6e5e09839c1..7a2834c0322 100644 --- a/src/data/moves/move.ts +++ b/src/data/moves/move.ts @@ -11231,6 +11231,8 @@ export function initMoves() { new AttackMove(Moves.TEMPER_FLARE, PokemonType.FIRE, MoveCategory.PHYSICAL, 75, 100, 10, -1, 0, 9) .attr(MovePowerMultiplierAttr, (user, target, move) => user.getLastXMoves(2)[1]?.result === MoveResult.MISS || user.getLastXMoves(2)[1]?.result === MoveResult.FAIL ? 2 : 1), new AttackMove(Moves.SUPERCELL_SLAM, PokemonType.ELECTRIC, MoveCategory.PHYSICAL, 100, 95, 15, -1, 0, 9) + .attr(AlwaysHitMinimizeAttr) + .attr(HitsTagForDoubleDamageAttr, BattlerTagType.MINIMIZED) .attr(MissEffectAttr, crashDamageFunc) .attr(NoEffectAttr, crashDamageFunc) .recklessMove(), From 5854b21da0a191b19413325c1b3ff048e4582323 Mon Sep 17 00:00:00 2001 From: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Date: Sat, 19 Apr 2025 06:57:03 -0500 Subject: [PATCH 12/18] [Refactor] Remove circular imports part 1 (#5663) * Extract Mode enum out of UI and into its own file Reduces circular imports from 909 to 773 * Move around utility files Reduces cyclical dependencies from 773 to 765 * Remove starterColors and bypassLogin from battle-scene Reduces cyclical dependencies from 765 to 623 * Fix test runner error * Update import for bypassLogin in test * Update mocks for utils in tests * Fix broken tests * Update selectWithTera override * Update path for utils in ab-attr.ts * Update path for utils in ability-class.ts * Fix utils import path in healer.test.ts --- src/account.ts | 4 +- src/battle-scene.ts | 17 +- src/battle.ts | 2 +- src/data/abilities/ab-attrs/ab-attr.ts | 4 +- src/data/abilities/ability-class.ts | 2 +- src/data/abilities/ability.ts | 2 +- src/data/arena-tag.ts | 2 +- src/data/balance/biomes.ts | 2 +- src/data/balance/egg-moves.ts | 2 +- src/data/balance/pokemon-evolutions.ts | 6 +- src/data/battle-anims.ts | 4 +- src/data/battler-tags.ts | 4 +- src/data/berry.ts | 2 +- src/data/challenge.ts | 2 +- src/data/custom-pokemon-data.ts | 2 +- src/data/daily-run.ts | 2 +- src/data/egg.ts | 2 +- src/data/moves/move.ts | 2 +- .../encounters/a-trainers-test-encounter.ts | 2 +- .../encounters/absolute-avarice-encounter.ts | 2 +- .../encounters/berries-abound-encounter.ts | 2 +- .../encounters/bug-type-superfan-encounter.ts | 2 +- .../encounters/clowning-around-encounter.ts | 12 +- .../encounters/dark-deal-encounter.ts | 2 +- .../encounters/delibirdy-encounter.ts | 2 +- .../department-store-sale-encounter.ts | 2 +- .../encounters/fiery-fallout-encounter.ts | 2 +- .../encounters/fight-or-flight-encounter.ts | 2 +- .../global-trade-system-encounter.ts | 9 +- .../mysterious-challengers-encounter.ts | 2 +- .../encounters/mysterious-chest-encounter.ts | 2 +- .../encounters/safari-zone-encounter.ts | 2 +- .../shady-vitamin-dealer-encounter.ts | 2 +- .../teleporting-hijinks-encounter.ts | 2 +- .../the-expert-pokemon-breeder-encounter.ts | 2 +- .../the-pokemon-salesman-encounter.ts | 2 +- .../encounters/training-session-encounter.ts | 2 +- .../encounters/trash-to-treasure-encounter.ts | 2 +- .../encounters/uncommon-breed-encounter.ts | 2 +- .../encounters/weird-dream-encounter.ts | 2 +- .../mystery-encounter-option.ts | 2 +- .../mystery-encounter-requirements.ts | 2 +- .../mystery-encounter-save-data.ts | 2 +- .../mystery-encounters/mystery-encounter.ts | 4 +- .../can-learn-move-requirement.ts | 2 +- .../utils/encounter-dialogue-utils.ts | 2 +- .../utils/encounter-phase-utils.ts | 18 +- .../utils/encounter-pokemon-utils.ts | 20 +-- .../encounter-transformation-sequence.ts | 2 +- src/data/nature.ts | 2 +- src/data/pokeball.ts | 2 +- src/data/pokemon-forms.ts | 2 +- src/data/pokemon-species.ts | 2 +- src/data/status-effect.ts | 2 +- src/data/trainer-names.ts | 2 +- src/data/trainers/TrainerPartyTemplate.ts | 2 +- src/data/trainers/trainer-config.ts | 2 +- src/data/weather.ts | 2 +- src/enums/ui-mode.ts | 47 +++++ src/field/anims.ts | 2 +- src/field/arena.ts | 2 +- src/field/damage-number-handler.ts | 2 +- src/field/mystery-encounter-intro.ts | 2 +- src/field/pokemon-sprite-sparkle-handler.ts | 2 +- src/field/pokemon.ts | 8 +- src/field/trainer.ts | 2 +- src/game-mode.ts | 2 +- src/global-vars/bypass-login.ts | 1 + src/global-vars/starter-colors.ts | 4 + src/inputs-controller.ts | 12 +- src/loading-scene.ts | 2 +- src/modifier/modifier-type.ts | 2 +- src/modifier/modifier.ts | 2 +- src/phases/attempt-capture-phase.ts | 31 ++-- src/phases/attempt-run-phase.ts | 2 +- src/phases/berry-phase.ts | 2 +- src/phases/check-switch-phase.ts | 8 +- src/phases/command-phase.ts | 70 ++++---- src/phases/damage-anim-phase.ts | 2 +- src/phases/egg-hatch-phase.ts | 6 +- src/phases/egg-lapse-phase.ts | 4 +- src/phases/egg-summary-phase.ts | 6 +- src/phases/encounter-phase.ts | 6 +- src/phases/end-evolution-phase.ts | 4 +- src/phases/evolution-phase.ts | 8 +- src/phases/exp-phase.ts | 2 +- src/phases/faint-phase.ts | 2 +- src/phases/form-change-phase.ts | 8 +- src/phases/game-over-modifier-reward-phase.ts | 4 +- src/phases/game-over-phase.ts | 6 +- src/phases/learn-move-phase.ts | 14 +- src/phases/level-cap-phase.ts | 4 +- src/phases/level-up-phase.ts | 4 +- src/phases/login-phase.ts | 17 +- src/phases/money-reward-phase.ts | 2 +- src/phases/move-charge-phase.ts | 2 +- src/phases/move-effect-phase.ts | 4 +- src/phases/move-phase.ts | 2 +- src/phases/mystery-encounter-phases.ts | 12 +- src/phases/obtain-status-effect-phase.ts | 2 +- src/phases/party-heal-phase.ts | 2 +- src/phases/pokemon-anim-phase.ts | 2 +- src/phases/pokemon-heal-phase.ts | 2 +- src/phases/post-turn-status-effect-phase.ts | 2 +- src/phases/reload-session-phase.ts | 6 +- src/phases/revival-blessing-phase.ts | 8 +- src/phases/ribbon-modifier-reward-phase.ts | 4 +- src/phases/scan-ivs-phase.ts | 8 +- src/phases/select-biome-phase.ts | 8 +- src/phases/select-challenge-phase.ts | 4 +- src/phases/select-gender-phase.ts | 6 +- src/phases/select-modifier-phase.ts | 38 ++-- src/phases/select-starter-phase.ts | 8 +- src/phases/select-target-phase.ts | 6 +- src/phases/show-party-exp-bar-phase.ts | 2 +- src/phases/stat-stage-change-phase.ts | 2 +- src/phases/switch-phase.ts | 6 +- src/phases/title-phase.ts | 20 +-- src/phases/trainer-victory-phase.ts | 2 +- src/phases/turn-start-phase.ts | 2 +- src/phases/unavailable-phase.ts | 4 +- src/phases/unlock-phase.ts | 4 +- src/phases/weather-effect-phase.ts | 2 +- src/pipelines/field-sprite.ts | 2 +- src/pipelines/sprite.ts | 2 +- src/plugins/api/api-base.ts | 2 +- src/plugins/api/pokerogue-account-api.ts | 2 +- src/plugins/i18n.ts | 2 +- src/sprites/variant.ts | 2 +- src/starter-colors.ts | 4 + src/starting-wave.ts | 3 + src/system/achv.ts | 2 +- src/system/game-data.ts | 10 +- src/system/game-speed.ts | 2 +- src/system/settings/settings-gamepad.ts | 8 +- src/system/settings/settings-keyboard.ts | 4 +- src/system/settings/settings.ts | 6 +- .../version_migration/versions/v1_0_4.ts | 2 +- .../version_migration/versions/v1_7_0.ts | 2 +- src/timed-event-manager.ts | 4 +- src/tutorial.ts | 6 +- src/ui-inputs.ts | 24 +-- src/ui/abstact-option-select-ui-handler.ts | 12 +- src/ui/achvs-ui-handler.ts | 4 +- src/ui/admin-ui-handler.ts | 20 +-- src/ui/arena-flyout.ts | 2 +- src/ui/autocomplete-ui-handler.ts | 4 +- src/ui/awaitable-ui-handler.ts | 4 +- src/ui/ball-ui-handler.ts | 10 +- src/ui/base-stats-overlay.ts | 2 +- src/ui/battle-flyout.ts | 2 +- src/ui/battle-info.ts | 6 +- src/ui/battle-message-ui-handler.ts | 4 +- src/ui/bgm-bar.ts | 2 +- src/ui/candy-bar.ts | 4 +- src/ui/challenges-select-ui-handler.ts | 6 +- src/ui/char-sprite.ts | 2 +- src/ui/command-ui-handler.ts | 12 +- src/ui/confirm-ui-handler.ts | 4 +- src/ui/daily-run-scoreboard.ts | 2 +- src/ui/egg-gacha-ui-handler.ts | 6 +- src/ui/egg-hatch-scene-handler.ts | 4 +- src/ui/egg-list-ui-handler.ts | 4 +- src/ui/egg-summary-ui-handler.ts | 4 +- src/ui/evolution-scene-handler.ts | 4 +- src/ui/fight-ui-handler.ts | 19 +- src/ui/filter-text.ts | 4 +- src/ui/form-modal-ui-handler.ts | 6 +- src/ui/game-stats-ui-handler.ts | 6 +- src/ui/loading-modal-ui-handler.ts | 4 +- src/ui/login-form-ui-handler.ts | 16 +- src/ui/menu-ui-handler.ts | 46 ++--- src/ui/message-ui-handler.ts | 6 +- src/ui/modal-ui-handler.ts | 4 +- src/ui/modifier-select-ui-handler.ts | 6 +- src/ui/move-info-overlay.ts | 2 +- src/ui/mystery-encounter-ui-handler.ts | 10 +- src/ui/party-ui-handler.ts | 32 ++-- src/ui/pokedex-info-overlay.ts | 2 +- src/ui/pokedex-mon-container.ts | 2 +- src/ui/pokedex-page-ui-handler.ts | 84 ++++----- src/ui/pokedex-scan-ui-handler.ts | 12 +- src/ui/pokedex-ui-handler.ts | 18 +- src/ui/pokemon-hatch-info-container.ts | 4 +- src/ui/pokemon-icon-anim-handler.ts | 2 +- src/ui/pokemon-info-container.ts | 2 +- src/ui/registration-form-ui-handler.ts | 6 +- src/ui/run-history-ui-handler.ts | 8 +- src/ui/run-info-ui-handler.ts | 6 +- src/ui/save-slot-select-ui-handler.ts | 12 +- src/ui/saving-icon-handler.ts | 2 +- src/ui/session-reload-modal-ui-handler.ts | 4 +- .../settings/abstract-binding-ui-handler.ts | 4 +- .../abstract-control-settings-ui-handler.ts | 4 +- .../settings/abstract-settings-ui-handler.ts | 6 +- src/ui/settings/gamepad-binding-ui-handler.ts | 4 +- .../settings/keyboard-binding-ui-handler.ts | 4 +- src/ui/settings/navigationMenu.ts | 18 +- src/ui/settings/option-select-ui-handler.ts | 4 +- src/ui/settings/settings-audio-ui-handler.ts | 4 +- .../settings/settings-display-ui-handler.ts | 4 +- .../settings/settings-gamepad-ui-handler.ts | 6 +- .../settings/settings-keyboard-ui-handler.ts | 10 +- src/ui/settings/settings-ui-handler.ts | 4 +- src/ui/starter-select-ui-handler.ts | 78 ++++----- src/ui/summary-ui-handler.ts | 14 +- src/ui/target-select-ui-handler.ts | 6 +- src/ui/test-dialogue-ui-handler.ts | 12 +- src/ui/time-of-day-widget.ts | 2 +- src/ui/title-ui-handler.ts | 6 +- src/ui/ui-handler.ts | 4 +- src/ui/ui.ts | 163 +++++++----------- src/ui/unavailable-modal-ui-handler.ts | 7 +- src/{utils.ts => utils/common.ts} | 37 ---- src/utils/cookies.ts | 36 ++++ src/utils/utility-vars.ts | 1 + test/abilities/ability_timing.test.ts | 6 +- test/abilities/analytic.test.ts | 2 +- test/abilities/disguise.test.ts | 2 +- test/abilities/healer.test.ts | 2 +- test/abilities/heatproof.test.ts | 2 +- test/abilities/intimidate.test.ts | 10 +- test/abilities/parental_bond.test.ts | 2 +- test/abilities/shield_dust.test.ts | 2 +- test/abilities/stakeout.test.ts | 2 +- test/abilities/wimp_out.test.ts | 2 +- test/account.test.ts | 10 +- test/achievements/achievement.test.ts | 2 +- test/battle/battle.test.ts | 38 ++-- test/battle/special_battle.test.ts | 20 +-- test/boss-pokemon.test.ts | 2 +- test/daily_mode.test.ts | 6 +- test/eggs/egg.test.ts | 2 +- test/enemy_command.test.ts | 2 +- test/escape-calculations.test.ts | 2 +- test/evolution.test.ts | 2 +- test/game-mode.test.ts | 2 +- test/items/dire_hit.test.ts | 4 +- .../double_battle_chance_booster.test.ts | 4 +- test/items/eviolite.test.ts | 2 +- test/items/exp_booster.test.ts | 2 +- test/items/leek.test.ts | 2 +- test/items/light_ball.test.ts | 2 +- test/items/lock_capsule.test.ts | 4 +- test/items/metal_powder.test.ts | 2 +- test/items/quick_powder.test.ts | 2 +- test/items/temp_stat_stage_booster.test.ts | 4 +- test/items/thick_club.test.ts | 2 +- test/moves/aurora_veil.test.ts | 2 +- test/moves/belly_drum.test.ts | 2 +- test/moves/fillet_away.test.ts | 2 +- test/moves/light_screen.test.ts | 2 +- test/moves/multi_target.test.ts | 2 +- test/moves/pledge_moves.test.ts | 2 +- test/moves/reflect.test.ts | 2 +- test/moves/revival_blessing.test.ts | 2 +- test/moves/substitute.test.ts | 4 +- .../mystery-encounter/encounter-test-utils.ts | 30 ++-- .../a-trainers-test-encounter.test.ts | 6 +- .../berries-abound-encounter.test.ts | 6 +- .../bug-type-superfan-encounter.test.ts | 14 +- .../clowning-around-encounter.test.ts | 8 +- .../dancing-lessons-encounter.test.ts | 4 +- .../department-store-sale-encounter.test.ts | 10 +- .../encounters/field-trip-encounter.test.ts | 14 +- .../fight-or-flight-encounter.test.ts | 6 +- .../fun-and-games-encounter.test.ts | 20 +-- .../global-trade-system-encounter.test.ts | 6 +- .../mysterious-challengers-encounter.test.ts | 8 +- .../teleporting-hijinks-encounter.test.ts | 4 +- .../the-strong-stuff-encounter.test.ts | 4 +- .../the-winstrate-challenge-encounter.test.ts | 8 +- .../trash-to-treasure-encounter.test.ts | 6 +- .../encounters/weird-dream-encounter.test.ts | 6 +- test/phases/learn-move-phase.test.ts | 12 +- test/phases/mystery-encounter-phase.test.ts | 10 +- test/phases/phases.test.ts | 8 +- test/phases/select-modifier-phase.test.ts | 24 +-- .../plugins/api/pokerogue-account-api.test.ts | 17 +- test/reload.test.ts | 4 +- test/settingMenu/rebinding_setting.test.ts | 2 +- test/system/game_data.test.ts | 6 +- test/testUtils/gameManager.ts | 46 ++--- test/testUtils/gameWrapper.ts | 9 +- test/testUtils/helpers/challengeModeHelper.ts | 12 +- test/testUtils/helpers/classicModeHelper.ts | 12 +- test/testUtils/helpers/dailyModeHelper.ts | 14 +- test/testUtils/helpers/moveHelper.ts | 20 +-- test/testUtils/helpers/overridesHelper.ts | 2 +- test/testUtils/helpers/reloadHelper.ts | 10 +- test/testUtils/phaseInterceptor.ts | 13 +- test/testUtils/testFileInitialization.ts | 4 +- test/ui/starter-select.test.ts | 110 ++++++------ test/ui/transfer-item.test.ts | 10 +- test/ui/type-hints.test.ts | 10 +- {src => test}/utils.test.ts | 2 +- 296 files changed, 1186 insertions(+), 1147 deletions(-) create mode 100644 src/enums/ui-mode.ts create mode 100644 src/global-vars/bypass-login.ts create mode 100644 src/global-vars/starter-colors.ts create mode 100644 src/starter-colors.ts create mode 100644 src/starting-wave.ts rename src/{utils.ts => utils/common.ts} (92%) create mode 100644 src/utils/cookies.ts create mode 100644 src/utils/utility-vars.ts rename {src => test}/utils.test.ts (95%) diff --git a/src/account.ts b/src/account.ts index 7baa7d10a1a..3416fa6ed5e 100644 --- a/src/account.ts +++ b/src/account.ts @@ -1,7 +1,7 @@ import { pokerogueApi } from "#app/plugins/api/pokerogue-api"; import type { UserInfo } from "#app/@types/UserInfo"; -import { bypassLogin } from "#app/battle-scene"; -import { randomString } from "#app/utils"; +import { bypassLogin } from "./global-vars/bypass-login"; +import { randomString } from "#app/utils/common"; export let loggedInUser: UserInfo | null = null; // This is a random string that is used to identify the client session - unique per session (tab or window) so that the game will only save on the one that the server is expecting diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 0fe4c7f7e4f..ecaffc5ed07 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -18,7 +18,7 @@ import { isNullOrUndefined, BooleanHolder, type Constructor, -} from "#app/utils"; +} from "#app/utils/common"; import type { Modifier, ModifierPredicate, TurnHeldItemTransferModifier } from "./modifier/modifier"; import { ConsumableModifier, @@ -185,8 +185,8 @@ import { HideAbilityPhase } from "#app/phases/hide-ability-phase"; import { expSpriteKeys } from "./sprites/sprite-keys"; import { hasExpSprite } from "./sprites/sprite-utils"; import { timedEventManager } from "./global-event-manager"; - -export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1"; +import { starterColors } from "./global-vars/starter-colors"; +import { startingWave } from "./starting-wave"; const DEBUG_RNG = false; @@ -194,13 +194,6 @@ const OPP_IVS_OVERRIDE_VALIDATED: number[] = ( Array.isArray(Overrides.OPP_IVS_OVERRIDE) ? Overrides.OPP_IVS_OVERRIDE : new Array(6).fill(Overrides.OPP_IVS_OVERRIDE) ).map(iv => (Number.isNaN(iv) || iv === null || iv > 31 ? -1 : iv)); -export const startingWave = Overrides.STARTING_WAVE_OVERRIDE || 1; - -export let starterColors: StarterColors; -interface StarterColors { - [key: string]: [string, string]; -} - export interface PokeballCounts { [pb: string]: number; } @@ -810,11 +803,11 @@ export default class BattleScene extends SceneBase { } async initStarterColors(): Promise { - if (starterColors) { + if (Object.keys(starterColors).length > 0) { + // already initialized return; } const sc = await this.cachedFetch("./starter-colors.json").then(res => res.json()); - starterColors = {}; for (const key of Object.keys(sc)) { starterColors[key] = sc[key]; } diff --git a/src/battle.ts b/src/battle.ts index 3e2f293065a..6630d53bd67 100644 --- a/src/battle.ts +++ b/src/battle.ts @@ -8,7 +8,7 @@ import { shiftCharCodes, randSeedItem, randInt, -} from "#app/utils"; +} from "#app/utils/common"; import Trainer, { TrainerVariant } from "./field/trainer"; import type { GameMode } from "./game-mode"; import { MoneyMultiplierModifier, PokemonHeldItemModifier } from "./modifier/modifier"; diff --git a/src/data/abilities/ab-attrs/ab-attr.ts b/src/data/abilities/ab-attrs/ab-attr.ts index c8ead691b25..a653c3f372d 100644 --- a/src/data/abilities/ab-attrs/ab-attr.ts +++ b/src/data/abilities/ab-attrs/ab-attr.ts @@ -1,6 +1,6 @@ import type { AbAttrCondition } from "#app/@types/ability-types"; import type Pokemon from "#app/field/pokemon"; -import type * as Utils from "#app/utils"; +import type { BooleanHolder } from "#app/utils/common"; export abstract class AbAttr { public showAbility: boolean; @@ -22,7 +22,7 @@ export abstract class AbAttr { _pokemon: Pokemon, _passive: boolean, _simulated: boolean, - _cancelled: Utils.BooleanHolder | null, + _cancelled: BooleanHolder | null, _args: any[], ): void {} diff --git a/src/data/abilities/ability-class.ts b/src/data/abilities/ability-class.ts index b4cda2482d4..387c5fb328b 100644 --- a/src/data/abilities/ability-class.ts +++ b/src/data/abilities/ability-class.ts @@ -3,7 +3,7 @@ import type { AbAttrCondition } from "#app/@types/ability-types"; import type { AbAttr } from "#app/data/abilities/ab-attrs/ab-attr"; import i18next from "i18next"; import type { Localizable } from "#app/interfaces/locales"; -import type { Constructor } from "#app/utils"; +import type { Constructor } from "#app/utils/common"; export class Ability implements Localizable { public id: Abilities; diff --git a/src/data/abilities/ability.ts b/src/data/abilities/ability.ts index a3bd9b728f5..55a1a4eb902 100644 --- a/src/data/abilities/ability.ts +++ b/src/data/abilities/ability.ts @@ -1,5 +1,5 @@ import { HitResult, MoveResult, PlayerPokemon } from "#app/field/pokemon"; -import { BooleanHolder, NumberHolder, toDmgValue, isNullOrUndefined, randSeedItem, randSeedInt, type Constructor } from "#app/utils"; +import { BooleanHolder, NumberHolder, toDmgValue, isNullOrUndefined, randSeedItem, randSeedInt, type Constructor } from "#app/utils/common"; import { getPokemonNameWithAffix } from "#app/messages"; import { BattlerTagLapseType, GroundedTag } from "#app/data/battler-tags"; import { getNonVolatileStatusEffects, getStatusEffectDescriptor, getStatusEffectHealText } from "#app/data/status-effect"; diff --git a/src/data/arena-tag.ts b/src/data/arena-tag.ts index 1fe1eca4bba..2ef98723cea 100644 --- a/src/data/arena-tag.ts +++ b/src/data/arena-tag.ts @@ -1,7 +1,7 @@ import { globalScene } from "#app/global-scene"; import type { Arena } from "#app/field/arena"; import { PokemonType } from "#enums/pokemon-type"; -import { BooleanHolder, NumberHolder, toDmgValue } from "#app/utils"; +import { BooleanHolder, NumberHolder, toDmgValue } from "#app/utils/common"; import { allMoves } from "#app/data/moves/move"; import { MoveTarget } from "#enums/MoveTarget"; import { MoveCategory } from "#enums/MoveCategory"; diff --git a/src/data/balance/biomes.ts b/src/data/balance/biomes.ts index c722291c66d..968164c7902 100644 --- a/src/data/balance/biomes.ts +++ b/src/data/balance/biomes.ts @@ -1,5 +1,5 @@ import { PokemonType } from "#enums/pokemon-type"; -import { randSeedInt, getEnumValues } from "#app/utils"; +import { randSeedInt, getEnumValues } from "#app/utils/common"; import type { SpeciesFormEvolution } from "#app/data/balance/pokemon-evolutions"; import { pokemonEvolutions } from "#app/data/balance/pokemon-evolutions"; import i18next from "i18next"; diff --git a/src/data/balance/egg-moves.ts b/src/data/balance/egg-moves.ts index 74f6a2c1afb..b0e8d5160fa 100644 --- a/src/data/balance/egg-moves.ts +++ b/src/data/balance/egg-moves.ts @@ -1,5 +1,5 @@ import { allMoves } from "#app/data/moves/move"; -import { getEnumKeys, getEnumValues } from "#app/utils"; +import { getEnumKeys, getEnumValues } from "#app/utils/common"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; diff --git a/src/data/balance/pokemon-evolutions.ts b/src/data/balance/pokemon-evolutions.ts index 17f71f3c3c9..64409c3c989 100644 --- a/src/data/balance/pokemon-evolutions.ts +++ b/src/data/balance/pokemon-evolutions.ts @@ -3,7 +3,7 @@ import { Gender } from "#app/data/gender"; import { PokeballType } from "#enums/pokeball"; import type Pokemon from "#app/field/pokemon"; import { PokemonType } from "#enums/pokemon-type"; -import { randSeedInt } from "#app/utils"; +import { randSeedInt } from "#app/utils/common"; import { WeatherType } from "#enums/weather-type"; import { Nature } from "#enums/nature"; import { Biome } from "#enums/biome"; @@ -14,6 +14,7 @@ import { DamageMoneyRewardModifier, ExtraModifierModifier, MoneyMultiplierModifi import { SpeciesFormKey } from "#enums/species-form-key"; import { speciesStarterCosts } from "./starters"; import i18next from "i18next"; +import { initI18n } from "#app/plugins/i18n"; export enum SpeciesWildEvolutionDelay { @@ -95,6 +96,9 @@ export class SpeciesFormEvolution { public description = ""; constructor(speciesId: Species, preFormKey: string | null, evoFormKey: string | null, level: number, item: EvolutionItem | null, condition: SpeciesEvolutionCondition | null, wildDelay?: SpeciesWildEvolutionDelay) { + if (!i18next.isInitialized) { + initI18n(); + } this.speciesId = speciesId; this.preFormKey = preFormKey; this.evoFormKey = evoFormKey; diff --git a/src/data/battle-anims.ts b/src/data/battle-anims.ts index 511c80bee72..0999e9db6ff 100644 --- a/src/data/battle-anims.ts +++ b/src/data/battle-anims.ts @@ -2,11 +2,11 @@ import { globalScene } from "#app/global-scene"; import { AttackMove, BeakBlastHeaderAttr, DelayedAttackAttr, SelfStatusMove, allMoves } from "./moves/move"; import { MoveFlags } from "#enums/MoveFlags"; import type Pokemon from "../field/pokemon"; -import { type nil, getFrameMs, getEnumKeys, getEnumValues, animationFileName } from "../utils"; +import { type nil, getFrameMs, getEnumKeys, getEnumValues, animationFileName } from "../utils/common"; import type { BattlerIndex } from "../battle"; import { Moves } from "#enums/moves"; import { SubstituteTag } from "./battler-tags"; -import { isNullOrUndefined } from "../utils"; +import { isNullOrUndefined } from "../utils/common"; import Phaser from "phaser"; import { EncounterAnim } from "#enums/encounter-anims"; diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index 9b72f3083fd..3b2421897c9 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -33,7 +33,7 @@ import { PokemonHealPhase } from "#app/phases/pokemon-heal-phase"; import type { StatStageChangeCallback } from "#app/phases/stat-stage-change-phase"; import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase"; import i18next from "#app/plugins/i18n"; -import { BooleanHolder, getFrameMs, NumberHolder, toDmgValue } from "#app/utils"; +import { BooleanHolder, getFrameMs, NumberHolder, toDmgValue } from "#app/utils/common"; import { Abilities } from "#enums/abilities"; import { BattlerTagType } from "#enums/battler-tag-type"; import { Moves } from "#enums/moves"; @@ -42,7 +42,7 @@ import { Species } from "#enums/species"; import { EFFECTIVE_STATS, getStatKey, Stat, type BattleStat, type EffectiveStat } from "#enums/stat"; import { StatusEffect } from "#enums/status-effect"; import { WeatherType } from "#enums/weather-type"; -import { isNullOrUndefined } from "#app/utils"; +import { isNullOrUndefined } from "#app/utils/common"; export enum BattlerTagLapseType { FAINT, diff --git a/src/data/berry.ts b/src/data/berry.ts index e118b45711c..22950c0beca 100644 --- a/src/data/berry.ts +++ b/src/data/berry.ts @@ -2,7 +2,7 @@ import { getPokemonNameWithAffix } from "../messages"; import type Pokemon from "../field/pokemon"; import { HitResult } from "../field/pokemon"; import { getStatusEffectHealText } from "./status-effect"; -import { NumberHolder, toDmgValue, randSeedInt } from "#app/utils"; +import { NumberHolder, toDmgValue, randSeedInt } from "#app/utils/common"; import { DoubleBerryEffectAbAttr, PostItemLostAbAttr, diff --git a/src/data/challenge.ts b/src/data/challenge.ts index cc5783ad1fb..f786152ca3d 100644 --- a/src/data/challenge.ts +++ b/src/data/challenge.ts @@ -1,4 +1,4 @@ -import { BooleanHolder, type NumberHolder, randSeedItem, deepCopy } from "#app/utils"; +import { BooleanHolder, type NumberHolder, randSeedItem, deepCopy } from "#app/utils/common"; import i18next from "i18next"; import type { DexAttrProps, GameData } from "#app/system/game-data"; import { defaultStarterSpecies } from "#app/system/game-data"; diff --git a/src/data/custom-pokemon-data.ts b/src/data/custom-pokemon-data.ts index d95d9f77b83..704835e9dbc 100644 --- a/src/data/custom-pokemon-data.ts +++ b/src/data/custom-pokemon-data.ts @@ -1,6 +1,6 @@ import type { Abilities } from "#enums/abilities"; import type { PokemonType } from "#enums/pokemon-type"; -import { isNullOrUndefined } from "#app/utils"; +import { isNullOrUndefined } from "#app/utils/common"; import type { Nature } from "#enums/nature"; /** diff --git a/src/data/daily-run.ts b/src/data/daily-run.ts index 3438510d613..8a1632ce160 100644 --- a/src/data/daily-run.ts +++ b/src/data/daily-run.ts @@ -3,7 +3,7 @@ import type { Species } from "#enums/species"; import { globalScene } from "#app/global-scene"; import { PlayerPokemon } from "#app/field/pokemon"; import type { Starter } from "#app/ui/starter-select-ui-handler"; -import { randSeedGauss, randSeedInt, randSeedItem, getEnumValues } from "#app/utils"; +import { randSeedGauss, randSeedInt, randSeedItem, getEnumValues } from "#app/utils/common"; import type { PokemonSpeciesForm } from "#app/data/pokemon-species"; import PokemonSpecies, { getPokemonSpecies, getPokemonSpeciesForm } from "#app/data/pokemon-species"; import { speciesStarterCosts } from "#app/data/balance/starters"; diff --git a/src/data/egg.ts b/src/data/egg.ts index 13ab0bec479..55a253e843f 100644 --- a/src/data/egg.ts +++ b/src/data/egg.ts @@ -4,7 +4,7 @@ import type PokemonSpecies from "#app/data/pokemon-species"; import { getPokemonSpecies } from "#app/data/pokemon-species"; import { speciesStarterCosts } from "#app/data/balance/starters"; import { VariantTier } from "#enums/variant-tier"; -import { randInt, randomString, randSeedInt, getIvsFromId } from "#app/utils"; +import { randInt, randomString, randSeedInt, getIvsFromId } from "#app/utils/common"; import Overrides from "#app/overrides"; import { pokemonPrevolutions } from "#app/data/balance/pokemon-evolutions"; import type { PlayerPokemon } from "#app/field/pokemon"; diff --git a/src/data/moves/move.ts b/src/data/moves/move.ts index 7a2834c0322..513ab3f6a74 100644 --- a/src/data/moves/move.ts +++ b/src/data/moves/move.ts @@ -29,7 +29,7 @@ import { } from "../status-effect"; import { getTypeDamageMultiplier } from "../type"; import { PokemonType } from "#enums/pokemon-type"; -import { BooleanHolder, NumberHolder, isNullOrUndefined, toDmgValue, randSeedItem, randSeedInt, getEnumValues, toReadableString, type Constructor } from "#app/utils"; +import { BooleanHolder, NumberHolder, isNullOrUndefined, toDmgValue, randSeedItem, randSeedInt, getEnumValues, toReadableString, type Constructor } from "#app/utils/common"; import { WeatherType } from "#enums/weather-type"; import type { ArenaTrapTag } from "../arena-tag"; import { ArenaTagSide, WeakenMoveTypeTag } from "../arena-tag"; diff --git a/src/data/mystery-encounters/encounters/a-trainers-test-encounter.ts b/src/data/mystery-encounters/encounters/a-trainers-test-encounter.ts index a49157f8e88..d8af7b6aac8 100644 --- a/src/data/mystery-encounters/encounters/a-trainers-test-encounter.ts +++ b/src/data/mystery-encounters/encounters/a-trainers-test-encounter.ts @@ -14,7 +14,7 @@ import { MysteryEncounterTier } from "#enums/mystery-encounter-tier"; import { TrainerType } from "#enums/trainer-type"; import { Species } from "#enums/species"; import { getSpriteKeysFromSpecies } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils"; -import { randSeedInt } from "#app/utils"; +import { randSeedInt } from "#app/utils/common"; import i18next from "i18next"; import type { IEggOptions } from "#app/data/egg"; import { EggSourceType } from "#enums/egg-source-types"; diff --git a/src/data/mystery-encounters/encounters/absolute-avarice-encounter.ts b/src/data/mystery-encounters/encounters/absolute-avarice-encounter.ts index 85f40a41e51..0a270aebf37 100644 --- a/src/data/mystery-encounters/encounters/absolute-avarice-encounter.ts +++ b/src/data/mystery-encounters/encounters/absolute-avarice-encounter.ts @@ -24,7 +24,7 @@ import { BerryModifier, PokemonInstantReviveModifier } from "#app/modifier/modif import { getPokemonSpecies } from "#app/data/pokemon-species"; import { Moves } from "#enums/moves"; import { BattlerTagType } from "#enums/battler-tag-type"; -import { randInt } from "#app/utils"; +import { randInt } from "#app/utils/common"; import { BattlerIndex } from "#app/battle"; import { applyModifierTypeToPlayerPokemon, diff --git a/src/data/mystery-encounters/encounters/berries-abound-encounter.ts b/src/data/mystery-encounters/encounters/berries-abound-encounter.ts index 94e27e32773..bf49dfdea91 100644 --- a/src/data/mystery-encounters/encounters/berries-abound-encounter.ts +++ b/src/data/mystery-encounters/encounters/berries-abound-encounter.ts @@ -13,7 +13,7 @@ import type { PlayerPokemon } from "#app/field/pokemon"; import type Pokemon from "#app/field/pokemon"; import type { BerryModifierType, ModifierTypeOption } from "#app/modifier/modifier-type"; import { ModifierPoolType, modifierTypes, regenerateModifierPoolThresholds } from "#app/modifier/modifier-type"; -import { randSeedInt } from "#app/utils"; +import { randSeedInt } from "#app/utils/common"; import { BattlerTagType } from "#enums/battler-tag-type"; import { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { globalScene } from "#app/global-scene"; diff --git a/src/data/mystery-encounters/encounters/bug-type-superfan-encounter.ts b/src/data/mystery-encounters/encounters/bug-type-superfan-encounter.ts index 1e4c9a3b957..8dfd1a270bd 100644 --- a/src/data/mystery-encounters/encounters/bug-type-superfan-encounter.ts +++ b/src/data/mystery-encounters/encounters/bug-type-superfan-encounter.ts @@ -16,7 +16,7 @@ import { TrainerSlot } from "#enums/trainer-slot"; import { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { PartyMemberStrength } from "#enums/party-member-strength"; import { globalScene } from "#app/global-scene"; -import { isNullOrUndefined, randSeedInt, randSeedShuffle } from "#app/utils"; +import { isNullOrUndefined, randSeedInt, randSeedShuffle } from "#app/utils/common"; import type MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter"; import { MysteryEncounterBuilder } from "#app/data/mystery-encounters/mystery-encounter"; import { MysteryEncounterTier } from "#enums/mystery-encounter-tier"; diff --git a/src/data/mystery-encounters/encounters/clowning-around-encounter.ts b/src/data/mystery-encounters/encounters/clowning-around-encounter.ts index 5edc2e6bbc5..07688db4583 100644 --- a/src/data/mystery-encounters/encounters/clowning-around-encounter.ts +++ b/src/data/mystery-encounters/encounters/clowning-around-encounter.ts @@ -31,9 +31,9 @@ import { import { PokemonType } from "#enums/pokemon-type"; import { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/mystery-encounter-option"; import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode"; -import { randSeedInt, randSeedShuffle } from "#app/utils"; +import { randSeedInt, randSeedShuffle } from "#app/utils/common"; import { showEncounterDialogue, showEncounterText } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import i18next from "i18next"; import type { OptionSelectConfig } from "#app/ui/abstact-option-select-ui-handler"; import type { PlayerPokemon } from "#app/field/pokemon"; @@ -437,7 +437,7 @@ async function handleSwapAbility() { await showEncounterDialogue(`${namespace}:option.1.apply_ability_dialogue`, `${namespace}:speaker`); await showEncounterText(`${namespace}:option.1.apply_ability_message`); - globalScene.ui.setMode(Mode.MESSAGE).then(() => { + globalScene.ui.setMode(UiMode.MESSAGE).then(() => { displayYesNoOptions(resolve); }); }); @@ -467,7 +467,7 @@ function displayYesNoOptions(resolve) { maxOptions: 7, yOffset: 0, }; - globalScene.ui.setModeWithoutClear(Mode.OPTION_SELECT, config, null, true); + globalScene.ui.setModeWithoutClear(UiMode.OPTION_SELECT, config, null, true); } function onYesAbilitySwap(resolve) { @@ -477,11 +477,11 @@ function onYesAbilitySwap(resolve) { applyAbilityOverrideToPokemon(pokemon, encounter.misc.ability); encounter.setDialogueToken("chosenPokemon", pokemon.getNameToRender()); - globalScene.ui.setMode(Mode.MESSAGE).then(() => resolve(true)); + globalScene.ui.setMode(UiMode.MESSAGE).then(() => resolve(true)); }; const onPokemonNotSelected = () => { - globalScene.ui.setMode(Mode.MESSAGE).then(() => { + globalScene.ui.setMode(UiMode.MESSAGE).then(() => { displayYesNoOptions(resolve); }); }; diff --git a/src/data/mystery-encounters/encounters/dark-deal-encounter.ts b/src/data/mystery-encounters/encounters/dark-deal-encounter.ts index 6c4c8f26deb..85ebf175f43 100644 --- a/src/data/mystery-encounters/encounters/dark-deal-encounter.ts +++ b/src/data/mystery-encounters/encounters/dark-deal-encounter.ts @@ -1,5 +1,5 @@ import type { PokemonType } from "#enums/pokemon-type"; -import { isNullOrUndefined, randSeedInt } from "#app/utils"; +import { isNullOrUndefined, randSeedInt } from "#app/utils/common"; import { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { Species } from "#enums/species"; import { globalScene } from "#app/global-scene"; diff --git a/src/data/mystery-encounters/encounters/delibirdy-encounter.ts b/src/data/mystery-encounters/encounters/delibirdy-encounter.ts index 364484cb511..e57955c324a 100644 --- a/src/data/mystery-encounters/encounters/delibirdy-encounter.ts +++ b/src/data/mystery-encounters/encounters/delibirdy-encounter.ts @@ -32,7 +32,7 @@ import { modifierTypes } from "#app/modifier/modifier-type"; import { ModifierRewardPhase } from "#app/phases/modifier-reward-phase"; import i18next from "#app/plugins/i18n"; import type { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler"; -import { randSeedItem } from "#app/utils"; +import { randSeedItem } from "#app/utils/common"; 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/encounters/department-store-sale-encounter.ts b/src/data/mystery-encounters/encounters/department-store-sale-encounter.ts index 9b8e2e24d12..6a26cf19d7f 100644 --- a/src/data/mystery-encounters/encounters/department-store-sale-encounter.ts +++ b/src/data/mystery-encounters/encounters/department-store-sale-encounter.ts @@ -4,7 +4,7 @@ import { } from "#app/data/mystery-encounters/utils/encounter-phase-utils"; import type { ModifierTypeFunc } from "#app/modifier/modifier-type"; import { modifierTypes } from "#app/modifier/modifier-type"; -import { randSeedInt } from "#app/utils"; +import { randSeedInt } from "#app/utils/common"; import { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { Species } from "#enums/species"; import type MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter"; diff --git a/src/data/mystery-encounters/encounters/fiery-fallout-encounter.ts b/src/data/mystery-encounters/encounters/fiery-fallout-encounter.ts index f0b7a05a21c..f0fb6398334 100644 --- a/src/data/mystery-encounters/encounters/fiery-fallout-encounter.ts +++ b/src/data/mystery-encounters/encounters/fiery-fallout-encounter.ts @@ -30,7 +30,7 @@ import { PokemonMove } from "#app/field/pokemon"; import { Moves } from "#enums/moves"; import { EncounterBattleAnim } from "#app/data/battle-anims"; import { WeatherType } from "#enums/weather-type"; -import { isNullOrUndefined, randSeedInt } from "#app/utils"; +import { isNullOrUndefined, randSeedInt } from "#app/utils/common"; import { StatusEffect } from "#enums/status-effect"; import { queueEncounterMessage } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils"; import { diff --git a/src/data/mystery-encounters/encounters/fight-or-flight-encounter.ts b/src/data/mystery-encounters/encounters/fight-or-flight-encounter.ts index 595d13cf727..d9b4140c6ee 100644 --- a/src/data/mystery-encounters/encounters/fight-or-flight-encounter.ts +++ b/src/data/mystery-encounters/encounters/fight-or-flight-encounter.ts @@ -31,7 +31,7 @@ import { import PokemonData from "#app/system/pokemon-data"; import { BattlerTagType } from "#enums/battler-tag-type"; import { queueEncounterMessage } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils"; -import { randSeedInt } from "#app/utils"; +import { randSeedInt } from "#app/utils/common"; import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase"; import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode"; diff --git a/src/data/mystery-encounters/encounters/global-trade-system-encounter.ts b/src/data/mystery-encounters/encounters/global-trade-system-encounter.ts index f80620647b0..63db5c7c5d6 100644 --- a/src/data/mystery-encounters/encounters/global-trade-system-encounter.ts +++ b/src/data/mystery-encounters/encounters/global-trade-system-encounter.ts @@ -23,7 +23,14 @@ import { allSpecies, getPokemonSpecies } from "#app/data/pokemon-species"; import { getTypeRgb } from "#app/data/type"; import { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/mystery-encounter-option"; import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode"; -import { NumberHolder, isNullOrUndefined, randInt, randSeedInt, randSeedShuffle, randSeedItem } from "#app/utils"; +import { + NumberHolder, + isNullOrUndefined, + randInt, + randSeedInt, + randSeedShuffle, + randSeedItem, +} from "#app/utils/common"; import type { PlayerPokemon } from "#app/field/pokemon"; import type Pokemon from "#app/field/pokemon"; import { EnemyPokemon, PokemonMove } from "#app/field/pokemon"; diff --git a/src/data/mystery-encounters/encounters/mysterious-challengers-encounter.ts b/src/data/mystery-encounters/encounters/mysterious-challengers-encounter.ts index 5f88ca083c0..b10f2f3dba2 100644 --- a/src/data/mystery-encounters/encounters/mysterious-challengers-encounter.ts +++ b/src/data/mystery-encounters/encounters/mysterious-challengers-encounter.ts @@ -12,7 +12,7 @@ import { modifierTypes } from "#app/modifier/modifier-type"; import { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { PartyMemberStrength } from "#enums/party-member-strength"; import { globalScene } from "#app/global-scene"; -import { randSeedInt } from "#app/utils"; +import { randSeedInt } from "#app/utils/common"; import type MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter"; import { MysteryEncounterBuilder } from "#app/data/mystery-encounters/mystery-encounter"; import { MysteryEncounterTier } from "#enums/mystery-encounter-tier"; diff --git a/src/data/mystery-encounters/encounters/mysterious-chest-encounter.ts b/src/data/mystery-encounters/encounters/mysterious-chest-encounter.ts index c295e36749a..8877bf36ce8 100644 --- a/src/data/mystery-encounters/encounters/mysterious-chest-encounter.ts +++ b/src/data/mystery-encounters/encounters/mysterious-chest-encounter.ts @@ -18,7 +18,7 @@ import { getPokemonSpecies } from "#app/data/pokemon-species"; import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode"; import { ModifierTier } from "#app/modifier/modifier-tier"; import { GameOverPhase } from "#app/phases/game-over-phase"; -import { randSeedInt } from "#app/utils"; +import { randSeedInt } from "#app/utils/common"; import { Moves } from "#enums/moves"; import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode"; import { MysteryEncounterTier } from "#enums/mystery-encounter-tier"; diff --git a/src/data/mystery-encounters/encounters/safari-zone-encounter.ts b/src/data/mystery-encounters/encounters/safari-zone-encounter.ts index 8c45fde3079..602a8d397db 100644 --- a/src/data/mystery-encounters/encounters/safari-zone-encounter.ts +++ b/src/data/mystery-encounters/encounters/safari-zone-encounter.ts @@ -15,7 +15,7 @@ import { HiddenAbilityRateBoosterModifier, IvScannerModifier } from "#app/modifi import type { EnemyPokemon } from "#app/field/pokemon"; import { PokeballType } from "#enums/pokeball"; import { PlayerGender } from "#enums/player-gender"; -import { NumberHolder, randSeedInt } from "#app/utils"; +import { NumberHolder, randSeedInt } from "#app/utils/common"; import type PokemonSpecies from "#app/data/pokemon-species"; import { getPokemonSpecies } from "#app/data/pokemon-species"; import { MoneyRequirement } from "#app/data/mystery-encounters/mystery-encounter-requirements"; diff --git a/src/data/mystery-encounters/encounters/shady-vitamin-dealer-encounter.ts b/src/data/mystery-encounters/encounters/shady-vitamin-dealer-encounter.ts index b9476d49fec..79f4b53a73e 100644 --- a/src/data/mystery-encounters/encounters/shady-vitamin-dealer-encounter.ts +++ b/src/data/mystery-encounters/encounters/shady-vitamin-dealer-encounter.ts @@ -8,7 +8,7 @@ import { import type { PlayerPokemon } from "#app/field/pokemon"; import type Pokemon from "#app/field/pokemon"; import { modifierTypes } from "#app/modifier/modifier-type"; -import { randSeedInt } from "#app/utils"; +import { randSeedInt } from "#app/utils/common"; import { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { Species } from "#enums/species"; import { globalScene } from "#app/global-scene"; diff --git a/src/data/mystery-encounters/encounters/teleporting-hijinks-encounter.ts b/src/data/mystery-encounters/encounters/teleporting-hijinks-encounter.ts index 806a89a7131..ef3532b080e 100644 --- a/src/data/mystery-encounters/encounters/teleporting-hijinks-encounter.ts +++ b/src/data/mystery-encounters/encounters/teleporting-hijinks-encounter.ts @@ -7,7 +7,7 @@ import { transitionMysteryEncounterIntroVisuals, updatePlayerMoney, } from "#app/data/mystery-encounters/utils/encounter-phase-utils"; -import { randSeedInt } from "#app/utils"; +import { randSeedInt } from "#app/utils/common"; import { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { globalScene } from "#app/global-scene"; import type MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter"; diff --git a/src/data/mystery-encounters/encounters/the-expert-pokemon-breeder-encounter.ts b/src/data/mystery-encounters/encounters/the-expert-pokemon-breeder-encounter.ts index c189e341089..ab2f19cfb77 100644 --- a/src/data/mystery-encounters/encounters/the-expert-pokemon-breeder-encounter.ts +++ b/src/data/mystery-encounters/encounters/the-expert-pokemon-breeder-encounter.ts @@ -7,7 +7,7 @@ import { import { trainerConfigs } from "#app/data/trainers/trainer-config"; import { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { globalScene } from "#app/global-scene"; -import { randSeedShuffle } from "#app/utils"; +import { randSeedShuffle } from "#app/utils/common"; import type MysteryEncounter from "../mystery-encounter"; import { MysteryEncounterBuilder } from "../mystery-encounter"; import { MysteryEncounterTier } from "#enums/mystery-encounter-tier"; diff --git a/src/data/mystery-encounters/encounters/the-pokemon-salesman-encounter.ts b/src/data/mystery-encounters/encounters/the-pokemon-salesman-encounter.ts index fb55c55a1a3..4e8e1c2524e 100644 --- a/src/data/mystery-encounters/encounters/the-pokemon-salesman-encounter.ts +++ b/src/data/mystery-encounters/encounters/the-pokemon-salesman-encounter.ts @@ -3,7 +3,7 @@ import { transitionMysteryEncounterIntroVisuals, updatePlayerMoney, } from "#app/data/mystery-encounters/utils/encounter-phase-utils"; -import { isNullOrUndefined, randSeedInt } from "#app/utils"; +import { isNullOrUndefined, randSeedInt } from "#app/utils/common"; import { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { globalScene } from "#app/global-scene"; import type MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter"; diff --git a/src/data/mystery-encounters/encounters/training-session-encounter.ts b/src/data/mystery-encounters/encounters/training-session-encounter.ts index e8711be172d..11d00f1dd8c 100644 --- a/src/data/mystery-encounters/encounters/training-session-encounter.ts +++ b/src/data/mystery-encounters/encounters/training-session-encounter.ts @@ -15,7 +15,7 @@ import type { PokemonHeldItemModifier } from "#app/modifier/modifier"; import { AbilityAttr } from "#app/system/game-data"; import PokemonData from "#app/system/pokemon-data"; import type { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler"; -import { isNullOrUndefined, randSeedShuffle } from "#app/utils"; +import { isNullOrUndefined, randSeedShuffle } from "#app/utils/common"; import { BattlerTagType } from "#enums/battler-tag-type"; import { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { globalScene } from "#app/global-scene"; diff --git a/src/data/mystery-encounters/encounters/trash-to-treasure-encounter.ts b/src/data/mystery-encounters/encounters/trash-to-treasure-encounter.ts index e60fe0ddc18..1ff96f21edc 100644 --- a/src/data/mystery-encounters/encounters/trash-to-treasure-encounter.ts +++ b/src/data/mystery-encounters/encounters/trash-to-treasure-encounter.ts @@ -27,7 +27,7 @@ import { Moves } from "#enums/moves"; import { BattlerIndex } from "#app/battle"; import { PokemonMove } from "#app/field/pokemon"; import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode"; -import { randSeedInt } from "#app/utils"; +import { randSeedInt } from "#app/utils/common"; /** the i18n namespace for this encounter */ const namespace = "mysteryEncounters/trashToTreasure"; diff --git a/src/data/mystery-encounters/encounters/uncommon-breed-encounter.ts b/src/data/mystery-encounters/encounters/uncommon-breed-encounter.ts index ed1866c7a1b..66c7f7afc56 100644 --- a/src/data/mystery-encounters/encounters/uncommon-breed-encounter.ts +++ b/src/data/mystery-encounters/encounters/uncommon-breed-encounter.ts @@ -27,7 +27,7 @@ import { getSpriteKeysFromPokemon, } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils"; import PokemonData from "#app/system/pokemon-data"; -import { isNullOrUndefined, randSeedInt } from "#app/utils"; +import { isNullOrUndefined, randSeedInt } from "#app/utils/common"; import type { Moves } from "#enums/moves"; import { BattlerIndex } from "#app/battle"; import { SelfStatusMove } from "#app/data/moves/move"; diff --git a/src/data/mystery-encounters/encounters/weird-dream-encounter.ts b/src/data/mystery-encounters/encounters/weird-dream-encounter.ts index 22ec52e976c..cd9ffefb516 100644 --- a/src/data/mystery-encounters/encounters/weird-dream-encounter.ts +++ b/src/data/mystery-encounters/encounters/weird-dream-encounter.ts @@ -17,7 +17,7 @@ import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode import type { PlayerPokemon } from "#app/field/pokemon"; import type Pokemon from "#app/field/pokemon"; import { PokemonMove } from "#app/field/pokemon"; -import { NumberHolder, isNullOrUndefined, randSeedInt, randSeedShuffle } from "#app/utils"; +import { NumberHolder, isNullOrUndefined, randSeedInt, randSeedShuffle } from "#app/utils/common"; import type PokemonSpecies from "#app/data/pokemon-species"; import { allSpecies, getPokemonSpecies } from "#app/data/pokemon-species"; import type { PokemonHeldItemModifier } from "#app/modifier/modifier"; diff --git a/src/data/mystery-encounters/mystery-encounter-option.ts b/src/data/mystery-encounters/mystery-encounter-option.ts index f360658c2dc..57dd50fa972 100644 --- a/src/data/mystery-encounters/mystery-encounter-option.ts +++ b/src/data/mystery-encounters/mystery-encounter-option.ts @@ -12,7 +12,7 @@ import { } from "#app/data/mystery-encounters/mystery-encounter-requirements"; import type { CanLearnMoveRequirementOptions } from "./requirements/can-learn-move-requirement"; import { CanLearnMoveRequirement } from "./requirements/can-learn-move-requirement"; -import { isNullOrUndefined, randSeedInt } from "#app/utils"; +import { isNullOrUndefined, randSeedInt } from "#app/utils/common"; import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode"; // biome-ignore lint/suspicious/noConfusingVoidType: void unions in callbacks are OK diff --git a/src/data/mystery-encounters/mystery-encounter-requirements.ts b/src/data/mystery-encounters/mystery-encounter-requirements.ts index 948e3e96ef0..49fd632932c 100644 --- a/src/data/mystery-encounters/mystery-encounter-requirements.ts +++ b/src/data/mystery-encounters/mystery-encounter-requirements.ts @@ -9,7 +9,7 @@ import { WeatherType } from "#enums/weather-type"; import type { PlayerPokemon } from "#app/field/pokemon"; import { AttackTypeBoosterModifier } from "#app/modifier/modifier"; import type { AttackTypeBoosterModifierType } from "#app/modifier/modifier-type"; -import { isNullOrUndefined } from "#app/utils"; +import { isNullOrUndefined } from "#app/utils/common"; import type { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import type { MysteryEncounterType } from "#enums/mystery-encounter-type"; diff --git a/src/data/mystery-encounters/mystery-encounter-save-data.ts b/src/data/mystery-encounters/mystery-encounter-save-data.ts index 7c8110628f0..dd633390e46 100644 --- a/src/data/mystery-encounters/mystery-encounter-save-data.ts +++ b/src/data/mystery-encounters/mystery-encounter-save-data.ts @@ -1,6 +1,6 @@ import type { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { BASE_MYSTERY_ENCOUNTER_SPAWN_WEIGHT } from "#app/data/mystery-encounters/mystery-encounters"; -import { isNullOrUndefined } from "#app/utils"; +import { isNullOrUndefined } from "#app/utils/common"; import type { MysteryEncounterTier } from "#enums/mystery-encounter-tier"; export class SeenEncounterData { diff --git a/src/data/mystery-encounters/mystery-encounter.ts b/src/data/mystery-encounters/mystery-encounter.ts index ff098d4d7dd..e305252ed0f 100644 --- a/src/data/mystery-encounters/mystery-encounter.ts +++ b/src/data/mystery-encounters/mystery-encounter.ts @@ -1,11 +1,11 @@ import type { EnemyPartyConfig } from "#app/data/mystery-encounters/utils/encounter-phase-utils"; import type { PlayerPokemon, PokemonMove } from "#app/field/pokemon"; import type Pokemon from "#app/field/pokemon"; -import { capitalizeFirstLetter, isNullOrUndefined } from "#app/utils"; +import { capitalizeFirstLetter, isNullOrUndefined } from "#app/utils/common"; import type { MysteryEncounterType } from "#enums/mystery-encounter-type"; import type { MysteryEncounterSpriteConfig } from "#app/field/mystery-encounter-intro"; import MysteryEncounterIntroVisuals from "#app/field/mystery-encounter-intro"; -import { randSeedInt } from "#app/utils"; +import { randSeedInt } from "#app/utils/common"; import type { StatusEffect } from "#enums/status-effect"; import type { OptionTextDisplay } from "./mystery-encounter-dialogue"; import type MysteryEncounterDialogue from "./mystery-encounter-dialogue"; diff --git a/src/data/mystery-encounters/requirements/can-learn-move-requirement.ts b/src/data/mystery-encounters/requirements/can-learn-move-requirement.ts index a7ffe3e26ca..37194aef78e 100644 --- a/src/data/mystery-encounters/requirements/can-learn-move-requirement.ts +++ b/src/data/mystery-encounters/requirements/can-learn-move-requirement.ts @@ -1,7 +1,7 @@ import type { Moves } from "#app/enums/moves"; import type { PlayerPokemon } from "#app/field/pokemon"; import { PokemonMove } from "#app/field/pokemon"; -import { isNullOrUndefined } from "#app/utils"; +import { isNullOrUndefined } from "#app/utils/common"; import { EncounterPokemonRequirement } from "#app/data/mystery-encounters/mystery-encounter-requirements"; import { globalScene } from "#app/global-scene"; diff --git a/src/data/mystery-encounters/utils/encounter-dialogue-utils.ts b/src/data/mystery-encounters/utils/encounter-dialogue-utils.ts index 94790145687..296d94093d9 100644 --- a/src/data/mystery-encounters/utils/encounter-dialogue-utils.ts +++ b/src/data/mystery-encounters/utils/encounter-dialogue-utils.ts @@ -2,7 +2,7 @@ import { globalScene } from "#app/global-scene"; import type { TextStyle } from "#app/ui/text"; import { getTextWithColors } from "#app/ui/text"; import { UiTheme } from "#enums/ui-theme"; -import { isNullOrUndefined } from "#app/utils"; +import { isNullOrUndefined } from "#app/utils/common"; import i18next from "i18next"; /** diff --git a/src/data/mystery-encounters/utils/encounter-phase-utils.ts b/src/data/mystery-encounters/utils/encounter-phase-utils.ts index 69b0d81520a..d77b70caa31 100644 --- a/src/data/mystery-encounters/utils/encounter-phase-utils.ts +++ b/src/data/mystery-encounters/utils/encounter-phase-utils.ts @@ -30,8 +30,8 @@ import type PokemonData from "#app/system/pokemon-data"; import type { OptionSelectConfig, OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler"; import type { PartyOption, PokemonSelectFilter } from "#app/ui/party-ui-handler"; import { PartyUiMode } from "#app/ui/party-ui-handler"; -import { Mode } from "#app/ui/ui"; -import { isNullOrUndefined, randSeedInt, randomString, randSeedItem } from "#app/utils"; +import { UiMode } from "#enums/ui-mode"; +import { isNullOrUndefined, randSeedInt, randomString, randSeedItem } from "#app/utils/common"; import type { BattlerTagType } from "#enums/battler-tag-type"; import { Biome } from "#enums/biome"; import type { TrainerType } from "#enums/trainer-type"; @@ -563,7 +563,7 @@ export function selectPokemonForOption( // Open party screen to choose pokemon globalScene.ui.setMode( - Mode.PARTY, + UiMode.PARTY, PartyUiMode.SELECT, -1, (slotIndex: number, _option: PartyOption) => { @@ -581,7 +581,7 @@ export function selectPokemonForOption( } // There is a second option to choose after selecting the Pokemon - globalScene.ui.setMode(Mode.MESSAGE).then(() => { + globalScene.ui.setMode(UiMode.MESSAGE).then(() => { const displayOptions = () => { // Always appends a cancel option to bottom of options const fullOptions = secondaryOptions @@ -623,7 +623,7 @@ export function selectPokemonForOption( if (fullOptions[0].onHover) { fullOptions[0].onHover(); } - globalScene.ui.setModeWithoutClear(Mode.OPTION_SELECT, config, null, true); + globalScene.ui.setModeWithoutClear(UiMode.OPTION_SELECT, config, null, true); }; const textPromptKey = @@ -673,20 +673,20 @@ export function selectOptionThenPokemon( const modeToSetOnExit = globalScene.ui.getMode(); const displayOptions = (config: OptionSelectConfig) => { - globalScene.ui.setMode(Mode.MESSAGE).then(() => { + globalScene.ui.setMode(UiMode.MESSAGE).then(() => { if (!optionSelectPromptKey) { // Do hover over the starting selection option if (fullOptions[0].onHover) { fullOptions[0].onHover(); } - globalScene.ui.setMode(Mode.OPTION_SELECT, config); + globalScene.ui.setMode(UiMode.OPTION_SELECT, config); } else { showEncounterText(optionSelectPromptKey).then(() => { // Do hover over the starting selection option if (fullOptions[0].onHover) { fullOptions[0].onHover(); } - globalScene.ui.setMode(Mode.OPTION_SELECT, config); + globalScene.ui.setMode(UiMode.OPTION_SELECT, config); }); } }); @@ -695,7 +695,7 @@ export function selectOptionThenPokemon( const selectPokemonAfterOption = (selectedOptionIndex: number) => { // Open party screen to choose a Pokemon globalScene.ui.setMode( - Mode.PARTY, + UiMode.PARTY, PartyUiMode.SELECT, -1, (slotIndex: number, _option: PartyOption) => { diff --git a/src/data/mystery-encounters/utils/encounter-pokemon-utils.ts b/src/data/mystery-encounters/utils/encounter-pokemon-utils.ts index a4787e819b8..ed94a46ac18 100644 --- a/src/data/mystery-encounters/utils/encounter-pokemon-utils.ts +++ b/src/data/mystery-encounters/utils/encounter-pokemon-utils.ts @@ -1,6 +1,6 @@ import { globalScene } from "#app/global-scene"; import i18next from "i18next"; -import { isNullOrUndefined, randSeedInt } from "#app/utils"; +import { isNullOrUndefined, randSeedInt } from "#app/utils/common"; import { PokemonHeldItemModifier } from "#app/modifier/modifier"; import type { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon"; import type Pokemon from "#app/field/pokemon"; @@ -14,7 +14,7 @@ import { PlayerGender } from "#enums/player-gender"; import { addPokeballCaptureStars, addPokeballOpenParticles } from "#app/field/anims"; import { getStatusEffectCatchRateMultiplier } from "#app/data/status-effect"; import { achvs } from "#app/system/achv"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import type { PartyOption } from "#app/ui/party-ui-handler"; import { PartyUiMode } from "#app/ui/party-ui-handler"; import { Species } from "#enums/species"; @@ -714,7 +714,7 @@ export async function catchPokemon( () => { globalScene.pokemonInfoContainer.makeRoomForConfirmUi(1, true); globalScene.ui.setMode( - Mode.CONFIRM, + UiMode.CONFIRM, () => { const newPokemon = globalScene.addPlayerPokemon( pokemon.species, @@ -729,12 +729,12 @@ export async function catchPokemon( pokemon, ); globalScene.ui.setMode( - Mode.SUMMARY, + UiMode.SUMMARY, newPokemon, 0, SummaryUiMode.DEFAULT, () => { - globalScene.ui.setMode(Mode.MESSAGE).then(() => { + globalScene.ui.setMode(UiMode.MESSAGE).then(() => { promptRelease(); }); }, @@ -749,13 +749,13 @@ export async function catchPokemon( female: pokemon.gender === Gender.FEMALE, }; globalScene.ui.setOverlayMode( - Mode.POKEDEX_PAGE, + UiMode.POKEDEX_PAGE, pokemon.species, pokemon.formIndex, attributes, null, () => { - globalScene.ui.setMode(Mode.MESSAGE).then(() => { + globalScene.ui.setMode(UiMode.MESSAGE).then(() => { promptRelease(); }); }, @@ -763,11 +763,11 @@ export async function catchPokemon( }, () => { globalScene.ui.setMode( - Mode.PARTY, + UiMode.PARTY, PartyUiMode.RELEASE, 0, (slotIndex: number, _option: PartyOption) => { - globalScene.ui.setMode(Mode.MESSAGE).then(() => { + globalScene.ui.setMode(UiMode.MESSAGE).then(() => { if (slotIndex < 6) { addToParty(slotIndex); } else { @@ -778,7 +778,7 @@ export async function catchPokemon( ); }, () => { - globalScene.ui.setMode(Mode.MESSAGE).then(() => { + globalScene.ui.setMode(UiMode.MESSAGE).then(() => { removePokemon(); end(); }); diff --git a/src/data/mystery-encounters/utils/encounter-transformation-sequence.ts b/src/data/mystery-encounters/utils/encounter-transformation-sequence.ts index 15085bb2bf8..578c2efefdb 100644 --- a/src/data/mystery-encounters/utils/encounter-transformation-sequence.ts +++ b/src/data/mystery-encounters/utils/encounter-transformation-sequence.ts @@ -1,5 +1,5 @@ import type { PlayerPokemon } from "#app/field/pokemon"; -import { getFrameMs } from "#app/utils"; +import { getFrameMs } from "#app/utils/common"; import { cos, sin } from "#app/field/anims"; import { getTypeRgb } from "#app/data/type"; import { globalScene } from "#app/global-scene"; diff --git a/src/data/nature.ts b/src/data/nature.ts index 2ab4723c10d..83b3ee7538d 100644 --- a/src/data/nature.ts +++ b/src/data/nature.ts @@ -1,4 +1,4 @@ -import { toReadableString } from "#app/utils"; +import { toReadableString } from "#app/utils/common"; import { TextStyle, getBBCodeFrag } from "../ui/text"; import { Nature } from "#enums/nature"; import { UiTheme } from "#enums/ui-theme"; diff --git a/src/data/pokeball.ts b/src/data/pokeball.ts index b0744237755..7a44ebdda7c 100644 --- a/src/data/pokeball.ts +++ b/src/data/pokeball.ts @@ -1,6 +1,6 @@ import { globalScene } from "#app/global-scene"; import { CriticalCatchChanceBoosterModifier } from "#app/modifier/modifier"; -import { NumberHolder } from "#app/utils"; +import { NumberHolder } from "#app/utils/common"; import { PokeballType } from "#enums/pokeball"; import i18next from "i18next"; diff --git a/src/data/pokemon-forms.ts b/src/data/pokemon-forms.ts index 63e166c7fc4..f76462d2725 100644 --- a/src/data/pokemon-forms.ts +++ b/src/data/pokemon-forms.ts @@ -3,7 +3,7 @@ import type Pokemon from "../field/pokemon"; import { StatusEffect } from "#enums/status-effect"; import { allMoves } from "./moves/move"; import { MoveCategory } from "#enums/MoveCategory"; -import type { Constructor, nil } from "#app/utils"; +import type { Constructor, nil } from "#app/utils/common"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; diff --git a/src/data/pokemon-species.ts b/src/data/pokemon-species.ts index 75ea07edd40..95ff28e61e0 100644 --- a/src/data/pokemon-species.ts +++ b/src/data/pokemon-species.ts @@ -8,7 +8,7 @@ import type { AnySound } from "#app/battle-scene"; import { globalScene } from "#app/global-scene"; import type { GameMode } from "#app/game-mode"; import { DexAttr, type StarterMoveset } from "#app/system/game-data"; -import { isNullOrUndefined, capitalizeString, randSeedInt, randSeedGauss, randSeedItem } from "#app/utils"; +import { isNullOrUndefined, capitalizeString, randSeedInt, randSeedGauss, randSeedItem } from "#app/utils/common"; import { uncatchableSpecies } from "#app/data/balance/biomes"; import { speciesEggMoves } from "#app/data/balance/egg-moves"; import { GrowthRate } from "#app/data/exp"; diff --git a/src/data/status-effect.ts b/src/data/status-effect.ts index fe4fa380d46..a90304c9f7d 100644 --- a/src/data/status-effect.ts +++ b/src/data/status-effect.ts @@ -1,4 +1,4 @@ -import { randIntRange } from "#app/utils"; +import { randIntRange } from "#app/utils/common"; import { StatusEffect } from "#enums/status-effect"; import type { ParseKeys } from "i18next"; import i18next from "i18next"; diff --git a/src/data/trainer-names.ts b/src/data/trainer-names.ts index 195e5041d28..8714dad0fc9 100644 --- a/src/data/trainer-names.ts +++ b/src/data/trainer-names.ts @@ -1,5 +1,5 @@ import { TrainerType } from "#enums/trainer-type"; -import { toReadableString } from "#app/utils"; +import { toReadableString } from "#app/utils/common"; class TrainerNameConfig { public urls: string[]; diff --git a/src/data/trainers/TrainerPartyTemplate.ts b/src/data/trainers/TrainerPartyTemplate.ts index adbaacc6b55..5d02ffdc6af 100644 --- a/src/data/trainers/TrainerPartyTemplate.ts +++ b/src/data/trainers/TrainerPartyTemplate.ts @@ -1,4 +1,4 @@ -import { startingWave } from "#app/battle-scene"; +import { startingWave } from "#app/starting-wave"; import { globalScene } from "#app/global-scene"; import { PartyMemberStrength } from "#enums/party-member-strength"; diff --git a/src/data/trainers/trainer-config.ts b/src/data/trainers/trainer-config.ts index d9922ecc097..fec1d4757e7 100644 --- a/src/data/trainers/trainer-config.ts +++ b/src/data/trainers/trainer-config.ts @@ -1,7 +1,7 @@ import { globalScene } from "#app/global-scene"; import { modifierTypes } from "#app/modifier/modifier-type"; import { PokemonMove } from "#app/field/pokemon"; -import { toReadableString, isNullOrUndefined, randSeedItem, randSeedInt } from "#app/utils"; +import { toReadableString, isNullOrUndefined, randSeedItem, randSeedInt } from "#app/utils/common"; import { pokemonEvolutions, pokemonPrevolutions } from "#app/data/balance/pokemon-evolutions"; import { getPokemonSpecies } from "#app/data/pokemon-species"; import { tmSpecies } from "#app/data/balance/tms"; diff --git a/src/data/weather.ts b/src/data/weather.ts index 31b460bbddb..81559304661 100644 --- a/src/data/weather.ts +++ b/src/data/weather.ts @@ -5,7 +5,7 @@ import type Pokemon from "../field/pokemon"; import { PokemonType } from "#enums/pokemon-type"; import type Move from "./moves/move"; import { AttackMove } from "./moves/move"; -import { randSeedInt } from "#app/utils"; +import { randSeedInt } from "#app/utils/common"; import { SuppressWeatherEffectAbAttr } from "./abilities/ability"; import { TerrainType, getTerrainName } from "./terrain"; import i18next from "i18next"; diff --git a/src/enums/ui-mode.ts b/src/enums/ui-mode.ts new file mode 100644 index 00000000000..dcf6bd2a238 --- /dev/null +++ b/src/enums/ui-mode.ts @@ -0,0 +1,47 @@ +export enum UiMode { + MESSAGE, + TITLE, + COMMAND, + FIGHT, + BALL, + TARGET_SELECT, + MODIFIER_SELECT, + SAVE_SLOT, + PARTY, + SUMMARY, + STARTER_SELECT, + EVOLUTION_SCENE, + EGG_HATCH_SCENE, + EGG_HATCH_SUMMARY, + CONFIRM, + OPTION_SELECT, + MENU, + MENU_OPTION_SELECT, + SETTINGS, + SETTINGS_DISPLAY, + SETTINGS_AUDIO, + SETTINGS_GAMEPAD, + GAMEPAD_BINDING, + SETTINGS_KEYBOARD, + KEYBOARD_BINDING, + ACHIEVEMENTS, + GAME_STATS, + EGG_LIST, + EGG_GACHA, + POKEDEX, + POKEDEX_SCAN, + POKEDEX_PAGE, + LOGIN_FORM, + REGISTRATION_FORM, + LOADING, + SESSION_RELOAD, + UNAVAILABLE, + CHALLENGE_SELECT, + RENAME_POKEMON, + RUN_HISTORY, + RUN_INFO, + TEST_DIALOGUE, + AUTO_COMPLETE, + ADMIN, + MYSTERY_ENCOUNTER +} diff --git a/src/field/anims.ts b/src/field/anims.ts index eb895c2d8f9..2fd23e4262b 100644 --- a/src/field/anims.ts +++ b/src/field/anims.ts @@ -1,7 +1,7 @@ import { globalScene } from "#app/global-scene"; import { PokeballType } from "#enums/pokeball"; import type { Variant } from "#app/sprites/variant"; -import { getFrameMs, randGauss } from "#app/utils"; +import { getFrameMs, randGauss } from "#app/utils/common"; export function addPokeballOpenParticles(x: number, y: number, pokeballType: PokeballType): void { switch (pokeballType) { diff --git a/src/field/arena.ts b/src/field/arena.ts index 1bc465c7dbb..f083180490b 100644 --- a/src/field/arena.ts +++ b/src/field/arena.ts @@ -1,7 +1,7 @@ import { globalScene } from "#app/global-scene"; import type { BiomeTierTrainerPools, PokemonPools } from "#app/data/balance/biomes"; import { biomePokemonPools, BiomePoolTier, biomeTrainerPools } from "#app/data/balance/biomes"; -import { randSeedInt, NumberHolder, isNullOrUndefined, type Constructor } from "#app/utils"; +import { randSeedInt, NumberHolder, isNullOrUndefined, type Constructor } from "#app/utils/common"; import type PokemonSpecies from "#app/data/pokemon-species"; import { getPokemonSpecies } from "#app/data/pokemon-species"; import { diff --git a/src/field/damage-number-handler.ts b/src/field/damage-number-handler.ts index a527b148fff..bfb85018dd6 100644 --- a/src/field/damage-number-handler.ts +++ b/src/field/damage-number-handler.ts @@ -2,7 +2,7 @@ import { TextStyle, addTextObject } from "../ui/text"; import type { DamageResult } from "./pokemon"; import type Pokemon from "./pokemon"; import { HitResult } from "./pokemon"; -import { formatStat, fixedInt } from "#app/utils"; +import { formatStat, fixedInt } from "#app/utils/common"; import type { BattlerIndex } from "../battle"; import { globalScene } from "#app/global-scene"; diff --git a/src/field/mystery-encounter-intro.ts b/src/field/mystery-encounter-intro.ts index e1fb0c37074..b6212b6b031 100644 --- a/src/field/mystery-encounter-intro.ts +++ b/src/field/mystery-encounter-intro.ts @@ -2,7 +2,7 @@ import type { GameObjects } from "phaser"; import { globalScene } from "#app/global-scene"; import type MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter"; import type { Species } from "#enums/species"; -import { isNullOrUndefined } from "#app/utils"; +import { isNullOrUndefined } from "#app/utils/common"; import { getSpriteKeysFromSpecies } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils"; import type { Variant } from "#app/sprites/variant"; import { doShinySparkleAnim } from "#app/field/anims"; diff --git a/src/field/pokemon-sprite-sparkle-handler.ts b/src/field/pokemon-sprite-sparkle-handler.ts index d2f69500258..cceb0bd7717 100644 --- a/src/field/pokemon-sprite-sparkle-handler.ts +++ b/src/field/pokemon-sprite-sparkle-handler.ts @@ -1,6 +1,6 @@ import { globalScene } from "#app/global-scene"; import Pokemon from "./pokemon"; -import { fixedInt, randInt } from "#app/utils"; +import { fixedInt, randInt } from "#app/utils/common"; export default class PokemonSpriteSparkleHandler { private sprites: Set; diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 27c4edea297..0242820dcde 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -55,7 +55,7 @@ import { getStarterValueFriendshipCap, speciesStarterCosts, } from "#app/data/balance/starters"; -import { NumberHolder, randSeedInt, getIvsFromId, BooleanHolder, randSeedItem, isNullOrUndefined, getEnumValues, toDmgValue, fixedInt, rgbaToInt, rgbHexToRgba, rgbToHsv, deltaRgb, isBetween, type nil, type Constructor } from "#app/utils"; +import { NumberHolder, randSeedInt, getIvsFromId, BooleanHolder, randSeedItem, isNullOrUndefined, getEnumValues, toDmgValue, fixedInt, rgbaToInt, rgbHexToRgba, rgbToHsv, deltaRgb, isBetween, type nil, type Constructor } from "#app/utils/common"; import type { TypeDamageMultiplier } from "#app/data/type"; import { getTypeDamageMultiplier, getTypeRgb } from "#app/data/type"; import { PokemonType } from "#enums/pokemon-type"; @@ -193,7 +193,7 @@ import { import { allAbilities } from "#app/data/data-lists"; import type PokemonData from "#app/system/pokemon-data"; import { BattlerIndex } from "#app/battle"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import type { PartyOption } from "#app/ui/party-ui-handler"; import PartyUiHandler, { PartyUiMode } from "#app/ui/party-ui-handler"; import SoundFade from "phaser3-rex-plugins/plugins/soundfade"; @@ -6581,7 +6581,7 @@ export class PlayerPokemon extends Pokemon { this.leaveField(switchType === SwitchType.SWITCH); globalScene.ui.setMode( - Mode.PARTY, + UiMode.PARTY, PartyUiMode.FAINT_SWITCH, this.getFieldIndex(), (slotIndex: number, option: PartyOption) => { @@ -6599,7 +6599,7 @@ export class PlayerPokemon extends Pokemon { MoveEndPhase, ); } - globalScene.ui.setMode(Mode.MESSAGE).then(resolve); + globalScene.ui.setMode(UiMode.MESSAGE).then(resolve); }, PartyUiHandler.FilterNonFainted, ); diff --git a/src/field/trainer.ts b/src/field/trainer.ts index 1679e6f12e0..6b0a54b2103 100644 --- a/src/field/trainer.ts +++ b/src/field/trainer.ts @@ -11,7 +11,7 @@ import { TrainerSlot } from "#enums/trainer-slot"; import { TrainerPoolTier } from "#enums/trainer-pool-tier"; import { TeraAIMode } from "#enums/tera-ai-mode"; import type { EnemyPokemon } from "#app/field/pokemon"; -import { randSeedWeightedItem, randSeedItem, randSeedInt } from "#app/utils"; +import { randSeedWeightedItem, randSeedItem, randSeedInt } from "#app/utils/common"; import type { PersistentModifier } from "#app/modifier/modifier"; import { ArenaTagSide, ArenaTrapTag } from "#app/data/arena-tag"; import { getIsInitialized, initI18n } from "#app/plugins/i18n"; diff --git a/src/game-mode.ts b/src/game-mode.ts index 4779fda50e8..dfe6b8cf123 100644 --- a/src/game-mode.ts +++ b/src/game-mode.ts @@ -7,7 +7,7 @@ import type PokemonSpecies from "./data/pokemon-species"; import { allSpecies } from "./data/pokemon-species"; import type { Arena } from "./field/arena"; import Overrides from "#app/overrides"; -import { randSeedInt, randSeedItem } from "#app/utils"; +import { randSeedInt, randSeedItem } from "#app/utils/common"; import { Biome } from "#enums/biome"; import { Species } from "#enums/species"; import { Challenges } from "./enums/challenges"; diff --git a/src/global-vars/bypass-login.ts b/src/global-vars/bypass-login.ts new file mode 100644 index 00000000000..3595a076101 --- /dev/null +++ b/src/global-vars/bypass-login.ts @@ -0,0 +1 @@ +export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1"; diff --git a/src/global-vars/starter-colors.ts b/src/global-vars/starter-colors.ts new file mode 100644 index 00000000000..6abe028be99 --- /dev/null +++ b/src/global-vars/starter-colors.ts @@ -0,0 +1,4 @@ +export const starterColors: StarterColors = {}; +interface StarterColors { + [key: string]: [string, string]; +} diff --git a/src/inputs-controller.ts b/src/inputs-controller.ts index f92ce3957ab..7fde0f2aca8 100644 --- a/src/inputs-controller.ts +++ b/src/inputs-controller.ts @@ -1,11 +1,11 @@ import Phaser from "phaser"; -import { deepCopy, getEnumValues } from "#app/utils"; +import { deepCopy, getEnumValues } from "#app/utils/common"; import pad_generic from "./configs/inputs/pad_generic"; import pad_unlicensedSNES from "./configs/inputs/pad_unlicensedSNES"; import pad_xbox360 from "./configs/inputs/pad_xbox360"; import pad_dualshock from "./configs/inputs/pad_dualshock"; import pad_procon from "./configs/inputs/pad_procon"; -import { Mode } from "./ui/ui"; +import { UiMode } from "#enums/ui-mode"; import type SettingsGamepadUiHandler from "./ui/settings/settings-gamepad-ui-handler"; import type SettingsKeyboardUiHandler from "./ui/settings/settings-keyboard-ui-handler"; import cfg_keyboard_qwerty from "./configs/inputs/cfg_keyboard_qwerty"; @@ -235,7 +235,7 @@ export class InputsController { if (gamepadName) { this.selectedDevice[Device.GAMEPAD] = gamepadName.toLowerCase(); } - const handler = globalScene.ui?.handlers[Mode.SETTINGS_GAMEPAD] as SettingsGamepadUiHandler; + const handler = globalScene.ui?.handlers[UiMode.SETTINGS_GAMEPAD] as SettingsGamepadUiHandler; handler?.updateChosenGamepadDisplay(); } @@ -248,7 +248,7 @@ export class InputsController { if (layoutKeyboard) { this.selectedDevice[Device.KEYBOARD] = layoutKeyboard.toLowerCase(); } - const handler = globalScene.ui?.handlers[Mode.SETTINGS_KEYBOARD] as SettingsKeyboardUiHandler; + const handler = globalScene.ui?.handlers[UiMode.SETTINGS_KEYBOARD] as SettingsKeyboardUiHandler; handler?.updateChosenKeyboardDisplay(); } @@ -296,7 +296,7 @@ export class InputsController { globalScene.gameData?.saveMappingConfigs(gamepadID, this.configs[gamepadID]); } this.lastSource = "gamepad"; - const handler = globalScene.ui?.handlers[Mode.SETTINGS_GAMEPAD] as SettingsGamepadUiHandler; + const handler = globalScene.ui?.handlers[UiMode.SETTINGS_GAMEPAD] as SettingsGamepadUiHandler; handler?.updateChosenGamepadDisplay(); } @@ -406,7 +406,7 @@ export class InputsController { this.lastSource = "gamepad"; if ( !this.selectedDevice[Device.GAMEPAD] || - (globalScene.ui.getMode() !== Mode.GAMEPAD_BINDING && + (globalScene.ui.getMode() !== UiMode.GAMEPAD_BINDING && this.selectedDevice[Device.GAMEPAD] !== pad.id.toLowerCase()) ) { this.setChosenGamepad(pad.id); diff --git a/src/loading-scene.ts b/src/loading-scene.ts index 4ec2fdf1bb2..914e6e961e2 100644 --- a/src/loading-scene.ts +++ b/src/loading-scene.ts @@ -4,7 +4,7 @@ import CacheBustedLoaderPlugin from "#app/plugins/cache-busted-loader-plugin"; import { SceneBase } from "#app/scene-base"; import { WindowVariant, getWindowVariantSuffix } from "#app/ui/ui-theme"; import { isMobile } from "#app/touch-controls"; -import { localPing, getEnumValues, hasAllLocalizedSprites, getEnumKeys } from "#app/utils"; +import { localPing, getEnumValues, hasAllLocalizedSprites, getEnumKeys } from "#app/utils/common"; import { initPokemonPrevolutions, initPokemonStarters } from "#app/data/balance/pokemon-evolutions"; import { initBiomes } from "#app/data/balance/biomes"; import { initEggMoves } from "#app/data/balance/egg-moves"; diff --git a/src/modifier/modifier-type.ts b/src/modifier/modifier-type.ts index 8feb60c7778..219a6b6344b 100644 --- a/src/modifier/modifier-type.ts +++ b/src/modifier/modifier-type.ts @@ -114,7 +114,7 @@ import { NumberHolder, padInt, randSeedInt, -} from "#app/utils"; +} from "#app/utils/common"; import { Abilities } from "#enums/abilities"; import { BattlerTagType } from "#enums/battler-tag-type"; import { BerryType } from "#enums/berry-type"; diff --git a/src/modifier/modifier.ts b/src/modifier/modifier.ts index 851fa33cedc..3eaf4e3c510 100644 --- a/src/modifier/modifier.ts +++ b/src/modifier/modifier.ts @@ -15,7 +15,7 @@ import { PokemonHealPhase } from "#app/phases/pokemon-heal-phase"; import type { VoucherType } from "#app/system/voucher"; import { Command } from "#app/ui/command-ui-handler"; import { addTextObject, TextStyle } from "#app/ui/text"; -import { BooleanHolder, hslToHex, isNullOrUndefined, NumberHolder, toDmgValue } from "#app/utils"; +import { BooleanHolder, hslToHex, isNullOrUndefined, NumberHolder, toDmgValue } from "#app/utils/common"; import { BattlerTagType } from "#enums/battler-tag-type"; import { BerryType } from "#enums/berry-type"; import type { Moves } from "#enums/moves"; diff --git a/src/phases/attempt-capture-phase.ts b/src/phases/attempt-capture-phase.ts index 78021da4066..795aa7010e1 100644 --- a/src/phases/attempt-capture-phase.ts +++ b/src/phases/attempt-capture-phase.ts @@ -19,7 +19,7 @@ import { achvs } from "#app/system/achv"; import type { PartyOption } from "#app/ui/party-ui-handler"; import { PartyUiMode } from "#app/ui/party-ui-handler"; import { SummaryUiMode } from "#app/ui/summary-ui-handler"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import type { PokeballType } from "#enums/pokeball"; import { StatusEffect } from "#enums/status-effect"; import i18next from "i18next"; @@ -295,7 +295,7 @@ export class AttemptCapturePhase extends PokemonPhase { () => { globalScene.pokemonInfoContainer.makeRoomForConfirmUi(1, true); globalScene.ui.setMode( - Mode.CONFIRM, + UiMode.CONFIRM, () => { const newPokemon = globalScene.addPlayerPokemon( pokemon.species, @@ -310,12 +310,12 @@ export class AttemptCapturePhase extends PokemonPhase { pokemon, ); globalScene.ui.setMode( - Mode.SUMMARY, + UiMode.SUMMARY, newPokemon, 0, SummaryUiMode.DEFAULT, () => { - globalScene.ui.setMode(Mode.MESSAGE).then(() => { + globalScene.ui.setMode(UiMode.MESSAGE).then(() => { promptRelease(); }); }, @@ -329,19 +329,26 @@ export class AttemptCapturePhase extends PokemonPhase { form: pokemon.formIndex, female: pokemon.gender === Gender.FEMALE, }; - globalScene.ui.setOverlayMode(Mode.POKEDEX_PAGE, pokemon.species, attributes, null, null, () => { - globalScene.ui.setMode(Mode.MESSAGE).then(() => { - promptRelease(); - }); - }); + globalScene.ui.setOverlayMode( + UiMode.POKEDEX_PAGE, + pokemon.species, + attributes, + null, + null, + () => { + globalScene.ui.setMode(UiMode.MESSAGE).then(() => { + promptRelease(); + }); + }, + ); }, () => { globalScene.ui.setMode( - Mode.PARTY, + UiMode.PARTY, PartyUiMode.RELEASE, this.fieldIndex, (slotIndex: number, _option: PartyOption) => { - globalScene.ui.setMode(Mode.MESSAGE).then(() => { + globalScene.ui.setMode(UiMode.MESSAGE).then(() => { if (slotIndex < 6) { addToParty(slotIndex); } else { @@ -352,7 +359,7 @@ export class AttemptCapturePhase extends PokemonPhase { ); }, () => { - globalScene.ui.setMode(Mode.MESSAGE).then(() => { + globalScene.ui.setMode(UiMode.MESSAGE).then(() => { removePokemon(); end(); }); diff --git a/src/phases/attempt-run-phase.ts b/src/phases/attempt-run-phase.ts index 5c51e5c589d..eed5c3c522e 100644 --- a/src/phases/attempt-run-phase.ts +++ b/src/phases/attempt-run-phase.ts @@ -9,7 +9,7 @@ import { StatusEffect } from "#enums/status-effect"; import type { PlayerPokemon, EnemyPokemon } from "#app/field/pokemon"; import type Pokemon from "#app/field/pokemon"; import i18next from "i18next"; -import { NumberHolder } from "#app/utils"; +import { NumberHolder } from "#app/utils/common"; import { BattleEndPhase } from "./battle-end-phase"; import { NewBattlePhase } from "./new-battle-phase"; import { PokemonPhase } from "./pokemon-phase"; diff --git a/src/phases/berry-phase.ts b/src/phases/berry-phase.ts index ae593f66f34..b20b1736d4f 100644 --- a/src/phases/berry-phase.ts +++ b/src/phases/berry-phase.ts @@ -4,7 +4,7 @@ import { BerryUsedEvent } from "#app/events/battle-scene"; import { getPokemonNameWithAffix } from "#app/messages"; import { BerryModifier } from "#app/modifier/modifier"; import i18next from "i18next"; -import { BooleanHolder } from "#app/utils"; +import { BooleanHolder } from "#app/utils/common"; import { FieldPhase } from "./field-phase"; import { CommonAnimPhase } from "./common-anim-phase"; import { globalScene } from "#app/global-scene"; diff --git a/src/phases/check-switch-phase.ts b/src/phases/check-switch-phase.ts index ba4837fd7cc..9d73411fd37 100644 --- a/src/phases/check-switch-phase.ts +++ b/src/phases/check-switch-phase.ts @@ -2,7 +2,7 @@ import { globalScene } from "#app/global-scene"; import { BattleStyle } from "#app/enums/battle-style"; import { BattlerTagType } from "#app/enums/battler-tag-type"; import { getPokemonNameWithAffix } from "#app/messages"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import i18next from "i18next"; import { BattlePhase } from "./battle-phase"; import { SummonMissingPhase } from "./summon-missing-phase"; @@ -64,14 +64,14 @@ export class CheckSwitchPhase extends BattlePhase { null, () => { globalScene.ui.setMode( - Mode.CONFIRM, + UiMode.CONFIRM, () => { - globalScene.ui.setMode(Mode.MESSAGE); + globalScene.ui.setMode(UiMode.MESSAGE); globalScene.unshiftPhase(new SwitchPhase(SwitchType.INITIAL_SWITCH, this.fieldIndex, false, true)); this.end(); }, () => { - globalScene.ui.setMode(Mode.MESSAGE); + globalScene.ui.setMode(UiMode.MESSAGE); this.end(); }, ); diff --git a/src/phases/command-phase.ts b/src/phases/command-phase.ts index 30343f92aa3..c3e558e1d86 100644 --- a/src/phases/command-phase.ts +++ b/src/phases/command-phase.ts @@ -15,12 +15,12 @@ import type { PlayerPokemon, TurnMove } from "#app/field/pokemon"; import { FieldPosition } from "#app/field/pokemon"; import { getPokemonNameWithAffix } from "#app/messages"; import { Command } from "#app/ui/command-ui-handler"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import i18next from "i18next"; import { FieldPhase } from "./field-phase"; import { SelectTargetPhase } from "./select-target-phase"; import { MysteryEncounterMode } from "#enums/mystery-encounter-mode"; -import { isNullOrUndefined } from "#app/utils"; +import { isNullOrUndefined } from "#app/utils/common"; import { ArenaTagSide } from "#app/data/arena-tag"; import { ArenaTagType } from "#app/enums/arena-tag-type"; @@ -38,7 +38,7 @@ export class CommandPhase extends FieldPhase { globalScene.updateGameInfo(); - const commandUiHandler = globalScene.ui.handlers[Mode.COMMAND]; + const commandUiHandler = globalScene.ui.handlers[UiMode.COMMAND]; // If one of these conditions is true, we always reset the cursor to Command.FIGHT const cursorResetEvent = @@ -127,7 +127,7 @@ export class CommandPhase extends FieldPhase { ) { this.handleCommand(Command.FIGHT, moveIndex, queuedMove.ignorePP, queuedMove); } else { - globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex); + globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); } } } else { @@ -136,9 +136,9 @@ export class CommandPhase extends FieldPhase { globalScene.currentBattle.mysteryEncounter?.skipToFightInput ) { globalScene.ui.clearText(); - globalScene.ui.setMode(Mode.FIGHT, this.fieldIndex); + globalScene.ui.setMode(UiMode.FIGHT, this.fieldIndex); } else { - globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex); + globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); } } } @@ -209,7 +209,7 @@ export class CommandPhase extends FieldPhase { success = true; } else if (cursor < playerPokemon.getMoveset().length) { const move = playerPokemon.getMoveset()[cursor]; - globalScene.ui.setMode(Mode.MESSAGE); + globalScene.ui.setMode(UiMode.MESSAGE); // Decides between a Disabled, Not Implemented, or No PP translation message const errorMessage = playerPokemon.isMoveRestricted(move.moveId, playerPokemon) @@ -226,7 +226,7 @@ export class CommandPhase extends FieldPhase { null, () => { globalScene.ui.clearText(); - globalScene.ui.setMode(Mode.FIGHT, this.fieldIndex); + globalScene.ui.setMode(UiMode.FIGHT, this.fieldIndex); }, null, true, @@ -244,27 +244,27 @@ export class CommandPhase extends FieldPhase { globalScene.arena.biomeType === Biome.END && (!globalScene.gameMode.isClassic || globalScene.gameMode.isFreshStartChallenge() || notInDex) ) { - globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex); - globalScene.ui.setMode(Mode.MESSAGE); + 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(Mode.COMMAND, this.fieldIndex); + globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); }, null, true, ); } else if (globalScene.currentBattle.battleType === BattleType.TRAINER) { - globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex); - globalScene.ui.setMode(Mode.MESSAGE); + 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(Mode.COMMAND, this.fieldIndex); + globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); }, null, true, @@ -273,14 +273,14 @@ export class CommandPhase extends FieldPhase { globalScene.currentBattle.isBattleMysteryEncounter() && !globalScene.currentBattle.mysteryEncounter!.catchAllowed ) { - globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex); - globalScene.ui.setMode(Mode.MESSAGE); + 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(Mode.COMMAND, this.fieldIndex); + globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); }, null, true, @@ -291,14 +291,14 @@ export class CommandPhase extends FieldPhase { .filter(p => p.isActive(true)) .map(p => p.getBattlerIndex()); if (targets.length > 1) { - globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex); - globalScene.ui.setMode(Mode.MESSAGE); + 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(Mode.COMMAND, this.fieldIndex); + globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); }, null, true, @@ -311,14 +311,14 @@ export class CommandPhase extends FieldPhase { !targetPokemon?.hasAbility(Abilities.WONDER_GUARD, false, true) && cursor < PokeballType.MASTER_BALL ) { - globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex); - globalScene.ui.setMode(Mode.MESSAGE); + 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(Mode.COMMAND, this.fieldIndex); + globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); }, null, true, @@ -347,14 +347,14 @@ export class CommandPhase extends FieldPhase { (arena.biomeType === Biome.END || (!isNullOrUndefined(mysteryEncounterFleeAllowed) && !mysteryEncounterFleeAllowed)) ) { - globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex); - globalScene.ui.setMode(Mode.MESSAGE); + 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(Mode.COMMAND, this.fieldIndex); + globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); }, null, true, @@ -364,14 +364,14 @@ export class CommandPhase extends FieldPhase { (currentBattle.battleType === BattleType.TRAINER || currentBattle.mysteryEncounter?.encounterMode === MysteryEncounterMode.TRAINER_BATTLE) ) { - globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex); - globalScene.ui.setMode(Mode.MESSAGE); + 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(Mode.COMMAND, this.fieldIndex); + globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); }, null, true, @@ -389,7 +389,7 @@ export class CommandPhase extends FieldPhase { } } else if (trappedAbMessages.length > 0) { if (!isSwitch) { - globalScene.ui.setMode(Mode.MESSAGE); + globalScene.ui.setMode(UiMode.MESSAGE); } globalScene.ui.showText( trappedAbMessages[0], @@ -397,7 +397,7 @@ export class CommandPhase extends FieldPhase { () => { globalScene.ui.showText("", 0); if (!isSwitch) { - globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex); + globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); } }, null, @@ -412,8 +412,8 @@ export class CommandPhase extends FieldPhase { break; } if (!isSwitch) { - globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex); - globalScene.ui.setMode(Mode.MESSAGE); + globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); + globalScene.ui.setMode(UiMode.MESSAGE); } const showNoEscapeText = (tag: any) => { globalScene.ui.showText( @@ -429,7 +429,7 @@ export class CommandPhase extends FieldPhase { () => { globalScene.ui.showText("", 0); if (!isSwitch) { - globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex); + globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex); } }, null, @@ -471,6 +471,6 @@ export class CommandPhase extends FieldPhase { } end() { - globalScene.ui.setMode(Mode.MESSAGE).then(() => super.end()); + globalScene.ui.setMode(UiMode.MESSAGE).then(() => super.end()); } } diff --git a/src/phases/damage-anim-phase.ts b/src/phases/damage-anim-phase.ts index 696a2e55b6f..b9581573f2e 100644 --- a/src/phases/damage-anim-phase.ts +++ b/src/phases/damage-anim-phase.ts @@ -2,7 +2,7 @@ import { globalScene } from "#app/global-scene"; import type { BattlerIndex } from "#app/battle"; import { BattleSpec } from "#enums/battle-spec"; import { type DamageResult, HitResult } from "#app/field/pokemon"; -import { fixedInt } from "#app/utils"; +import { fixedInt } from "#app/utils/common"; import { PokemonPhase } from "#app/phases/pokemon-phase"; export class DamageAnimPhase extends PokemonPhase { diff --git a/src/phases/egg-hatch-phase.ts b/src/phases/egg-hatch-phase.ts index 07eeeb0f8ae..69bcf741383 100644 --- a/src/phases/egg-hatch-phase.ts +++ b/src/phases/egg-hatch-phase.ts @@ -8,10 +8,10 @@ import { achvs } from "#app/system/achv"; import EggCounterContainer from "#app/ui/egg-counter-container"; import type EggHatchSceneHandler from "#app/ui/egg-hatch-scene-handler"; import PokemonInfoContainer from "#app/ui/pokemon-info-container"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import i18next from "i18next"; import SoundFade from "phaser3-rex-plugins/plugins/soundfade"; -import { fixedInt, getFrameMs, randInt } from "#app/utils"; +import { fixedInt, getFrameMs, randInt } from "#app/utils/common"; import type { EggLapsePhase } from "./egg-lapse-phase"; import type { EggHatchData } from "#app/data/egg-hatch-data"; import { doShinySparkleAnim } from "#app/field/anims"; @@ -76,7 +76,7 @@ export class EggHatchPhase extends Phase { start() { super.start(); - globalScene.ui.setModeForceTransition(Mode.EGG_HATCH_SCENE).then(() => { + globalScene.ui.setModeForceTransition(UiMode.EGG_HATCH_SCENE).then(() => { if (!this.egg) { return this.end(); } diff --git a/src/phases/egg-lapse-phase.ts b/src/phases/egg-lapse-phase.ts index 397eb970fec..4632e264c1d 100644 --- a/src/phases/egg-lapse-phase.ts +++ b/src/phases/egg-lapse-phase.ts @@ -5,7 +5,7 @@ import { Phase } from "#app/phase"; import i18next from "i18next"; import Overrides from "#app/overrides"; import { EggHatchPhase } from "./egg-hatch-phase"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { achvs } from "#app/system/achv"; import type { PlayerPokemon } from "#app/field/pokemon"; import { EggSummaryPhase } from "./egg-summary-phase"; @@ -41,7 +41,7 @@ export class EggLapsePhase extends Phase { 0, ); globalScene.ui.setModeWithoutClear( - Mode.CONFIRM, + UiMode.CONFIRM, () => { this.hatchEggsSkipped(eggsToHatch); this.showSummary(); diff --git a/src/phases/egg-summary-phase.ts b/src/phases/egg-summary-phase.ts index 9d9259d1e67..d16cafa7611 100644 --- a/src/phases/egg-summary-phase.ts +++ b/src/phases/egg-summary-phase.ts @@ -1,6 +1,6 @@ import { globalScene } from "#app/global-scene"; import { Phase } from "#app/phase"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import type { EggHatchData } from "#app/data/egg-hatch-data"; /** @@ -22,7 +22,7 @@ export class EggSummaryPhase extends Phase { // updates next pokemon once the current update has been completed const updateNextPokemon = (i: number) => { if (i >= this.eggHatchData.length) { - globalScene.ui.setModeForceTransition(Mode.EGG_HATCH_SUMMARY, this.eggHatchData).then(() => { + globalScene.ui.setModeForceTransition(UiMode.EGG_HATCH_SUMMARY, this.eggHatchData).then(() => { globalScene.fadeOutBgm(undefined, false); }); } else { @@ -39,7 +39,7 @@ export class EggSummaryPhase extends Phase { end() { globalScene.time.delayedCall(250, () => globalScene.setModifiersVisible(true)); - globalScene.ui.setModeForceTransition(Mode.MESSAGE).then(() => { + globalScene.ui.setModeForceTransition(UiMode.MESSAGE).then(() => { super.end(); }); } diff --git a/src/phases/encounter-phase.ts b/src/phases/encounter-phase.ts index c196608f91e..6fd11c416a2 100644 --- a/src/phases/encounter-phase.ts +++ b/src/phases/encounter-phase.ts @@ -29,8 +29,8 @@ import { SummonPhase } from "#app/phases/summon-phase"; import { ToggleDoublePositionPhase } from "#app/phases/toggle-double-position-phase"; import { achvs } from "#app/system/achv"; import { handleTutorial, Tutorial } from "#app/tutorial"; -import { Mode } from "#app/ui/ui"; -import { randSeedInt, randSeedItem } from "#app/utils"; +import { UiMode } from "#enums/ui-mode"; +import { randSeedInt, randSeedItem } from "#app/utils/common"; import { BattleSpec } from "#enums/battle-spec"; import { Biome } from "#enums/biome"; import { MysteryEncounterMode } from "#enums/mystery-encounter-mode"; @@ -298,7 +298,7 @@ export class EncounterPhase extends BattlePhase { globalScene.currentBattle.trainer!.genAI(globalScene.getEnemyParty()); } - globalScene.ui.setMode(Mode.MESSAGE).then(() => { + globalScene.ui.setMode(UiMode.MESSAGE).then(() => { if (!this.loaded) { this.trySetWeatherIfNewBiome(); // Set weather before session gets saved // Game syncs to server on waves X1 and X6 (As of 1.2.0) diff --git a/src/phases/end-evolution-phase.ts b/src/phases/end-evolution-phase.ts index e0bdc7e0d68..579920dde90 100644 --- a/src/phases/end-evolution-phase.ts +++ b/src/phases/end-evolution-phase.ts @@ -1,11 +1,11 @@ import { globalScene } from "#app/global-scene"; import { Phase } from "#app/phase"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; export class EndEvolutionPhase extends Phase { start() { super.start(); - globalScene.ui.setModeForceTransition(Mode.MESSAGE).then(() => this.end()); + globalScene.ui.setModeForceTransition(UiMode.MESSAGE).then(() => this.end()); } } diff --git a/src/phases/evolution-phase.ts b/src/phases/evolution-phase.ts index 203c7542eff..7b013555f40 100644 --- a/src/phases/evolution-phase.ts +++ b/src/phases/evolution-phase.ts @@ -5,8 +5,8 @@ import { globalScene } from "#app/global-scene"; import type { SpeciesFormEvolution } from "#app/data/balance/pokemon-evolutions"; import { FusionSpeciesFormEvolution } from "#app/data/balance/pokemon-evolutions"; import type EvolutionSceneHandler from "#app/ui/evolution-scene-handler"; -import { fixedInt, getFrameMs, randInt } from "#app/utils"; -import { Mode } from "#app/ui/ui"; +import { fixedInt, getFrameMs, randInt } from "#app/utils/common"; +import { UiMode } from "#enums/ui-mode"; import { cos, sin } from "#app/field/anims"; import type { PlayerPokemon } from "#app/field/pokemon"; import type Pokemon from "#app/field/pokemon"; @@ -53,7 +53,7 @@ export class EvolutionPhase extends Phase { } setMode(): Promise { - return globalScene.ui.setModeForceTransition(Mode.EVOLUTION_SCENE); + return globalScene.ui.setModeForceTransition(UiMode.EVOLUTION_SCENE); } start() { @@ -280,7 +280,7 @@ export class EvolutionPhase extends Phase { this.end(); }; globalScene.ui.setOverlayMode( - Mode.CONFIRM, + UiMode.CONFIRM, () => { globalScene.ui.revertMode(); this.pokemon.pauseEvolutions = true; diff --git a/src/phases/exp-phase.ts b/src/phases/exp-phase.ts index b7d62c92bcf..8841a90d5b1 100644 --- a/src/phases/exp-phase.ts +++ b/src/phases/exp-phase.ts @@ -2,7 +2,7 @@ import { globalScene } from "#app/global-scene"; import { getPokemonNameWithAffix } from "#app/messages"; import { ExpBoosterModifier } from "#app/modifier/modifier"; import i18next from "i18next"; -import { NumberHolder } from "#app/utils"; +import { NumberHolder } from "#app/utils/common"; import { PlayerPartyMemberPokemonPhase } from "./player-party-member-pokemon-phase"; import { LevelUpPhase } from "./level-up-phase"; diff --git a/src/phases/faint-phase.ts b/src/phases/faint-phase.ts index 2719206a6cc..5a25cf6330d 100644 --- a/src/phases/faint-phase.ts +++ b/src/phases/faint-phase.ts @@ -29,7 +29,7 @@ import { SwitchPhase } from "./switch-phase"; import { SwitchSummonPhase } from "./switch-summon-phase"; import { ToggleDoublePositionPhase } from "./toggle-double-position-phase"; import { VictoryPhase } from "./victory-phase"; -import { isNullOrUndefined } from "#app/utils"; +import { isNullOrUndefined } from "#app/utils/common"; import { FRIENDSHIP_LOSS_FROM_FAINT } from "#app/data/balance/starters"; import { BattlerTagType } from "#enums/battler-tag-type"; diff --git a/src/phases/form-change-phase.ts b/src/phases/form-change-phase.ts index bf94284b117..ac7edadf244 100644 --- a/src/phases/form-change-phase.ts +++ b/src/phases/form-change-phase.ts @@ -1,10 +1,10 @@ import { globalScene } from "#app/global-scene"; -import { fixedInt } from "#app/utils"; +import { fixedInt } from "#app/utils/common"; import { achvs } from "../system/achv"; import type { SpeciesFormChange } from "../data/pokemon-forms"; import { getSpeciesFormChangeMessage } from "../data/pokemon-forms"; import type { PlayerPokemon } from "../field/pokemon"; -import { Mode } from "../ui/ui"; +import { UiMode } from "#enums/ui-mode"; import type PartyUiHandler from "../ui/party-ui-handler"; import { getPokemonNameWithAffix } from "../messages"; import { EndEvolutionPhase } from "./end-evolution-phase"; @@ -31,7 +31,7 @@ export class FormChangePhase extends EvolutionPhase { if (!this.modal) { return super.setMode(); } - return globalScene.ui.setOverlayMode(Mode.EVOLUTION_SCENE); + return globalScene.ui.setOverlayMode(UiMode.EVOLUTION_SCENE); } doEvolution(): void { @@ -181,7 +181,7 @@ export class FormChangePhase extends EvolutionPhase { this.pokemon.findAndRemoveTags(t => t.tagType === BattlerTagType.AUTOTOMIZED); if (this.modal) { globalScene.ui.revertMode().then(() => { - if (globalScene.ui.getMode() === Mode.PARTY) { + if (globalScene.ui.getMode() === UiMode.PARTY) { const partyUiHandler = globalScene.ui.getHandler() as PartyUiHandler; partyUiHandler.clearPartySlots(); partyUiHandler.populatePartySlots(); diff --git a/src/phases/game-over-modifier-reward-phase.ts b/src/phases/game-over-modifier-reward-phase.ts index d0a39a4031a..ab6f6554c99 100644 --- a/src/phases/game-over-modifier-reward-phase.ts +++ b/src/phases/game-over-modifier-reward-phase.ts @@ -1,5 +1,5 @@ import { globalScene } from "#app/global-scene"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import i18next from "i18next"; import { ModifierRewardPhase } from "./modifier-reward-phase"; @@ -10,7 +10,7 @@ export class GameOverModifierRewardPhase extends ModifierRewardPhase { globalScene.addModifier(newModifier); // Sound loaded into game as is globalScene.playSound("level_up_fanfare"); - globalScene.ui.setMode(Mode.MESSAGE); + globalScene.ui.setMode(UiMode.MESSAGE); globalScene.ui.fadeIn(250).then(() => { globalScene.ui.showText( i18next.t("battle:rewardGain", { diff --git a/src/phases/game-over-phase.ts b/src/phases/game-over-phase.ts index 9e79eafe88b..304d876a99e 100644 --- a/src/phases/game-over-phase.ts +++ b/src/phases/game-over-phase.ts @@ -19,8 +19,8 @@ import { SummonPhase } from "#app/phases/summon-phase"; import { UnlockPhase } from "#app/phases/unlock-phase"; import { achvs, ChallengeAchv } from "#app/system/achv"; import { Unlockables } from "#app/system/unlockables"; -import { Mode } from "#app/ui/ui"; -import { isLocal, isLocalServerConnected } from "#app/utils"; +import { UiMode } from "#enums/ui-mode"; +import { isLocal, isLocalServerConnected } from "#app/utils/common"; import { PlayerGender } from "#enums/player-gender"; import { TrainerType } from "#enums/trainer-type"; import i18next from "i18next"; @@ -78,7 +78,7 @@ export class GameOverPhase extends BattlePhase { } else { globalScene.ui.showText(i18next.t("battle:retryBattle"), null, () => { globalScene.ui.setMode( - Mode.CONFIRM, + UiMode.CONFIRM, () => { globalScene.ui.fadeOut(1250).then(() => { globalScene.reset(); diff --git a/src/phases/learn-move-phase.ts b/src/phases/learn-move-phase.ts index 4107a9cf087..515ce492b92 100644 --- a/src/phases/learn-move-phase.ts +++ b/src/phases/learn-move-phase.ts @@ -8,7 +8,7 @@ import { getPokemonNameWithAffix } from "#app/messages"; import Overrides from "#app/overrides"; import EvolutionSceneHandler from "#app/ui/evolution-scene-handler"; import { SummaryUiMode } from "#app/ui/summary-ui-handler"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import i18next from "i18next"; import { PlayerPartyMemberPokemonPhase } from "#app/phases/player-party-member-pokemon-phase"; import type Pokemon from "#app/field/pokemon"; @@ -25,7 +25,7 @@ export enum LearnMoveType { export class LearnMovePhase extends PlayerPartyMemberPokemonPhase { private moveId: Moves; - private messageMode: Mode; + private messageMode: UiMode; private learnMoveType: LearnMoveType; private cost: number; @@ -55,7 +55,7 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase { } this.messageMode = - globalScene.ui.getHandler() instanceof EvolutionSceneHandler ? Mode.EVOLUTION_SCENE : Mode.MESSAGE; + globalScene.ui.getHandler() instanceof EvolutionSceneHandler ? UiMode.EVOLUTION_SCENE : UiMode.MESSAGE; globalScene.ui.setMode(this.messageMode); // If the Pokemon has less than 4 moves, the new move is added to the largest empty moveset index // If it has 4 moves, the phase then checks if the player wants to replace the move itself. @@ -90,7 +90,7 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase { await globalScene.ui.showTextPromise(preQText); await globalScene.ui.showTextPromise(shouldReplaceQ, undefined, false); await globalScene.ui.setModeWithoutClear( - Mode.CONFIRM, + UiMode.CONFIRM, () => this.forgetMoveProcess(move, pokemon), // Yes () => { // No @@ -115,7 +115,7 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase { globalScene.ui.setMode(this.messageMode); await globalScene.ui.showTextPromise(i18next.t("battle:learnMoveForgetQuestion"), undefined, true); await globalScene.ui.setModeWithoutClear( - Mode.SUMMARY, + UiMode.SUMMARY, pokemon, SummaryUiMode.LEARN_MOVE, move, @@ -153,7 +153,7 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase { false, ); globalScene.ui.setModeWithoutClear( - Mode.CONFIRM, + UiMode.CONFIRM, () => { globalScene.ui.setMode(this.messageMode); globalScene.ui @@ -228,7 +228,7 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase { globalScene.triggerPokemonFormChange(pokemon, SpeciesFormChangeMoveLearnedTrigger, true); this.end(); }, - this.messageMode === Mode.EVOLUTION_SCENE ? 1000 : undefined, + this.messageMode === UiMode.EVOLUTION_SCENE ? 1000 : undefined, true, ); } diff --git a/src/phases/level-cap-phase.ts b/src/phases/level-cap-phase.ts index 567ac922124..6f3fa6fdb39 100644 --- a/src/phases/level-cap-phase.ts +++ b/src/phases/level-cap-phase.ts @@ -1,5 +1,5 @@ import { globalScene } from "#app/global-scene"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import i18next from "i18next"; import { FieldPhase } from "./field-phase"; @@ -7,7 +7,7 @@ export class LevelCapPhase extends FieldPhase { start(): void { super.start(); - globalScene.ui.setMode(Mode.MESSAGE).then(() => { + globalScene.ui.setMode(UiMode.MESSAGE).then(() => { // Sound loaded into game as is globalScene.playSound("level_up_fanfare"); globalScene.ui.showText( diff --git a/src/phases/level-up-phase.ts b/src/phases/level-up-phase.ts index c6ca17d583e..8c4f4f58095 100644 --- a/src/phases/level-up-phase.ts +++ b/src/phases/level-up-phase.ts @@ -6,7 +6,7 @@ import { EvolutionPhase } from "#app/phases/evolution-phase"; import { LearnMovePhase } from "#app/phases/learn-move-phase"; import { PlayerPartyMemberPokemonPhase } from "#app/phases/player-party-member-pokemon-phase"; import { LevelAchv } from "#app/system/achv"; -import { NumberHolder } from "#app/utils"; +import { NumberHolder } from "#app/utils/common"; import i18next from "i18next"; export class LevelUpPhase extends PlayerPartyMemberPokemonPhase { @@ -71,7 +71,7 @@ export class LevelUpPhase extends PlayerPartyMemberPokemonPhase { if (!this.pokemon.pauseEvolutions) { const evolution = this.pokemon.getEvolution(); if (evolution) { - this.pokemon.breakIllusion() + this.pokemon.breakIllusion(); globalScene.unshiftPhase(new EvolutionPhase(this.pokemon, evolution, this.lastLevel)); } } diff --git a/src/phases/login-phase.ts b/src/phases/login-phase.ts index 846482ff726..673b94b1148 100644 --- a/src/phases/login-phase.ts +++ b/src/phases/login-phase.ts @@ -1,11 +1,12 @@ import { updateUserInfo } from "#app/account"; -import { bypassLogin } from "#app/battle-scene"; +import { bypassLogin } from "#app/global-vars/bypass-login"; import { globalScene } from "#app/global-scene"; import { Phase } from "#app/phase"; import { handleTutorial, Tutorial } from "#app/tutorial"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import i18next, { t } from "i18next"; -import { getCookie, sessionIdKey, executeIf, removeCookie } from "#app/utils"; +import { sessionIdKey, executeIf } from "#app/utils/common"; +import { getCookie, removeCookie } from "#app/utils/cookies"; import { SelectGenderPhase } from "./select-gender-phase"; import { UnavailablePhase } from "./unavailable-phase"; @@ -23,7 +24,7 @@ export class LoginPhase extends Phase { const hasSession = !!getCookie(sessionIdKey); - globalScene.ui.setMode(Mode.LOADING, { buttonActions: [] }); + globalScene.ui.setMode(UiMode.LOADING, { buttonActions: [] }); executeIf(bypassLogin || hasSession, updateUserInfo).then(response => { const success = response ? response[0] : false; const statusCode = response ? response[1] : null; @@ -46,7 +47,7 @@ export class LoginPhase extends Phase { }); }; - globalScene.ui.setMode(Mode.LOGIN_FORM, { + globalScene.ui.setMode(UiMode.LOGIN_FORM, { buttonActions: [ () => { globalScene.ui.playSelect(); @@ -54,7 +55,7 @@ export class LoginPhase extends Phase { }, () => { globalScene.playSound("menu_open"); - globalScene.ui.setMode(Mode.REGISTRATION_FORM, { + globalScene.ui.setMode(UiMode.REGISTRATION_FORM, { buttonActions: [ () => { globalScene.ui.playSelect(); @@ -101,7 +102,7 @@ export class LoginPhase extends Phase { if (success || bypassLogin) { this.end(); } else { - globalScene.ui.setMode(Mode.MESSAGE); + globalScene.ui.setMode(UiMode.MESSAGE); globalScene.ui.showText(t("menu:failedToLoadSaveData")); } }); @@ -109,7 +110,7 @@ export class LoginPhase extends Phase { } end(): void { - globalScene.ui.setMode(Mode.MESSAGE); + globalScene.ui.setMode(UiMode.MESSAGE); if (!globalScene.gameData.gender) { globalScene.unshiftPhase(new SelectGenderPhase()); diff --git a/src/phases/money-reward-phase.ts b/src/phases/money-reward-phase.ts index ae8dc90616d..708bb3a2fa8 100644 --- a/src/phases/money-reward-phase.ts +++ b/src/phases/money-reward-phase.ts @@ -2,7 +2,7 @@ import { globalScene } from "#app/global-scene"; import { ArenaTagType } from "#app/enums/arena-tag-type"; import { MoneyMultiplierModifier } from "#app/modifier/modifier"; import i18next from "i18next"; -import { NumberHolder } from "#app/utils"; +import { NumberHolder } from "#app/utils/common"; import { BattlePhase } from "./battle-phase"; export class MoneyRewardPhase extends BattlePhase { diff --git a/src/phases/move-charge-phase.ts b/src/phases/move-charge-phase.ts index 26ad85bbe03..ea43f1ddb88 100644 --- a/src/phases/move-charge-phase.ts +++ b/src/phases/move-charge-phase.ts @@ -5,7 +5,7 @@ import { applyMoveChargeAttrs, MoveEffectAttr, InstantChargeAttr } from "#app/da import type { PokemonMove } from "#app/field/pokemon"; import type Pokemon from "#app/field/pokemon"; import { MoveResult } from "#app/field/pokemon"; -import { BooleanHolder } from "#app/utils"; +import { BooleanHolder } from "#app/utils/common"; import { MovePhase } from "#app/phases/move-phase"; import { PokemonPhase } from "#app/phases/pokemon-phase"; import { BattlerTagType } from "#enums/battler-tag-type"; diff --git a/src/phases/move-effect-phase.ts b/src/phases/move-effect-phase.ts index 3a4e5f32ede..c29e3fe5cda 100644 --- a/src/phases/move-effect-phase.ts +++ b/src/phases/move-effect-phase.ts @@ -61,8 +61,8 @@ import { PokemonMultiHitModifier, } from "#app/modifier/modifier"; import { PokemonPhase } from "#app/phases/pokemon-phase"; -import { BooleanHolder, isNullOrUndefined, NumberHolder } from "#app/utils"; -import type { nil } from "#app/utils"; +import { BooleanHolder, isNullOrUndefined, NumberHolder } from "#app/utils/common"; +import type { nil } from "#app/utils/common"; import { BattlerTagType } from "#enums/battler-tag-type"; import type { Moves } from "#enums/moves"; import i18next from "i18next"; diff --git a/src/phases/move-phase.ts b/src/phases/move-phase.ts index dc394b8a134..f42a2aefa34 100644 --- a/src/phases/move-phase.ts +++ b/src/phases/move-phase.ts @@ -43,7 +43,7 @@ import { CommonAnimPhase } from "#app/phases/common-anim-phase"; import { MoveChargePhase } from "#app/phases/move-charge-phase"; import { MoveEffectPhase } from "#app/phases/move-effect-phase"; import { MoveEndPhase } from "#app/phases/move-end-phase"; -import { NumberHolder } from "#app/utils"; +import { NumberHolder } from "#app/utils/common"; import { Abilities } from "#enums/abilities"; import { ArenaTagType } from "#enums/arena-tag-type"; import { BattlerTagType } from "#enums/battler-tag-type"; diff --git a/src/phases/mystery-encounter-phases.ts b/src/phases/mystery-encounter-phases.ts index f42290ff872..100be47e4e9 100644 --- a/src/phases/mystery-encounter-phases.ts +++ b/src/phases/mystery-encounter-phases.ts @@ -25,8 +25,8 @@ import { transitionMysteryEncounterIntroVisuals } from "../data/mystery-encounte import { TrainerSlot } from "#enums/trainer-slot"; import { IvScannerModifier } from "../modifier/modifier"; import { Phase } from "../phase"; -import { Mode } from "../ui/ui"; -import { isNullOrUndefined, randSeedItem } from "#app/utils"; +import { UiMode } from "#enums/ui-mode"; +import { isNullOrUndefined, randSeedItem } from "#app/utils/common"; /** * Will handle (in order): @@ -72,7 +72,7 @@ export class MysteryEncounterPhase extends Phase { } // Initiates encounter dialogue window and option select - globalScene.ui.setMode(Mode.MYSTERY_ENCOUNTER, this.optionSelectSettings); + globalScene.ui.setMode(UiMode.MYSTERY_ENCOUNTER, this.optionSelectSettings); } /** @@ -130,7 +130,7 @@ export class MysteryEncounterPhase extends Phase { const optionSelectDialogue = globalScene.currentBattle?.mysteryEncounter?.selectedOption?.dialogue; if (optionSelectDialogue?.selected && optionSelectDialogue.selected.length > 0) { // Handle intermediate dialogue (between player selection event and the onOptionSelect logic) - globalScene.ui.setMode(Mode.MESSAGE); + globalScene.ui.setMode(UiMode.MESSAGE); const selectedDialogue = optionSelectDialogue.selected; let i = 0; const showNextDialogue = () => { @@ -167,7 +167,7 @@ export class MysteryEncounterPhase extends Phase { * Ends phase */ end() { - globalScene.ui.setMode(Mode.MESSAGE).then(() => super.end()); + globalScene.ui.setMode(UiMode.MESSAGE).then(() => super.end()); } } @@ -629,7 +629,7 @@ export class PostMysteryEncounterPhase extends Phase { } i++; - globalScene.ui.setMode(Mode.MESSAGE); + globalScene.ui.setMode(UiMode.MESSAGE); if (title) { globalScene.ui.showDialogue( text ?? "", diff --git a/src/phases/obtain-status-effect-phase.ts b/src/phases/obtain-status-effect-phase.ts index 10ae195b02f..47cae2dcbf6 100644 --- a/src/phases/obtain-status-effect-phase.ts +++ b/src/phases/obtain-status-effect-phase.ts @@ -8,7 +8,7 @@ import { getPokemonNameWithAffix } from "#app/messages"; import { PokemonPhase } from "./pokemon-phase"; import { SpeciesFormChangeStatusEffectTrigger } from "#app/data/pokemon-forms"; import { applyPostSetStatusAbAttrs, PostSetStatusAbAttr } from "#app/data/abilities/ability"; -import { isNullOrUndefined } from "#app/utils"; +import { isNullOrUndefined } from "#app/utils/common"; export class ObtainStatusEffectPhase extends PokemonPhase { private statusEffect?: StatusEffect; diff --git a/src/phases/party-heal-phase.ts b/src/phases/party-heal-phase.ts index 137af9f3a2d..a208ccfff92 100644 --- a/src/phases/party-heal-phase.ts +++ b/src/phases/party-heal-phase.ts @@ -1,5 +1,5 @@ import { globalScene } from "#app/global-scene"; -import { fixedInt } from "#app/utils"; +import { fixedInt } from "#app/utils/common"; import { BattlePhase } from "./battle-phase"; export class PartyHealPhase extends BattlePhase { diff --git a/src/phases/pokemon-anim-phase.ts b/src/phases/pokemon-anim-phase.ts index f0693a52aaa..1889b238f05 100644 --- a/src/phases/pokemon-anim-phase.ts +++ b/src/phases/pokemon-anim-phase.ts @@ -2,7 +2,7 @@ import { globalScene } from "#app/global-scene"; import { SubstituteTag } from "#app/data/battler-tags"; import type Pokemon from "#app/field/pokemon"; import { BattlePhase } from "#app/phases/battle-phase"; -import { isNullOrUndefined } from "#app/utils"; +import { isNullOrUndefined } from "#app/utils/common"; import { PokemonAnimType } from "#enums/pokemon-anim-type"; import { Species } from "#enums/species"; diff --git a/src/phases/pokemon-heal-phase.ts b/src/phases/pokemon-heal-phase.ts index 651c625b23a..7cb013251f6 100644 --- a/src/phases/pokemon-heal-phase.ts +++ b/src/phases/pokemon-heal-phase.ts @@ -8,7 +8,7 @@ import { getPokemonNameWithAffix } from "#app/messages"; import { HealingBoosterModifier } from "#app/modifier/modifier"; import { HealAchv } from "#app/system/achv"; import i18next from "i18next"; -import { NumberHolder } from "#app/utils"; +import { NumberHolder } from "#app/utils/common"; import { CommonAnimPhase } from "./common-anim-phase"; import { BattlerTagType } from "#app/enums/battler-tag-type"; import type { HealBlockTag } from "#app/data/battler-tags"; diff --git a/src/phases/post-turn-status-effect-phase.ts b/src/phases/post-turn-status-effect-phase.ts index af9a9ac1c29..9b530d48196 100644 --- a/src/phases/post-turn-status-effect-phase.ts +++ b/src/phases/post-turn-status-effect-phase.ts @@ -13,7 +13,7 @@ import { getStatusEffectActivationText } from "#app/data/status-effect"; import { BattleSpec } from "#app/enums/battle-spec"; import { StatusEffect } from "#app/enums/status-effect"; import { getPokemonNameWithAffix } from "#app/messages"; -import { BooleanHolder, NumberHolder } from "#app/utils"; +import { BooleanHolder, NumberHolder } from "#app/utils/common"; import { PokemonPhase } from "./pokemon-phase"; export class PostTurnStatusEffectPhase extends PokemonPhase { diff --git a/src/phases/reload-session-phase.ts b/src/phases/reload-session-phase.ts index a7ac0002b03..8cd5f67b43a 100644 --- a/src/phases/reload-session-phase.ts +++ b/src/phases/reload-session-phase.ts @@ -1,7 +1,7 @@ import { globalScene } from "#app/global-scene"; import { Phase } from "#app/phase"; -import { Mode } from "#app/ui/ui"; -import { fixedInt } from "#app/utils"; +import { UiMode } from "#enums/ui-mode"; +import { fixedInt } from "#app/utils/common"; export class ReloadSessionPhase extends Phase { private systemDataStr?: string; @@ -13,7 +13,7 @@ export class ReloadSessionPhase extends Phase { } start(): void { - globalScene.ui.setMode(Mode.SESSION_RELOAD); + globalScene.ui.setMode(UiMode.SESSION_RELOAD); let delayElapsed = false; let loaded = false; diff --git a/src/phases/revival-blessing-phase.ts b/src/phases/revival-blessing-phase.ts index f6fe4d9a3ee..2de1c616f69 100644 --- a/src/phases/revival-blessing-phase.ts +++ b/src/phases/revival-blessing-phase.ts @@ -2,9 +2,9 @@ import { SwitchType } from "#enums/switch-type"; import { globalScene } from "#app/global-scene"; import type { PartyOption } from "#app/ui/party-ui-handler"; import PartyUiHandler, { PartyUiMode } from "#app/ui/party-ui-handler"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import i18next from "i18next"; -import { toDmgValue, isNullOrUndefined } from "#app/utils"; +import { toDmgValue, isNullOrUndefined } from "#app/utils/common"; import { BattlePhase } from "#app/phases/battle-phase"; import { SwitchSummonPhase } from "#app/phases/switch-summon-phase"; import { ToggleDoublePositionPhase } from "#app/phases/toggle-double-position-phase"; @@ -21,7 +21,7 @@ export class RevivalBlessingPhase extends BattlePhase { public override start(): void { globalScene.ui.setMode( - Mode.PARTY, + UiMode.PARTY, PartyUiMode.REVIVAL_BLESSING, this.user.getFieldIndex(), (slotIndex: integer, _option: PartyOption) => { @@ -63,7 +63,7 @@ export class RevivalBlessingPhase extends BattlePhase { } } } - globalScene.ui.setMode(Mode.MESSAGE).then(() => this.end()); + globalScene.ui.setMode(UiMode.MESSAGE).then(() => this.end()); }, PartyUiHandler.FilterFainted, ); diff --git a/src/phases/ribbon-modifier-reward-phase.ts b/src/phases/ribbon-modifier-reward-phase.ts index 0ee38250ce1..21114ab3de9 100644 --- a/src/phases/ribbon-modifier-reward-phase.ts +++ b/src/phases/ribbon-modifier-reward-phase.ts @@ -1,7 +1,7 @@ import { globalScene } from "#app/global-scene"; import type PokemonSpecies from "#app/data/pokemon-species"; import type { ModifierTypeFunc } from "#app/modifier/modifier-type"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import i18next from "i18next"; import { ModifierRewardPhase } from "./modifier-reward-phase"; @@ -19,7 +19,7 @@ export class RibbonModifierRewardPhase extends ModifierRewardPhase { const newModifier = this.modifierType.newModifier(); globalScene.addModifier(newModifier); globalScene.playSound("level_up_fanfare"); - globalScene.ui.setMode(Mode.MESSAGE); + globalScene.ui.setMode(UiMode.MESSAGE); globalScene.ui.showText( i18next.t("battle:beatModeFirstTime", { speciesName: this.species.name, diff --git a/src/phases/scan-ivs-phase.ts b/src/phases/scan-ivs-phase.ts index aaeeb7f84f8..d79a32bd47e 100644 --- a/src/phases/scan-ivs-phase.ts +++ b/src/phases/scan-ivs-phase.ts @@ -3,7 +3,7 @@ import type { BattlerIndex } from "#app/battle"; import { PERMANENT_STATS, Stat } from "#app/enums/stat"; import { getPokemonNameWithAffix } from "#app/messages"; import { getTextColor, TextStyle } from "#app/ui/text"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import i18next from "i18next"; import { PokemonPhase } from "./pokemon-phase"; @@ -51,9 +51,9 @@ export class ScanIvsPhase extends PokemonPhase { null, () => { globalScene.ui.setMode( - Mode.CONFIRM, + UiMode.CONFIRM, () => { - globalScene.ui.setMode(Mode.MESSAGE); + globalScene.ui.setMode(UiMode.MESSAGE); globalScene.ui.clearText(); globalScene.ui .getMessageHandler() @@ -61,7 +61,7 @@ export class ScanIvsPhase extends PokemonPhase { .then(() => this.end()); }, () => { - globalScene.ui.setMode(Mode.MESSAGE); + globalScene.ui.setMode(UiMode.MESSAGE); globalScene.ui.clearText(); this.end(); }, diff --git a/src/phases/select-biome-phase.ts b/src/phases/select-biome-phase.ts index b27e2d0e7cc..0ea2841a2d3 100644 --- a/src/phases/select-biome-phase.ts +++ b/src/phases/select-biome-phase.ts @@ -3,9 +3,9 @@ import { biomeLinks, getBiomeName } from "#app/data/balance/biomes"; import { Biome } from "#app/enums/biome"; import { MoneyInterestModifier, MapModifier } from "#app/modifier/modifier"; import type { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { BattlePhase } from "./battle-phase"; -import { randSeedInt } from "#app/utils"; +import { randSeedInt } from "#app/utils/common"; import { PartyHealPhase } from "./party-heal-phase"; import { SwitchBiomePhase } from "./switch-biome-phase"; @@ -42,14 +42,14 @@ export class SelectBiomePhase extends BattlePhase { const ret: OptionSelectItem = { label: getBiomeName(b), handler: () => { - globalScene.ui.setMode(Mode.MESSAGE); + globalScene.ui.setMode(UiMode.MESSAGE); setNextBiome(b); return true; }, }; return ret; }); - globalScene.ui.setMode(Mode.OPTION_SELECT, { + globalScene.ui.setMode(UiMode.OPTION_SELECT, { options: biomeSelectItems, delay: 1000, }); diff --git a/src/phases/select-challenge-phase.ts b/src/phases/select-challenge-phase.ts index 5e6f20f93ee..76ac8a60c4f 100644 --- a/src/phases/select-challenge-phase.ts +++ b/src/phases/select-challenge-phase.ts @@ -1,6 +1,6 @@ import { globalScene } from "#app/global-scene"; import { Phase } from "#app/phase"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; export class SelectChallengePhase extends Phase { start() { @@ -8,6 +8,6 @@ export class SelectChallengePhase extends Phase { globalScene.playBgm("menu"); - globalScene.ui.setMode(Mode.CHALLENGE_SELECT); + globalScene.ui.setMode(UiMode.CHALLENGE_SELECT); } } diff --git a/src/phases/select-gender-phase.ts b/src/phases/select-gender-phase.ts index 4da60b38aa1..a1171c1a5db 100644 --- a/src/phases/select-gender-phase.ts +++ b/src/phases/select-gender-phase.ts @@ -2,7 +2,7 @@ import { globalScene } from "#app/global-scene"; import { PlayerGender } from "#app/enums/player-gender"; import { Phase } from "#app/phase"; import { SettingKeys } from "#app/system/settings/settings"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import i18next from "i18next"; export class SelectGenderPhase extends Phase { @@ -10,7 +10,7 @@ export class SelectGenderPhase extends Phase { super.start(); globalScene.ui.showText(i18next.t("menu:boyOrGirl"), null, () => { - globalScene.ui.setMode(Mode.OPTION_SELECT, { + globalScene.ui.setMode(UiMode.OPTION_SELECT, { options: [ { label: i18next.t("settings:boy"), @@ -36,7 +36,7 @@ export class SelectGenderPhase extends Phase { } end(): void { - globalScene.ui.setMode(Mode.MESSAGE); + globalScene.ui.setMode(UiMode.MESSAGE); super.end(); } } diff --git a/src/phases/select-modifier-phase.ts b/src/phases/select-modifier-phase.ts index 27ab7e374a2..5f11441333b 100644 --- a/src/phases/select-modifier-phase.ts +++ b/src/phases/select-modifier-phase.ts @@ -24,12 +24,12 @@ import { import type ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler"; import { SHOP_OPTIONS_ROW_LIMIT } from "#app/ui/modifier-select-ui-handler"; import PartyUiHandler, { PartyUiMode, PartyOption } from "#app/ui/party-ui-handler"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import i18next from "i18next"; import { BattlePhase } from "./battle-phase"; import Overrides from "#app/overrides"; import type { CustomModifierSettings } from "#app/modifier/modifier-type"; -import { isNullOrUndefined, NumberHolder } from "#app/utils"; +import { isNullOrUndefined, NumberHolder } from "#app/utils/common"; export class SelectModifierPhase extends BattlePhase { private rerollCount: number; @@ -92,15 +92,15 @@ export class SelectModifierPhase extends BattlePhase { if (rowCursor < 0 || cursor < 0) { globalScene.ui.showText(i18next.t("battle:skipItemQuestion"), null, () => { globalScene.ui.setOverlayMode( - Mode.CONFIRM, + UiMode.CONFIRM, () => { globalScene.ui.revertMode(); - globalScene.ui.setMode(Mode.MESSAGE); + globalScene.ui.setMode(UiMode.MESSAGE); super.end(); }, () => globalScene.ui.setMode( - Mode.MODIFIER_SELECT, + UiMode.MODIFIER_SELECT, this.isPlayer(), this.typeOptions, modifierSelectCallback, @@ -129,7 +129,7 @@ export class SelectModifierPhase extends BattlePhase { ), ); globalScene.ui.clearText(); - globalScene.ui.setMode(Mode.MESSAGE).then(() => super.end()); + globalScene.ui.setMode(UiMode.MESSAGE).then(() => super.end()); if (!Overrides.WAIVE_ROLL_FEE_OVERRIDE) { globalScene.money -= rerollCost; globalScene.updateMoneyText(); @@ -139,7 +139,7 @@ export class SelectModifierPhase extends BattlePhase { break; case 1: globalScene.ui.setModeWithoutClear( - Mode.PARTY, + UiMode.PARTY, PartyUiMode.MODIFIER_TRANSFER, -1, (fromSlotIndex: number, itemIndex: number, itemQuantity: number, toSlotIndex: number) => { @@ -168,7 +168,7 @@ export class SelectModifierPhase extends BattlePhase { ); } else { globalScene.ui.setMode( - Mode.MODIFIER_SELECT, + UiMode.MODIFIER_SELECT, this.isPlayer(), this.typeOptions, modifierSelectCallback, @@ -180,9 +180,9 @@ export class SelectModifierPhase extends BattlePhase { ); break; case 2: - globalScene.ui.setModeWithoutClear(Mode.PARTY, PartyUiMode.CHECK, -1, () => { + globalScene.ui.setModeWithoutClear(UiMode.PARTY, PartyUiMode.CHECK, -1, () => { globalScene.ui.setMode( - Mode.MODIFIER_SELECT, + UiMode.MODIFIER_SELECT, this.isPlayer(), this.typeOptions, modifierSelectCallback, @@ -207,7 +207,7 @@ export class SelectModifierPhase extends BattlePhase { case 1: if (this.typeOptions.length === 0) { globalScene.ui.clearText(); - globalScene.ui.setMode(Mode.MESSAGE); + globalScene.ui.setMode(UiMode.MESSAGE); super.end(); return true; } @@ -263,7 +263,7 @@ export class SelectModifierPhase extends BattlePhase { } } else { globalScene.ui.clearText(); - globalScene.ui.setMode(Mode.MESSAGE); + globalScene.ui.setMode(UiMode.MESSAGE); super.end(); } }; @@ -272,7 +272,7 @@ export class SelectModifierPhase extends BattlePhase { //TODO: is the bang correct? if (modifierType instanceof FusePokemonModifierType) { globalScene.ui.setModeWithoutClear( - Mode.PARTY, + UiMode.PARTY, PartyUiMode.SPLICE, -1, (fromSlotIndex: number, spliceSlotIndex: number) => { @@ -282,13 +282,13 @@ export class SelectModifierPhase extends BattlePhase { spliceSlotIndex < 6 && fromSlotIndex !== spliceSlotIndex ) { - globalScene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer()).then(() => { + globalScene.ui.setMode(UiMode.MODIFIER_SELECT, this.isPlayer()).then(() => { const modifier = modifierType.newModifier(party[fromSlotIndex], party[spliceSlotIndex])!; //TODO: is the bang correct? applyModifier(modifier, true); }); } else { globalScene.ui.setMode( - Mode.MODIFIER_SELECT, + UiMode.MODIFIER_SELECT, this.isPlayer(), this.typeOptions, modifierSelectCallback, @@ -314,12 +314,12 @@ export class SelectModifierPhase extends BattlePhase { : PartyUiMode.MODIFIER; const tmMoveId = isTmModifier ? (modifierType as TmModifierType).moveId : undefined; globalScene.ui.setModeWithoutClear( - Mode.PARTY, + UiMode.PARTY, partyUiMode, -1, (slotIndex: number, option: PartyOption) => { if (slotIndex < 6) { - globalScene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer()).then(() => { + globalScene.ui.setMode(UiMode.MODIFIER_SELECT, this.isPlayer()).then(() => { const modifier = !isMoveModifier ? !isRememberMoveModifier ? modifierType.newModifier(party[slotIndex]) @@ -329,7 +329,7 @@ export class SelectModifierPhase extends BattlePhase { }); } else { globalScene.ui.setMode( - Mode.MODIFIER_SELECT, + UiMode.MODIFIER_SELECT, this.isPlayer(), this.typeOptions, modifierSelectCallback, @@ -352,7 +352,7 @@ export class SelectModifierPhase extends BattlePhase { return !cost!; // TODO: is the bang correct? }; globalScene.ui.setMode( - Mode.MODIFIER_SELECT, + UiMode.MODIFIER_SELECT, this.isPlayer(), this.typeOptions, modifierSelectCallback, diff --git a/src/phases/select-starter-phase.ts b/src/phases/select-starter-phase.ts index 35511531609..0a76df31a2c 100644 --- a/src/phases/select-starter-phase.ts +++ b/src/phases/select-starter-phase.ts @@ -9,10 +9,10 @@ import { Phase } from "#app/phase"; import { TitlePhase } from "#app/phases/title-phase"; import { SaveSlotUiMode } from "#app/ui/save-slot-select-ui-handler"; import type { Starter } from "#app/ui/starter-select-ui-handler"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import type { Species } from "#enums/species"; import SoundFade from "phaser3-rex-plugins/plugins/soundfade"; -import { isNullOrUndefined } from "#app/utils"; +import { isNullOrUndefined } from "#app/utils/common"; export class SelectStarterPhase extends Phase { start() { @@ -20,9 +20,9 @@ export class SelectStarterPhase extends Phase { globalScene.playBgm("menu"); - globalScene.ui.setMode(Mode.STARTER_SELECT, (starters: Starter[]) => { + globalScene.ui.setMode(UiMode.STARTER_SELECT, (starters: Starter[]) => { globalScene.ui.clearText(); - globalScene.ui.setMode(Mode.SAVE_SLOT, SaveSlotUiMode.SAVE, (slotId: number) => { + globalScene.ui.setMode(UiMode.SAVE_SLOT, SaveSlotUiMode.SAVE, (slotId: number) => { if (slotId === -1) { globalScene.clearPhaseQueue(); globalScene.pushPhase(new TitlePhase()); diff --git a/src/phases/select-target-phase.ts b/src/phases/select-target-phase.ts index 035eaff41fa..c969b9ca421 100644 --- a/src/phases/select-target-phase.ts +++ b/src/phases/select-target-phase.ts @@ -1,7 +1,7 @@ import { globalScene } from "#app/global-scene"; import type { BattlerIndex } from "#app/battle"; import { Command } from "#app/ui/command-ui-handler"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { CommandPhase } from "./command-phase"; import { PokemonPhase } from "./pokemon-phase"; import i18next from "#app/plugins/i18n"; @@ -18,8 +18,8 @@ export class SelectTargetPhase extends PokemonPhase { const turnCommand = globalScene.currentBattle.turnCommands[this.fieldIndex]; const move = turnCommand?.move?.move; - globalScene.ui.setMode(Mode.TARGET_SELECT, this.fieldIndex, move, (targets: BattlerIndex[]) => { - globalScene.ui.setMode(Mode.MESSAGE); + globalScene.ui.setMode(UiMode.TARGET_SELECT, this.fieldIndex, move, (targets: BattlerIndex[]) => { + globalScene.ui.setMode(UiMode.MESSAGE); const fieldSide = globalScene.getField(); const user = fieldSide[this.fieldIndex]; const moveObject = allMoves[move!]; diff --git a/src/phases/show-party-exp-bar-phase.ts b/src/phases/show-party-exp-bar-phase.ts index 139f4efcc49..89bec6d8fdd 100644 --- a/src/phases/show-party-exp-bar-phase.ts +++ b/src/phases/show-party-exp-bar-phase.ts @@ -2,7 +2,7 @@ import { globalScene } from "#app/global-scene"; import { ExpGainsSpeed } from "#app/enums/exp-gains-speed"; import { ExpNotification } from "#app/enums/exp-notification"; import { ExpBoosterModifier } from "#app/modifier/modifier"; -import { NumberHolder } from "#app/utils"; +import { NumberHolder } from "#app/utils/common"; import { HidePartyExpBarPhase } from "./hide-party-exp-bar-phase"; import { LevelUpPhase } from "./level-up-phase"; import { PlayerPartyMemberPokemonPhase } from "./player-party-member-pokemon-phase"; diff --git a/src/phases/stat-stage-change-phase.ts b/src/phases/stat-stage-change-phase.ts index f52e4fb06a0..9d64a81bbb4 100644 --- a/src/phases/stat-stage-change-phase.ts +++ b/src/phases/stat-stage-change-phase.ts @@ -17,7 +17,7 @@ import type Pokemon from "#app/field/pokemon"; import { getPokemonNameWithAffix } from "#app/messages"; import { ResetNegativeStatStageModifier } from "#app/modifier/modifier"; import { handleTutorial, Tutorial } from "#app/tutorial"; -import { NumberHolder, BooleanHolder, isNullOrUndefined } from "#app/utils"; +import { NumberHolder, BooleanHolder, isNullOrUndefined } from "#app/utils/common"; import i18next from "i18next"; import { PokemonPhase } from "./pokemon-phase"; import { Stat, type BattleStat, getStatKey, getStatStageChangeDescriptionKey } from "#enums/stat"; diff --git a/src/phases/switch-phase.ts b/src/phases/switch-phase.ts index 8562309ede5..c056b186021 100644 --- a/src/phases/switch-phase.ts +++ b/src/phases/switch-phase.ts @@ -1,6 +1,6 @@ import { globalScene } from "#app/global-scene"; import PartyUiHandler, { PartyOption, PartyUiMode } from "#app/ui/party-ui-handler"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { SwitchType } from "#enums/switch-type"; import { BattlePhase } from "./battle-phase"; import { PostSummonPhase } from "./post-summon-phase"; @@ -69,7 +69,7 @@ export class SwitchPhase extends BattlePhase { : 0; globalScene.ui.setMode( - Mode.PARTY, + UiMode.PARTY, this.isModal ? PartyUiMode.FAINT_SWITCH : PartyUiMode.POST_BATTLE_SWITCH, fieldIndex, (slotIndex: number, option: PartyOption) => { @@ -80,7 +80,7 @@ export class SwitchPhase extends BattlePhase { const switchType = option === PartyOption.PASS_BATON ? SwitchType.BATON_PASS : this.switchType; globalScene.unshiftPhase(new SwitchSummonPhase(switchType, fieldIndex, slotIndex, this.doReturn)); } - globalScene.ui.setMode(Mode.MESSAGE).then(() => super.end()); + globalScene.ui.setMode(UiMode.MESSAGE).then(() => super.end()); }, PartyUiHandler.FilterNonFainted, ); diff --git a/src/phases/title-phase.ts b/src/phases/title-phase.ts index bc1b157e98e..56057c23372 100644 --- a/src/phases/title-phase.ts +++ b/src/phases/title-phase.ts @@ -17,8 +17,8 @@ import { Unlockables } from "#app/system/unlockables"; import { vouchers } from "#app/system/voucher"; import type { OptionSelectConfig, OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler"; import { SaveSlotUiMode } from "#app/ui/save-slot-select-ui-handler"; -import { Mode } from "#app/ui/ui"; -import { isLocal, isLocalServerConnected, isNullOrUndefined } from "#app/utils"; +import { UiMode } from "#enums/ui-mode"; +import { isLocal, isLocalServerConnected, isNullOrUndefined } from "#app/utils/common"; import i18next from "i18next"; import { CheckSwitchPhase } from "./check-switch-phase"; import { EncounterPhase } from "./encounter-phase"; @@ -75,7 +75,7 @@ export class TitlePhase extends Phase { handler: () => { const setModeAndEnd = (gameMode: GameModes) => { this.gameMode = gameMode; - globalScene.ui.setMode(Mode.MESSAGE); + globalScene.ui.setMode(UiMode.MESSAGE); globalScene.ui.clearText(); this.end(); }; @@ -130,7 +130,7 @@ export class TitlePhase extends Phase { }, }); globalScene.ui.showText(i18next.t("menu:selectGameMode"), null, () => - globalScene.ui.setOverlayMode(Mode.OPTION_SELECT, { + globalScene.ui.setOverlayMode(UiMode.OPTION_SELECT, { options: options, }), ); @@ -140,7 +140,7 @@ export class TitlePhase extends Phase { { label: i18next.t("menu:loadGame"), handler: () => { - globalScene.ui.setOverlayMode(Mode.SAVE_SLOT, SaveSlotUiMode.LOAD, (slotId: number) => { + globalScene.ui.setOverlayMode(UiMode.SAVE_SLOT, SaveSlotUiMode.LOAD, (slotId: number) => { if (slotId === -1) { return this.showOptions(); } @@ -152,7 +152,7 @@ export class TitlePhase extends Phase { { label: i18next.t("menu:runHistory"), handler: () => { - globalScene.ui.setOverlayMode(Mode.RUN_HISTORY); + globalScene.ui.setOverlayMode(UiMode.RUN_HISTORY); return true; }, keepOpen: true, @@ -160,7 +160,7 @@ export class TitlePhase extends Phase { { label: i18next.t("menu:settings"), handler: () => { - globalScene.ui.setOverlayMode(Mode.SETTINGS); + globalScene.ui.setOverlayMode(UiMode.SETTINGS); return true; }, keepOpen: true, @@ -171,12 +171,12 @@ export class TitlePhase extends Phase { noCancel: true, yOffset: 47, }; - globalScene.ui.setMode(Mode.TITLE, config); + globalScene.ui.setMode(UiMode.TITLE, config); } loadSaveSlot(slotId: number): void { globalScene.sessionSlotId = slotId > -1 || !loggedInUser ? slotId : loggedInUser.lastSessionSlot; - globalScene.ui.setMode(Mode.MESSAGE); + globalScene.ui.setMode(UiMode.MESSAGE); globalScene.ui.resetModeChain(); globalScene.gameData .loadSession(slotId, slotId === -1 ? this.lastSessionData : undefined) @@ -196,7 +196,7 @@ export class TitlePhase extends Phase { initDailyRun(): void { globalScene.ui.clearText(); - globalScene.ui.setMode(Mode.SAVE_SLOT, SaveSlotUiMode.SAVE, (slotId: number) => { + globalScene.ui.setMode(UiMode.SAVE_SLOT, SaveSlotUiMode.SAVE, (slotId: number) => { globalScene.clearPhaseQueue(); if (slotId === -1) { globalScene.pushPhase(new TitlePhase()); diff --git a/src/phases/trainer-victory-phase.ts b/src/phases/trainer-victory-phase.ts index f17071f118e..f7005b1300d 100644 --- a/src/phases/trainer-victory-phase.ts +++ b/src/phases/trainer-victory-phase.ts @@ -3,7 +3,7 @@ import { TrainerType } from "#app/enums/trainer-type"; import { modifierTypes } from "#app/modifier/modifier-type"; import { vouchers } from "#app/system/voucher"; import i18next from "i18next"; -import { randSeedItem } from "#app/utils"; +import { randSeedItem } from "#app/utils/common"; import { BattlePhase } from "./battle-phase"; import { ModifierRewardPhase } from "./modifier-reward-phase"; import { MoneyRewardPhase } from "./money-reward-phase"; diff --git a/src/phases/turn-start-phase.ts b/src/phases/turn-start-phase.ts index ba6ace2d188..622b9cdcbd1 100644 --- a/src/phases/turn-start-phase.ts +++ b/src/phases/turn-start-phase.ts @@ -6,7 +6,7 @@ import type Pokemon from "#app/field/pokemon"; import { PokemonMove } from "#app/field/pokemon"; import { BypassSpeedChanceModifier } from "#app/modifier/modifier"; import { Command } from "#app/ui/command-ui-handler"; -import { randSeedShuffle, BooleanHolder } from "#app/utils"; +import { randSeedShuffle, BooleanHolder } from "#app/utils/common"; import { AttemptCapturePhase } from "./attempt-capture-phase"; import { AttemptRunPhase } from "./attempt-run-phase"; import { BerryPhase } from "./berry-phase"; diff --git a/src/phases/unavailable-phase.ts b/src/phases/unavailable-phase.ts index 33042739971..e5f1d899191 100644 --- a/src/phases/unavailable-phase.ts +++ b/src/phases/unavailable-phase.ts @@ -1,11 +1,11 @@ import { globalScene } from "#app/global-scene"; import { Phase } from "#app/phase"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { LoginPhase } from "./login-phase"; export class UnavailablePhase extends Phase { start(): void { - globalScene.ui.setMode(Mode.UNAVAILABLE, () => { + globalScene.ui.setMode(UiMode.UNAVAILABLE, () => { globalScene.unshiftPhase(new LoginPhase(true)); this.end(); }); diff --git a/src/phases/unlock-phase.ts b/src/phases/unlock-phase.ts index b420a4b3a61..7a69fc207bb 100644 --- a/src/phases/unlock-phase.ts +++ b/src/phases/unlock-phase.ts @@ -2,7 +2,7 @@ import { globalScene } from "#app/global-scene"; import { Phase } from "#app/phase"; import type { Unlockables } from "#app/system/unlockables"; import { getUnlockableName } from "#app/system/unlockables"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import i18next from "i18next"; export class UnlockPhase extends Phase { @@ -19,7 +19,7 @@ export class UnlockPhase extends Phase { globalScene.gameData.unlocks[this.unlockable] = true; // Sound loaded into game as is globalScene.playSound("level_up_fanfare"); - globalScene.ui.setMode(Mode.MESSAGE); + globalScene.ui.setMode(UiMode.MESSAGE); globalScene.ui.showText( i18next.t("battle:unlockedSomething", { unlockedThing: getUnlockableName(this.unlockable), diff --git a/src/phases/weather-effect-phase.ts b/src/phases/weather-effect-phase.ts index b83eab43b65..d89c78e96c7 100644 --- a/src/phases/weather-effect-phase.ts +++ b/src/phases/weather-effect-phase.ts @@ -15,7 +15,7 @@ import { BattlerTagType } from "#app/enums/battler-tag-type"; import { WeatherType } from "#app/enums/weather-type"; import type Pokemon from "#app/field/pokemon"; import { HitResult } from "#app/field/pokemon"; -import { BooleanHolder, toDmgValue } from "#app/utils"; +import { BooleanHolder, toDmgValue } from "#app/utils/common"; import { CommonAnimPhase } from "./common-anim-phase"; export class WeatherEffectPhase extends CommonAnimPhase { diff --git a/src/pipelines/field-sprite.ts b/src/pipelines/field-sprite.ts index a55b6a9adb6..a6e248c9998 100644 --- a/src/pipelines/field-sprite.ts +++ b/src/pipelines/field-sprite.ts @@ -1,6 +1,6 @@ import { globalScene } from "#app/global-scene"; import { TerrainType, getTerrainColor } from "../data/terrain"; -import { getCurrentTime } from "#app/utils"; +import { getCurrentTime } from "#app/utils/common"; import fieldSpriteFragShader from "./glsl/fieldSpriteFragShader.frag?raw"; import spriteVertShader from "./glsl/spriteShader.vert?raw"; diff --git a/src/pipelines/sprite.ts b/src/pipelines/sprite.ts index 0aa9409617a..307c2cee4cc 100644 --- a/src/pipelines/sprite.ts +++ b/src/pipelines/sprite.ts @@ -3,7 +3,7 @@ import MysteryEncounterIntroVisuals from "#app/field/mystery-encounter-intro"; import Pokemon from "#app/field/pokemon"; import Trainer from "#app/field/trainer"; import { globalScene } from "#app/global-scene"; -import { rgbHexToRgba } from "#app/utils"; +import { rgbHexToRgba } from "#app/utils/common"; import FieldSpritePipeline from "./field-sprite"; import spriteFragShader from "./glsl/spriteFragShader.frag?raw"; import spriteVertShader from "./glsl/spriteShader.vert?raw"; diff --git a/src/plugins/api/api-base.ts b/src/plugins/api/api-base.ts index 6a0eca56eaa..f55ffe2d3fd 100644 --- a/src/plugins/api/api-base.ts +++ b/src/plugins/api/api-base.ts @@ -1,5 +1,5 @@ import { SESSION_ID_COOKIE_NAME } from "#app/constants"; -import { getCookie } from "#app/utils"; +import { getCookie } from "#app/utils/cookies"; type DataType = "json" | "form-urlencoded"; diff --git a/src/plugins/api/pokerogue-account-api.ts b/src/plugins/api/pokerogue-account-api.ts index bab74799677..9cd82c24430 100644 --- a/src/plugins/api/pokerogue-account-api.ts +++ b/src/plugins/api/pokerogue-account-api.ts @@ -6,7 +6,7 @@ import type { } from "#app/@types/PokerogueAccountApi"; import { SESSION_ID_COOKIE_NAME } from "#app/constants"; import { ApiBase } from "#app/plugins/api/api-base"; -import { removeCookie, setCookie } from "#app/utils"; +import { removeCookie, setCookie } from "#app/utils/cookies"; /** * A wrapper for PokéRogue account API requests. diff --git a/src/plugins/i18n.ts b/src/plugins/i18n.ts index 5e145d08e28..ff9e54fcf50 100644 --- a/src/plugins/i18n.ts +++ b/src/plugins/i18n.ts @@ -1,4 +1,4 @@ -import { camelCaseToKebabCase } from "#app/utils"; +import { camelCaseToKebabCase } from "#app/utils/common"; import i18next from "i18next"; import LanguageDetector from "i18next-browser-languagedetector"; import HttpBackend from "i18next-http-backend"; diff --git a/src/sprites/variant.ts b/src/sprites/variant.ts index 7552f63b778..985068015c6 100644 --- a/src/sprites/variant.ts +++ b/src/sprites/variant.ts @@ -2,7 +2,7 @@ import { VariantTier } from "#app/enums/variant-tier"; import { hasExpSprite } from "#app/sprites/sprite-utils"; import { globalScene } from "#app/global-scene"; import type Pokemon from "#app/field/pokemon"; -import { isNullOrUndefined } from "#app/utils"; +import { isNullOrUndefined } from "#app/utils/common"; export type Variant = 0 | 1 | 2; diff --git a/src/starter-colors.ts b/src/starter-colors.ts new file mode 100644 index 00000000000..6abe028be99 --- /dev/null +++ b/src/starter-colors.ts @@ -0,0 +1,4 @@ +export const starterColors: StarterColors = {}; +interface StarterColors { + [key: string]: [string, string]; +} diff --git a/src/starting-wave.ts b/src/starting-wave.ts new file mode 100644 index 00000000000..3d36dabe652 --- /dev/null +++ b/src/starting-wave.ts @@ -0,0 +1,3 @@ +import Overrides from "./overrides"; + +export const startingWave = Overrides.STARTING_WAVE_OVERRIDE || 1; diff --git a/src/system/achv.ts b/src/system/achv.ts index 62e69e6fbfe..90816ff65c3 100644 --- a/src/system/achv.ts +++ b/src/system/achv.ts @@ -2,7 +2,7 @@ import type { Modifier } from "typescript"; import { TurnHeldItemTransferModifier } from "../modifier/modifier"; import { pokemonEvolutions } from "#app/data/balance/pokemon-evolutions"; import i18next from "i18next"; -import { NumberHolder } from "#app/utils"; +import { NumberHolder } from "#app/utils/common"; import { PlayerGender } from "#enums/player-gender"; import type { Challenge } from "#app/data/challenge"; import { diff --git a/src/system/game-data.ts b/src/system/game-data.ts index 698299845a3..8b7987556ee 100644 --- a/src/system/game-data.ts +++ b/src/system/game-data.ts @@ -1,6 +1,6 @@ import i18next from "i18next"; import type { PokeballCounts } from "#app/battle-scene"; -import { bypassLogin } from "#app/battle-scene"; +import { bypassLogin } from "#app/global-vars/bypass-login"; import { globalScene } from "#app/global-scene"; import type { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon"; import type Pokemon from "#app/field/pokemon"; @@ -8,7 +8,7 @@ import { pokemonPrevolutions } from "#app/data/balance/pokemon-evolutions"; import type PokemonSpecies from "#app/data/pokemon-species"; import { allSpecies, getPokemonSpecies } from "#app/data/pokemon-species"; import { speciesStarterCosts } from "#app/data/balance/starters"; -import { randInt, getEnumKeys, isLocal, executeIf, fixedInt, randSeedItem, NumberHolder } from "#app/utils"; +import { randInt, getEnumKeys, isLocal, executeIf, fixedInt, randSeedItem, NumberHolder } from "#app/utils/common"; import Overrides from "#app/overrides"; import PokemonData from "#app/system/pokemon-data"; import PersistentModifierData from "#app/system/modifier-data"; @@ -24,7 +24,7 @@ import EggData from "#app/system/egg-data"; import type { Egg } from "#app/data/egg"; import { vouchers, VoucherType } from "#app/system/voucher"; import { AES, enc } from "crypto-js"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { clientSessionId, loggedInUser, updateUserInfo } from "#app/account"; import { Nature } from "#enums/nature"; import { GameStats } from "#app/system/game-stats"; @@ -1430,7 +1430,7 @@ export class GameData { const systemData = useCachedSystem ? this.parseSystemData(decrypt(localStorage.getItem(`data_${loggedInUser?.username}`)!, bypassLogin)) : this.getSystemSaveData(); // TODO: is this bang correct? - + const request = { system: systemData, session: sessionData, @@ -1604,7 +1604,7 @@ export class GameData { null, () => { globalScene.ui.setOverlayMode( - Mode.CONFIRM, + UiMode.CONFIRM, () => { localStorage.setItem(dataKey, encrypt(dataStr, bypassLogin)); diff --git a/src/system/game-speed.ts b/src/system/game-speed.ts index 3df47fafc6c..712870dfaf1 100644 --- a/src/system/game-speed.ts +++ b/src/system/game-speed.ts @@ -3,7 +3,7 @@ import type FadeIn from "phaser3-rex-plugins/plugins/audio/fade/FadeIn"; import type FadeOut from "phaser3-rex-plugins/plugins/audio/fade/FadeOut"; import type BattleScene from "#app/battle-scene"; import { globalScene } from "#app/global-scene"; -import { FixedInt } from "#app/utils"; +import { FixedInt } from "#app/utils/common"; type FadeInType = typeof FadeIn; type FadeOutType = typeof FadeOut; diff --git a/src/system/settings/settings-gamepad.ts b/src/system/settings/settings-gamepad.ts index f4a6bd465af..12add905096 100644 --- a/src/system/settings/settings-gamepad.ts +++ b/src/system/settings/settings-gamepad.ts @@ -1,6 +1,6 @@ import type SettingsGamepadUiHandler from "../../ui/settings/settings-gamepad-ui-handler"; -import { Mode } from "../../ui/ui"; -import { truncateString } from "../../utils"; +import { UiMode } from "#enums/ui-mode"; +import { truncateString } from "../../utils/common"; import { Button } from "#enums/buttons"; import { SettingKeyboard } from "#app/system/settings/settings-keyboard"; import { globalScene } from "#app/global-scene"; @@ -107,7 +107,7 @@ export function setSettingGamepad(setting: SettingGamepad, value: number): boole (globalScene.ui.getHandler() as SettingsGamepadUiHandler).updateBindings(); return success; }; - globalScene.ui.setOverlayMode(Mode.GAMEPAD_BINDING, { + globalScene.ui.setOverlayMode(UiMode.GAMEPAD_BINDING, { target: setting, cancelHandler: cancelHandler, }); @@ -133,7 +133,7 @@ export function setSettingGamepad(setting: SettingGamepad, value: number): boole cancelHandler(); return true; }; - globalScene.ui.setOverlayMode(Mode.OPTION_SELECT, { + globalScene.ui.setOverlayMode(UiMode.OPTION_SELECT, { options: [ ...gp.map((g: string) => ({ label: truncateString(g, 30), // Truncate the gamepad name for display diff --git a/src/system/settings/settings-keyboard.ts b/src/system/settings/settings-keyboard.ts index ffe8811e5d9..ec5c9ad6b0e 100644 --- a/src/system/settings/settings-keyboard.ts +++ b/src/system/settings/settings-keyboard.ts @@ -1,5 +1,5 @@ import { Button } from "#enums/buttons"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import type SettingsKeyboardUiHandler from "#app/ui/settings/settings-keyboard-ui-handler"; import i18next from "i18next"; import { globalScene } from "#app/global-scene"; @@ -174,7 +174,7 @@ export function setSettingKeyboard(setting: SettingKeyboard, value: number): boo (globalScene.ui.getHandler() as SettingsKeyboardUiHandler).updateBindings(); return success; }; - globalScene.ui.setOverlayMode(Mode.KEYBOARD_BINDING, { + globalScene.ui.setOverlayMode(UiMode.KEYBOARD_BINDING, { target: setting, cancelHandler: cancelHandler, }); diff --git a/src/system/settings/settings.ts b/src/system/settings/settings.ts index 377216291e2..31faf2b6283 100644 --- a/src/system/settings/settings.ts +++ b/src/system/settings/settings.ts @@ -1,4 +1,4 @@ -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import i18next from "i18next"; import { globalScene } from "#app/global-scene"; import { hasTouchscreen } from "#app/touch-controls"; @@ -9,7 +9,7 @@ import { EaseType } from "#enums/ease-type"; import { MoneyFormat } from "#enums/money-format"; import { PlayerGender } from "#enums/player-gender"; import { ShopCursorTarget } from "#enums/shop-cursor-target"; -import { isLocal } from "#app/utils"; +import { isLocal } from "#app/utils/common"; const VOLUME_OPTIONS: SettingOption[] = new Array(11).fill(null).map((_, i) => i @@ -906,7 +906,7 @@ export function setSetting(setting: string, value: number): boolean { return false; } }; - globalScene.ui.setOverlayMode(Mode.OPTION_SELECT, { + globalScene.ui.setOverlayMode(UiMode.OPTION_SELECT, { options: [ { label: "English", diff --git a/src/system/version_migration/versions/v1_0_4.ts b/src/system/version_migration/versions/v1_0_4.ts index 2139352b783..9e30ccdc2a7 100644 --- a/src/system/version_migration/versions/v1_0_4.ts +++ b/src/system/version_migration/versions/v1_0_4.ts @@ -3,7 +3,7 @@ import type { SystemSaveData, SessionSaveData } from "#app/system/game-data"; import { AbilityAttr, defaultStarterSpecies, DexAttr } from "#app/system/game-data"; import { allSpecies } from "#app/data/pokemon-species"; import { CustomPokemonData } from "#app/data/custom-pokemon-data"; -import { isNullOrUndefined } from "#app/utils"; +import { isNullOrUndefined } from "#app/utils/common"; import type { SystemSaveMigrator } from "#app/@types/SystemSaveMigrator"; import type { SettingsSaveMigrator } from "#app/@types/SettingsSaveMigrator"; import type { SessionSaveMigrator } from "#app/@types/SessionSaveMigrator"; diff --git a/src/system/version_migration/versions/v1_7_0.ts b/src/system/version_migration/versions/v1_7_0.ts index a1213ccf64c..dc7c0f48640 100644 --- a/src/system/version_migration/versions/v1_7_0.ts +++ b/src/system/version_migration/versions/v1_7_0.ts @@ -3,7 +3,7 @@ import type { SystemSaveMigrator } from "#app/@types/SystemSaveMigrator"; import { getPokemonSpecies, getPokemonSpeciesForm } from "#app/data/pokemon-species"; import { globalScene } from "#app/global-scene"; import { DexAttr, type SessionSaveData, type SystemSaveData } from "#app/system/game-data"; -import { isNullOrUndefined } from "#app/utils"; +import { isNullOrUndefined } from "#app/utils/common"; /** * If a starter is caught, but the only forms registered as caught are not starterSelectable, diff --git a/src/timed-event-manager.ts b/src/timed-event-manager.ts index 7bbd157948b..8f5a9c75428 100644 --- a/src/timed-event-manager.ts +++ b/src/timed-event-manager.ts @@ -1,7 +1,7 @@ import { globalScene } from "#app/global-scene"; import { TextStyle, addTextObject } from "#app/ui/text"; -import type { nil } from "#app/utils"; -import { isNullOrUndefined } from "#app/utils"; +import type { nil } from "#app/utils/common"; +import { isNullOrUndefined } from "#app/utils/common"; import i18next from "i18next"; import { Species } from "#enums/species"; import type { WeatherPoolEntry } from "#app/data/weather"; diff --git a/src/tutorial.ts b/src/tutorial.ts index 82912f73979..d9ae3a03290 100644 --- a/src/tutorial.ts +++ b/src/tutorial.ts @@ -1,7 +1,7 @@ import { globalScene } from "#app/global-scene"; import AwaitableUiHandler from "./ui/awaitable-ui-handler"; import type UiHandler from "./ui/ui-handler"; -import { Mode } from "./ui/ui"; +import { UiMode } from "#enums/ui-mode"; import i18next from "i18next"; import Overrides from "#app/overrides"; @@ -92,13 +92,13 @@ const tutorialHandlers = { }, [Tutorial.Select_Item]: () => { return new Promise(resolve => { - globalScene.ui.setModeWithoutClear(Mode.MESSAGE).then(() => { + globalScene.ui.setModeWithoutClear(UiMode.MESSAGE).then(() => { globalScene.ui.showText( i18next.t("tutorial:selectItem"), null, () => globalScene.ui.showText("", null, () => - globalScene.ui.setModeWithoutClear(Mode.MODIFIER_SELECT).then(() => resolve()), + globalScene.ui.setModeWithoutClear(UiMode.MODIFIER_SELECT).then(() => resolve()), ), null, true, diff --git a/src/ui-inputs.ts b/src/ui-inputs.ts index c9898f9b71e..bf4f51e5af7 100644 --- a/src/ui-inputs.ts +++ b/src/ui-inputs.ts @@ -1,5 +1,5 @@ import type Phaser from "phaser"; -import { Mode } from "./ui/ui"; +import { UiMode } from "#enums/ui-mode"; import type { InputsController } from "./inputs-controller"; import type MessageUiHandler from "./ui/message-ui-handler"; import StarterSelectUiHandler from "./ui/starter-select-ui-handler"; @@ -176,22 +176,22 @@ export class UiInputs { return; } switch (globalScene.ui?.getMode()) { - case Mode.MESSAGE: + case UiMode.MESSAGE: const messageHandler = globalScene.ui.getHandler(); if (!messageHandler.pendingPrompt || messageHandler.isTextAnimationInProgress()) { return; } - case Mode.TITLE: - case Mode.COMMAND: - case Mode.MODIFIER_SELECT: - case Mode.MYSTERY_ENCOUNTER: - globalScene.ui.setOverlayMode(Mode.MENU); + case UiMode.TITLE: + case UiMode.COMMAND: + case UiMode.MODIFIER_SELECT: + case UiMode.MYSTERY_ENCOUNTER: + globalScene.ui.setOverlayMode(UiMode.MENU); break; - case Mode.STARTER_SELECT: - case Mode.POKEDEX_PAGE: + case UiMode.STARTER_SELECT: + case UiMode.POKEDEX_PAGE: this.buttonTouch(); break; - case Mode.MENU: + case UiMode.MENU: globalScene.ui.revertMode(); globalScene.playSound("ui/select"); break; @@ -227,7 +227,7 @@ export class UiInputs { SettingKeys.Game_Speed, Setting[settingGameSpeed].options.findIndex(item => item.label === `${globalScene.gameSpeed}x`) + 1, ); - if (globalScene.ui?.getMode() === Mode.SETTINGS) { + if (globalScene.ui?.getMode() === UiMode.SETTINGS) { (globalScene.ui.getHandler() as SettingsUiHandler).show([]); } } else if (!up && globalScene.gameSpeed > 1) { @@ -238,7 +238,7 @@ export class UiInputs { 0, ), ); - if (globalScene.ui?.getMode() === Mode.SETTINGS) { + if (globalScene.ui?.getMode() === UiMode.SETTINGS) { (globalScene.ui.getHandler() as SettingsUiHandler).show([]); } } diff --git a/src/ui/abstact-option-select-ui-handler.ts b/src/ui/abstact-option-select-ui-handler.ts index b360065f61d..07609648a4e 100644 --- a/src/ui/abstact-option-select-ui-handler.ts +++ b/src/ui/abstact-option-select-ui-handler.ts @@ -1,9 +1,9 @@ import { globalScene } from "#app/global-scene"; import { TextStyle, addBBCodeTextObject, getTextColor, getTextStyleOptions } from "./text"; -import { Mode } from "./ui"; +import { UiMode } from "#enums/ui-mode"; import UiHandler from "./ui-handler"; import { addWindow } from "./ui-theme"; -import { rgbHexToRgba, fixedInt } from "#app/utils"; +import { rgbHexToRgba, fixedInt } from "#app/utils/common"; import { argbFromRgba } from "@material/material-color-utilities"; import { Button } from "#enums/buttons"; import BBCodeText from "phaser3-rex-plugins/plugins/gameobjects/tagtext/bbcodetext/BBCodeText"; @@ -56,7 +56,7 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler { protected defaultTextStyle: TextStyle = TextStyle.WINDOW; protected textContent: string; - constructor(mode: Mode | null) { + constructor(mode: UiMode | null) { super(mode); } @@ -70,7 +70,7 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler { const ui = this.getUi(); this.optionSelectContainer = globalScene.add.container(globalScene.game.canvas.width / 6 - 1, -48); - this.optionSelectContainer.setName(`option-select-${this.mode ? Mode[this.mode] : "UNKNOWN"}`); + this.optionSelectContainer.setName(`option-select-${this.mode ? UiMode[this.mode] : "UNKNOWN"}`); this.optionSelectContainer.setVisible(false); ui.add(this.optionSelectContainer); @@ -120,7 +120,7 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler { // Setting the initial text to establish the width of the select object. We consider all options, even ones that are not displayed, // Except in the case of autocomplete, where we don't want to set up a text element with potentially hundreds of lines. - const optionsForWidth = globalScene.ui.getMode() === Mode.AUTO_COMPLETE ? optionsWithScroll : options; + const optionsForWidth = globalScene.ui.getMode() === UiMode.AUTO_COMPLETE ? optionsWithScroll : options; this.optionSelectText = addBBCodeTextObject( 0, 0, @@ -250,7 +250,7 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler { } else { ui.playError(); } - } else if (button === Button.SUBMIT && ui.getMode() === Mode.AUTO_COMPLETE) { + } else if (button === Button.SUBMIT && ui.getMode() === UiMode.AUTO_COMPLETE) { // this is here to differentiate between a Button.SUBMIT vs Button.ACTION within the autocomplete handler // this is here because Button.ACTION is picked up as z on the keyboard, meaning if you're typing and hit z, it'll select the option you've chosen success = true; diff --git a/src/ui/achvs-ui-handler.ts b/src/ui/achvs-ui-handler.ts index 8b5a4dbd395..d0c8b716c7a 100644 --- a/src/ui/achvs-ui-handler.ts +++ b/src/ui/achvs-ui-handler.ts @@ -6,7 +6,7 @@ import type { Voucher } from "#app/system/voucher"; import { getVoucherTypeIcon, getVoucherTypeName, vouchers } from "#app/system/voucher"; import MessageUiHandler from "#app/ui/message-ui-handler"; import { addTextObject, TextStyle } from "#app/ui/text"; -import type { Mode } from "#app/ui/ui"; +import type { UiMode } from "#enums/ui-mode"; import { addWindow } from "#app/ui/ui-theme"; import { ScrollBar } from "#app/ui/scroll-bar"; import { PlayerGender } from "#enums/player-gender"; @@ -59,7 +59,7 @@ export default class AchvsUiHandler extends MessageUiHandler { private cursorObj: Phaser.GameObjects.NineSlice | null; private currentPage: Page; - constructor(mode: Mode | null = null) { + constructor(mode: UiMode | null = null) { super(mode); this.achvsTotal = Object.keys(achvs).length; diff --git a/src/ui/admin-ui-handler.ts b/src/ui/admin-ui-handler.ts index 34b6e59145f..67ae3118863 100644 --- a/src/ui/admin-ui-handler.ts +++ b/src/ui/admin-ui-handler.ts @@ -1,11 +1,11 @@ import { Button } from "#app/enums/buttons"; import { pokerogueApi } from "#app/plugins/api/pokerogue-api"; -import { formatText } from "#app/utils"; +import { formatText } from "#app/utils/common"; import type { InputFieldConfig } from "./form-modal-ui-handler"; import { FormModalUiHandler } from "./form-modal-ui-handler"; import type { ModalConfig } from "./modal-ui-handler"; import { TextStyle } from "./text"; -import { Mode } from "./ui"; +import { UiMode } from "#enums/ui-mode"; import { globalScene } from "#app/global-scene"; type AdminUiHandlerService = "discord" | "google"; @@ -30,7 +30,7 @@ export default class AdminUiHandler extends FormModalUiHandler { return `Username and ${service} successfully ${mode.toLowerCase()}ed`; }; - constructor(mode: Mode | null = null) { + constructor(mode: UiMode | null = null) { super(mode); } @@ -143,10 +143,10 @@ export default class AdminUiHandler extends FormModalUiHandler { const adminSearchResult: AdminSearchInfo = this.convertInputsToAdmin(); // this converts the input texts into a single object for use later const validFields = this.areFieldsValid(this.adminMode); if (validFields.error) { - globalScene.ui.setMode(Mode.LOADING, { buttonActions: [] }); // this is here to force a loading screen to allow the admin tool to reopen again if there's an error + globalScene.ui.setMode(UiMode.LOADING, { buttonActions: [] }); // this is here to force a loading screen to allow the admin tool to reopen again if there's an error return this.showMessage(validFields.errorMessage ?? "", adminSearchResult, true); } - globalScene.ui.setMode(Mode.LOADING, { buttonActions: [] }); + globalScene.ui.setMode(UiMode.LOADING, { buttonActions: [] }); if (this.adminMode === AdminMode.LINK) { this.adminLinkUnlink(adminSearchResult, "discord", "Link") // calls server to link discord .then(response => { @@ -174,7 +174,7 @@ export default class AdminUiHandler extends FormModalUiHandler { showMessage(message: string, adminResult: AdminSearchInfo, isError: boolean) { globalScene.ui.setMode( - Mode.ADMIN, + UiMode.ADMIN, Object.assign(this.config, { errorMessage: message?.trim() }), this.adminMode, adminResult, @@ -221,18 +221,18 @@ export default class AdminUiHandler extends FormModalUiHandler { const mode = adminResult[aR] === "" ? "Link" : "Unlink"; // this figures out if we're linking or unlinking a service const validFields = this.areFieldsValid(this.adminMode, service); if (validFields.error) { - globalScene.ui.setMode(Mode.LOADING, { buttonActions: [] }); // this is here to force a loading screen to allow the admin tool to reopen again if there's an error + globalScene.ui.setMode(UiMode.LOADING, { buttonActions: [] }); // this is here to force a loading screen to allow the admin tool to reopen again if there's an error return this.showMessage(validFields.errorMessage ?? "", adminResult, true); } this.adminLinkUnlink(this.convertInputsToAdmin(), service as AdminUiHandlerService, mode).then( response => { // attempts to link/unlink depending on the service if (response.error) { - globalScene.ui.setMode(Mode.LOADING, { buttonActions: [] }); + globalScene.ui.setMode(UiMode.LOADING, { buttonActions: [] }); return this.showMessage(response.errorType, adminResult, true); // fail } // success, reload panel with new results - globalScene.ui.setMode(Mode.LOADING, { buttonActions: [] }); + globalScene.ui.setMode(UiMode.LOADING, { buttonActions: [] }); this.adminSearch(adminResult).then(response => { if (response.error) { return this.showMessage(response.errorType, adminResult, true); @@ -385,7 +385,7 @@ export default class AdminUiHandler extends FormModalUiHandler { private updateAdminPanelInfo(adminSearchResult: AdminSearchInfo, mode?: AdminMode) { mode = mode ?? AdminMode.ADMIN; globalScene.ui.setMode( - Mode.ADMIN, + UiMode.ADMIN, { buttonActions: [ // we double revert here and below to go back 2 layers of menus diff --git a/src/ui/arena-flyout.ts b/src/ui/arena-flyout.ts index 1eb18a32f98..ab3bd13b47a 100644 --- a/src/ui/arena-flyout.ts +++ b/src/ui/arena-flyout.ts @@ -16,7 +16,7 @@ import type { TurnEndEvent } from "../events/battle-scene"; import { BattleSceneEventType } from "../events/battle-scene"; import { ArenaTagType } from "#enums/arena-tag-type"; import TimeOfDayWidget from "./time-of-day-widget"; -import { toCamelCaseString, formatText, fixedInt } from "#app/utils"; +import { toCamelCaseString, formatText, fixedInt } from "#app/utils/common"; import type { ParseKeys } from "i18next"; import i18next from "i18next"; diff --git a/src/ui/autocomplete-ui-handler.ts b/src/ui/autocomplete-ui-handler.ts index a170ae43f23..ba1802c8582 100644 --- a/src/ui/autocomplete-ui-handler.ts +++ b/src/ui/autocomplete-ui-handler.ts @@ -1,10 +1,10 @@ import { Button } from "#enums/buttons"; import AbstractOptionSelectUiHandler from "./abstact-option-select-ui-handler"; -import { Mode } from "./ui"; +import { UiMode } from "#enums/ui-mode"; export default class AutoCompleteUiHandler extends AbstractOptionSelectUiHandler { modalContainer: Phaser.GameObjects.Container; - constructor(mode: Mode = Mode.OPTION_SELECT) { + constructor(mode: UiMode = UiMode.OPTION_SELECT) { super(mode); } diff --git a/src/ui/awaitable-ui-handler.ts b/src/ui/awaitable-ui-handler.ts index 890e2884fd5..3c577fd4411 100644 --- a/src/ui/awaitable-ui-handler.ts +++ b/src/ui/awaitable-ui-handler.ts @@ -1,4 +1,4 @@ -import type { Mode } from "./ui"; +import type { UiMode } from "#enums/ui-mode"; import UiHandler from "./ui-handler"; import { Button } from "#enums/buttons"; import { globalScene } from "#app/global-scene"; @@ -9,7 +9,7 @@ export default abstract class AwaitableUiHandler extends UiHandler { public tutorialActive = false; public tutorialOverlay: Phaser.GameObjects.Rectangle; - constructor(mode: Mode | null = null) { + constructor(mode: UiMode | null = null) { super(mode); } diff --git a/src/ui/ball-ui-handler.ts b/src/ui/ball-ui-handler.ts index cfa44832824..abb106a6553 100644 --- a/src/ui/ball-ui-handler.ts +++ b/src/ui/ball-ui-handler.ts @@ -1,7 +1,7 @@ import { getPokeballName } from "../data/pokeball"; import { addTextObject, getTextStyleOptions, TextStyle } from "./text"; import { Command } from "./command-ui-handler"; -import { Mode } from "./ui"; +import { UiMode } from "#enums/ui-mode"; import UiHandler from "./ui-handler"; import { addWindow } from "./ui-theme"; import { Button } from "#enums/buttons"; @@ -18,7 +18,7 @@ export default class BallUiHandler extends UiHandler { private scale = 0.1666666667; constructor() { - super(Mode.BALL); + super(UiMode.BALL); } setup() { @@ -82,15 +82,15 @@ export default class BallUiHandler extends UiHandler { if (button === Button.ACTION && this.cursor < pokeballTypeCount) { if (globalScene.pokeballCounts[this.cursor]) { if (commandPhase.handleCommand(Command.BALL, this.cursor)) { - globalScene.ui.setMode(Mode.COMMAND, commandPhase.getFieldIndex()); - globalScene.ui.setMode(Mode.MESSAGE); + globalScene.ui.setMode(UiMode.COMMAND, commandPhase.getFieldIndex()); + globalScene.ui.setMode(UiMode.MESSAGE); success = true; } } else { ui.playError(); } } else { - ui.setMode(Mode.COMMAND, commandPhase.getFieldIndex()); + ui.setMode(UiMode.COMMAND, commandPhase.getFieldIndex()); success = true; } } else { diff --git a/src/ui/base-stats-overlay.ts b/src/ui/base-stats-overlay.ts index d0b0aff3a9d..0541ae766e5 100644 --- a/src/ui/base-stats-overlay.ts +++ b/src/ui/base-stats-overlay.ts @@ -1,7 +1,7 @@ import type { InfoToggle } from "../battle-scene"; import { TextStyle, addTextObject } from "./text"; import { addWindow } from "./ui-theme"; -import { fixedInt } from "#app/utils"; +import { fixedInt } from "#app/utils/common"; import i18next from "i18next"; import { globalScene } from "#app/global-scene"; diff --git a/src/ui/battle-flyout.ts b/src/ui/battle-flyout.ts index 854f4cc4dd9..e590bebcf5a 100644 --- a/src/ui/battle-flyout.ts +++ b/src/ui/battle-flyout.ts @@ -1,6 +1,6 @@ import type { default as Pokemon } from "../field/pokemon"; import { addTextObject, TextStyle } from "./text"; -import { fixedInt } from "#app/utils"; +import { fixedInt } from "#app/utils/common"; import { globalScene } from "#app/global-scene"; import type Move from "#app/data/moves/move"; import type { BerryUsedEvent, MoveUsedEvent } from "../events/battle-scene"; diff --git a/src/ui/battle-info.ts b/src/ui/battle-info.ts index 06c5f7fb3f1..4f9e59c8c89 100644 --- a/src/ui/battle-info.ts +++ b/src/ui/battle-info.ts @@ -1,6 +1,6 @@ import type { EnemyPokemon, default as Pokemon } from "../field/pokemon"; import { getLevelTotalExp, getLevelRelExp } from "../data/exp"; -import { getLocalizedSpriteKey, fixedInt } from "#app/utils"; +import { getLocalizedSpriteKey, fixedInt } from "#app/utils/common"; import { addTextObject, TextStyle } from "./text"; import { getGenderSymbol, getGenderColor, Gender } from "../data/gender"; import { StatusEffect } from "#enums/status-effect"; @@ -617,7 +617,7 @@ export default class BattleInfo extends Phaser.GameObjects.Container { return resolve(); } - const gender: Gender = !!pokemon.summonData?.illusion ? pokemon.summonData?.illusion.gender : pokemon.gender; + const gender: Gender = pokemon.summonData?.illusion ? pokemon.summonData?.illusion.gender : pokemon.gender; this.genderText.setText(getGenderSymbol(gender)); this.genderText.setColor(getGenderColor(gender)); @@ -794,7 +794,7 @@ export default class BattleInfo extends Phaser.GameObjects.Container { const nameSizeTest = addTextObject(0, 0, displayName, TextStyle.BATTLE_INFO); nameTextWidth = nameSizeTest.displayWidth; - const gender: Gender = !!pokemon.summonData?.illusion ? pokemon.summonData?.illusion.gender : pokemon.gender; + const gender: Gender = pokemon.summonData?.illusion ? pokemon.summonData?.illusion.gender : pokemon.gender; while ( nameTextWidth > (this.player || !this.boss ? 60 : 98) - diff --git a/src/ui/battle-message-ui-handler.ts b/src/ui/battle-message-ui-handler.ts index ccb9378c688..d1102bbe53e 100644 --- a/src/ui/battle-message-ui-handler.ts +++ b/src/ui/battle-message-ui-handler.ts @@ -1,6 +1,6 @@ import { globalScene } from "#app/global-scene"; import { addBBCodeTextObject, addTextObject, getTextColor, TextStyle } from "./text"; -import { Mode } from "./ui"; +import { UiMode } from "#enums/ui-mode"; import MessageUiHandler from "./message-ui-handler"; import { addWindow } from "./ui-theme"; import type BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext"; @@ -23,7 +23,7 @@ export default class BattleMessageUiHandler extends MessageUiHandler { public readonly wordWrapWidth: number = 1780; constructor() { - super(Mode.MESSAGE); + super(UiMode.MESSAGE); } setup(): void { diff --git a/src/ui/bgm-bar.ts b/src/ui/bgm-bar.ts index d944453ba2c..e331d82f6d9 100644 --- a/src/ui/bgm-bar.ts +++ b/src/ui/bgm-bar.ts @@ -1,6 +1,6 @@ import { addTextObject, TextStyle } from "./text"; import i18next from "i18next"; -import { formatText } from "#app/utils"; +import { formatText } from "#app/utils/common"; import { globalScene } from "#app/global-scene"; const hiddenX = -150; diff --git a/src/ui/candy-bar.ts b/src/ui/candy-bar.ts index 0cf3e0c91e9..f7a01b83093 100644 --- a/src/ui/candy-bar.ts +++ b/src/ui/candy-bar.ts @@ -1,8 +1,8 @@ -import { starterColors } from "#app/battle-scene"; +import { starterColors } from "#app/global-vars/starter-colors"; import { globalScene } from "#app/global-scene"; import { TextStyle, addTextObject } from "./text"; import { argbFromRgba } from "@material/material-color-utilities"; -import { rgbHexToRgba } from "#app/utils"; +import { rgbHexToRgba } from "#app/utils/common"; import type { Species } from "#enums/species"; export default class CandyBar extends Phaser.GameObjects.Container { diff --git a/src/ui/challenges-select-ui-handler.ts b/src/ui/challenges-select-ui-handler.ts index caffede2487..d1df16a457b 100644 --- a/src/ui/challenges-select-ui-handler.ts +++ b/src/ui/challenges-select-ui-handler.ts @@ -1,11 +1,11 @@ import { TextStyle, addTextObject } from "./text"; -import type { Mode } from "./ui"; +import type { UiMode } from "#enums/ui-mode"; import UiHandler from "./ui-handler"; import { addWindow } from "./ui-theme"; import { Button } from "#enums/buttons"; import i18next from "i18next"; import type { Challenge } from "#app/data/challenge"; -import { getLocalizedSpriteKey } from "#app/utils"; +import { getLocalizedSpriteKey } from "#app/utils/common"; import { Challenges } from "#app/enums/challenges"; import BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext"; import { Color, ShadowColor } from "#app/enums/color"; @@ -50,7 +50,7 @@ export default class GameChallengesUiHandler extends UiHandler { private readonly leftArrowGap: number = 90; // distance from the label to the left arrow private readonly arrowSpacing: number = 3; // distance between the arrows and the value area - constructor(mode: Mode | null = null) { + constructor(mode: UiMode | null = null) { super(mode); } diff --git a/src/ui/char-sprite.ts b/src/ui/char-sprite.ts index f717927c107..a8451f4bb9c 100644 --- a/src/ui/char-sprite.ts +++ b/src/ui/char-sprite.ts @@ -1,5 +1,5 @@ import { globalScene } from "#app/global-scene"; -import { MissingTextureKey } from "#app/utils"; +import { MissingTextureKey } from "#app/utils/common"; export default class CharSprite extends Phaser.GameObjects.Container { private sprite: Phaser.GameObjects.Sprite; diff --git a/src/ui/command-ui-handler.ts b/src/ui/command-ui-handler.ts index 55937bb8b00..57c5b5a82a2 100644 --- a/src/ui/command-ui-handler.ts +++ b/src/ui/command-ui-handler.ts @@ -1,6 +1,6 @@ import { addTextObject, TextStyle } from "./text"; import PartyUiHandler, { PartyUiMode } from "./party-ui-handler"; -import { Mode } from "./ui"; +import { UiMode } from "#enums/ui-mode"; import UiHandler from "./ui-handler"; import i18next from "i18next"; import { Button } from "#enums/buttons"; @@ -30,7 +30,7 @@ export default class CommandUiHandler extends UiHandler { protected cursor2 = 0; constructor() { - super(Mode.COMMAND); + super(UiMode.COMMAND); } setup() { @@ -124,18 +124,18 @@ export default class CommandUiHandler extends UiHandler { switch (cursor) { // Fight case Command.FIGHT: - ui.setMode(Mode.FIGHT, (globalScene.getCurrentPhase() as CommandPhase).getFieldIndex()); + ui.setMode(UiMode.FIGHT, (globalScene.getCurrentPhase() as CommandPhase).getFieldIndex()); success = true; break; // Ball case Command.BALL: - ui.setModeWithoutClear(Mode.BALL); + ui.setModeWithoutClear(UiMode.BALL); success = true; break; // Pokemon case Command.POKEMON: ui.setMode( - Mode.PARTY, + UiMode.PARTY, PartyUiMode.SWITCH, (globalScene.getCurrentPhase() as CommandPhase).getPokemon().getFieldIndex(), null, @@ -149,7 +149,7 @@ export default class CommandUiHandler extends UiHandler { success = true; break; case Command.TERA: - ui.setMode(Mode.FIGHT, (globalScene.getCurrentPhase() as CommandPhase).getFieldIndex(), Command.TERA); + ui.setMode(UiMode.FIGHT, (globalScene.getCurrentPhase() as CommandPhase).getFieldIndex(), Command.TERA); success = true; break; } diff --git a/src/ui/confirm-ui-handler.ts b/src/ui/confirm-ui-handler.ts index eb7018051b7..7b5ca3d7e63 100644 --- a/src/ui/confirm-ui-handler.ts +++ b/src/ui/confirm-ui-handler.ts @@ -1,6 +1,6 @@ import type { OptionSelectConfig } from "./abstact-option-select-ui-handler"; import AbstractOptionSelectUiHandler from "./abstact-option-select-ui-handler"; -import { Mode } from "./ui"; +import { UiMode } from "#enums/ui-mode"; import i18next from "i18next"; import { Button } from "#enums/buttons"; import { globalScene } from "#app/global-scene"; @@ -12,7 +12,7 @@ export default class ConfirmUiHandler extends AbstractOptionSelectUiHandler { private switchCheckCursor: number; constructor() { - super(Mode.CONFIRM); + super(UiMode.CONFIRM); } getWindowWidth(): number { diff --git a/src/ui/daily-run-scoreboard.ts b/src/ui/daily-run-scoreboard.ts index 896f2171676..076a782908b 100644 --- a/src/ui/daily-run-scoreboard.ts +++ b/src/ui/daily-run-scoreboard.ts @@ -1,6 +1,6 @@ import i18next from "i18next"; import { globalScene } from "#app/global-scene"; -import { getEnumKeys, executeIf } from "#app/utils"; +import { getEnumKeys, executeIf } from "#app/utils/common"; import { TextStyle, addTextObject } from "./text"; import { WindowVariant, addWindow } from "./ui-theme"; import { pokerogueApi } from "#app/plugins/api/pokerogue-api"; diff --git a/src/ui/egg-gacha-ui-handler.ts b/src/ui/egg-gacha-ui-handler.ts index 956a308448b..5377cf3d283 100644 --- a/src/ui/egg-gacha-ui-handler.ts +++ b/src/ui/egg-gacha-ui-handler.ts @@ -1,7 +1,7 @@ -import { Mode } from "./ui"; +import { UiMode } from "#enums/ui-mode"; import { TextStyle, addTextObject, getEggTierTextTint, getTextStyleOptions } from "./text"; import MessageUiHandler from "./message-ui-handler"; -import { getEnumValues, getEnumKeys, fixedInt, randSeedShuffle } from "#app/utils"; +import { getEnumValues, getEnumKeys, fixedInt, randSeedShuffle } from "#app/utils/common"; import type { IEggOptions } from "../data/egg"; import { Egg, getLegendaryGachaSpeciesForTimestamp } from "../data/egg"; import { VoucherType, getVoucherTypeIcon } from "../system/voucher"; @@ -41,7 +41,7 @@ export default class EggGachaUiHandler extends MessageUiHandler { private scale = 0.1666666667; constructor() { - super(Mode.EGG_GACHA); + super(UiMode.EGG_GACHA); this.gachaContainers = []; this.gachaKnobs = []; diff --git a/src/ui/egg-hatch-scene-handler.ts b/src/ui/egg-hatch-scene-handler.ts index 6ede68b7ae6..76e2c54f4b6 100644 --- a/src/ui/egg-hatch-scene-handler.ts +++ b/src/ui/egg-hatch-scene-handler.ts @@ -1,4 +1,4 @@ -import { Mode } from "./ui"; +import { UiMode } from "#enums/ui-mode"; import UiHandler from "./ui-handler"; import { Button } from "#enums/buttons"; import { EggHatchPhase } from "#app/phases/egg-hatch-phase"; @@ -16,7 +16,7 @@ export default class EggHatchSceneHandler extends UiHandler { public readonly eventTarget: EventTarget = new EventTarget(); constructor() { - super(Mode.EGG_HATCH_SCENE); + super(UiMode.EGG_HATCH_SCENE); } setup() { diff --git a/src/ui/egg-list-ui-handler.ts b/src/ui/egg-list-ui-handler.ts index cf3326bec13..9f41feea8ab 100644 --- a/src/ui/egg-list-ui-handler.ts +++ b/src/ui/egg-list-ui-handler.ts @@ -1,4 +1,4 @@ -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import PokemonIconAnimHandler, { PokemonIconAnimMode } from "#app/ui/pokemon-icon-anim-handler"; import { TextStyle, addTextObject } from "#app/ui/text"; import MessageUiHandler from "#app/ui/message-ui-handler"; @@ -29,7 +29,7 @@ export default class EggListUiHandler extends MessageUiHandler { private iconAnimHandler: PokemonIconAnimHandler; constructor() { - super(Mode.EGG_LIST); + super(UiMode.EGG_LIST); } setup() { diff --git a/src/ui/egg-summary-ui-handler.ts b/src/ui/egg-summary-ui-handler.ts index f335f83d8bf..ddc536fe1ad 100644 --- a/src/ui/egg-summary-ui-handler.ts +++ b/src/ui/egg-summary-ui-handler.ts @@ -1,4 +1,4 @@ -import { Mode } from "./ui"; +import { UiMode } from "#enums/ui-mode"; import PokemonIconAnimHandler, { PokemonIconAnimMode } from "./pokemon-icon-anim-handler"; import MessageUiHandler from "./message-ui-handler"; import { getEggTierForSpecies } from "../data/egg"; @@ -54,7 +54,7 @@ export default class EggSummaryUiHandler extends MessageUiHandler { public readonly eventTarget: EventTarget = new EventTarget(); constructor() { - super(Mode.EGG_HATCH_SUMMARY); + super(UiMode.EGG_HATCH_SUMMARY); } setup() { diff --git a/src/ui/evolution-scene-handler.ts b/src/ui/evolution-scene-handler.ts index 91f3360a3d4..cea91ce4e2c 100644 --- a/src/ui/evolution-scene-handler.ts +++ b/src/ui/evolution-scene-handler.ts @@ -1,6 +1,6 @@ import MessageUiHandler from "./message-ui-handler"; import { TextStyle, addTextObject } from "./text"; -import { Mode } from "./ui"; +import { UiMode } from "#enums/ui-mode"; import { Button } from "#enums/buttons"; import { globalScene } from "#app/global-scene"; @@ -12,7 +12,7 @@ export default class EvolutionSceneHandler extends MessageUiHandler { public cancelled: boolean; constructor() { - super(Mode.EVOLUTION_SCENE); + super(UiMode.EVOLUTION_SCENE); } setup() { diff --git a/src/ui/fight-ui-handler.ts b/src/ui/fight-ui-handler.ts index 285a1dd36cc..e0a73d62934 100644 --- a/src/ui/fight-ui-handler.ts +++ b/src/ui/fight-ui-handler.ts @@ -4,9 +4,9 @@ import { addTextObject, TextStyle } from "./text"; import { getTypeDamageMultiplierColor } from "#app/data/type"; import { PokemonType } from "#enums/pokemon-type"; import { Command } from "./command-ui-handler"; -import { Mode } from "./ui"; +import { UiMode } from "#enums/ui-mode"; import UiHandler from "./ui-handler"; -import { getLocalizedSpriteKey, fixedInt, padInt } from "#app/utils"; +import { getLocalizedSpriteKey, fixedInt, padInt } from "#app/utils/common"; import { MoveCategory } from "#enums/MoveCategory"; import i18next from "i18next"; import { Button } from "#enums/buttons"; @@ -37,7 +37,7 @@ export default class FightUiHandler extends UiHandler implements InfoToggle { protected cursor2 = 0; constructor() { - super(Mode.FIGHT); + super(UiMode.FIGHT); } setup() { @@ -156,7 +156,7 @@ export default class FightUiHandler extends UiHandler implements InfoToggle { // Cannot back out of fight menu if skipToFightInput is enabled const { battleType, mysteryEncounter } = globalScene.currentBattle; if (battleType !== BattleType.MYSTERY_ENCOUNTER || !mysteryEncounter?.skipToFightInput) { - ui.setMode(Mode.COMMAND, this.fieldIndex); + ui.setMode(UiMode.COMMAND, this.fieldIndex); success = true; } } @@ -308,7 +308,7 @@ export default class FightUiHandler extends UiHandler implements InfoToggle { !opponent.battleData?.abilityRevealed, undefined, undefined, - true + true, ); if (effectiveness === undefined) { return undefined; @@ -353,7 +353,14 @@ export default class FightUiHandler extends UiHandler implements InfoToggle { const moveColors = opponents .map(opponent => - opponent.getMoveEffectiveness(pokemon, pokemonMove.getMove(), !opponent.battleData.abilityRevealed, undefined, undefined, true), + opponent.getMoveEffectiveness( + pokemon, + pokemonMove.getMove(), + !opponent.battleData.abilityRevealed, + undefined, + undefined, + true, + ), ) .sort((a, b) => b - a) .map(effectiveness => getTypeDamageMultiplierColor(effectiveness ?? 0, "offense")); diff --git a/src/ui/filter-text.ts b/src/ui/filter-text.ts index a6b01ba39e6..8b13b76db31 100644 --- a/src/ui/filter-text.ts +++ b/src/ui/filter-text.ts @@ -5,7 +5,7 @@ import { addWindow, WindowVariant } from "./ui-theme"; import i18next from "i18next"; import type AwaitableUiHandler from "./awaitable-ui-handler"; import type UI from "./ui"; -import { Mode } from "./ui"; +import { UiMode } from "#enums/ui-mode"; import { globalScene } from "#app/global-scene"; export enum FilterTextRow { @@ -154,7 +154,7 @@ export class FilterText extends Phaser.GameObjects.Container { this.onChange; }, ]; - ui.setOverlayMode(Mode.POKEDEX_SCAN, buttonAction, prefilledText, index); + ui.setOverlayMode(UiMode.POKEDEX_SCAN, buttonAction, prefilledText, index); } setCursor(cursor: number): void { diff --git a/src/ui/form-modal-ui-handler.ts b/src/ui/form-modal-ui-handler.ts index e27b2e9ed89..e8e67d591d5 100644 --- a/src/ui/form-modal-ui-handler.ts +++ b/src/ui/form-modal-ui-handler.ts @@ -1,10 +1,10 @@ import type { ModalConfig } from "./modal-ui-handler"; import { ModalUiHandler } from "./modal-ui-handler"; -import type { Mode } from "./ui"; +import type { UiMode } from "#enums/ui-mode"; import { TextStyle, addTextInputObject, addTextObject } from "./text"; import { WindowVariant, addWindow } from "./ui-theme"; import type InputText from "phaser3-rex-plugins/plugins/inputtext"; -import { fixedInt } from "#app/utils"; +import { fixedInt } from "#app/utils/common"; import { Button } from "#enums/buttons"; import { globalScene } from "#app/global-scene"; @@ -21,7 +21,7 @@ export abstract class FormModalUiHandler extends ModalUiHandler { protected tween: Phaser.Tweens.Tween; protected formLabels: Phaser.GameObjects.Text[]; - constructor(mode: Mode | null = null) { + constructor(mode: UiMode | null = null) { super(mode); this.editing = false; diff --git a/src/ui/game-stats-ui-handler.ts b/src/ui/game-stats-ui-handler.ts index 2e2112dfda4..dc184a34866 100644 --- a/src/ui/game-stats-ui-handler.ts +++ b/src/ui/game-stats-ui-handler.ts @@ -1,9 +1,9 @@ import Phaser from "phaser"; import { TextStyle, addTextObject } from "#app/ui/text"; -import type { Mode } from "#app/ui/ui"; +import type { UiMode } from "#enums/ui-mode"; import UiHandler from "#app/ui/ui-handler"; import { addWindow } from "#app/ui/ui-theme"; -import { getPlayTimeString, formatFancyLargeNumber, toReadableString } from "#app/utils"; +import { getPlayTimeString, formatFancyLargeNumber, toReadableString } from "#app/utils/common"; import type { GameData } from "#app/system/game-data"; import { DexAttr } from "#app/system/game-data"; import { speciesStarterCosts } from "#app/data/balance/starters"; @@ -223,7 +223,7 @@ export default class GameStatsUiHandler extends UiHandler { private arrowUp: Phaser.GameObjects.Sprite; private arrowDown: Phaser.GameObjects.Sprite; - constructor(mode: Mode | null = null) { + constructor(mode: UiMode | null = null) { super(mode); this.statLabels = []; diff --git a/src/ui/loading-modal-ui-handler.ts b/src/ui/loading-modal-ui-handler.ts index 9626276245d..13dffe5614c 100644 --- a/src/ui/loading-modal-ui-handler.ts +++ b/src/ui/loading-modal-ui-handler.ts @@ -1,10 +1,10 @@ import i18next from "i18next"; import { ModalUiHandler } from "./modal-ui-handler"; import { addTextObject, TextStyle } from "./text"; -import type { Mode } from "./ui"; +import type { UiMode } from "#enums/ui-mode"; export default class LoadingModalUiHandler extends ModalUiHandler { - constructor(mode: Mode | null = null) { + constructor(mode: UiMode | null = null) { super(mode); } diff --git a/src/ui/login-form-ui-handler.ts b/src/ui/login-form-ui-handler.ts index 5c009357443..2dfab9c0c40 100644 --- a/src/ui/login-form-ui-handler.ts +++ b/src/ui/login-form-ui-handler.ts @@ -1,8 +1,8 @@ import type { InputFieldConfig } from "./form-modal-ui-handler"; import { FormModalUiHandler } from "./form-modal-ui-handler"; import type { ModalConfig } from "./modal-ui-handler"; -import { fixedInt } from "#app/utils"; -import { Mode } from "./ui"; +import { fixedInt } from "#app/utils/common"; +import { UiMode } from "#enums/ui-mode"; import i18next from "i18next"; import { addTextObject, TextStyle } from "./text"; import { addWindow } from "./ui-theme"; @@ -34,7 +34,7 @@ export default class LoginFormUiHandler extends FormModalUiHandler { private infoContainer: Phaser.GameObjects.Container; private externalPartyBg: Phaser.GameObjects.NineSlice; private externalPartyTitle: Phaser.GameObjects.Text; - constructor(mode: Mode | null = null) { + constructor(mode: UiMode | null = null) { super(mode); } @@ -146,9 +146,9 @@ export default class LoginFormUiHandler extends FormModalUiHandler { // Prevent overlapping overrides on action modification this.submitAction = originalLoginAction; this.sanitizeInputs(); - globalScene.ui.setMode(Mode.LOADING, { buttonActions: [] }); + globalScene.ui.setMode(UiMode.LOADING, { buttonActions: [] }); const onFail = error => { - globalScene.ui.setMode(Mode.LOGIN_FORM, Object.assign(config, { errorMessage: error?.trim() })); + globalScene.ui.setMode(UiMode.LOGIN_FORM, Object.assign(config, { errorMessage: error?.trim() })); globalScene.ui.playError(); }; if (!this.inputs[0].text) { @@ -215,8 +215,8 @@ export default class LoginFormUiHandler extends FormModalUiHandler { }); const onFail = error => { - globalScene.ui.setMode(Mode.LOADING, { buttonActions: [] }); - globalScene.ui.setModeForceTransition(Mode.LOGIN_FORM, Object.assign(config, { errorMessage: error?.trim() })); + globalScene.ui.setMode(UiMode.LOADING, { buttonActions: [] }); + globalScene.ui.setModeForceTransition(UiMode.LOGIN_FORM, Object.assign(config, { errorMessage: error?.trim() })); globalScene.ui.playError(); }; @@ -236,7 +236,7 @@ export default class LoginFormUiHandler extends FormModalUiHandler { }, }); } - globalScene.ui.setOverlayMode(Mode.OPTION_SELECT, { + globalScene.ui.setOverlayMode(UiMode.OPTION_SELECT, { options: options, delay: 1000, }); diff --git a/src/ui/menu-ui-handler.ts b/src/ui/menu-ui-handler.ts index 241ddbb91a8..7f0cd4d6a78 100644 --- a/src/ui/menu-ui-handler.ts +++ b/src/ui/menu-ui-handler.ts @@ -1,8 +1,10 @@ -import { bypassLogin } from "#app/battle-scene"; +import { bypassLogin } from "#app/global-vars/bypass-login"; import { globalScene } from "#app/global-scene"; import { TextStyle, addTextObject, getTextStyleOptions } from "./text"; -import { Mode } from "./ui"; -import { getEnumKeys, isLocal, isBeta, fixedInt, getCookie, sessionIdKey } from "#app/utils"; +import { UiMode } from "#enums/ui-mode"; +import { getEnumKeys, isLocal, fixedInt, sessionIdKey } from "#app/utils/common"; +import { isBeta } from "#app/utils/utility-vars"; +import { getCookie } from "#app/utils/cookies"; import { addWindow, WindowVariant } from "./ui-theme"; import MessageUiHandler from "./message-ui-handler"; import type { OptionSelectConfig, OptionSelectItem } from "./abstact-option-select-ui-handler"; @@ -64,12 +66,12 @@ export default class MenuUiHandler extends MessageUiHandler { public bgmBar: BgmBar; - constructor(mode: Mode | null = null) { + constructor(mode: UiMode | null = null) { super(mode); this.excludedMenus = () => [ { - condition: [Mode.COMMAND, Mode.TITLE].includes(mode ?? Mode.TITLE), + condition: [UiMode.COMMAND, UiMode.TITLE].includes(mode ?? UiMode.TITLE), options: [MenuOptions.EGG_GACHA, MenuOptions.EGG_LIST], }, { condition: bypassLogin, options: [MenuOptions.LOG_OUT] }, @@ -234,7 +236,7 @@ export default class MenuUiHandler extends MessageUiHandler { ]), xOffset: 98, }; - ui.setOverlayMode(Mode.MENU_OPTION_SELECT, config); + ui.setOverlayMode(UiMode.MENU_OPTION_SELECT, config); }); }; @@ -377,7 +379,7 @@ export default class MenuUiHandler extends MessageUiHandler { ui.revertMode(); }, ]; - ui.setMode(Mode.TEST_DIALOGUE, buttonAction, prefilledText); + ui.setMode(UiMode.TEST_DIALOGUE, buttonAction, prefilledText); return true; }, keepOpen: true, @@ -456,7 +458,7 @@ export default class MenuUiHandler extends MessageUiHandler { handler: () => { ui.playSelect(); ui.setOverlayMode( - Mode.ADMIN, + UiMode.ADMIN, { buttonActions: [ // we double revert here and below to go back 2 layers of menus @@ -483,7 +485,7 @@ export default class MenuUiHandler extends MessageUiHandler { return true; }, }); - globalScene.ui.setOverlayMode(Mode.OPTION_SELECT, { + globalScene.ui.setOverlayMode(UiMode.OPTION_SELECT, { options: options, delay: 0, }); @@ -557,21 +559,21 @@ export default class MenuUiHandler extends MessageUiHandler { this.showText("", 0); switch (adjustedCursor) { case MenuOptions.GAME_SETTINGS: - ui.setOverlayMode(Mode.SETTINGS); + ui.setOverlayMode(UiMode.SETTINGS); success = true; break; case MenuOptions.ACHIEVEMENTS: - ui.setOverlayMode(Mode.ACHIEVEMENTS); + ui.setOverlayMode(UiMode.ACHIEVEMENTS); success = true; break; case MenuOptions.STATS: - ui.setOverlayMode(Mode.GAME_STATS); + ui.setOverlayMode(UiMode.GAME_STATS); success = true; break; case MenuOptions.EGG_LIST: if (globalScene.gameData.eggs.length) { ui.revertMode(); - ui.setOverlayMode(Mode.EGG_LIST); + ui.setOverlayMode(UiMode.EGG_LIST); success = true; } else { ui.showText(i18next.t("menuUiHandler:noEggs"), null, () => ui.showText(""), fixedInt(1500)); @@ -580,12 +582,12 @@ export default class MenuUiHandler extends MessageUiHandler { break; case MenuOptions.EGG_GACHA: ui.revertMode(); - ui.setOverlayMode(Mode.EGG_GACHA); + ui.setOverlayMode(UiMode.EGG_GACHA); success = true; break; case MenuOptions.POKEDEX: ui.revertMode(); - ui.setOverlayMode(Mode.POKEDEX); + ui.setOverlayMode(UiMode.POKEDEX); success = true; break; case MenuOptions.MANAGE_DATA: @@ -642,18 +644,18 @@ export default class MenuUiHandler extends MessageUiHandler { }, ); } - ui.setOverlayMode(Mode.MENU_OPTION_SELECT, this.manageDataConfig); + ui.setOverlayMode(UiMode.MENU_OPTION_SELECT, this.manageDataConfig); success = true; break; case MenuOptions.COMMUNITY: - ui.setOverlayMode(Mode.MENU_OPTION_SELECT, this.communityConfig); + ui.setOverlayMode(UiMode.MENU_OPTION_SELECT, this.communityConfig); success = true; break; case MenuOptions.SAVE_AND_QUIT: if (globalScene.currentBattle) { success = true; const doSaveQuit = () => { - ui.setMode(Mode.LOADING, { + ui.setMode(UiMode.LOADING, { buttonActions: [], fadeOut: () => globalScene.gameData.saveAll(true, true, true, true).then(() => { @@ -668,7 +670,7 @@ export default class MenuUiHandler extends MessageUiHandler { return; } ui.setOverlayMode( - Mode.CONFIRM, + UiMode.CONFIRM, doSaveQuit, () => { ui.revertMode(); @@ -688,7 +690,7 @@ export default class MenuUiHandler extends MessageUiHandler { case MenuOptions.LOG_OUT: success = true; const doLogout = () => { - ui.setMode(Mode.LOADING, { + ui.setMode(UiMode.LOADING, { buttonActions: [], fadeOut: () => pokerogueApi.account.logout().then(() => { @@ -703,7 +705,7 @@ export default class MenuUiHandler extends MessageUiHandler { return; } ui.setOverlayMode( - Mode.CONFIRM, + UiMode.CONFIRM, doLogout, () => { ui.revertMode(); @@ -722,7 +724,7 @@ export default class MenuUiHandler extends MessageUiHandler { success = true; ui.revertMode().then(result => { if (!result) { - ui.setMode(Mode.MESSAGE); + ui.setMode(UiMode.MESSAGE); } }); } else { diff --git a/src/ui/message-ui-handler.ts b/src/ui/message-ui-handler.ts index b57b236531c..efa53b63808 100644 --- a/src/ui/message-ui-handler.ts +++ b/src/ui/message-ui-handler.ts @@ -1,6 +1,6 @@ import AwaitableUiHandler from "./awaitable-ui-handler"; -import type { Mode } from "./ui"; -import { getFrameMs } from "#app/utils"; +import type { UiMode } from "#enums/ui-mode"; +import { getFrameMs } from "#app/utils/common"; import { globalScene } from "#app/global-scene"; export default abstract class MessageUiHandler extends AwaitableUiHandler { @@ -11,7 +11,7 @@ export default abstract class MessageUiHandler extends AwaitableUiHandler { public message: Phaser.GameObjects.Text; public prompt: Phaser.GameObjects.Sprite; - constructor(mode: Mode | null = null) { + constructor(mode: UiMode | null = null) { super(mode); this.pendingPrompt = false; diff --git a/src/ui/modal-ui-handler.ts b/src/ui/modal-ui-handler.ts index b7dbbeb202d..a3b94296d3f 100644 --- a/src/ui/modal-ui-handler.ts +++ b/src/ui/modal-ui-handler.ts @@ -1,5 +1,5 @@ import { TextStyle, addTextObject } from "./text"; -import type { Mode } from "./ui"; +import type { UiMode } from "#enums/ui-mode"; import UiHandler from "./ui-handler"; import { WindowVariant, addWindow } from "./ui-theme"; import type { Button } from "#enums/buttons"; @@ -17,7 +17,7 @@ export abstract class ModalUiHandler extends UiHandler { protected buttonBgs: Phaser.GameObjects.NineSlice[]; protected buttonLabels: Phaser.GameObjects.Text[]; - constructor(mode: Mode | null = null) { + constructor(mode: UiMode | null = null) { super(mode); this.buttonContainers = []; diff --git a/src/ui/modifier-select-ui-handler.ts b/src/ui/modifier-select-ui-handler.ts index 26351d4dbf1..9ba54491175 100644 --- a/src/ui/modifier-select-ui-handler.ts +++ b/src/ui/modifier-select-ui-handler.ts @@ -4,13 +4,13 @@ import { getPlayerShopModifierTypeOptionsForWave, TmModifierType } from "../modi import { getPokeballAtlasKey } from "#app/data/pokeball"; import { addTextObject, getTextStyleOptions, getModifierTierTextTint, getTextColor, TextStyle } from "./text"; import AwaitableUiHandler from "./awaitable-ui-handler"; -import { Mode } from "./ui"; +import { UiMode } from "#enums/ui-mode"; import { LockModifierTiersModifier, PokemonHeldItemModifier, HealShopCostModifier } from "../modifier/modifier"; import { handleTutorial, Tutorial } from "../tutorial"; import { Button } from "#enums/buttons"; import MoveInfoOverlay from "./move-info-overlay"; import { allMoves } from "../data/moves/move"; -import { formatMoney, NumberHolder } from "#app/utils"; +import { formatMoney, NumberHolder } from "#app/utils/common"; import Overrides from "#app/overrides"; import i18next from "i18next"; import { ShopCursorTarget } from "#app/enums/shop-cursor-target"; @@ -50,7 +50,7 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler { private cursorObj: Phaser.GameObjects.Image | null; constructor() { - super(Mode.CONFIRM); + super(UiMode.CONFIRM); this.options = []; this.shopOptionsRows = []; diff --git a/src/ui/move-info-overlay.ts b/src/ui/move-info-overlay.ts index bd9fdf00c72..2b230d609fd 100644 --- a/src/ui/move-info-overlay.ts +++ b/src/ui/move-info-overlay.ts @@ -2,7 +2,7 @@ import type { InfoToggle } from "#app/battle-scene"; import { globalScene } from "#app/global-scene"; import { TextStyle, addTextObject } from "./text"; import { addWindow } from "./ui-theme"; -import { getLocalizedSpriteKey, fixedInt } from "#app/utils"; +import { getLocalizedSpriteKey, fixedInt } from "#app/utils/common"; import type Move from "../data/moves/move"; import { MoveCategory } from "#enums/MoveCategory"; import { PokemonType } from "#enums/pokemon-type"; diff --git a/src/ui/mystery-encounter-ui-handler.ts b/src/ui/mystery-encounter-ui-handler.ts index 2bf05302c55..0866ed8788e 100644 --- a/src/ui/mystery-encounter-ui-handler.ts +++ b/src/ui/mystery-encounter-ui-handler.ts @@ -1,12 +1,12 @@ import { addBBCodeTextObject, getBBCodeFrag, TextStyle } from "./text"; -import { Mode } from "./ui"; +import { UiMode } from "#enums/ui-mode"; import UiHandler from "./ui-handler"; import { Button } from "#enums/buttons"; import { addWindow, WindowVariant } from "./ui-theme"; import type { MysteryEncounterPhase } from "../phases/mystery-encounter-phases"; import { PartyUiMode } from "./party-ui-handler"; import type MysteryEncounterOption from "#app/data/mystery-encounters/mystery-encounter-option"; -import { fixedInt, isNullOrUndefined } from "#app/utils"; +import { fixedInt, isNullOrUndefined } from "#app/utils/common"; import { getPokeballAtlasKey } from "../data/pokeball"; import type { OptionSelectSettings } from "#app/data/mystery-encounters/utils/encounter-phase-utils"; import { getEncounterText } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils"; @@ -47,7 +47,7 @@ export default class MysteryEncounterUiHandler extends UiHandler { protected blockInput = true; constructor() { - super(Mode.MYSTERY_ENCOUNTER); + super(UiMode.MYSTERY_ENCOUNTER); } override setup() { @@ -141,8 +141,8 @@ export default class MysteryEncounterUiHandler extends UiHandler { ...this.overrideSettings, slideInDescription: false, }; - globalScene.ui.setMode(Mode.PARTY, PartyUiMode.CHECK, -1, () => { - globalScene.ui.setMode(Mode.MYSTERY_ENCOUNTER, overrideSettings); + globalScene.ui.setMode(UiMode.PARTY, PartyUiMode.CHECK, -1, () => { + globalScene.ui.setMode(UiMode.MYSTERY_ENCOUNTER, overrideSettings); setTimeout(() => { this.setCursor(this.viewPartyIndex); this.unblockInput(); diff --git a/src/ui/party-ui-handler.ts b/src/ui/party-ui-handler.ts index ba90108c274..7c3689e757c 100644 --- a/src/ui/party-ui-handler.ts +++ b/src/ui/party-ui-handler.ts @@ -4,8 +4,8 @@ import { MoveResult } from "#app/field/pokemon"; import { addBBCodeTextObject, addTextObject, getTextColor, TextStyle } from "#app/ui/text"; import { Command } from "#app/ui/command-ui-handler"; import MessageUiHandler from "#app/ui/message-ui-handler"; -import { Mode } from "#app/ui/ui"; -import { BooleanHolder, toReadableString, randInt, getLocalizedSpriteKey } from "#app/utils"; +import { UiMode } from "#enums/ui-mode"; +import { BooleanHolder, toReadableString, randInt, getLocalizedSpriteKey } from "#app/utils/common"; import { PokemonFormChangeItemModifier, PokemonHeldItemModifier, @@ -252,7 +252,7 @@ export default class PartyUiHandler extends MessageUiHandler { ]; constructor() { - super(Mode.PARTY); + super(UiMode.PARTY); } setup() { @@ -556,7 +556,7 @@ export default class PartyUiHandler extends MessageUiHandler { this.showText(filterResult as string, undefined, () => this.showText("", 0), undefined, true); } else if (option === PartyOption.SUMMARY) { ui.playSelect(); - ui.setModeWithoutClear(Mode.SUMMARY, pokemon).then(() => this.clearOptions()); + ui.setModeWithoutClear(UiMode.SUMMARY, pokemon).then(() => this.clearOptions()); return true; } else if (option === PartyOption.POKEDEX) { ui.playSelect(); @@ -566,7 +566,7 @@ export default class PartyUiHandler extends MessageUiHandler { form: pokemon.formIndex, female: pokemon.gender === Gender.FEMALE, }; - ui.setOverlayMode(Mode.POKEDEX_PAGE, pokemon.species, attributes).then(() => this.clearOptions()); + ui.setOverlayMode(UiMode.POKEDEX_PAGE, pokemon.species, attributes).then(() => this.clearOptions()); return true; } else if (option === PartyOption.UNPAUSE_EVOLUTION) { this.clearOptions(); @@ -593,13 +593,13 @@ export default class PartyUiHandler extends MessageUiHandler { null, () => { ui.setModeWithoutClear( - Mode.CONFIRM, + UiMode.CONFIRM, () => { const fusionName = pokemon.getName(); pokemon.unfuse().then(() => { this.clearPartySlots(); this.populatePartySlots(); - ui.setMode(Mode.PARTY); + ui.setMode(UiMode.PARTY); this.showText( i18next.t("partyUiHandler:wasReverted", { fusionName: fusionName, @@ -607,7 +607,7 @@ export default class PartyUiHandler extends MessageUiHandler { }), undefined, () => { - ui.setMode(Mode.PARTY); + ui.setMode(UiMode.PARTY); this.showText("", 0); }, null, @@ -616,7 +616,7 @@ export default class PartyUiHandler extends MessageUiHandler { }); }, () => { - ui.setMode(Mode.PARTY); + ui.setMode(UiMode.PARTY); this.showText("", 0); }, ); @@ -635,13 +635,13 @@ export default class PartyUiHandler extends MessageUiHandler { () => { this.blockInput = false; ui.setModeWithoutClear( - Mode.CONFIRM, + UiMode.CONFIRM, () => { - ui.setMode(Mode.PARTY); + ui.setMode(UiMode.PARTY); this.doRelease(this.cursor); }, () => { - ui.setMode(Mode.PARTY); + ui.setMode(UiMode.PARTY); this.showText("", 0); }, ); @@ -655,7 +655,7 @@ export default class PartyUiHandler extends MessageUiHandler { this.clearOptions(); ui.playSelect(); ui.setModeWithoutClear( - Mode.RENAME_POKEMON, + UiMode.RENAME_POKEMON, { buttonActions: [ (nickname: string) => { @@ -664,10 +664,10 @@ export default class PartyUiHandler extends MessageUiHandler { pokemon.updateInfo(); this.clearPartySlots(); this.populatePartySlots(); - ui.setMode(Mode.PARTY); + ui.setMode(UiMode.PARTY); }, () => { - ui.setMode(Mode.PARTY); + ui.setMode(UiMode.PARTY); }, ], }, @@ -788,7 +788,7 @@ export default class PartyUiHandler extends MessageUiHandler { selectCallback(6, PartyOption.CANCEL); ui.playSelect(); } else { - ui.setMode(Mode.COMMAND, this.fieldIndex); + ui.setMode(UiMode.COMMAND, this.fieldIndex); ui.playSelect(); } } diff --git a/src/ui/pokedex-info-overlay.ts b/src/ui/pokedex-info-overlay.ts index 43e9bbc1a65..2e889f6d2a9 100644 --- a/src/ui/pokedex-info-overlay.ts +++ b/src/ui/pokedex-info-overlay.ts @@ -1,7 +1,7 @@ import type { InfoToggle } from "../battle-scene"; import { TextStyle, addTextObject } from "./text"; import { addWindow } from "./ui-theme"; -import { fixedInt } from "#app/utils"; +import { fixedInt } from "#app/utils/common"; import i18next from "i18next"; import { globalScene } from "#app/global-scene"; diff --git a/src/ui/pokedex-mon-container.ts b/src/ui/pokedex-mon-container.ts index 410effda40d..da79320850d 100644 --- a/src/ui/pokedex-mon-container.ts +++ b/src/ui/pokedex-mon-container.ts @@ -1,6 +1,6 @@ import type { Variant } from "#app/sprites/variant"; import { globalScene } from "#app/global-scene"; -import { isNullOrUndefined } from "#app/utils"; +import { isNullOrUndefined } from "#app/utils/common"; import type PokemonSpecies from "../data/pokemon-species"; import { addTextObject, TextStyle } from "./text"; diff --git a/src/ui/pokedex-page-ui-handler.ts b/src/ui/pokedex-page-ui-handler.ts index 3f8959c6219..d0b85544494 100644 --- a/src/ui/pokedex-page-ui-handler.ts +++ b/src/ui/pokedex-page-ui-handler.ts @@ -4,7 +4,7 @@ import type { Variant } from "#app/sprites/variant"; import { getVariantTint, getVariantIcon } from "#app/sprites/variant"; import { argbFromRgba } from "@material/material-color-utilities"; import i18next from "i18next"; -import { starterColors } from "#app/battle-scene"; +import { starterColors } from "#app/global-vars/starter-colors"; import { allAbilities } from "#app/data/data-lists"; import { speciesEggMoves } from "#app/data/balance/egg-moves"; import { GrowthRate, getGrowthRateColor } from "#app/data/exp"; @@ -26,7 +26,7 @@ import type { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler" import MessageUiHandler from "#app/ui/message-ui-handler"; import { StatsContainer } from "#app/ui/stats-container"; import { TextStyle, addBBCodeTextObject, addTextObject, getTextColor, getTextStyleOptions } from "#app/ui/text"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { addWindow } from "#app/ui/ui-theme"; import { Egg } from "#app/data/egg"; import Overrides from "#app/overrides"; @@ -52,9 +52,9 @@ import { padInt, rgbHexToRgba, toReadableString, -} from "#app/utils"; +} from "#app/utils/common"; import type { Nature } from "#enums/nature"; -import { getEnumKeys } from "#app/utils"; +import { getEnumKeys } from "#app/utils/common"; import { speciesTmMoves } from "#app/data/balance/tms"; import type { BiomeTierTod } from "#app/data/balance/biomes"; import { BiomePoolTier, catchableSpecies } from "#app/data/balance/biomes"; @@ -265,7 +265,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { private exitCallback; constructor() { - super(Mode.POKEDEX_PAGE); + super(UiMode.POKEDEX_PAGE); } setup() { @@ -1140,12 +1140,12 @@ export default class PokedexPageUiHandler extends MessageUiHandler { success = true; } else if (this.previousSpecies.length > 0) { this.blockInput = true; - ui.setModeWithoutClear(Mode.OPTION_SELECT).then(() => { + ui.setModeWithoutClear(UiMode.OPTION_SELECT).then(() => { const species = this.previousSpecies.pop(); const starterAttributes = this.previousStarterAttributes.pop(); this.moveInfoOverlay.clear(); this.clearText(); - ui.setModeForceTransition(Mode.POKEDEX_PAGE, species, starterAttributes); + ui.setModeForceTransition(UiMode.POKEDEX_PAGE, species, starterAttributes); success = true; }); this.blockInput = false; @@ -1173,7 +1173,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { } else { this.blockInput = true; - ui.setMode(Mode.POKEDEX_PAGE, "refresh").then(() => { + ui.setMode(UiMode.POKEDEX_PAGE, "refresh").then(() => { ui.showText(i18next.t("pokedexUiHandler:showBaseStats"), null, () => { this.baseStatsOverlay.show(this.baseStats, this.baseTotal); @@ -1193,11 +1193,11 @@ export default class PokedexPageUiHandler extends MessageUiHandler { } else { this.blockInput = true; - ui.setMode(Mode.POKEDEX_PAGE, "refresh").then(() => { + ui.setMode(UiMode.POKEDEX_PAGE, "refresh").then(() => { ui.showText(i18next.t("pokedexUiHandler:showLevelMoves"), null, () => { this.moveInfoOverlay.show(allMoves[this.levelMoves[0][1]]); - ui.setModeWithoutClear(Mode.OPTION_SELECT, { + ui.setModeWithoutClear(UiMode.OPTION_SELECT, { options: this.levelMoves .map(m => { const levelNumber = m[0] > 0 ? String(m[0]) : ""; @@ -1226,7 +1226,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { handler: () => { this.moveInfoOverlay.clear(); this.clearText(); - ui.setMode(Mode.POKEDEX_PAGE, "refresh"); + ui.setMode(UiMode.POKEDEX_PAGE, "refresh"); return true; }, onHover: () => { @@ -1251,7 +1251,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { } else { this.blockInput = true; - ui.setMode(Mode.POKEDEX_PAGE, "refresh").then(() => { + ui.setMode(UiMode.POKEDEX_PAGE, "refresh").then(() => { if (this.eggMoves.length === 0) { ui.showText(i18next.t("pokedexUiHandler:noEggMoves")); this.blockInput = false; @@ -1261,7 +1261,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { ui.showText(i18next.t("pokedexUiHandler:showEggMoves"), null, () => { this.moveInfoOverlay.show(allMoves[this.eggMoves[0]]); - ui.setModeWithoutClear(Mode.OPTION_SELECT, { + ui.setModeWithoutClear(UiMode.OPTION_SELECT, { options: [ { label: i18next.t("pokedexUiHandler:common"), @@ -1294,7 +1294,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { handler: () => { this.moveInfoOverlay.clear(); this.clearText(); - ui.setMode(Mode.POKEDEX_PAGE, "refresh"); + ui.setMode(UiMode.POKEDEX_PAGE, "refresh"); return true; }, onHover: () => this.moveInfoOverlay.clear(), @@ -1321,11 +1321,11 @@ export default class PokedexPageUiHandler extends MessageUiHandler { } else { this.blockInput = true; - ui.setMode(Mode.POKEDEX_PAGE, "refresh").then(() => { + ui.setMode(UiMode.POKEDEX_PAGE, "refresh").then(() => { ui.showText(i18next.t("pokedexUiHandler:showTmMoves"), null, () => { this.moveInfoOverlay.show(allMoves[this.tmMoves[0]]); - ui.setModeWithoutClear(Mode.OPTION_SELECT, { + ui.setModeWithoutClear(UiMode.OPTION_SELECT, { options: this.tmMoves .map(m => { const option: OptionSelectItem = { @@ -1344,7 +1344,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { handler: () => { this.moveInfoOverlay.clear(); this.clearText(); - ui.setMode(Mode.POKEDEX_PAGE, "refresh"); + ui.setMode(UiMode.POKEDEX_PAGE, "refresh"); return true; }, onHover: () => { @@ -1369,7 +1369,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { } else { this.blockInput = true; - ui.setMode(Mode.POKEDEX_PAGE, "refresh").then(() => { + ui.setMode(UiMode.POKEDEX_PAGE, "refresh").then(() => { ui.showText(i18next.t("pokedexUiHandler:showAbilities"), null, () => { this.infoOverlay.show(allAbilities[this.ability1].description); @@ -1431,13 +1431,13 @@ export default class PokedexPageUiHandler extends MessageUiHandler { handler: () => { this.infoOverlay.clear(); this.clearText(); - ui.setMode(Mode.POKEDEX_PAGE, "refresh"); + ui.setMode(UiMode.POKEDEX_PAGE, "refresh"); return true; }, onHover: () => this.infoOverlay.clear(), }); - ui.setModeWithoutClear(Mode.OPTION_SELECT, { + ui.setModeWithoutClear(UiMode.OPTION_SELECT, { options: options, supportHover: true, maxOptions: 8, @@ -1457,7 +1457,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { } else { this.blockInput = true; - ui.setMode(Mode.POKEDEX_PAGE, "refresh").then(() => { + ui.setMode(UiMode.POKEDEX_PAGE, "refresh").then(() => { if ((!this.biomes || this.biomes?.length === 0) && (!this.preBiomes || this.preBiomes?.length === 0)) { ui.showText(i18next.t("pokedexUiHandler:noBiomes")); ui.playError(); @@ -1510,13 +1510,13 @@ export default class PokedexPageUiHandler extends MessageUiHandler { handler: () => { this.moveInfoOverlay.clear(); this.clearText(); - ui.setMode(Mode.POKEDEX_PAGE, "refresh"); + ui.setMode(UiMode.POKEDEX_PAGE, "refresh"); return true; }, onHover: () => this.moveInfoOverlay.clear(), }); - ui.setModeWithoutClear(Mode.OPTION_SELECT, { + ui.setModeWithoutClear(UiMode.OPTION_SELECT, { options: options, supportHover: true, maxOptions: 8, @@ -1536,7 +1536,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { } else { this.blockInput = true; - ui.setMode(Mode.POKEDEX_PAGE, "refresh").then(() => { + ui.setMode(UiMode.POKEDEX_PAGE, "refresh").then(() => { const options: any[] = []; if ( @@ -1589,7 +1589,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { this.savedStarterAttributes.form = newFormIndex; this.moveInfoOverlay.clear(); this.clearText(); - ui.setMode(Mode.POKEDEX_PAGE, newSpecies, this.savedStarterAttributes); + ui.setMode(UiMode.POKEDEX_PAGE, newSpecies, this.savedStarterAttributes); return true; }, onHover: () => this.showText(conditionText), @@ -1631,7 +1631,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { this.savedStarterAttributes.form = newFormIndex; this.moveInfoOverlay.clear(); this.clearText(); - ui.setMode(Mode.POKEDEX_PAGE, evoSpecies, this.savedStarterAttributes); + ui.setMode(UiMode.POKEDEX_PAGE, evoSpecies, this.savedStarterAttributes); return true; }, onHover: () => this.showText(conditionText), @@ -1676,7 +1676,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { this.moveInfoOverlay.clear(); this.clearText(); ui.setMode( - Mode.POKEDEX_PAGE, + UiMode.POKEDEX_PAGE, newSpecies, this.savedStarterAttributes, this.filteredIndices, @@ -1694,13 +1694,13 @@ export default class PokedexPageUiHandler extends MessageUiHandler { handler: () => { this.moveInfoOverlay.clear(); this.clearText(); - ui.setMode(Mode.POKEDEX_PAGE, "refresh"); + ui.setMode(UiMode.POKEDEX_PAGE, "refresh"); return true; }, onHover: () => this.moveInfoOverlay.clear(), }); - ui.setModeWithoutClear(Mode.OPTION_SELECT, { + ui.setModeWithoutClear(UiMode.OPTION_SELECT, { options: options, supportHover: true, maxOptions: 8, @@ -1719,7 +1719,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { error = true; } else { this.toggleStatsMode(); - ui.setMode(Mode.POKEDEX_PAGE, "refresh"); + ui.setMode(UiMode.POKEDEX_PAGE, "refresh"); success = true; } break; @@ -1729,10 +1729,10 @@ export default class PokedexPageUiHandler extends MessageUiHandler { error = true; } else { this.blockInput = true; - ui.setMode(Mode.POKEDEX_PAGE, "refresh").then(() => { + ui.setMode(UiMode.POKEDEX_PAGE, "refresh").then(() => { ui.showText(i18next.t("pokedexUiHandler:showNature"), null, () => { const natures = globalScene.gameData.getNaturesForAttr(this.speciesStarterDexEntry?.natureAttr); - ui.setModeWithoutClear(Mode.OPTION_SELECT, { + ui.setModeWithoutClear(UiMode.OPTION_SELECT, { options: natures .map((n: Nature, _i: number) => { const option: OptionSelectItem = { @@ -1747,7 +1747,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { label: i18next.t("menu:cancel"), handler: () => { this.clearText(); - ui.setMode(Mode.POKEDEX_PAGE, "refresh"); + ui.setMode(UiMode.POKEDEX_PAGE, "refresh"); this.blockInput = false; return true; }, @@ -1897,7 +1897,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { }); this.setSpeciesDetails(this.species); globalScene.playSound("se/buy"); - ui.setMode(Mode.POKEDEX_PAGE, "refresh"); + ui.setMode(UiMode.POKEDEX_PAGE, "refresh"); return true; } @@ -1927,7 +1927,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { return globalScene.reset(true); } }); - ui.setMode(Mode.POKEDEX_PAGE, "refresh"); + ui.setMode(UiMode.POKEDEX_PAGE, "refresh"); globalScene.playSound("se/buy"); return true; @@ -1976,7 +1976,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { return globalScene.reset(true); } }); - ui.setMode(Mode.POKEDEX_PAGE, "refresh"); + ui.setMode(UiMode.POKEDEX_PAGE, "refresh"); globalScene.playSound("se/buy"); return true; @@ -1990,11 +1990,11 @@ export default class PokedexPageUiHandler extends MessageUiHandler { options.push({ label: i18next.t("menu:cancel"), handler: () => { - ui.setMode(Mode.POKEDEX_PAGE, "refresh"); + ui.setMode(UiMode.POKEDEX_PAGE, "refresh"); return true; }, }); - ui.setModeWithoutClear(Mode.OPTION_SELECT, { + ui.setModeWithoutClear(UiMode.OPTION_SELECT, { options: options, yOffset: 47, }); @@ -2032,7 +2032,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { return true; } this.blockInput = true; - ui.setModeWithoutClear(Mode.OPTION_SELECT).then(() => { + ui.setModeWithoutClear(UiMode.OPTION_SELECT).then(() => { // Always go back to first selection after scrolling around if (this.previousSpecies.length === 0) { this.previousSpecies.push(this.species); @@ -2057,7 +2057,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { this.moveInfoOverlay.clear(); this.clearText(); ui.setModeForceTransition( - Mode.POKEDEX_PAGE, + UiMode.POKEDEX_PAGE, newSpecies, this.savedStarterAttributes, this.filteredIndices, @@ -2071,7 +2071,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { this.blockInput = false; return true; } - ui.setModeWithoutClear(Mode.OPTION_SELECT).then(() => { + ui.setModeWithoutClear(UiMode.OPTION_SELECT).then(() => { // Always go back to first selection after scrolling around if (this.previousSpecies.length === 0) { this.previousSpecies.push(this.species); @@ -2096,7 +2096,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { this.moveInfoOverlay.clear(); this.clearText(); ui.setModeForceTransition( - Mode.POKEDEX_PAGE, + UiMode.POKEDEX_PAGE, newSpecies, this.savedStarterAttributes, this.filteredIndices, diff --git a/src/ui/pokedex-scan-ui-handler.ts b/src/ui/pokedex-scan-ui-handler.ts index 171040f6f12..45092d461a3 100644 --- a/src/ui/pokedex-scan-ui-handler.ts +++ b/src/ui/pokedex-scan-ui-handler.ts @@ -3,8 +3,8 @@ import { FormModalUiHandler } from "./form-modal-ui-handler"; import type { ModalConfig } from "./modal-ui-handler"; import type { PlayerPokemon } from "#app/field/pokemon"; import type { OptionSelectItem } from "./abstact-option-select-ui-handler"; -import { isNullOrUndefined } from "#app/utils"; -import { Mode } from "./ui"; +import { isNullOrUndefined } from "#app/utils/common"; +import { UiMode } from "#enums/ui-mode"; import { FilterTextRow } from "./filter-text"; import { allAbilities } from "#app/data/data-lists"; import { allMoves } from "#app/data/moves/move"; @@ -115,7 +115,7 @@ export default class PokedexScanUiHandler extends FormModalUiHandler { input.on("keydown", (inputObject, evt: KeyboardEvent) => { if ( ["escape", "space"].some(v => v === evt.key.toLowerCase() || v === evt.code.toLowerCase()) && - ui.getMode() === Mode.AUTO_COMPLETE + ui.getMode() === UiMode.AUTO_COMPLETE ) { // Delete autocomplete list and recovery focus. inputObject.on("blur", () => inputObject.node.focus(), { once: true }); @@ -125,7 +125,7 @@ export default class PokedexScanUiHandler extends FormModalUiHandler { input.on("textchange", (inputObject, evt: InputEvent) => { // Delete autocomplete. - if (ui.getMode() === Mode.AUTO_COMPLETE) { + if (ui.getMode() === UiMode.AUTO_COMPLETE) { ui.revertMode(); } @@ -154,7 +154,7 @@ export default class PokedexScanUiHandler extends FormModalUiHandler { maxOptions: 5, modalContainer: this.modalContainer, }; - ui.setOverlayMode(Mode.AUTO_COMPLETE, modalOpts); + ui.setOverlayMode(UiMode.AUTO_COMPLETE, modalOpts); } }); @@ -168,7 +168,7 @@ export default class PokedexScanUiHandler extends FormModalUiHandler { this.inputs[0].text = args[1]; } this.submitAction = _ => { - if (ui.getMode() === Mode.POKEDEX_SCAN) { + if (ui.getMode() === UiMode.POKEDEX_SCAN) { this.sanitizeInputs(); const outputName = this.reducedKeys.includes(this.inputs[0].text) ? this.inputs[0].text : ""; const sanitizedName = btoa(unescape(encodeURIComponent(outputName))); diff --git a/src/ui/pokedex-ui-handler.ts b/src/ui/pokedex-ui-handler.ts index 5fd3ca3e379..e9726031bf5 100644 --- a/src/ui/pokedex-ui-handler.ts +++ b/src/ui/pokedex-ui-handler.ts @@ -2,7 +2,7 @@ import type { Variant } from "#app/sprites/variant"; import { getVariantTint, getVariantIcon } from "#app/sprites/variant"; import { argbFromRgba } from "@material/material-color-utilities"; import i18next from "i18next"; -import { starterColors } from "#app/battle-scene"; +import { starterColors } from "#app/global-vars/starter-colors"; import { speciesEggMoves } from "#app/data/balance/egg-moves"; import { pokemonFormLevelMoves, pokemonSpeciesLevelMoves } from "#app/data/balance/pokemon-level-moves"; import type { PokemonForm } from "#app/data/pokemon-species"; @@ -16,7 +16,7 @@ import { AbilityAttr, DexAttr, loadStarterPreferences } from "#app/system/game-d import MessageUiHandler from "#app/ui/message-ui-handler"; import PokemonIconAnimHandler, { PokemonIconAnimMode } from "#app/ui/pokemon-icon-anim-handler"; import { TextStyle, addTextObject } from "#app/ui/text"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { SettingKeyboard } from "#app/system/settings/settings-keyboard"; import { Passive as PassiveAttr } from "#enums/passive"; import type { Species } from "#enums/species"; @@ -31,7 +31,7 @@ import { getValueReductionCandyCounts, getSameSpeciesEggCandyCounts, } from "#app/data/balance/starters"; -import { BooleanHolder, fixedInt, getLocalizedSpriteKey, padInt, randIntRange, rgbHexToRgba } from "#app/utils"; +import { BooleanHolder, fixedInt, getLocalizedSpriteKey, padInt, randIntRange, rgbHexToRgba } from "#app/utils/common"; import type { Nature } from "#enums/nature"; import { addWindow } from "./ui-theme"; import type { OptionSelectConfig } from "./abstact-option-select-ui-handler"; @@ -231,7 +231,7 @@ export default class PokedexUiHandler extends MessageUiHandler { private filteredIndices: Species[]; constructor() { - super(Mode.POKEDEX); + super(UiMode.POKEDEX); } setup() { @@ -1133,7 +1133,7 @@ export default class PokedexUiHandler extends MessageUiHandler { } else if (this.showingTray) { if (button === Button.ACTION) { const formIndex = this.trayForms[this.trayCursor].formIndex; - ui.setOverlayMode(Mode.POKEDEX_PAGE, this.lastSpecies, { form: formIndex }, this.filteredIndices); + ui.setOverlayMode(UiMode.POKEDEX_PAGE, this.lastSpecies, { form: formIndex }, this.filteredIndices); success = true; } else { const numberOfForms = this.trayContainers.length; @@ -1182,7 +1182,7 @@ export default class PokedexUiHandler extends MessageUiHandler { } } else { if (button === Button.ACTION) { - ui.setOverlayMode(Mode.POKEDEX_PAGE, this.lastSpecies, null, this.filteredIndices); + ui.setOverlayMode(UiMode.POKEDEX_PAGE, this.lastSpecies, null, this.filteredIndices); success = true; } else { switch (button) { @@ -2268,15 +2268,15 @@ export default class PokedexUiHandler extends MessageUiHandler { const ui = this.getUi(); const cancel = () => { - ui.setMode(Mode.POKEDEX, "refresh"); + ui.setMode(UiMode.POKEDEX, "refresh"); this.clearText(); this.blockInput = false; }; ui.showText(i18next.t("pokedexUiHandler:confirmExit"), null, () => { ui.setModeWithoutClear( - Mode.CONFIRM, + UiMode.CONFIRM, () => { - ui.setMode(Mode.POKEDEX, "refresh"); + ui.setMode(UiMode.POKEDEX, "refresh"); this.clearText(); this.clear(); ui.revertMode(); diff --git a/src/ui/pokemon-hatch-info-container.ts b/src/ui/pokemon-hatch-info-container.ts index 692f0f1d374..f3095cb48bf 100644 --- a/src/ui/pokemon-hatch-info-container.ts +++ b/src/ui/pokemon-hatch-info-container.ts @@ -1,13 +1,13 @@ import PokemonInfoContainer from "#app/ui/pokemon-info-container"; import { Gender } from "#app/data/gender"; import { PokemonType } from "#enums/pokemon-type"; -import { rgbHexToRgba, padInt } from "#app/utils"; +import { rgbHexToRgba, padInt } from "#app/utils/common"; import { TextStyle, addTextObject } from "#app/ui/text"; import { speciesEggMoves } from "#app/data/balance/egg-moves"; import { allMoves } from "#app/data/moves/move"; import { Species } from "#enums/species"; import { getEggTierForSpecies } from "#app/data/egg"; -import { starterColors } from "#app/battle-scene"; +import { starterColors } from "#app/global-vars/starter-colors"; import { globalScene } from "#app/global-scene"; import { argbFromRgba } from "@material/material-color-utilities"; import type { EggHatchData } from "#app/data/egg-hatch-data"; diff --git a/src/ui/pokemon-icon-anim-handler.ts b/src/ui/pokemon-icon-anim-handler.ts index b6944c0fd84..253ccbe3623 100644 --- a/src/ui/pokemon-icon-anim-handler.ts +++ b/src/ui/pokemon-icon-anim-handler.ts @@ -1,5 +1,5 @@ import { globalScene } from "#app/global-scene"; -import { fixedInt } from "#app/utils"; +import { fixedInt } from "#app/utils/common"; export enum PokemonIconAnimMode { NONE, diff --git a/src/ui/pokemon-info-container.ts b/src/ui/pokemon-info-container.ts index 0ccece46ab9..18b5d2384ef 100644 --- a/src/ui/pokemon-info-container.ts +++ b/src/ui/pokemon-info-container.ts @@ -8,7 +8,7 @@ import type Pokemon from "../field/pokemon"; import i18next from "i18next"; import type { DexEntry, StarterDataEntry } from "../system/game-data"; import { DexAttr } from "../system/game-data"; -import { fixedInt } from "#app/utils"; +import { fixedInt } from "#app/utils/common"; import ConfirmUiHandler from "./confirm-ui-handler"; import { StatsContainer } from "./stats-container"; import { TextStyle, addBBCodeTextObject, addTextObject, getTextColor } from "./text"; diff --git a/src/ui/registration-form-ui-handler.ts b/src/ui/registration-form-ui-handler.ts index 74669bc1f44..bb10efc5869 100644 --- a/src/ui/registration-form-ui-handler.ts +++ b/src/ui/registration-form-ui-handler.ts @@ -1,7 +1,7 @@ import type { InputFieldConfig } from "./form-modal-ui-handler"; import { FormModalUiHandler } from "./form-modal-ui-handler"; import type { ModalConfig } from "./modal-ui-handler"; -import { Mode } from "./ui"; +import { UiMode } from "#enums/ui-mode"; import { TextStyle, addTextObject } from "./text"; import i18next from "i18next"; import { pokerogueApi } from "#app/plugins/api/pokerogue-api"; @@ -101,9 +101,9 @@ export default class RegistrationFormUiHandler extends FormModalUiHandler { // Prevent overlapping overrides on action modification this.submitAction = originalRegistrationAction; this.sanitizeInputs(); - globalScene.ui.setMode(Mode.LOADING, { buttonActions: [] }); + globalScene.ui.setMode(UiMode.LOADING, { buttonActions: [] }); const onFail = error => { - globalScene.ui.setMode(Mode.REGISTRATION_FORM, Object.assign(config, { errorMessage: error?.trim() })); + globalScene.ui.setMode(UiMode.REGISTRATION_FORM, Object.assign(config, { errorMessage: error?.trim() })); globalScene.ui.playError(); const errorMessageFontSize = languageSettings[i18next.resolvedLanguage!]?.errorMessageFontSize; if (errorMessageFontSize) { diff --git a/src/ui/run-history-ui-handler.ts b/src/ui/run-history-ui-handler.ts index 16aad7b8634..92c5a2fde07 100644 --- a/src/ui/run-history-ui-handler.ts +++ b/src/ui/run-history-ui-handler.ts @@ -1,9 +1,9 @@ import { globalScene } from "#app/global-scene"; import { GameModes } from "../game-mode"; import { TextStyle, addTextObject } from "./text"; -import { Mode } from "./ui"; +import { UiMode } from "#enums/ui-mode"; import { addWindow } from "./ui-theme"; -import { fixedInt, formatLargeNumber } from "#app/utils"; +import { fixedInt, formatLargeNumber } from "#app/utils/common"; import type PokemonData from "../system/pokemon-data"; import MessageUiHandler from "./message-ui-handler"; import i18next from "i18next"; @@ -40,7 +40,7 @@ export default class RunHistoryUiHandler extends MessageUiHandler { private runContainerInitialY: number; constructor() { - super(Mode.RUN_HISTORY); + super(UiMode.RUN_HISTORY); } override setup() { @@ -110,7 +110,7 @@ export default class RunHistoryUiHandler extends MessageUiHandler { if (button === Button.ACTION) { const cursor = this.cursor + this.scrollCursor; if (this.runs[cursor]) { - globalScene.ui.setOverlayMode(Mode.RUN_INFO, this.runs[cursor].entryData, RunDisplayMode.RUN_HISTORY, true); + globalScene.ui.setOverlayMode(UiMode.RUN_INFO, this.runs[cursor].entryData, RunDisplayMode.RUN_HISTORY, true); } else { return false; } diff --git a/src/ui/run-info-ui-handler.ts b/src/ui/run-info-ui-handler.ts index 60667035147..8487533f465 100644 --- a/src/ui/run-info-ui-handler.ts +++ b/src/ui/run-info-ui-handler.ts @@ -2,10 +2,10 @@ import { GameModes } from "../game-mode"; import UiHandler from "./ui-handler"; import type { SessionSaveData } from "../system/game-data"; import { TextStyle, addTextObject, addBBCodeTextObject, getTextColor } from "./text"; -import { Mode } from "./ui"; +import { UiMode } from "#enums/ui-mode"; import { addWindow } from "./ui-theme"; import { getPokeballAtlasKey } from "#app/data/pokeball"; -import { formatLargeNumber, getPlayTimeString, formatMoney, formatFancyLargeNumber } from "#app/utils"; +import { formatLargeNumber, getPlayTimeString, formatMoney, formatFancyLargeNumber } from "#app/utils/common"; import type PokemonData from "../system/pokemon-data"; import i18next from "i18next"; import { Button } from "../enums/buttons"; @@ -69,7 +69,7 @@ export default class RunInfoUiHandler extends UiHandler { private modifiersModule: any; constructor() { - super(Mode.RUN_INFO); + super(UiMode.RUN_INFO); } override async setup() { diff --git a/src/ui/save-slot-select-ui-handler.ts b/src/ui/save-slot-select-ui-handler.ts index 0c16e41bbef..7b4d46203c9 100644 --- a/src/ui/save-slot-select-ui-handler.ts +++ b/src/ui/save-slot-select-ui-handler.ts @@ -6,10 +6,10 @@ import { GameMode } from "../game-mode"; import * as Modifier from "#app/modifier/modifier"; import type { SessionSaveData } from "../system/game-data"; import type PokemonData from "../system/pokemon-data"; -import { isNullOrUndefined, fixedInt, getPlayTimeString, formatLargeNumber } from "#app/utils"; +import { isNullOrUndefined, fixedInt, getPlayTimeString, formatLargeNumber } from "#app/utils/common"; import MessageUiHandler from "./message-ui-handler"; import { TextStyle, addTextObject } from "./text"; -import { Mode } from "./ui"; +import { UiMode } from "#enums/ui-mode"; import { addWindow } from "./ui-theme"; import { RunDisplayMode } from "#app/ui/run-info-ui-handler"; @@ -40,7 +40,7 @@ export default class SaveSlotSelectUiHandler extends MessageUiHandler { private sessionSlotsContainerInitialY: number; constructor() { - super(Mode.SAVE_SLOT); + super(UiMode.SAVE_SLOT); } setup() { @@ -122,13 +122,13 @@ export default class SaveSlotSelectUiHandler extends MessageUiHandler { this.saveSlotSelectCallback = null; ui.revertMode(); ui.showText("", 0); - ui.setMode(Mode.MESSAGE); + ui.setMode(UiMode.MESSAGE); originalCallback?.(cursor); }; if (this.sessionSlots[cursor].hasData) { ui.showText(i18next.t("saveSlotSelectUiHandler:overwriteData"), null, () => { ui.setOverlayMode( - Mode.CONFIRM, + UiMode.CONFIRM, () => { globalScene.gameData.deleteSession(cursor).then(response => { if (response === false) { @@ -198,7 +198,7 @@ export default class SaveSlotSelectUiHandler extends MessageUiHandler { case Button.RIGHT: if (this.sessionSlots[cursorPosition].hasData && this.sessionSlots[cursorPosition].saveData) { globalScene.ui.setOverlayMode( - Mode.RUN_INFO, + UiMode.RUN_INFO, this.sessionSlots[cursorPosition].saveData, RunDisplayMode.SESSION_PREVIEW, ); diff --git a/src/ui/saving-icon-handler.ts b/src/ui/saving-icon-handler.ts index 3db84f128a1..3b7db549a4a 100644 --- a/src/ui/saving-icon-handler.ts +++ b/src/ui/saving-icon-handler.ts @@ -1,5 +1,5 @@ import { globalScene } from "#app/global-scene"; -import { fixedInt } from "#app/utils"; +import { fixedInt } from "#app/utils/common"; export default class SavingIconHandler extends Phaser.GameObjects.Container { private icon: Phaser.GameObjects.Sprite; diff --git a/src/ui/session-reload-modal-ui-handler.ts b/src/ui/session-reload-modal-ui-handler.ts index d3b88da9e63..f866783afe8 100644 --- a/src/ui/session-reload-modal-ui-handler.ts +++ b/src/ui/session-reload-modal-ui-handler.ts @@ -1,10 +1,10 @@ import type { ModalConfig } from "./modal-ui-handler"; import { ModalUiHandler } from "./modal-ui-handler"; import { addTextObject, TextStyle } from "./text"; -import type { Mode } from "./ui"; +import type { UiMode } from "#enums/ui-mode"; export default class SessionReloadModalUiHandler extends ModalUiHandler { - constructor(mode: Mode | null = null) { + constructor(mode: UiMode | null = null) { super(mode); } diff --git a/src/ui/settings/abstract-binding-ui-handler.ts b/src/ui/settings/abstract-binding-ui-handler.ts index 62f78da89f5..a4707418b7c 100644 --- a/src/ui/settings/abstract-binding-ui-handler.ts +++ b/src/ui/settings/abstract-binding-ui-handler.ts @@ -1,5 +1,5 @@ import UiHandler from "../ui-handler"; -import type { Mode } from "../ui"; +import type { UiMode } from "#enums/ui-mode"; import { addWindow } from "../ui-theme"; import { addTextObject, TextStyle } from "../text"; import { Button } from "#enums/buttons"; @@ -51,7 +51,7 @@ export default abstract class AbstractBindingUiHandler extends UiHandler { * * @param mode - The UI mode. */ - constructor(mode: Mode | null = null) { + constructor(mode: UiMode | null = null) { super(mode); } diff --git a/src/ui/settings/abstract-control-settings-ui-handler.ts b/src/ui/settings/abstract-control-settings-ui-handler.ts index 2c634e2c5bf..495a0f68540 100644 --- a/src/ui/settings/abstract-control-settings-ui-handler.ts +++ b/src/ui/settings/abstract-control-settings-ui-handler.ts @@ -1,5 +1,5 @@ import UiHandler from "#app/ui/ui-handler"; -import type { Mode } from "#app/ui/ui"; +import type { UiMode } from "#enums/ui-mode"; import type { InterfaceConfig } from "#app/inputs-controller"; import { addWindow } from "#app/ui/ui-theme"; import { addTextObject, TextStyle } from "#app/ui/text"; @@ -74,7 +74,7 @@ export default abstract class AbstractControlSettingsUiHandler extends UiHandler * * @param mode - The UI mode. */ - constructor(mode: Mode | null = null) { + constructor(mode: UiMode | null = null) { super(mode); this.rowsToDisplay = 8; } diff --git a/src/ui/settings/abstract-settings-ui-handler.ts b/src/ui/settings/abstract-settings-ui-handler.ts index 0c14b91251e..27ca95c25ac 100644 --- a/src/ui/settings/abstract-settings-ui-handler.ts +++ b/src/ui/settings/abstract-settings-ui-handler.ts @@ -1,5 +1,5 @@ import { TextStyle, addTextObject } from "#app/ui/text"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import MessageUiHandler from "#app/ui/message-ui-handler"; import { addWindow } from "#app/ui/ui-theme"; import { ScrollBar } from "#app/ui/scroll-bar"; @@ -42,7 +42,7 @@ export default class AbstractSettingsUiHandler extends MessageUiHandler { protected settings: Array; protected localStorageKey: string; - constructor(type: SettingType, mode: Mode | null = null) { + constructor(type: SettingType, mode: UiMode | null = null) { super(mode); this.settings = Setting.filter(s => s.type === type && !s?.isHidden?.()); this.reloadRequired = false; @@ -425,7 +425,7 @@ export default class AbstractSettingsUiHandler extends MessageUiHandler { const confirmationMessage = setting.options[cursor].confirmationMessage ?? i18next.t("settings:defaultConfirmMessage"); globalScene.ui.showText(confirmationMessage, null, () => { - globalScene.ui.setOverlayMode(Mode.CONFIRM, confirmUpdateSetting, cancelUpdateSetting, null, null, 1, 750); + globalScene.ui.setOverlayMode(UiMode.CONFIRM, confirmUpdateSetting, cancelUpdateSetting, null, null, 1, 750); }); } else { saveSetting(); diff --git a/src/ui/settings/gamepad-binding-ui-handler.ts b/src/ui/settings/gamepad-binding-ui-handler.ts index 62bc2db7825..0f226ddcafa 100644 --- a/src/ui/settings/gamepad-binding-ui-handler.ts +++ b/src/ui/settings/gamepad-binding-ui-handler.ts @@ -1,12 +1,12 @@ import AbstractBindingUiHandler from "./abstract-binding-ui-handler"; -import type { Mode } from "../ui"; +import type { UiMode } from "#enums/ui-mode"; import { Device } from "#enums/devices"; import { getIconWithSettingName, getKeyWithKeycode } from "#app/configs/inputs/configHandler"; import { addTextObject, TextStyle } from "#app/ui/text"; import { globalScene } from "#app/global-scene"; export default class GamepadBindingUiHandler extends AbstractBindingUiHandler { - constructor(mode: Mode | null = null) { + constructor(mode: UiMode | null = null) { super(mode); globalScene.input.gamepad?.on("down", this.gamepadButtonDown, this); } diff --git a/src/ui/settings/keyboard-binding-ui-handler.ts b/src/ui/settings/keyboard-binding-ui-handler.ts index 8735faeaaab..c05a31ca91e 100644 --- a/src/ui/settings/keyboard-binding-ui-handler.ts +++ b/src/ui/settings/keyboard-binding-ui-handler.ts @@ -1,12 +1,12 @@ import AbstractBindingUiHandler from "./abstract-binding-ui-handler"; -import type { Mode } from "../ui"; +import type { UiMode } from "#enums/ui-mode"; import { getKeyWithKeycode } from "#app/configs/inputs/configHandler"; import { Device } from "#enums/devices"; import { addTextObject, TextStyle } from "#app/ui/text"; import { globalScene } from "#app/global-scene"; export default class KeyboardBindingUiHandler extends AbstractBindingUiHandler { - constructor(mode: Mode | null = null) { + constructor(mode: UiMode | null = null) { super(mode); // Listen to gamepad button down events to initiate binding. globalScene.input.keyboard?.on("keydown", this.onKeyDown, this); diff --git a/src/ui/settings/navigationMenu.ts b/src/ui/settings/navigationMenu.ts index 1d2d71e1e20..ad3d4ccf0b5 100644 --- a/src/ui/settings/navigationMenu.ts +++ b/src/ui/settings/navigationMenu.ts @@ -1,5 +1,5 @@ import { globalScene } from "#app/global-scene"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import type { InputsIcons } from "#app/ui/settings/abstract-control-settings-ui-handler"; import { addTextObject, setTextStyle, TextStyle } from "#app/ui/text"; import { addWindow } from "#app/ui/ui-theme"; @@ -14,8 +14,8 @@ const RIGHT = "RIGHT"; */ export class NavigationManager { private static instance: NavigationManager; - public modes: Mode[]; - public selectedMode: Mode = Mode.SETTINGS; + public modes: UiMode[]; + public selectedMode: UiMode = UiMode.SETTINGS; public navigationMenus: NavigationMenu[] = new Array(); public labels: string[]; @@ -27,11 +27,11 @@ export class NavigationManager { */ constructor() { this.modes = [ - Mode.SETTINGS, - Mode.SETTINGS_DISPLAY, - Mode.SETTINGS_AUDIO, - Mode.SETTINGS_GAMEPAD, - Mode.SETTINGS_KEYBOARD, + UiMode.SETTINGS, + UiMode.SETTINGS_DISPLAY, + UiMode.SETTINGS_AUDIO, + UiMode.SETTINGS_GAMEPAD, + UiMode.SETTINGS_KEYBOARD, ]; this.labels = [ i18next.t("settings:general"), @@ -43,7 +43,7 @@ export class NavigationManager { } public reset() { - this.selectedMode = Mode.SETTINGS; + this.selectedMode = UiMode.SETTINGS; this.updateNavigationMenus(); } diff --git a/src/ui/settings/option-select-ui-handler.ts b/src/ui/settings/option-select-ui-handler.ts index b3d1735dc19..af9760814ac 100644 --- a/src/ui/settings/option-select-ui-handler.ts +++ b/src/ui/settings/option-select-ui-handler.ts @@ -1,8 +1,8 @@ import AbstractOptionSelectUiHandler from "../abstact-option-select-ui-handler"; -import { Mode } from "../ui"; +import { UiMode } from "#enums/ui-mode"; export default class OptionSelectUiHandler extends AbstractOptionSelectUiHandler { - constructor(mode: Mode = Mode.OPTION_SELECT) { + constructor(mode: UiMode = UiMode.OPTION_SELECT) { super(mode); } diff --git a/src/ui/settings/settings-audio-ui-handler.ts b/src/ui/settings/settings-audio-ui-handler.ts index f8cb4da4ba2..019d66d7428 100644 --- a/src/ui/settings/settings-audio-ui-handler.ts +++ b/src/ui/settings/settings-audio-ui-handler.ts @@ -1,4 +1,4 @@ -import type { Mode } from "../ui"; +import type { UiMode } from "#enums/ui-mode"; import AbstractSettingsUiHandler from "./abstract-settings-ui-handler"; import { SettingType } from "#app/system/settings/settings"; ("#app/inputs-controller"); @@ -9,7 +9,7 @@ export default class SettingsAudioUiHandler extends AbstractSettingsUiHandler { * * @param mode - The UI mode, optional. */ - constructor(mode: Mode | null = null) { + constructor(mode: UiMode | null = null) { super(SettingType.AUDIO, mode); this.title = "Audio"; this.localStorageKey = "settings"; diff --git a/src/ui/settings/settings-display-ui-handler.ts b/src/ui/settings/settings-display-ui-handler.ts index 985aa9adca2..4878bae72cb 100644 --- a/src/ui/settings/settings-display-ui-handler.ts +++ b/src/ui/settings/settings-display-ui-handler.ts @@ -1,4 +1,4 @@ -import type { Mode } from "../ui"; +import type { UiMode } from "#enums/ui-mode"; import AbstractSettingsUiHandler from "./abstract-settings-ui-handler"; import { SettingKeys, SettingType } from "#app/system/settings/settings"; ("#app/inputs-controller"); @@ -9,7 +9,7 @@ export default class SettingsDisplayUiHandler extends AbstractSettingsUiHandler * * @param mode - The UI mode, optional. */ - constructor(mode: Mode | null = null) { + constructor(mode: UiMode | null = null) { super(SettingType.DISPLAY, mode); this.title = "Display"; diff --git a/src/ui/settings/settings-gamepad-ui-handler.ts b/src/ui/settings/settings-gamepad-ui-handler.ts index 0b3a7241ff2..7d269deab14 100644 --- a/src/ui/settings/settings-gamepad-ui-handler.ts +++ b/src/ui/settings/settings-gamepad-ui-handler.ts @@ -1,5 +1,5 @@ import { addTextObject, TextStyle } from "../text"; -import type { Mode } from "../ui"; +import type { UiMode } from "#enums/ui-mode"; import { setSettingGamepad, SettingGamepad, @@ -13,7 +13,7 @@ import pad_unlicensedSNES from "#app/configs/inputs/pad_unlicensedSNES"; import type { InterfaceConfig } from "#app/inputs-controller"; import AbstractControlSettingsUiHandler from "#app/ui/settings/abstract-control-settings-ui-handler"; import { Device } from "#enums/devices"; -import { truncateString } from "#app/utils"; +import { truncateString } from "#app/utils/common"; import i18next from "i18next"; import { globalScene } from "#app/global-scene"; @@ -29,7 +29,7 @@ export default class SettingsGamepadUiHandler extends AbstractControlSettingsUiH * * @param mode - The UI mode, optional. */ - constructor(mode: Mode | null = null) { + constructor(mode: UiMode | null = null) { super(mode); this.titleSelected = "Gamepad"; this.setting = SettingGamepad; diff --git a/src/ui/settings/settings-keyboard-ui-handler.ts b/src/ui/settings/settings-keyboard-ui-handler.ts index a7837c8961e..c334ee8f1fc 100644 --- a/src/ui/settings/settings-keyboard-ui-handler.ts +++ b/src/ui/settings/settings-keyboard-ui-handler.ts @@ -1,4 +1,4 @@ -import { Mode } from "../ui"; +import { UiMode } from "#enums/ui-mode"; import cfg_keyboard_qwerty from "#app/configs/inputs/cfg_keyboard_qwerty"; import { setSettingKeyboard, @@ -7,7 +7,7 @@ import { settingKeyboardDefaults, settingKeyboardOptions, } from "#app/system/settings/settings-keyboard"; -import { reverseValueToKeySetting, truncateString } from "#app/utils"; +import { reverseValueToKeySetting, truncateString } from "#app/utils/common"; import AbstractControlSettingsUiHandler from "#app/ui/settings/abstract-control-settings-ui-handler"; import type { InterfaceConfig } from "#app/inputs-controller"; import { addTextObject, TextStyle } from "#app/ui/text"; @@ -28,7 +28,7 @@ export default class SettingsKeyboardUiHandler extends AbstractControlSettingsUi * * @param mode - The UI mode, optional. */ - constructor(mode: Mode | null = null) { + constructor(mode: UiMode | null = null) { super(mode); this.titleSelected = "Keyboard"; this.setting = SettingKeyboard; @@ -84,7 +84,7 @@ export default class SettingsKeyboardUiHandler extends AbstractControlSettingsUi * Handle the home key press event. */ onHomeDown(): void { - if (![Mode.SETTINGS_KEYBOARD, Mode.SETTINGS_GAMEPAD].includes(globalScene.ui.getMode())) { + if (![UiMode.SETTINGS_KEYBOARD, UiMode.SETTINGS_GAMEPAD].includes(globalScene.ui.getMode())) { return; } globalScene.gameData.resetMappingToFactory(); @@ -95,7 +95,7 @@ export default class SettingsKeyboardUiHandler extends AbstractControlSettingsUi * Handle the delete key press event. */ onDeleteDown(): void { - if (globalScene.ui.getMode() !== Mode.SETTINGS_KEYBOARD) { + if (globalScene.ui.getMode() !== UiMode.SETTINGS_KEYBOARD) { return; } const cursor = this.cursor + this.scrollCursor; // Calculate the absolute cursor position. diff --git a/src/ui/settings/settings-ui-handler.ts b/src/ui/settings/settings-ui-handler.ts index 22ea76d798b..8d61044ff91 100644 --- a/src/ui/settings/settings-ui-handler.ts +++ b/src/ui/settings/settings-ui-handler.ts @@ -1,5 +1,5 @@ import { SettingType } from "../../system/settings/settings"; -import type { Mode } from "../ui"; +import type { UiMode } from "#enums/ui-mode"; import AbstractSettingsUiHandler from "./abstract-settings-ui-handler"; export default class SettingsUiHandler extends AbstractSettingsUiHandler { @@ -8,7 +8,7 @@ export default class SettingsUiHandler extends AbstractSettingsUiHandler { * * @param mode - The UI mode, optional. */ - constructor(mode: Mode | null = null) { + constructor(mode: UiMode | null = null) { super(SettingType.GENERAL, mode); this.title = "General"; this.localStorageKey = "settings"; diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index 9b0009d666e..1902c691715 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -6,7 +6,7 @@ import { getVariantTint, getVariantIcon } from "#app/sprites/variant"; import { argbFromRgba } from "@material/material-color-utilities"; import i18next from "i18next"; import type BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext"; -import { starterColors } from "#app/battle-scene"; +import { starterColors } from "#app/global-vars/starter-colors"; import { globalScene } from "#app/global-scene"; import type { Ability } from "#app/data/abilities/ability-class"; import { allAbilities } from "#app/data/data-lists"; @@ -37,7 +37,7 @@ import MessageUiHandler from "#app/ui/message-ui-handler"; import PokemonIconAnimHandler, { PokemonIconAnimMode } from "#app/ui/pokemon-icon-anim-handler"; import { StatsContainer } from "#app/ui/stats-container"; import { TextStyle, addBBCodeTextObject, addTextObject } from "#app/ui/text"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { addWindow } from "#app/ui/ui-theme"; import { Egg } from "#app/data/egg"; import Overrides from "#app/overrides"; @@ -74,7 +74,7 @@ import { randIntRange, rgbHexToRgba, toReadableString, -} from "#app/utils"; +} from "#app/utils/common"; import type { Nature } from "#enums/nature"; import { PLAYER_PARTY_MAX_SIZE } from "#app/constants"; import { achvs } from "#app/system/achv"; @@ -375,7 +375,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { protected blockInput = false; constructor() { - super(Mode.STARTER_SELECT); + super(UiMode.STARTER_SELECT); } setup() { @@ -1888,7 +1888,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { { label: i18next.t("starterSelectUiHandler:addToParty"), handler: () => { - ui.setMode(Mode.STARTER_SELECT); + ui.setMode(UiMode.STARTER_SELECT); const isOverValueLimit = this.tryUpdateValue( globalScene.gameData.getSpeciesStarterValue(this.lastSpecies.speciesId), true, @@ -1921,7 +1921,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { label: i18next.t("starterSelectUiHandler:removeFromParty"), handler: () => { this.popStarter(removeIndex); - ui.setMode(Mode.STARTER_SELECT); + ui.setMode(UiMode.STARTER_SELECT); return true; }, }, @@ -1934,7 +1934,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { label: i18next.t("starterSelectUiHandler:toggleIVs"), handler: () => { this.toggleStatsMode(); - ui.setMode(Mode.STARTER_SELECT); + ui.setMode(UiMode.STARTER_SELECT); return true; }, }, @@ -1944,18 +1944,18 @@ export default class StarterSelectUiHandler extends MessageUiHandler { const showSwapOptions = (moveset: StarterMoveset) => { this.blockInput = true; - ui.setMode(Mode.STARTER_SELECT).then(() => { + ui.setMode(UiMode.STARTER_SELECT).then(() => { ui.showText(i18next.t("starterSelectUiHandler:selectMoveSwapOut"), null, () => { this.moveInfoOverlay.show(allMoves[moveset[0]]); - ui.setModeWithoutClear(Mode.OPTION_SELECT, { + ui.setModeWithoutClear(UiMode.OPTION_SELECT, { options: moveset .map((m: Moves, i: number) => { const option: OptionSelectItem = { label: allMoves[m].name, handler: () => { this.blockInput = true; - ui.setMode(Mode.STARTER_SELECT).then(() => { + ui.setMode(UiMode.STARTER_SELECT).then(() => { ui.showText( `${i18next.t("starterSelectUiHandler:selectMoveSwapWith")} ${allMoves[m].name}.`, null, @@ -1963,7 +1963,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { const possibleMoves = this.speciesStarterMoves.filter((sm: Moves) => sm !== m); this.moveInfoOverlay.show(allMoves[possibleMoves[0]]); - ui.setModeWithoutClear(Mode.OPTION_SELECT, { + ui.setModeWithoutClear(UiMode.OPTION_SELECT, { options: possibleMoves .map(sm => { // make an option for each available starter move @@ -2011,7 +2011,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { handler: () => { this.moveInfoOverlay.clear(); this.clearText(); - ui.setMode(Mode.STARTER_SELECT); + ui.setMode(UiMode.STARTER_SELECT); return true; }, onHover: () => { @@ -2039,10 +2039,10 @@ export default class StarterSelectUiHandler extends MessageUiHandler { const showNatureOptions = () => { this.blockInput = true; - ui.setMode(Mode.STARTER_SELECT).then(() => { + ui.setMode(UiMode.STARTER_SELECT).then(() => { ui.showText(i18next.t("starterSelectUiHandler:selectNature"), null, () => { const natures = globalScene.gameData.getNaturesForAttr(this.speciesStarterDexEntry?.natureAttr); - ui.setModeWithoutClear(Mode.OPTION_SELECT, { + ui.setModeWithoutClear(UiMode.OPTION_SELECT, { options: natures .map((n: Nature, _i: number) => { const option: OptionSelectItem = { @@ -2054,7 +2054,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { } starterAttributes.nature = n; this.clearText(); - ui.setMode(Mode.STARTER_SELECT); + ui.setMode(UiMode.STARTER_SELECT); // set nature for starter this.setSpeciesDetails(this.lastSpecies, { natureIndex: n, @@ -2069,7 +2069,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { label: i18next.t("menu:cancel"), handler: () => { this.clearText(); - ui.setMode(Mode.STARTER_SELECT); + ui.setMode(UiMode.STARTER_SELECT); this.blockInput = false; return true; }, @@ -2097,7 +2097,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { label: i18next.t("starterSelectUiHandler:enablePassive"), handler: () => { starterData.passiveAttr |= PassiveAttr.ENABLED; - ui.setMode(Mode.STARTER_SELECT); + ui.setMode(UiMode.STARTER_SELECT); this.setSpeciesDetails(this.lastSpecies); return true; }, @@ -2107,7 +2107,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { label: i18next.t("starterSelectUiHandler:disablePassive"), handler: () => { starterData.passiveAttr ^= PassiveAttr.ENABLED; - ui.setMode(Mode.STARTER_SELECT); + ui.setMode(UiMode.STARTER_SELECT); this.setSpeciesDetails(this.lastSpecies); return true; }, @@ -2125,7 +2125,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { if (starterContainer) { starterContainer.favoriteIcon.setVisible(starterAttributes.favorite); } - ui.setMode(Mode.STARTER_SELECT); + ui.setMode(UiMode.STARTER_SELECT); return true; }, }); @@ -2138,7 +2138,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { if (starterContainer) { starterContainer.favoriteIcon.setVisible(starterAttributes.favorite); } - ui.setMode(Mode.STARTER_SELECT); + ui.setMode(UiMode.STARTER_SELECT); return true; }, }); @@ -2150,7 +2150,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { let nickname = starterAttributes.nickname ? String(starterAttributes.nickname) : ""; nickname = decodeURIComponent(escape(atob(nickname))); ui.setModeWithoutClear( - Mode.RENAME_POKEMON, + UiMode.RENAME_POKEMON, { buttonActions: [ (sanitizedName: string) => { @@ -2162,10 +2162,10 @@ export default class StarterSelectUiHandler extends MessageUiHandler { } else { this.pokemonNameText.setText(this.lastSpecies.name); } - ui.setMode(Mode.STARTER_SELECT); + ui.setMode(UiMode.STARTER_SELECT); }, () => { - ui.setMode(Mode.STARTER_SELECT); + ui.setMode(UiMode.STARTER_SELECT); }, ], }, @@ -2197,7 +2197,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { return globalScene.reset(true); } }); - ui.setMode(Mode.STARTER_SELECT); + ui.setMode(UiMode.STARTER_SELECT); this.setSpeciesDetails(this.lastSpecies); globalScene.playSound("se/buy"); @@ -2238,7 +2238,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { } }); this.tryUpdateValue(0); - ui.setMode(Mode.STARTER_SELECT); + ui.setMode(UiMode.STARTER_SELECT); globalScene.playSound("se/buy"); // update the value label and icon/animation for available upgrade @@ -2290,7 +2290,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { return globalScene.reset(true); } }); - ui.setMode(Mode.STARTER_SELECT); + ui.setMode(UiMode.STARTER_SELECT); globalScene.playSound("se/buy"); // update the icon/animation for available upgrade @@ -2308,11 +2308,11 @@ export default class StarterSelectUiHandler extends MessageUiHandler { options.push({ label: i18next.t("menu:cancel"), handler: () => { - ui.setMode(Mode.STARTER_SELECT); + ui.setMode(UiMode.STARTER_SELECT); return true; }, }); - ui.setModeWithoutClear(Mode.OPTION_SELECT, { + ui.setModeWithoutClear(UiMode.OPTION_SELECT, { options: options, yOffset: 47, }); @@ -2320,14 +2320,14 @@ export default class StarterSelectUiHandler extends MessageUiHandler { options.push({ label: i18next.t("menuUiHandler:POKEDEX"), handler: () => { - ui.setMode(Mode.STARTER_SELECT).then(() => { + ui.setMode(UiMode.STARTER_SELECT).then(() => { const attributes = { shiny: starterAttributes.shiny, variant: starterAttributes.variant, form: starterAttributes.form, female: starterAttributes.female, }; - ui.setOverlayMode(Mode.POKEDEX_PAGE, this.lastSpecies, attributes); + ui.setOverlayMode(UiMode.POKEDEX_PAGE, this.lastSpecies, attributes); }); return true; }, @@ -2336,7 +2336,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { options.push({ label: i18next.t("starterSelectUiHandler:useCandies"), handler: () => { - ui.setMode(Mode.STARTER_SELECT).then(() => showUseCandies()); + ui.setMode(UiMode.STARTER_SELECT).then(() => showUseCandies()); return true; }, }); @@ -2344,11 +2344,11 @@ export default class StarterSelectUiHandler extends MessageUiHandler { options.push({ label: i18next.t("menu:cancel"), handler: () => { - ui.setMode(Mode.STARTER_SELECT); + ui.setMode(UiMode.STARTER_SELECT); return true; }, }); - ui.setModeWithoutClear(Mode.OPTION_SELECT, { + ui.setModeWithoutClear(UiMode.OPTION_SELECT, { options: options, yOffset: 47, }); @@ -4281,15 +4281,15 @@ export default class StarterSelectUiHandler extends MessageUiHandler { const ui = this.getUi(); const cancel = () => { - ui.setMode(Mode.STARTER_SELECT); + ui.setMode(UiMode.STARTER_SELECT); this.clearText(); this.blockInput = false; }; ui.showText(i18next.t("starterSelectUiHandler:confirmExit"), null, () => { ui.setModeWithoutClear( - Mode.CONFIRM, + UiMode.CONFIRM, () => { - ui.setMode(Mode.STARTER_SELECT); + ui.setMode(UiMode.STARTER_SELECT); globalScene.clearPhaseQueue(); if (globalScene.gameMode.isChallenge) { globalScene.pushPhase(new SelectChallengePhase()); @@ -4318,7 +4318,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { const ui = this.getUi(); const cancel = () => { - ui.setMode(Mode.STARTER_SELECT); + ui.setMode(UiMode.STARTER_SELECT); if (!manualTrigger) { this.popStarter(this.starterSpecies.length - 1); } @@ -4330,11 +4330,11 @@ export default class StarterSelectUiHandler extends MessageUiHandler { if (canStart) { ui.showText(i18next.t("starterSelectUiHandler:confirmStartTeam"), null, () => { ui.setModeWithoutClear( - Mode.CONFIRM, + UiMode.CONFIRM, () => { const startRun = () => { globalScene.money = globalScene.gameMode.getStartingMoney(); - ui.setMode(Mode.STARTER_SELECT); + ui.setMode(UiMode.STARTER_SELECT); const thisObj = this; const originalStarterSelectCallback = this.starterSelectCallback; this.starterSelectCallback = null; diff --git a/src/ui/summary-ui-handler.ts b/src/ui/summary-ui-handler.ts index 5ff4a02793d..877c342651f 100644 --- a/src/ui/summary-ui-handler.ts +++ b/src/ui/summary-ui-handler.ts @@ -1,6 +1,6 @@ -import { starterColors } from "#app/battle-scene"; +import { starterColors } from "#app/global-vars/starter-colors"; import { globalScene } from "#app/global-scene"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import UiHandler from "#app/ui/ui-handler"; import { getLocalizedSpriteKey, @@ -11,7 +11,7 @@ import { isNullOrUndefined, toReadableString, formatStat, -} from "#app/utils"; +} from "#app/utils/common"; import type { PlayerPokemon, PokemonMove } from "#app/field/pokemon"; import { getStarterValueFriendshipCap, speciesStarterCosts } from "#app/data/balance/starters"; import { argbFromRgba } from "@material/material-color-utilities"; @@ -128,7 +128,7 @@ export default class SummaryUiHandler extends UiHandler { private selectCallback: Function | null; constructor() { - super(Mode.SUMMARY); + super(UiMode.SUMMARY); } setup() { @@ -510,7 +510,7 @@ export default class SummaryUiHandler extends UiHandler { } const ui = this.getUi(); - const fromPartyMode = ui.handlers[Mode.PARTY].active; + const fromPartyMode = ui.handlers[UiMode.PARTY].active; let success = false; let error = false; @@ -610,9 +610,9 @@ export default class SummaryUiHandler extends UiHandler { } if (!fromPartyMode) { - ui.setMode(Mode.MESSAGE); + ui.setMode(UiMode.MESSAGE); } else { - ui.setMode(Mode.PARTY); + ui.setMode(UiMode.PARTY); } } success = true; diff --git a/src/ui/target-select-ui-handler.ts b/src/ui/target-select-ui-handler.ts index a9f88b337f3..0db2020c25a 100644 --- a/src/ui/target-select-ui-handler.ts +++ b/src/ui/target-select-ui-handler.ts @@ -1,7 +1,7 @@ import { BattlerIndex } from "../battle"; -import { Mode } from "./ui"; +import { UiMode } from "#enums/ui-mode"; import UiHandler from "./ui-handler"; -import { isNullOrUndefined, fixedInt } from "#app/utils"; +import { isNullOrUndefined, fixedInt } from "#app/utils/common"; import { getMoveTargets } from "../data/moves/move"; import { Button } from "#enums/buttons"; import type { Moves } from "#enums/moves"; @@ -27,7 +27,7 @@ export default class TargetSelectUiHandler extends UiHandler { private targetBattleInfoMoveTween: Phaser.Tweens.Tween[] = []; constructor() { - super(Mode.TARGET_SELECT); + super(UiMode.TARGET_SELECT); this.cursor = -1; } diff --git a/src/ui/test-dialogue-ui-handler.ts b/src/ui/test-dialogue-ui-handler.ts index 9fbfc01a317..9ecf1641e7b 100644 --- a/src/ui/test-dialogue-ui-handler.ts +++ b/src/ui/test-dialogue-ui-handler.ts @@ -4,8 +4,8 @@ import type { ModalConfig } from "./modal-ui-handler"; import i18next from "i18next"; import type { PlayerPokemon } from "#app/field/pokemon"; import type { OptionSelectItem } from "./abstact-option-select-ui-handler"; -import { isNullOrUndefined } from "#app/utils"; -import { Mode } from "./ui"; +import { isNullOrUndefined } from "#app/utils/common"; +import { UiMode } from "#enums/ui-mode"; export default class TestDialogueUiHandler extends FormModalUiHandler { keys: string[]; @@ -88,7 +88,7 @@ export default class TestDialogueUiHandler extends FormModalUiHandler { input.on("keydown", (inputObject, evt: KeyboardEvent) => { if ( ["escape", "space"].some(v => v === evt.key.toLowerCase() || v === evt.code.toLowerCase()) && - ui.getMode() === Mode.AUTO_COMPLETE + ui.getMode() === UiMode.AUTO_COMPLETE ) { // Delete autocomplete list and recovery focus. inputObject.on("blur", () => inputObject.node.focus(), { once: true }); @@ -98,7 +98,7 @@ export default class TestDialogueUiHandler extends FormModalUiHandler { input.on("textchange", (inputObject, evt: InputEvent) => { // Delete autocomplete. - if (ui.getMode() === Mode.AUTO_COMPLETE) { + if (ui.getMode() === UiMode.AUTO_COMPLETE) { ui.revertMode(); } @@ -133,7 +133,7 @@ export default class TestDialogueUiHandler extends FormModalUiHandler { maxOptions: 5, modalContainer: this.modalContainer, }; - ui.setOverlayMode(Mode.AUTO_COMPLETE, modalOpts); + ui.setOverlayMode(UiMode.AUTO_COMPLETE, modalOpts); } }); @@ -147,7 +147,7 @@ export default class TestDialogueUiHandler extends FormModalUiHandler { this.inputs[0].text = args[1]; } this.submitAction = _ => { - if (ui.getMode() === Mode.TEST_DIALOGUE) { + if (ui.getMode() === UiMode.TEST_DIALOGUE) { this.sanitizeInputs(); const sanitizedName = btoa(unescape(encodeURIComponent(this.inputs[0].text))); config.buttonActions[0](sanitizedName); diff --git a/src/ui/time-of-day-widget.ts b/src/ui/time-of-day-widget.ts index 5e42e6215f8..5f5116a2da0 100644 --- a/src/ui/time-of-day-widget.ts +++ b/src/ui/time-of-day-widget.ts @@ -1,4 +1,4 @@ -import { fixedInt } from "#app/utils"; +import { fixedInt } from "#app/utils/common"; import { globalScene } from "#app/global-scene"; import { BattleSceneEventType } from "../events/battle-scene"; import { EaseType } from "#enums/ease-type"; diff --git a/src/ui/title-ui-handler.ts b/src/ui/title-ui-handler.ts index 405e3cc4a27..bed4d568481 100644 --- a/src/ui/title-ui-handler.ts +++ b/src/ui/title-ui-handler.ts @@ -1,6 +1,6 @@ import OptionSelectUiHandler from "./settings/option-select-ui-handler"; -import { Mode } from "./ui"; -import { fixedInt, randInt, randItem } from "#app/utils"; +import { UiMode } from "#enums/ui-mode"; +import { fixedInt, randInt, randItem } from "#app/utils/common"; import { TextStyle, addTextObject } from "./text"; import { getSplashMessages } from "../data/splash-messages"; import i18next from "i18next"; @@ -26,7 +26,7 @@ export default class TitleUiHandler extends OptionSelectUiHandler { private titleStatsTimer: NodeJS.Timeout | null; - constructor(mode: Mode = Mode.TITLE) { + constructor(mode: UiMode = UiMode.TITLE) { super(mode); } diff --git a/src/ui/ui-handler.ts b/src/ui/ui-handler.ts index 433f85d0f92..d3784c1225c 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 { TextStyle } from "./text"; import { getTextColor } from "./text"; -import type { Mode } from "./ui"; +import type { UiMode } from "#enums/ui-mode"; import type { Button } from "#enums/buttons"; /** @@ -15,7 +15,7 @@ export default abstract class UiHandler { /** * @param mode The mode of the UI element. These should be unique. */ - constructor(mode: Mode | null = null) { + constructor(mode: UiMode | null = null) { this.mode = mode; } diff --git a/src/ui/ui.ts b/src/ui/ui.ts index c7981cd5fba..ad496df6382 100644 --- a/src/ui/ui.ts +++ b/src/ui/ui.ts @@ -28,7 +28,7 @@ import { addWindow } from "./ui-theme"; import LoginFormUiHandler from "./login-form-ui-handler"; import RegistrationFormUiHandler from "./registration-form-ui-handler"; import LoadingModalUiHandler from "./loading-modal-ui-handler"; -import { executeIf } from "#app/utils"; +import { executeIf } from "#app/utils/common"; import GameStatsUiHandler from "./game-stats-ui-handler"; import AwaitableUiHandler from "./awaitable-ui-handler"; import SaveSlotSelectUiHandler from "./save-slot-select-ui-handler"; @@ -57,102 +57,55 @@ import MysteryEncounterUiHandler from "./mystery-encounter-ui-handler"; import PokedexScanUiHandler from "./pokedex-scan-ui-handler"; import PokedexPageUiHandler from "./pokedex-page-ui-handler"; import { NavigationManager } from "./settings/navigationMenu"; - -export enum Mode { - MESSAGE, - TITLE, - COMMAND, - FIGHT, - BALL, - TARGET_SELECT, - MODIFIER_SELECT, - SAVE_SLOT, - PARTY, - SUMMARY, - STARTER_SELECT, - EVOLUTION_SCENE, - EGG_HATCH_SCENE, - EGG_HATCH_SUMMARY, - CONFIRM, - OPTION_SELECT, - MENU, - MENU_OPTION_SELECT, - SETTINGS, - SETTINGS_DISPLAY, - SETTINGS_AUDIO, - SETTINGS_GAMEPAD, - GAMEPAD_BINDING, - SETTINGS_KEYBOARD, - KEYBOARD_BINDING, - ACHIEVEMENTS, - GAME_STATS, - EGG_LIST, - EGG_GACHA, - POKEDEX, - POKEDEX_SCAN, - POKEDEX_PAGE, - LOGIN_FORM, - REGISTRATION_FORM, - LOADING, - SESSION_RELOAD, - UNAVAILABLE, - CHALLENGE_SELECT, - RENAME_POKEMON, - RUN_HISTORY, - RUN_INFO, - TEST_DIALOGUE, - AUTO_COMPLETE, - ADMIN, - MYSTERY_ENCOUNTER, -} +import { UiMode } from "#enums/ui-mode"; const transitionModes = [ - Mode.SAVE_SLOT, - Mode.PARTY, - Mode.SUMMARY, - Mode.STARTER_SELECT, - Mode.EVOLUTION_SCENE, - Mode.EGG_HATCH_SCENE, - Mode.EGG_LIST, - Mode.EGG_GACHA, - Mode.POKEDEX, - Mode.POKEDEX_PAGE, - Mode.CHALLENGE_SELECT, - Mode.RUN_HISTORY, + UiMode.SAVE_SLOT, + UiMode.PARTY, + UiMode.SUMMARY, + UiMode.STARTER_SELECT, + UiMode.EVOLUTION_SCENE, + UiMode.EGG_HATCH_SCENE, + UiMode.EGG_LIST, + UiMode.EGG_GACHA, + UiMode.POKEDEX, + UiMode.POKEDEX_PAGE, + UiMode.CHALLENGE_SELECT, + UiMode.RUN_HISTORY, ]; const noTransitionModes = [ - Mode.TITLE, - Mode.CONFIRM, - Mode.OPTION_SELECT, - Mode.MENU, - Mode.MENU_OPTION_SELECT, - Mode.GAMEPAD_BINDING, - Mode.KEYBOARD_BINDING, - Mode.SETTINGS, - Mode.SETTINGS_AUDIO, - Mode.SETTINGS_DISPLAY, - Mode.SETTINGS_GAMEPAD, - Mode.SETTINGS_KEYBOARD, - Mode.ACHIEVEMENTS, - Mode.GAME_STATS, - Mode.POKEDEX_SCAN, - Mode.LOGIN_FORM, - Mode.REGISTRATION_FORM, - Mode.LOADING, - Mode.SESSION_RELOAD, - Mode.UNAVAILABLE, - Mode.RENAME_POKEMON, - Mode.TEST_DIALOGUE, - Mode.AUTO_COMPLETE, - Mode.ADMIN, - Mode.MYSTERY_ENCOUNTER, - Mode.RUN_INFO, + UiMode.TITLE, + UiMode.CONFIRM, + UiMode.OPTION_SELECT, + UiMode.MENU, + UiMode.MENU_OPTION_SELECT, + UiMode.GAMEPAD_BINDING, + UiMode.KEYBOARD_BINDING, + UiMode.SETTINGS, + UiMode.SETTINGS_AUDIO, + UiMode.SETTINGS_DISPLAY, + UiMode.SETTINGS_GAMEPAD, + UiMode.SETTINGS_KEYBOARD, + UiMode.ACHIEVEMENTS, + UiMode.GAME_STATS, + UiMode.POKEDEX_SCAN, + UiMode.LOGIN_FORM, + UiMode.REGISTRATION_FORM, + UiMode.LOADING, + UiMode.SESSION_RELOAD, + UiMode.UNAVAILABLE, + UiMode.RENAME_POKEMON, + UiMode.TEST_DIALOGUE, + UiMode.AUTO_COMPLETE, + UiMode.ADMIN, + UiMode.MYSTERY_ENCOUNTER, + UiMode.RUN_INFO, ]; export default class UI extends Phaser.GameObjects.Container { - private mode: Mode; - private modeChain: Mode[]; + private mode: UiMode; + private modeChain: UiMode[]; public handlers: UiHandler[]; private overlay: Phaser.GameObjects.Rectangle; public achvBar: AchvBar; @@ -169,7 +122,7 @@ export default class UI extends Phaser.GameObjects.Container { constructor() { super(globalScene, 0, globalScene.game.canvas.height / 6); - this.mode = Mode.MESSAGE; + this.mode = UiMode.MESSAGE; this.modeChain = []; this.handlers = [ new BattleMessageUiHandler(), @@ -189,7 +142,7 @@ export default class UI extends Phaser.GameObjects.Container { new ConfirmUiHandler(), new OptionSelectUiHandler(), new MenuUiHandler(), - new OptionSelectUiHandler(Mode.MENU_OPTION_SELECT), + new OptionSelectUiHandler(UiMode.MENU_OPTION_SELECT), // settings new SettingsUiHandler(), new SettingsDisplayUiHandler(), @@ -203,7 +156,7 @@ export default class UI extends Phaser.GameObjects.Container { new EggListUiHandler(), new EggGachaUiHandler(), new PokedexUiHandler(), - new PokedexScanUiHandler(Mode.TEST_DIALOGUE), + new PokedexScanUiHandler(UiMode.TEST_DIALOGUE), new PokedexPageUiHandler(), new LoginFormUiHandler(), new RegistrationFormUiHandler(), @@ -214,7 +167,7 @@ export default class UI extends Phaser.GameObjects.Container { new RenameFormUiHandler(), new RunHistoryUiHandler(), new RunInfoUiHandler(), - new TestDialogueUiHandler(Mode.TEST_DIALOGUE), + new TestDialogueUiHandler(UiMode.TEST_DIALOGUE), new AutoCompleteUiHandler(), new AdminUiHandler(), new MysteryEncounterUiHandler(), @@ -222,7 +175,7 @@ export default class UI extends Phaser.GameObjects.Container { } setup(): void { - this.setName(`ui-${Mode[this.mode]}`); + this.setName(`ui-${UiMode[this.mode]}`); for (const handler of this.handlers) { handler.setup(); } @@ -279,7 +232,7 @@ export default class UI extends Phaser.GameObjects.Container { } getMessageHandler(): BattleMessageUiHandler { - return this.handlers[Mode.MESSAGE] as BattleMessageUiHandler; + return this.handlers[UiMode.MESSAGE] as BattleMessageUiHandler; } processInfoButton(pressed: boolean) { @@ -287,7 +240,7 @@ export default class UI extends Phaser.GameObjects.Container { return false; } - if ([Mode.CONFIRM, Mode.COMMAND, Mode.FIGHT, Mode.MESSAGE, Mode.TARGET_SELECT].includes(this.mode)) { + if ([UiMode.CONFIRM, UiMode.COMMAND, UiMode.FIGHT, UiMode.MESSAGE, UiMode.TARGET_SELECT].includes(this.mode)) { globalScene?.processInfoButton(pressed); return true; } @@ -564,7 +517,7 @@ export default class UI extends Phaser.GameObjects.Container { } private setModeInternal( - mode: Mode, + mode: UiMode, clear: boolean, forceTransition: boolean, chainMode: boolean, @@ -587,7 +540,7 @@ export default class UI extends Phaser.GameObjects.Container { this.mode = mode; const touchControls = document?.getElementById("touchControls"); if (touchControls) { - touchControls.dataset.uiMode = Mode[mode]; + touchControls.dataset.uiMode = UiMode[mode]; } this.getHandler().show(args); } @@ -612,23 +565,23 @@ export default class UI extends Phaser.GameObjects.Container { }); } - getMode(): Mode { + getMode(): UiMode { return this.mode; } - setMode(mode: Mode, ...args: any[]): Promise { + setMode(mode: UiMode, ...args: any[]): Promise { return this.setModeInternal(mode, true, false, false, args); } - setModeForceTransition(mode: Mode, ...args: any[]): Promise { + setModeForceTransition(mode: UiMode, ...args: any[]): Promise { return this.setModeInternal(mode, true, true, false, args); } - setModeWithoutClear(mode: Mode, ...args: any[]): Promise { + setModeWithoutClear(mode: UiMode, ...args: any[]): Promise { return this.setModeInternal(mode, false, false, false, args); } - setOverlayMode(mode: Mode, ...args: any[]): Promise { + setOverlayMode(mode: UiMode, ...args: any[]): Promise { return this.setModeInternal(mode, false, false, true, args); } @@ -651,7 +604,7 @@ export default class UI extends Phaser.GameObjects.Container { globalScene.updateGameInfo(); const touchControls = document.getElementById("touchControls"); if (touchControls) { - touchControls.dataset.uiMode = Mode[this.mode]; + touchControls.dataset.uiMode = UiMode[this.mode]; } resolve(true); }; @@ -678,7 +631,7 @@ export default class UI extends Phaser.GameObjects.Container { }); } - public getModeChain(): Mode[] { + public getModeChain(): UiMode[] { return this.modeChain; } diff --git a/src/ui/unavailable-modal-ui-handler.ts b/src/ui/unavailable-modal-ui-handler.ts index 01ed850f6d0..5bed55ec24a 100644 --- a/src/ui/unavailable-modal-ui-handler.ts +++ b/src/ui/unavailable-modal-ui-handler.ts @@ -1,9 +1,10 @@ import type { ModalConfig } from "./modal-ui-handler"; import { ModalUiHandler } from "./modal-ui-handler"; import { addTextObject, TextStyle } from "./text"; -import type { Mode } from "./ui"; +import type { UiMode } from "#enums/ui-mode"; import { updateUserInfo } from "#app/account"; -import { removeCookie, sessionIdKey } from "#app/utils"; +import { sessionIdKey } from "#app/utils/common"; +import { removeCookie } from "#app/utils/cookies"; import i18next from "i18next"; import { globalScene } from "#app/global-scene"; @@ -17,7 +18,7 @@ export default class UnavailableModalUiHandler extends ModalUiHandler { private readonly randVarianceTime = 1000 * 10; - constructor(mode: Mode | null = null) { + constructor(mode: UiMode | null = null) { super(mode); this.reconnectDuration = this.minTime; } diff --git a/src/utils.ts b/src/utils/common.ts similarity index 92% rename from src/utils.ts rename to src/utils/common.ts index ce9966c0d7f..4acfabce080 100644 --- a/src/utils.ts +++ b/src/utils/common.ts @@ -276,43 +276,6 @@ export const apiUrl = localServerUrl ?? "https://api.pokerogue.net"; // used to disable api calls when isLocal is true and a server is not found export let isLocalServerConnected = true; -export const isBeta = import.meta.env.MODE === "beta"; // this checks to see if the env mode is development. Technically this gives the same value for beta AND for dev envs - -export function setCookie(cName: string, cValue: string): void { - const expiration = new Date(); - expiration.setTime(new Date().getTime() + 3600000 * 24 * 30 * 3 /*7*/); - document.cookie = `${cName}=${cValue};Secure;SameSite=Strict;Domain=${window.location.hostname};Path=/;Expires=${expiration.toUTCString()}`; -} - -export function removeCookie(cName: string): void { - if (isBeta) { - document.cookie = `${cName}=;Secure;SameSite=Strict;Domain=pokerogue.net;Path=/;Max-Age=-1`; // we need to remove the cookie from the main domain as well - } - - document.cookie = `${cName}=;Secure;SameSite=Strict;Domain=${window.location.hostname};Path=/;Max-Age=-1`; - document.cookie = `${cName}=;Secure;SameSite=Strict;Path=/;Max-Age=-1`; // legacy cookie without domain, for older cookies to prevent a login loop -} - -export function getCookie(cName: string): string { - // check if there are multiple cookies with the same name and delete them - if (document.cookie.split(";").filter(c => c.includes(cName)).length > 1) { - removeCookie(cName); - return ""; - } - const name = `${cName}=`; - const ca = document.cookie.split(";"); - for (let i = 0; i < ca.length; i++) { - let c = ca[i]; - while (c.charAt(0) === " ") { - c = c.substring(1); - } - if (c.indexOf(name) === 0) { - return c.substring(name.length, c.length); - } - } - return ""; -} - /** * When locally running the game, "pings" the local server * with a GET request to verify if a server is running, diff --git a/src/utils/cookies.ts b/src/utils/cookies.ts new file mode 100644 index 00000000000..5ed793c0451 --- /dev/null +++ b/src/utils/cookies.ts @@ -0,0 +1,36 @@ +import { isBeta } from "./utility-vars"; + +export function setCookie(cName: string, cValue: string): void { + const expiration = new Date(); + expiration.setTime(new Date().getTime() + 3600000 * 24 * 30 * 3 /*7*/); + document.cookie = `${cName}=${cValue};Secure;SameSite=Strict;Domain=${window.location.hostname};Path=/;Expires=${expiration.toUTCString()}`; +} + +export function removeCookie(cName: string): void { + if (isBeta) { + document.cookie = `${cName}=;Secure;SameSite=Strict;Domain=pokerogue.net;Path=/;Max-Age=-1`; // we need to remove the cookie from the main domain as well + } + + document.cookie = `${cName}=;Secure;SameSite=Strict;Domain=${window.location.hostname};Path=/;Max-Age=-1`; + document.cookie = `${cName}=;Secure;SameSite=Strict;Path=/;Max-Age=-1`; // legacy cookie without domain, for older cookies to prevent a login loop +} + +export function getCookie(cName: string): string { + // check if there are multiple cookies with the same name and delete them + if (document.cookie.split(";").filter(c => c.includes(cName)).length > 1) { + removeCookie(cName); + return ""; + } + const name = `${cName}=`; + const ca = document.cookie.split(";"); + for (let i = 0; i < ca.length; i++) { + let c = ca[i]; + while (c.charAt(0) === " ") { + c = c.substring(1); + } + if (c.indexOf(name) === 0) { + return c.substring(name.length, c.length); + } + } + return ""; +} diff --git a/src/utils/utility-vars.ts b/src/utils/utility-vars.ts new file mode 100644 index 00000000000..081f70164c8 --- /dev/null +++ b/src/utils/utility-vars.ts @@ -0,0 +1 @@ +export const isBeta = import.meta.env.MODE === "beta"; // this checks to see if the env mode is development. Technically this gives the same value for beta AND for dev envs diff --git a/test/abilities/ability_timing.test.ts b/test/abilities/ability_timing.test.ts index 9df4fe0d1c9..6128a3e6196 100644 --- a/test/abilities/ability_timing.test.ts +++ b/test/abilities/ability_timing.test.ts @@ -2,7 +2,7 @@ import { BattleStyle } from "#app/enums/battle-style"; import { CommandPhase } from "#app/phases/command-phase"; import { TurnInitPhase } from "#app/phases/turn-init-phase"; import i18next from "#app/plugins/i18n"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { Abilities } from "#enums/abilities"; import { Species } from "#enums/species"; import GameManager from "#test/testUtils/gameManager"; @@ -40,9 +40,9 @@ describe("Ability Timing", () => { game.onNextPrompt( "CheckSwitchPhase", - Mode.CONFIRM, + UiMode.CONFIRM, () => { - game.setMode(Mode.MESSAGE); + game.setMode(UiMode.MESSAGE); game.endPhase(); }, () => game.isCurrentPhase(CommandPhase) || game.isCurrentPhase(TurnInitPhase), diff --git a/test/abilities/analytic.test.ts b/test/abilities/analytic.test.ts index 1aadf2c0746..108c712da00 100644 --- a/test/abilities/analytic.test.ts +++ b/test/abilities/analytic.test.ts @@ -1,5 +1,5 @@ import { BattlerIndex } from "#app/battle"; -import { isBetween, toDmgValue } from "#app/utils"; +import { isBetween, toDmgValue } from "#app/utils/common"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; diff --git a/test/abilities/disguise.test.ts b/test/abilities/disguise.test.ts index fd8289312db..aeaf8ea2363 100644 --- a/test/abilities/disguise.test.ts +++ b/test/abilities/disguise.test.ts @@ -1,5 +1,5 @@ import { BattlerIndex } from "#app/battle"; -import { toDmgValue } from "#app/utils"; +import { toDmgValue } from "#app/utils/common"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; diff --git a/test/abilities/healer.test.ts b/test/abilities/healer.test.ts index d06c4680e36..d292ad0f625 100644 --- a/test/abilities/healer.test.ts +++ b/test/abilities/healer.test.ts @@ -5,7 +5,7 @@ import { StatusEffect } from "#enums/status-effect"; import GameManager from "#test/testUtils/gameManager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi, type MockInstance } from "vitest"; -import { isNullOrUndefined } from "#app/utils"; +import { isNullOrUndefined } from "#app/utils/common"; import { PostTurnResetStatusAbAttr } from "#app/data/abilities/ability"; import { allAbilities } from "#app/data/data-lists"; import type Pokemon from "#app/field/pokemon"; diff --git a/test/abilities/heatproof.test.ts b/test/abilities/heatproof.test.ts index f2fabf953d6..016237bb02f 100644 --- a/test/abilities/heatproof.test.ts +++ b/test/abilities/heatproof.test.ts @@ -1,7 +1,7 @@ import { Species } from "#app/enums/species"; import { StatusEffect } from "#app/enums/status-effect"; import { TurnEndPhase } from "#app/phases/turn-end-phase"; -import { toDmgValue } from "#app/utils"; +import { toDmgValue } from "#app/utils/common"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import GameManager from "#test/testUtils/gameManager"; diff --git a/test/abilities/intimidate.test.ts b/test/abilities/intimidate.test.ts index 2888c575b0d..8db39270dcf 100644 --- a/test/abilities/intimidate.test.ts +++ b/test/abilities/intimidate.test.ts @@ -1,7 +1,7 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import Phaser from "phaser"; import GameManager from "#test/testUtils/gameManager"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { Stat } from "#enums/stat"; import { getMovePosition } from "#test/testUtils/gameManagerUtils"; import { Abilities } from "#enums/abilities"; @@ -38,9 +38,9 @@ describe("Abilities - Intimidate", () => { await game.classicMode.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]); game.onNextPrompt( "CheckSwitchPhase", - Mode.CONFIRM, + UiMode.CONFIRM, () => { - game.setMode(Mode.MESSAGE); + game.setMode(UiMode.MESSAGE); game.endPhase(); }, () => game.isCurrentPhase("CommandPhase") || game.isCurrentPhase("TurnInitPhase"), @@ -69,9 +69,9 @@ describe("Abilities - Intimidate", () => { await game.classicMode.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]); game.onNextPrompt( "CheckSwitchPhase", - Mode.CONFIRM, + UiMode.CONFIRM, () => { - game.setMode(Mode.MESSAGE); + game.setMode(UiMode.MESSAGE); game.endPhase(); }, () => game.isCurrentPhase("CommandPhase") || game.isCurrentPhase("TurnInitPhase"), diff --git a/test/abilities/parental_bond.test.ts b/test/abilities/parental_bond.test.ts index d81486e7316..a75fea82830 100644 --- a/test/abilities/parental_bond.test.ts +++ b/test/abilities/parental_bond.test.ts @@ -1,6 +1,6 @@ import { PokemonType } from "#enums/pokemon-type"; import { BattlerTagType } from "#enums/battler-tag-type"; -import { toDmgValue } from "#app/utils"; +import { toDmgValue } from "#app/utils/common"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; diff --git a/test/abilities/shield_dust.test.ts b/test/abilities/shield_dust.test.ts index 4f6783eb66a..0b96640a29f 100644 --- a/test/abilities/shield_dust.test.ts +++ b/test/abilities/shield_dust.test.ts @@ -6,7 +6,7 @@ import { MoveEffectChanceMultiplierAbAttr, } from "#app/data/abilities/ability"; import { MoveEffectPhase } from "#app/phases/move-effect-phase"; -import { NumberHolder } from "#app/utils"; +import { NumberHolder } from "#app/utils/common"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; diff --git a/test/abilities/stakeout.test.ts b/test/abilities/stakeout.test.ts index b3a7bdbf287..8a2231bba0b 100644 --- a/test/abilities/stakeout.test.ts +++ b/test/abilities/stakeout.test.ts @@ -1,5 +1,5 @@ import { BattlerIndex } from "#app/battle"; -import { isBetween } from "#app/utils"; +import { isBetween } from "#app/utils/common"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; diff --git a/test/abilities/wimp_out.test.ts b/test/abilities/wimp_out.test.ts index c46675376c1..463ec7587dc 100644 --- a/test/abilities/wimp_out.test.ts +++ b/test/abilities/wimp_out.test.ts @@ -2,7 +2,7 @@ import { BattlerIndex } from "#app/battle"; import { ArenaTagSide } from "#app/data/arena-tag"; import { allMoves } from "#app/data/moves/move"; import GameManager from "#test/testUtils/gameManager"; -import { toDmgValue } from "#app/utils"; +import { toDmgValue } from "#app/utils/common"; import { Abilities } from "#enums/abilities"; import { ArenaTagType } from "#enums/arena-tag-type"; import { BattlerTagType } from "#enums/battler-tag-type"; diff --git a/test/account.test.ts b/test/account.test.ts index 3f6b9f3f80b..77368b0b64c 100644 --- a/test/account.test.ts +++ b/test/account.test.ts @@ -1,4 +1,4 @@ -import * as battleScene from "#app/battle-scene"; +import * as bypassLogin from "#app/global-vars/bypass-login"; import { pokerogueApi } from "#app/plugins/api/pokerogue-api"; import { describe, expect, it, vi } from "vitest"; import { initLoggedInUser, loggedInUser, updateUserInfo } from "#app/account"; @@ -15,7 +15,7 @@ describe("account", () => { describe("updateUserInfo", () => { it("should set loggedInUser! to Guest if bypassLogin is true", async () => { - vi.spyOn(battleScene, "bypassLogin", "get").mockReturnValue(true); + vi.spyOn(bypassLogin, "bypassLogin", "get").mockReturnValue(true); const [success, status] = await updateUserInfo(); @@ -26,7 +26,7 @@ describe("account", () => { }); it("should fetch user info from the API if bypassLogin is false", async () => { - vi.spyOn(battleScene, "bypassLogin", "get").mockReturnValue(false); + vi.spyOn(bypassLogin, "bypassLogin", "get").mockReturnValue(false); vi.spyOn(pokerogueApi.account, "getInfo").mockResolvedValue([ { username: "test", @@ -47,7 +47,7 @@ describe("account", () => { }); it("should handle resolved API errors", async () => { - vi.spyOn(battleScene, "bypassLogin", "get").mockReturnValue(false); + vi.spyOn(bypassLogin, "bypassLogin", "get").mockReturnValue(false); vi.spyOn(pokerogueApi.account, "getInfo").mockResolvedValue([null, 401]); const [success, status] = await updateUserInfo(); @@ -57,7 +57,7 @@ describe("account", () => { }); it("should handle 500 API errors", async () => { - vi.spyOn(battleScene, "bypassLogin", "get").mockReturnValue(false); + vi.spyOn(bypassLogin, "bypassLogin", "get").mockReturnValue(false); vi.spyOn(pokerogueApi.account, "getInfo").mockResolvedValue([null, 500]); const [success, status] = await updateUserInfo(); diff --git a/test/achievements/achievement.test.ts b/test/achievements/achievement.test.ts index 5c53e38e208..0b49c4d23ab 100644 --- a/test/achievements/achievement.test.ts +++ b/test/achievements/achievement.test.ts @@ -10,7 +10,7 @@ import { RibbonAchv, achvs, } from "#app/system/achv"; -import { NumberHolder } from "#app/utils"; +import { NumberHolder } from "#app/utils/common"; import GameManager from "#test/testUtils/gameManager"; 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 51304c7d5dd..e980984580e 100644 --- a/test/battle/battle.test.ts +++ b/test/battle/battle.test.ts @@ -18,7 +18,7 @@ import { TurnInitPhase } from "#app/phases/turn-init-phase"; import { VictoryPhase } from "#app/phases/victory-phase"; import GameManager from "#test/testUtils/gameManager"; import { generateStarter } from "#test/testUtils/gameManagerUtils"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { PlayerGender } from "#enums/player-gender"; @@ -49,7 +49,7 @@ describe("Test Battle Phase", () => { it("test phase interceptor with prompt", async () => { await game.phaseInterceptor.run(LoginPhase); - game.onNextPrompt("SelectGenderPhase", Mode.OPTION_SELECT, () => { + game.onNextPrompt("SelectGenderPhase", UiMode.OPTION_SELECT, () => { game.scene.gameData.gender = PlayerGender.MALE; game.endPhase(); }); @@ -57,36 +57,36 @@ describe("Test Battle Phase", () => { await game.phaseInterceptor.run(SelectGenderPhase); await game.phaseInterceptor.run(TitlePhase); - await game.waitMode(Mode.TITLE); + await game.waitMode(UiMode.TITLE); - expect(game.scene.ui?.getMode()).toBe(Mode.TITLE); + expect(game.scene.ui?.getMode()).toBe(UiMode.TITLE); expect(game.scene.gameData.gender).toBe(PlayerGender.MALE); }, 20000); it("test phase interceptor with prompt with preparation for a future prompt", async () => { await game.phaseInterceptor.run(LoginPhase); - game.onNextPrompt("SelectGenderPhase", Mode.OPTION_SELECT, () => { + game.onNextPrompt("SelectGenderPhase", UiMode.OPTION_SELECT, () => { game.scene.gameData.gender = PlayerGender.MALE; game.endPhase(); }); - game.onNextPrompt("CheckSwitchPhase", Mode.CONFIRM, () => { - game.setMode(Mode.MESSAGE); + game.onNextPrompt("CheckSwitchPhase", UiMode.CONFIRM, () => { + game.setMode(UiMode.MESSAGE); game.endPhase(); }); await game.phaseInterceptor.run(SelectGenderPhase); await game.phaseInterceptor.run(TitlePhase); - await game.waitMode(Mode.TITLE); + await game.waitMode(UiMode.TITLE); - expect(game.scene.ui?.getMode()).toBe(Mode.TITLE); + expect(game.scene.ui?.getMode()).toBe(UiMode.TITLE); expect(game.scene.gameData.gender).toBe(PlayerGender.MALE); }, 20000); it("newGame one-liner", async () => { await game.startBattle(); - expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND); + expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND); expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); }, 20000); @@ -156,7 +156,7 @@ describe("Test Battle Phase", () => { await game.phaseInterceptor.run(LoginPhase); game.onNextPrompt( "SelectGenderPhase", - Mode.OPTION_SELECT, + UiMode.OPTION_SELECT, () => { game.scene.gameData.gender = PlayerGender.MALE; game.endPhase(); @@ -171,7 +171,7 @@ describe("Test Battle Phase", () => { await game.phaseInterceptor.run(LoginPhase); game.onNextPrompt( "SelectGenderPhase", - Mode.OPTION_SELECT, + UiMode.OPTION_SELECT, () => { game.scene.gameData.gender = PlayerGender.MALE; game.endPhase(); @@ -185,14 +185,14 @@ describe("Test Battle Phase", () => { await game.phaseInterceptor.run(LoginPhase); game.onNextPrompt( "SelectGenderPhase", - Mode.OPTION_SELECT, + UiMode.OPTION_SELECT, () => { game.scene.gameData.gender = PlayerGender.MALE; game.endPhase(); }, () => game.isCurrentPhase(TitlePhase), ); - game.onNextPrompt("TitlePhase", Mode.TITLE, () => { + game.onNextPrompt("TitlePhase", UiMode.TITLE, () => { game.scene.gameMode = getGameMode(GameModes.CLASSIC); const starters = generateStarter(game.scene); const selectStarterPhase = new SelectStarterPhase(); @@ -208,7 +208,7 @@ describe("Test Battle Phase", () => { game.override.enemyAbility(Abilities.HYDRATION); game.override.ability(Abilities.HYDRATION); await game.startBattle([Species.BLASTOISE, Species.CHARIZARD]); - expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND); + expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND); expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); }, 20000); @@ -218,7 +218,7 @@ describe("Test Battle Phase", () => { game.override.enemyAbility(Abilities.HYDRATION); game.override.ability(Abilities.HYDRATION); await game.startBattle([Species.BLASTOISE]); - expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND); + expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND); expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); }, 20000); @@ -229,7 +229,7 @@ describe("Test Battle Phase", () => { game.override.ability(Abilities.HYDRATION); game.override.startingWave(3); await game.startBattle([Species.BLASTOISE, Species.CHARIZARD]); - expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND); + expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND); expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); }, 20000); @@ -240,7 +240,7 @@ describe("Test Battle Phase", () => { game.override.ability(Abilities.HYDRATION); game.override.startingWave(3); await game.startBattle([Species.BLASTOISE, Species.CHARIZARD, Species.DARKRAI, Species.GABITE]); - expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND); + expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND); expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); }, 20000); @@ -328,7 +328,7 @@ describe("Test Battle Phase", () => { game.onNextPrompt( "SwitchPhase", - Mode.PARTY, + UiMode.PARTY, () => { expect.fail("Switch was forced"); }, diff --git a/test/battle/special_battle.test.ts b/test/battle/special_battle.test.ts index 46dd8eaa010..163f23e488d 100644 --- a/test/battle/special_battle.test.ts +++ b/test/battle/special_battle.test.ts @@ -1,5 +1,5 @@ import { CommandPhase } from "#app/phases/command-phase"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; @@ -34,63 +34,63 @@ describe("Test Battle Phase", () => { it("startBattle 2vs1 boss", async () => { game.override.battleStyle("single").startingWave(10); await game.startBattle([Species.BLASTOISE, Species.CHARIZARD]); - expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND); + expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND); expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); }, 20000); it("startBattle 2vs2 boss", async () => { game.override.battleStyle("double").startingWave(10); await game.startBattle([Species.BLASTOISE, Species.CHARIZARD]); - expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND); + expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND); expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); }, 20000); it("startBattle 2vs2 trainer", async () => { game.override.battleStyle("double").startingWave(5); await game.startBattle([Species.BLASTOISE, Species.CHARIZARD]); - expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND); + expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND); expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); }, 20000); it("startBattle 2vs1 trainer", async () => { game.override.battleStyle("single").startingWave(5); await game.startBattle([Species.BLASTOISE, Species.CHARIZARD]); - expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND); + expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND); expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); }, 20000); it("startBattle 2vs1 rival", async () => { game.override.battleStyle("single").startingWave(8); await game.startBattle([Species.BLASTOISE, Species.CHARIZARD]); - expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND); + expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND); expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); }, 20000); it("startBattle 2vs2 rival", async () => { game.override.battleStyle("double").startingWave(8); await game.startBattle([Species.BLASTOISE, Species.CHARIZARD]); - expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND); + expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND); expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); }, 20000); it("startBattle 1vs1 trainer", async () => { game.override.battleStyle("single").startingWave(5); await game.startBattle([Species.BLASTOISE]); - expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND); + expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND); expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); }, 20000); it("startBattle 2vs2 trainer", async () => { game.override.battleStyle("double").startingWave(5); await game.startBattle([Species.BLASTOISE, Species.CHARIZARD]); - expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND); + expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND); expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); }, 20000); it("startBattle 4vs2 trainer", async () => { game.override.battleStyle("double").startingWave(5); await game.startBattle([Species.BLASTOISE, Species.CHARIZARD, Species.DARKRAI, Species.GABITE]); - expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND); + expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND); expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); }, 20000); }); diff --git a/test/boss-pokemon.test.ts b/test/boss-pokemon.test.ts index 9df69da09b7..ef95ae9bcc2 100644 --- a/test/boss-pokemon.test.ts +++ b/test/boss-pokemon.test.ts @@ -6,7 +6,7 @@ import { Abilities } from "#app/enums/abilities"; import { Moves } from "#app/enums/moves"; import { EFFECTIVE_STATS } from "#app/enums/stat"; import type { EnemyPokemon } from "#app/field/pokemon"; -import { toDmgValue } from "#app/utils"; +import { toDmgValue } from "#app/utils/common"; describe("Boss Pokemon / Shields", () => { let phaserGame: Phaser.Game; diff --git a/test/daily_mode.test.ts b/test/daily_mode.test.ts index 6b95543fb3b..a7f5784087a 100644 --- a/test/daily_mode.test.ts +++ b/test/daily_mode.test.ts @@ -4,7 +4,7 @@ import { MapModifier } from "#app/modifier/modifier"; import { pokerogueApi } from "#app/plugins/api/pokerogue-api"; import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler"; import { Species } from "#enums/species"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import GameManager from "#test/testUtils/gameManager"; @@ -76,7 +76,7 @@ describe("Shop modifications", async () => { game.move.select(Moves.SPLASH); await game.doKillOpponents(); await game.phaseInterceptor.to("BattleEndPhase"); - game.onNextPrompt("SelectModifierPhase", Mode.MODIFIER_SELECT, () => { + game.onNextPrompt("SelectModifierPhase", UiMode.MODIFIER_SELECT, () => { expect(game.scene.ui.getHandler()).toBeInstanceOf(ModifierSelectUiHandler); game.modifiers.testCheck("EVIOLITE", false).testCheck("MINI_BLACK_HOLE", false); }); @@ -87,7 +87,7 @@ describe("Shop modifications", async () => { game.move.select(Moves.SPLASH); await game.doKillOpponents(); await game.phaseInterceptor.to("BattleEndPhase"); - game.onNextPrompt("SelectModifierPhase", Mode.MODIFIER_SELECT, () => { + game.onNextPrompt("SelectModifierPhase", UiMode.MODIFIER_SELECT, () => { expect(game.scene.ui.getHandler()).toBeInstanceOf(ModifierSelectUiHandler); game.modifiers.testCheck("EVIOLITE", true).testCheck("MINI_BLACK_HOLE", true); }); diff --git a/test/eggs/egg.test.ts b/test/eggs/egg.test.ts index 8875300780b..0110aa5fdaf 100644 --- a/test/eggs/egg.test.ts +++ b/test/eggs/egg.test.ts @@ -5,7 +5,7 @@ import { EggSourceType } from "#app/enums/egg-source-types"; import { EggTier } from "#app/enums/egg-type"; import { VariantTier } from "#app/enums/variant-tier"; import EggData from "#app/system/egg-data"; -import * as Utils from "#app/utils"; +import * as Utils from "#app/utils/common"; import { Species } from "#enums/species"; import GameManager from "#test/testUtils/gameManager"; import Phaser from "phaser"; diff --git a/test/enemy_command.test.ts b/test/enemy_command.test.ts index 6d5cc2698a3..ae1f2918798 100644 --- a/test/enemy_command.test.ts +++ b/test/enemy_command.test.ts @@ -6,7 +6,7 @@ import { Moves } from "#app/enums/moves"; import { Species } from "#app/enums/species"; import type { EnemyPokemon } from "#app/field/pokemon"; import { AiType } from "#app/field/pokemon"; -import { randSeedInt } from "#app/utils"; +import { randSeedInt } from "#app/utils/common"; import GameManager from "#test/testUtils/gameManager"; 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 d591bdec9fc..56333432cee 100644 --- a/test/escape-calculations.test.ts +++ b/test/escape-calculations.test.ts @@ -1,7 +1,7 @@ import { AttemptRunPhase } from "#app/phases/attempt-run-phase"; import type { CommandPhase } from "#app/phases/command-phase"; import { Command } from "#app/ui/command-ui-handler"; -import { NumberHolder } from "#app/utils"; +import { NumberHolder } from "#app/utils/common"; import { Abilities } from "#enums/abilities"; import { Species } from "#enums/species"; import GameManager from "#test/testUtils/gameManager"; diff --git a/test/evolution.test.ts b/test/evolution.test.ts index 68d02402eac..4f91cd99382 100644 --- a/test/evolution.test.ts +++ b/test/evolution.test.ts @@ -6,7 +6,7 @@ import { import { Abilities } from "#app/enums/abilities"; import { Moves } from "#app/enums/moves"; import { Species } from "#app/enums/species"; -import * as Utils from "#app/utils"; +import * as Utils from "#app/utils/common"; import GameManager from "#test/testUtils/gameManager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/test/game-mode.test.ts b/test/game-mode.test.ts index a2da7d1690a..0483d18e492 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 { GameModes, getGameMode } from "#app/game-mode"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import * as Utils from "#app/utils"; +import * as Utils from "#app/utils/common"; import GameManager from "#test/testUtils/gameManager"; describe("game-mode", () => { diff --git a/test/items/dire_hit.test.ts b/test/items/dire_hit.test.ts index f6197e097c2..b409b2ac7cb 100644 --- a/test/items/dire_hit.test.ts +++ b/test/items/dire_hit.test.ts @@ -6,7 +6,7 @@ import Phase from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { BattleEndPhase } from "#app/phases/battle-end-phase"; import { TempCritBoosterModifier } from "#app/modifier/modifier"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import type ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler"; import { Button } from "#app/enums/buttons"; import { CommandPhase } from "#app/phases/command-phase"; @@ -71,7 +71,7 @@ describe("Items - Dire Hit", () => { // Forced DIRE_HIT to spawn in the first slot with override game.onNextPrompt( "SelectModifierPhase", - Mode.MODIFIER_SELECT, + UiMode.MODIFIER_SELECT, () => { const handler = game.scene.ui.getHandler() as ModifierSelectUiHandler; // Traverse to first modifier slot diff --git a/test/items/double_battle_chance_booster.test.ts b/test/items/double_battle_chance_booster.test.ts index b4818e7e7ba..68a29ef823e 100644 --- a/test/items/double_battle_chance_booster.test.ts +++ b/test/items/double_battle_chance_booster.test.ts @@ -5,7 +5,7 @@ import GameManager from "#test/testUtils/gameManager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { ShopCursorTarget } from "#app/enums/shop-cursor-target"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import type ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler"; import { Button } from "#app/enums/buttons"; @@ -69,7 +69,7 @@ describe("Items - Double Battle Chance Boosters", () => { // Forced LURE to spawn in the first slot with override game.onNextPrompt( "SelectModifierPhase", - Mode.MODIFIER_SELECT, + UiMode.MODIFIER_SELECT, () => { const handler = game.scene.ui.getHandler() as ModifierSelectUiHandler; // Traverse to first modifier slot diff --git a/test/items/eviolite.test.ts b/test/items/eviolite.test.ts index 43fd6a795bb..fafc0f4a10c 100644 --- a/test/items/eviolite.test.ts +++ b/test/items/eviolite.test.ts @@ -1,5 +1,5 @@ import { StatBoosterModifier } from "#app/modifier/modifier"; -import { NumberHolder, randItem } from "#app/utils"; +import { NumberHolder, randItem } from "#app/utils/common"; import { Species } from "#enums/species"; import { Stat } from "#enums/stat"; import GameManager from "#test/testUtils/gameManager"; diff --git a/test/items/exp_booster.test.ts b/test/items/exp_booster.test.ts index 3fe31e5c202..ec7528c3b23 100644 --- a/test/items/exp_booster.test.ts +++ b/test/items/exp_booster.test.ts @@ -1,6 +1,6 @@ import { Abilities } from "#app/enums/abilities"; import { PokemonExpBoosterModifier } from "#app/modifier/modifier"; -import { NumberHolder } from "#app/utils"; +import { NumberHolder } from "#app/utils/common"; import GameManager from "#test/testUtils/gameManager"; import Phase from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; diff --git a/test/items/leek.test.ts b/test/items/leek.test.ts index 5f9be882bc1..7589b89bc15 100644 --- a/test/items/leek.test.ts +++ b/test/items/leek.test.ts @@ -1,5 +1,5 @@ import { TurnEndPhase } from "#app/phases/turn-end-phase"; -import { randInt } from "#app/utils"; +import { randInt } from "#app/utils/common"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; import GameManager from "#test/testUtils/gameManager"; diff --git a/test/items/light_ball.test.ts b/test/items/light_ball.test.ts index e85fb1b602b..91195d0b1e5 100644 --- a/test/items/light_ball.test.ts +++ b/test/items/light_ball.test.ts @@ -2,7 +2,7 @@ import { Stat } from "#enums/stat"; import { SpeciesStatBoosterModifier } from "#app/modifier/modifier"; import { modifierTypes } from "#app/modifier/modifier-type"; import i18next from "#app/plugins/i18n"; -import { NumberHolder } from "#app/utils"; +import { NumberHolder } from "#app/utils/common"; import { Species } from "#enums/species"; import GameManager from "#test/testUtils/gameManager"; import Phase from "phaser"; diff --git a/test/items/lock_capsule.test.ts b/test/items/lock_capsule.test.ts index 9cc6046307e..19829578d87 100644 --- a/test/items/lock_capsule.test.ts +++ b/test/items/lock_capsule.test.ts @@ -2,7 +2,7 @@ import { Abilities } from "#app/enums/abilities"; import { Moves } from "#app/enums/moves"; import { ModifierTier } from "#app/modifier/modifier-tier"; import { SelectModifierPhase } from "#app/phases/select-modifier-phase"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import GameManager from "#test/testUtils/gameManager"; import Phase from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; @@ -41,7 +41,7 @@ describe("Items - Lock Capsule", () => { }), ); - game.onNextPrompt("SelectModifierPhase", Mode.MODIFIER_SELECT, () => { + game.onNextPrompt("SelectModifierPhase", UiMode.MODIFIER_SELECT, () => { const selectModifierPhase = game.scene.getCurrentPhase() as SelectModifierPhase; const rerollCost = selectModifierPhase.getRerollCost(true); expect(rerollCost).toBe(150); diff --git a/test/items/metal_powder.test.ts b/test/items/metal_powder.test.ts index 37686710848..6be7655ec70 100644 --- a/test/items/metal_powder.test.ts +++ b/test/items/metal_powder.test.ts @@ -2,7 +2,7 @@ import { Stat } from "#enums/stat"; import { SpeciesStatBoosterModifier } from "#app/modifier/modifier"; import { modifierTypes } from "#app/modifier/modifier-type"; import i18next from "#app/plugins/i18n"; -import { NumberHolder } from "#app/utils"; +import { NumberHolder } from "#app/utils/common"; import { Species } from "#enums/species"; import GameManager from "#test/testUtils/gameManager"; import Phase from "phaser"; diff --git a/test/items/quick_powder.test.ts b/test/items/quick_powder.test.ts index 6937d6093f3..d77f981f04d 100644 --- a/test/items/quick_powder.test.ts +++ b/test/items/quick_powder.test.ts @@ -2,7 +2,7 @@ import { Stat } from "#enums/stat"; import { SpeciesStatBoosterModifier } from "#app/modifier/modifier"; import { modifierTypes } from "#app/modifier/modifier-type"; import i18next from "#app/plugins/i18n"; -import { NumberHolder } from "#app/utils"; +import { NumberHolder } from "#app/utils/common"; import { Species } from "#enums/species"; import GameManager from "#test/testUtils/gameManager"; import Phase from "phaser"; diff --git a/test/items/temp_stat_stage_booster.test.ts b/test/items/temp_stat_stage_booster.test.ts index ccbabf01ccb..a3cfc3256bb 100644 --- a/test/items/temp_stat_stage_booster.test.ts +++ b/test/items/temp_stat_stage_booster.test.ts @@ -7,7 +7,7 @@ import { Moves } from "#app/enums/moves"; import { TurnEndPhase } from "#app/phases/turn-end-phase"; import { Abilities } from "#app/enums/abilities"; import { TempStatStageBoosterModifier } from "#app/modifier/modifier"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { Button } from "#app/enums/buttons"; import type ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler"; import { ShopCursorTarget } from "#app/enums/shop-cursor-target"; @@ -137,7 +137,7 @@ describe("Items - Temporary Stat Stage Boosters", () => { // Forced X_ATTACK to spawn in the first slot with override game.onNextPrompt( "SelectModifierPhase", - Mode.MODIFIER_SELECT, + UiMode.MODIFIER_SELECT, () => { const handler = game.scene.ui.getHandler() as ModifierSelectUiHandler; // Traverse to first modifier slot diff --git a/test/items/thick_club.test.ts b/test/items/thick_club.test.ts index 9e9cd2e2ec8..2a63a60a0e6 100644 --- a/test/items/thick_club.test.ts +++ b/test/items/thick_club.test.ts @@ -2,7 +2,7 @@ import { Stat } from "#enums/stat"; import { SpeciesStatBoosterModifier } from "#app/modifier/modifier"; import { modifierTypes } from "#app/modifier/modifier-type"; import i18next from "#app/plugins/i18n"; -import { NumberHolder, randInt } from "#app/utils"; +import { NumberHolder, randInt } from "#app/utils/common"; import { Species } from "#enums/species"; import GameManager from "#test/testUtils/gameManager"; import Phase from "phaser"; diff --git a/test/moves/aurora_veil.test.ts b/test/moves/aurora_veil.test.ts index ef53b69b4e4..e9ab66d4203 100644 --- a/test/moves/aurora_veil.test.ts +++ b/test/moves/aurora_veil.test.ts @@ -5,7 +5,7 @@ import { allMoves, CritOnlyAttr } from "#app/data/moves/move"; import { ArenaTagType } from "#app/enums/arena-tag-type"; import type Pokemon from "#app/field/pokemon"; import { TurnEndPhase } from "#app/phases/turn-end-phase"; -import { NumberHolder } from "#app/utils"; +import { NumberHolder } from "#app/utils/common"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; diff --git a/test/moves/belly_drum.test.ts b/test/moves/belly_drum.test.ts index f01a50f8a79..8ee1026bf20 100644 --- a/test/moves/belly_drum.test.ts +++ b/test/moves/belly_drum.test.ts @@ -1,5 +1,5 @@ import { TurnEndPhase } from "#app/phases/turn-end-phase"; -import { toDmgValue } from "#app/utils"; +import { toDmgValue } from "#app/utils/common"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; import { Stat } from "#enums/stat"; diff --git a/test/moves/fillet_away.test.ts b/test/moves/fillet_away.test.ts index cc462b3746a..477cdf76fc7 100644 --- a/test/moves/fillet_away.test.ts +++ b/test/moves/fillet_away.test.ts @@ -1,5 +1,5 @@ import { TurnEndPhase } from "#app/phases/turn-end-phase"; -import { toDmgValue } from "#app/utils"; +import { toDmgValue } from "#app/utils/common"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; import { Stat } from "#enums/stat"; diff --git a/test/moves/light_screen.test.ts b/test/moves/light_screen.test.ts index 12aeb29577a..cea26f29542 100644 --- a/test/moves/light_screen.test.ts +++ b/test/moves/light_screen.test.ts @@ -6,7 +6,7 @@ import { Abilities } from "#app/enums/abilities"; import { ArenaTagType } from "#app/enums/arena-tag-type"; import type Pokemon from "#app/field/pokemon"; import { TurnEndPhase } from "#app/phases/turn-end-phase"; -import { NumberHolder } from "#app/utils"; +import { NumberHolder } from "#app/utils/common"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; import GameManager from "#test/testUtils/gameManager"; diff --git a/test/moves/multi_target.test.ts b/test/moves/multi_target.test.ts index fccf650416c..ad47d540a14 100644 --- a/test/moves/multi_target.test.ts +++ b/test/moves/multi_target.test.ts @@ -1,7 +1,7 @@ import { BattlerIndex } from "#app/battle"; import { Abilities } from "#app/enums/abilities"; import { Species } from "#app/enums/species"; -import { toDmgValue } from "#app/utils"; +import { toDmgValue } from "#app/utils/common"; import { Moves } from "#enums/moves"; import GameManager from "#test/testUtils/gameManager"; import Phaser from "phaser"; diff --git a/test/moves/pledge_moves.test.ts b/test/moves/pledge_moves.test.ts index b3d13a27b83..2bfd408e5fb 100644 --- a/test/moves/pledge_moves.test.ts +++ b/test/moves/pledge_moves.test.ts @@ -5,7 +5,7 @@ import { allMoves, FlinchAttr } from "#app/data/moves/move"; import { PokemonType } from "#enums/pokemon-type"; import { ArenaTagType } from "#enums/arena-tag-type"; import { Stat } from "#enums/stat"; -import { toDmgValue } from "#app/utils"; +import { toDmgValue } from "#app/utils/common"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; diff --git a/test/moves/reflect.test.ts b/test/moves/reflect.test.ts index 473b46bf097..b8338cea8cf 100644 --- a/test/moves/reflect.test.ts +++ b/test/moves/reflect.test.ts @@ -6,7 +6,7 @@ import { Abilities } from "#app/enums/abilities"; import { ArenaTagType } from "#app/enums/arena-tag-type"; import type Pokemon from "#app/field/pokemon"; import { TurnEndPhase } from "#app/phases/turn-end-phase"; -import { NumberHolder } from "#app/utils"; +import { NumberHolder } from "#app/utils/common"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; import GameManager from "#test/testUtils/gameManager"; diff --git a/test/moves/revival_blessing.test.ts b/test/moves/revival_blessing.test.ts index 860ce5524d4..b36cd43eb83 100644 --- a/test/moves/revival_blessing.test.ts +++ b/test/moves/revival_blessing.test.ts @@ -1,6 +1,6 @@ import { BattlerIndex } from "#app/battle"; import { MoveResult } from "#app/field/pokemon"; -import { toDmgValue } from "#app/utils"; +import { toDmgValue } from "#app/utils/common"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; diff --git a/test/moves/substitute.test.ts b/test/moves/substitute.test.ts index 2e82078418b..7f4a2e69f9e 100644 --- a/test/moves/substitute.test.ts +++ b/test/moves/substitute.test.ts @@ -6,7 +6,7 @@ import { MoveResult } from "#app/field/pokemon"; import type { CommandPhase } from "#app/phases/command-phase"; import GameManager from "#test/testUtils/gameManager"; import { Command } from "#app/ui/command-ui-handler"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { Abilities } from "#enums/abilities"; import { ArenaTagType } from "#enums/arena-tag-type"; import { BattlerTagType } from "#enums/battler-tag-type"; @@ -398,7 +398,7 @@ describe("Moves - Substitute", () => { leadPokemon.addTag(BattlerTagType.SUBSTITUTE, 0, Moves.NONE, leadPokemon.id); // Simulate a Baton switch for the player this turn - game.onNextPrompt("CommandPhase", Mode.COMMAND, () => { + game.onNextPrompt("CommandPhase", UiMode.COMMAND, () => { (game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.POKEMON, 1, true); }); diff --git a/test/mystery-encounter/encounter-test-utils.ts b/test/mystery-encounter/encounter-test-utils.ts index 93629778e0a..977f40bc90e 100644 --- a/test/mystery-encounter/encounter-test-utils.ts +++ b/test/mystery-encounter/encounter-test-utils.ts @@ -14,8 +14,8 @@ import type MessageUiHandler from "#app/ui/message-ui-handler"; import type MysteryEncounterUiHandler from "#app/ui/mystery-encounter-ui-handler"; import type PartyUiHandler from "#app/ui/party-ui-handler"; import type OptionSelectUiHandler from "#app/ui/settings/option-select-ui-handler"; -import { Mode } from "#app/ui/ui"; -import { isNullOrUndefined } from "#app/utils"; +import { UiMode } from "#enums/ui-mode"; +import { isNullOrUndefined } from "#app/utils/common"; import { Button } from "#enums/buttons"; import { StatusEffect } from "#enums/status-effect"; import type GameManager from "#test/testUtils/gameManager"; @@ -40,7 +40,7 @@ export async function runMysteryEncounterToEnd( // run the selected options phase game.onNextPrompt( "MysteryEncounterOptionSelectedPhase", - Mode.MESSAGE, + UiMode.MESSAGE, () => { const uiHandler = game.scene.ui.getHandler(); uiHandler.processInput(Button.ACTION); @@ -51,9 +51,9 @@ export async function runMysteryEncounterToEnd( if (isBattle) { game.onNextPrompt( "CheckSwitchPhase", - Mode.CONFIRM, + UiMode.CONFIRM, () => { - game.setMode(Mode.MESSAGE); + game.setMode(UiMode.MESSAGE); game.endPhase(); }, () => game.isCurrentPhase(CommandPhase), @@ -61,16 +61,16 @@ export async function runMysteryEncounterToEnd( game.onNextPrompt( "CheckSwitchPhase", - Mode.MESSAGE, + UiMode.MESSAGE, () => { - game.setMode(Mode.MESSAGE); + game.setMode(UiMode.MESSAGE); game.endPhase(); }, () => game.isCurrentPhase(CommandPhase), ); // If a battle is started, fast forward to end of the battle - game.onNextPrompt("CommandPhase", Mode.COMMAND, () => { + game.onNextPrompt("CommandPhase", UiMode.COMMAND, () => { game.scene.clearPhaseQueue(); game.scene.clearPhaseQueueSplice(); game.scene.unshiftPhase(new VictoryPhase(0)); @@ -78,13 +78,13 @@ export async function runMysteryEncounterToEnd( }); // Handle end of battle trainer messages - game.onNextPrompt("TrainerVictoryPhase", Mode.MESSAGE, () => { + game.onNextPrompt("TrainerVictoryPhase", UiMode.MESSAGE, () => { const uiHandler = game.scene.ui.getHandler(); uiHandler.processInput(Button.ACTION); }); // Handle egg hatch dialogue - game.onNextPrompt("EggLapsePhase", Mode.MESSAGE, () => { + game.onNextPrompt("EggLapsePhase", UiMode.MESSAGE, () => { const uiHandler = game.scene.ui.getHandler(); uiHandler.processInput(Button.ACTION); }); @@ -103,7 +103,7 @@ export async function runSelectMysteryEncounterOption( // Handle any eventual queued messages (e.g. weather phase, etc.) game.onNextPrompt( "MessagePhase", - Mode.MESSAGE, + UiMode.MESSAGE, () => { const uiHandler = game.scene.ui.getHandler(); uiHandler.processInput(Button.ACTION); @@ -118,7 +118,7 @@ export async function runSelectMysteryEncounterOption( // dispose of intro messages game.onNextPrompt( "MysteryEncounterPhase", - Mode.MESSAGE, + UiMode.MESSAGE, () => { const uiHandler = game.scene.ui.getHandler(); uiHandler.processInput(Button.ACTION); @@ -157,7 +157,7 @@ export async function runSelectMysteryEncounterOption( async function handleSecondaryOptionSelect(game: GameManager, pokemonNo: number, optionNo?: number) { // Handle secondary option selections - const partyUiHandler = game.scene.ui.handlers[Mode.PARTY] as PartyUiHandler; + const partyUiHandler = game.scene.ui.handlers[UiMode.PARTY] as PartyUiHandler; vi.spyOn(partyUiHandler, "show"); const encounterUiHandler = game.scene.ui.getHandler(); @@ -177,7 +177,7 @@ async function handleSecondaryOptionSelect(game: GameManager, pokemonNo: number, // If there is a second choice to make after selecting a Pokemon if (!isNullOrUndefined(optionNo)) { // Wait for Summary menu to close and second options to spawn - const secondOptionUiHandler = game.scene.ui.handlers[Mode.OPTION_SELECT] as OptionSelectUiHandler; + const secondOptionUiHandler = game.scene.ui.handlers[UiMode.OPTION_SELECT] as OptionSelectUiHandler; vi.spyOn(secondOptionUiHandler, "show"); await vi.waitFor(() => expect(secondOptionUiHandler.show).toHaveBeenCalled()); @@ -206,6 +206,6 @@ export async function skipBattleRunMysteryEncounterRewardsPhase(game: GameManage }); game.scene.pushPhase(new VictoryPhase(0)); game.phaseInterceptor.superEndPhase(); - game.setMode(Mode.MESSAGE); + game.setMode(UiMode.MESSAGE); await game.phaseInterceptor.to(MysteryEncounterRewardsPhase, runRewardsPhase); } 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 43d582c5b70..a4c043ad13f 100644 --- a/test/mystery-encounter/encounters/a-trainers-test-encounter.test.ts +++ b/test/mystery-encounter/encounters/a-trainers-test-encounter.test.ts @@ -117,10 +117,8 @@ describe("A Trainer's Test - Mystery Encounter", () => { i18next.t("trainerNames:marley"), i18next.t("trainerNames:mira"), i18next.t("trainerNames:riley"), - ] - .map(name => name.toLowerCase()) - .includes(scene.currentBattle.trainer!.config.name), - ).toBeTruthy(); + ].map(name => name.toLowerCase()), + ).toContain(scene.currentBattle.trainer!.config.name.toLowerCase()); expect(enemyField[0]).toBeDefined(); }); diff --git a/test/mystery-encounter/encounters/berries-abound-encounter.test.ts b/test/mystery-encounter/encounters/berries-abound-encounter.test.ts index e19726f49fd..3f85b0b89d9 100644 --- a/test/mystery-encounter/encounters/berries-abound-encounter.test.ts +++ b/test/mystery-encounter/encounters/berries-abound-encounter.test.ts @@ -9,7 +9,7 @@ import { skipBattleRunMysteryEncounterRewardsPhase, } from "#test/mystery-encounter/encounter-test-utils"; import type BattleScene from "#app/battle-scene"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler"; import { BerryModifier } from "#app/modifier/modifier"; import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode"; @@ -153,7 +153,7 @@ describe("Berries Abound - Mystery Encounter", () => { expect(scene.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name); await game.phaseInterceptor.run(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; @@ -238,7 +238,7 @@ describe("Berries Abound - Mystery Encounter", () => { expect(scene.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name); await game.phaseInterceptor.run(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; 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 9befe77e688..fc208ed7180 100644 --- a/test/mystery-encounter/encounters/bug-type-superfan-encounter.test.ts +++ b/test/mystery-encounter/encounters/bug-type-superfan-encounter.test.ts @@ -12,7 +12,7 @@ import { import { Moves } from "#enums/moves"; import type BattleScene from "#app/battle-scene"; import { PokemonMove } from "#app/field/pokemon"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode"; import { MysteryEncounterTier } from "#enums/mystery-encounter-tier"; import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils"; @@ -364,7 +364,7 @@ describe("Bug-Type Superfan - Mystery Encounter", () => { expect(scene.getCurrentPhase()?.constructor.name).toBe(MysteryEncounterRewardsPhase.name); game.phaseInterceptor["prompts"] = []; // Clear out prompt handlers - game.onNextPrompt("MysteryEncounterRewardsPhase", Mode.OPTION_SELECT, () => { + game.onNextPrompt("MysteryEncounterRewardsPhase", UiMode.OPTION_SELECT, () => { game.phaseInterceptor.superEndPhase(); }); await game.phaseInterceptor.run(MysteryEncounterRewardsPhase); @@ -416,7 +416,7 @@ describe("Bug-Type Superfan - Mystery Encounter", () => { expect(scene.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name); await game.phaseInterceptor.run(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; @@ -432,7 +432,7 @@ describe("Bug-Type Superfan - Mystery Encounter", () => { expect(scene.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name); await game.phaseInterceptor.run(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; @@ -454,7 +454,7 @@ describe("Bug-Type Superfan - Mystery Encounter", () => { expect(scene.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name); await game.phaseInterceptor.run(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; @@ -478,7 +478,7 @@ describe("Bug-Type Superfan - Mystery Encounter", () => { expect(scene.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name); await game.phaseInterceptor.run(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; @@ -554,7 +554,7 @@ describe("Bug-Type Superfan - Mystery Encounter", () => { expect(scene.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name); await game.phaseInterceptor.run(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; diff --git a/test/mystery-encounter/encounters/clowning-around-encounter.test.ts b/test/mystery-encounter/encounters/clowning-around-encounter.test.ts index 4bbe76e5c72..afc4a83e9bf 100644 --- a/test/mystery-encounter/encounters/clowning-around-encounter.test.ts +++ b/test/mystery-encounter/encounters/clowning-around-encounter.test.ts @@ -16,7 +16,7 @@ import { Moves } from "#enums/moves"; import type BattleScene from "#app/battle-scene"; import type Pokemon from "#app/field/pokemon"; import { PokemonMove } from "#app/field/pokemon"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode"; import { MysteryEncounterTier } from "#enums/mystery-encounter-tier"; import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils"; @@ -206,14 +206,14 @@ describe("Clowning Around - Mystery Encounter", () => { await game.phaseInterceptor.run(SelectModifierPhase); const abilityToTrain = scene.currentBattle.mysteryEncounter?.misc.ability; - game.onNextPrompt("PostMysteryEncounterPhase", Mode.MESSAGE, () => { + game.onNextPrompt("PostMysteryEncounterPhase", UiMode.MESSAGE, () => { game.scene.ui.getHandler().processInput(Button.ACTION); }); // Run to ability train option selection - const optionSelectUiHandler = game.scene.ui.handlers[Mode.OPTION_SELECT] as OptionSelectUiHandler; + const optionSelectUiHandler = game.scene.ui.handlers[UiMode.OPTION_SELECT] as OptionSelectUiHandler; vi.spyOn(optionSelectUiHandler, "show"); - const partyUiHandler = game.scene.ui.handlers[Mode.PARTY] as PartyUiHandler; + const partyUiHandler = game.scene.ui.handlers[UiMode.PARTY] as PartyUiHandler; vi.spyOn(partyUiHandler, "show"); game.endPhase(); await game.phaseInterceptor.to(PostMysteryEncounterPhase); diff --git a/test/mystery-encounter/encounters/dancing-lessons-encounter.test.ts b/test/mystery-encounter/encounters/dancing-lessons-encounter.test.ts index 77cd65e51b9..873bed2f213 100644 --- a/test/mystery-encounter/encounters/dancing-lessons-encounter.test.ts +++ b/test/mystery-encounter/encounters/dancing-lessons-encounter.test.ts @@ -15,7 +15,7 @@ import { MysteryEncounterTier } from "#enums/mystery-encounter-tier"; import * as MysteryEncounters from "#app/data/mystery-encounters/mystery-encounters"; import { Moves } from "#enums/moves"; import { DancingLessonsEncounter } from "#app/data/mystery-encounters/encounters/dancing-lessons-encounter"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler"; import { PokemonMove } from "#app/field/pokemon"; import { MysteryEncounterPhase } from "#app/phases/mystery-encounter-phases"; @@ -132,7 +132,7 @@ describe("Dancing Lessons - Mystery Encounter", () => { expect(scene.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name); await game.phaseInterceptor.run(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; 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 d4b0de30535..2488d12dad1 100644 --- a/test/mystery-encounter/encounters/department-store-sale-encounter.test.ts +++ b/test/mystery-encounter/encounters/department-store-sale-encounter.test.ts @@ -7,7 +7,7 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vite import * as EncounterPhaseUtils from "#app/data/mystery-encounters/utils/encounter-phase-utils"; import { runMysteryEncounterToEnd } from "#test/mystery-encounter/encounter-test-utils"; import type BattleScene from "#app/battle-scene"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler"; import { DepartmentStoreSaleEncounter } from "#app/data/mystery-encounters/encounters/department-store-sale-encounter"; import { CIVILIZATION_ENCOUNTER_BIOMES } from "#app/data/mystery-encounters/mystery-encounters"; @@ -98,7 +98,7 @@ describe("Department Store Sale - Mystery Encounter", () => { expect(scene.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name); await game.phaseInterceptor.run(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; @@ -135,7 +135,7 @@ describe("Department Store Sale - Mystery Encounter", () => { expect(scene.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name); await game.phaseInterceptor.run(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; @@ -175,7 +175,7 @@ describe("Department Store Sale - Mystery Encounter", () => { expect(scene.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name); await game.phaseInterceptor.run(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; @@ -215,7 +215,7 @@ describe("Department Store Sale - Mystery Encounter", () => { expect(scene.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name); await game.phaseInterceptor.run(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; diff --git a/test/mystery-encounter/encounters/field-trip-encounter.test.ts b/test/mystery-encounter/encounters/field-trip-encounter.test.ts index 8bd35d6013f..75a6fe77492 100644 --- a/test/mystery-encounter/encounters/field-trip-encounter.test.ts +++ b/test/mystery-encounter/encounters/field-trip-encounter.test.ts @@ -12,7 +12,7 @@ import * as MysteryEncounters from "#app/data/mystery-encounters/mystery-encount import { FieldTripEncounter } from "#app/data/mystery-encounters/encounters/field-trip-encounter"; import { Moves } from "#enums/moves"; import { SelectModifierPhase } from "#app/phases/select-modifier-phase"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler"; import i18next from "i18next"; @@ -88,7 +88,7 @@ describe("Field Trip - Mystery Encounter", () => { await runMysteryEncounterToEnd(game, 1, { pokemonNo: 1, optionNo: 2 }); await game.phaseInterceptor.to(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; @@ -100,7 +100,7 @@ describe("Field Trip - Mystery Encounter", () => { await runMysteryEncounterToEnd(game, 1, { pokemonNo: 1, optionNo: 1 }); await game.phaseInterceptor.to(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; @@ -149,7 +149,7 @@ describe("Field Trip - Mystery Encounter", () => { await runMysteryEncounterToEnd(game, 2, { pokemonNo: 1, optionNo: 1 }); await game.phaseInterceptor.to(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; @@ -161,7 +161,7 @@ describe("Field Trip - Mystery Encounter", () => { await runMysteryEncounterToEnd(game, 2, { pokemonNo: 1, optionNo: 2 }); await game.phaseInterceptor.to(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; @@ -210,7 +210,7 @@ describe("Field Trip - Mystery Encounter", () => { await runMysteryEncounterToEnd(game, 3, { pokemonNo: 1, optionNo: 1 }); await game.phaseInterceptor.to(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; @@ -223,7 +223,7 @@ describe("Field Trip - Mystery Encounter", () => { await runMysteryEncounterToEnd(game, 3, { pokemonNo: 1, optionNo: 3 }); await game.phaseInterceptor.to(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; 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 d233e72932a..d47266268ee 100644 --- a/test/mystery-encounter/encounters/fight-or-flight-encounter.test.ts +++ b/test/mystery-encounter/encounters/fight-or-flight-encounter.test.ts @@ -12,7 +12,7 @@ import { import { Moves } from "#enums/moves"; import type BattleScene from "#app/battle-scene"; import { PokemonMove } from "#app/field/pokemon"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler"; import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode"; import { MysteryEncounterTier } from "#enums/mystery-encounter-tier"; @@ -126,7 +126,7 @@ describe("Fight or Flight - Mystery Encounter", () => { await game.phaseInterceptor.to(SelectModifierPhase, false); expect(scene.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name); await game.phaseInterceptor.run(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, @@ -186,7 +186,7 @@ describe("Fight or Flight - Mystery Encounter", () => { await game.phaseInterceptor.to(SelectModifierPhase, false); expect(scene.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name); await game.phaseInterceptor.run(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, 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 4bb44c4d19e..f8375c1aa78 100644 --- a/test/mystery-encounter/encounters/fun-and-games-encounter.test.ts +++ b/test/mystery-encounter/encounters/fun-and-games-encounter.test.ts @@ -10,7 +10,7 @@ import { runSelectMysteryEncounterOption, } from "#test/mystery-encounter/encounter-test-utils"; import type BattleScene from "#app/battle-scene"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode"; import { MysteryEncounterTier } from "#enums/mystery-encounter-tier"; import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils"; @@ -147,7 +147,7 @@ describe("Fun And Games! - Mystery Encounter", () => { expect(scene.getEnemyPokemon()?.ivs).toEqual([0, 0, 0, 0, 0, 0]); expect(scene.getEnemyPokemon()?.nature).toBe(Nature.MILD); - game.onNextPrompt("MessagePhase", Mode.MESSAGE, () => { + game.onNextPrompt("MessagePhase", UiMode.MESSAGE, () => { game.endPhase(); }); @@ -173,7 +173,7 @@ describe("Fun And Games! - Mystery Encounter", () => { await runMysteryEncounterToEnd(game, 1, { pokemonNo: 1 }, true); expect(scene.getCurrentPhase()?.constructor.name).toBe(CommandPhase.name); - game.onNextPrompt("MessagePhase", Mode.MESSAGE, () => { + game.onNextPrompt("MessagePhase", UiMode.MESSAGE, () => { game.endPhase(); }); @@ -186,7 +186,7 @@ describe("Fun And Games! - Mystery Encounter", () => { expect(scene.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name); await game.phaseInterceptor.run(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; @@ -200,7 +200,7 @@ describe("Fun And Games! - Mystery Encounter", () => { await runMysteryEncounterToEnd(game, 1, { pokemonNo: 1 }, true); expect(scene.getCurrentPhase()?.constructor.name).toBe(CommandPhase.name); - game.onNextPrompt("MessagePhase", Mode.MESSAGE, () => { + game.onNextPrompt("MessagePhase", UiMode.MESSAGE, () => { game.endPhase(); }); @@ -215,7 +215,7 @@ describe("Fun And Games! - Mystery Encounter", () => { expect(scene.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name); await game.phaseInterceptor.run(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; @@ -230,7 +230,7 @@ describe("Fun And Games! - Mystery Encounter", () => { await runMysteryEncounterToEnd(game, 1, { pokemonNo: 1 }, true); expect(scene.getCurrentPhase()?.constructor.name).toBe(CommandPhase.name); - game.onNextPrompt("MessagePhase", Mode.MESSAGE, () => { + game.onNextPrompt("MessagePhase", UiMode.MESSAGE, () => { game.endPhase(); }); @@ -245,7 +245,7 @@ describe("Fun And Games! - Mystery Encounter", () => { expect(scene.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name); await game.phaseInterceptor.run(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; @@ -260,7 +260,7 @@ describe("Fun And Games! - Mystery Encounter", () => { await runMysteryEncounterToEnd(game, 1, { pokemonNo: 1 }, true); expect(scene.getCurrentPhase()?.constructor.name).toBe(CommandPhase.name); - game.onNextPrompt("MessagePhase", Mode.MESSAGE, () => { + game.onNextPrompt("MessagePhase", UiMode.MESSAGE, () => { game.endPhase(); }); @@ -275,7 +275,7 @@ describe("Fun And Games! - Mystery Encounter", () => { expect(scene.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name); await game.phaseInterceptor.run(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; 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 f68561c2286..576e99c4e18 100644 --- a/test/mystery-encounter/encounters/global-trade-system-encounter.test.ts +++ b/test/mystery-encounter/encounters/global-trade-system-encounter.test.ts @@ -15,10 +15,10 @@ import { modifierTypes } from "#app/modifier/modifier-type"; import { GlobalTradeSystemEncounter } from "#app/data/mystery-encounters/encounters/global-trade-system-encounter"; import { CIVILIZATION_ENCOUNTER_BIOMES } from "#app/data/mystery-encounters/mystery-encounters"; import { SelectModifierPhase } from "#app/phases/select-modifier-phase"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler"; import { ModifierTier } from "#app/modifier/modifier-tier"; -import * as Utils from "#app/utils"; +import * as Utils from "#app/utils/common"; const namespace = "mysteryEncounters/globalTradeSystem"; const defaultParty = [Species.LAPRAS, Species.GENGAR, Species.ABRA]; @@ -231,7 +231,7 @@ describe("Global Trade System - Mystery Encounter", () => { expect(scene.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name); await game.phaseInterceptor.run(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; diff --git a/test/mystery-encounter/encounters/mysterious-challengers-encounter.test.ts b/test/mystery-encounter/encounters/mysterious-challengers-encounter.test.ts index f620cbd6c36..2c61d03b29d 100644 --- a/test/mystery-encounter/encounters/mysterious-challengers-encounter.test.ts +++ b/test/mystery-encounter/encounters/mysterious-challengers-encounter.test.ts @@ -10,7 +10,7 @@ import { skipBattleRunMysteryEncounterRewardsPhase, } from "#test/mystery-encounter/encounter-test-utils"; import type BattleScene from "#app/battle-scene"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode"; import { MysteryEncounterTier } from "#enums/mystery-encounter-tier"; import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils"; @@ -166,7 +166,7 @@ describe("Mysterious Challengers - Mystery Encounter", () => { expect(scene.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name); await game.phaseInterceptor.run(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; @@ -210,7 +210,7 @@ describe("Mysterious Challengers - Mystery Encounter", () => { expect(scene.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name); await game.phaseInterceptor.run(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; @@ -267,7 +267,7 @@ describe("Mysterious Challengers - Mystery Encounter", () => { expect(scene.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name); await game.phaseInterceptor.run(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; diff --git a/test/mystery-encounter/encounters/teleporting-hijinks-encounter.test.ts b/test/mystery-encounter/encounters/teleporting-hijinks-encounter.test.ts index 85c823038e8..4ff94c5a9bd 100644 --- a/test/mystery-encounter/encounters/teleporting-hijinks-encounter.test.ts +++ b/test/mystery-encounter/encounters/teleporting-hijinks-encounter.test.ts @@ -10,7 +10,7 @@ import { MysteryEncounterPhase } from "#app/phases/mystery-encounter-phases"; import { SelectModifierPhase } from "#app/phases/select-modifier-phase"; import GameManager from "#test/testUtils/gameManager"; import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode"; import { MysteryEncounterTier } from "#enums/mystery-encounter-tier"; import { @@ -301,7 +301,7 @@ describe("Teleporting Hijinks - Mystery Encounter", () => { expect(scene.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name); await game.phaseInterceptor.run(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; 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 a9e6a339d36..e3440aee9e0 100644 --- a/test/mystery-encounter/encounters/the-strong-stuff-encounter.test.ts +++ b/test/mystery-encounter/encounters/the-strong-stuff-encounter.test.ts @@ -18,7 +18,7 @@ import { Nature } from "#enums/nature"; import { BerryType } from "#enums/berry-type"; import { BattlerTagType } from "#enums/battler-tag-type"; import { PokemonMove } from "#app/field/pokemon"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler"; import { BerryModifier, PokemonBaseStatTotalModifier } from "#app/modifier/modifier"; import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode"; @@ -236,7 +236,7 @@ describe("The Strong Stuff - Mystery Encounter", () => { expect(scene.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name); await game.phaseInterceptor.run(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; 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 94c8141aa1e..4cb712ce779 100644 --- a/test/mystery-encounter/encounters/the-winstrate-challenge-encounter.test.ts +++ b/test/mystery-encounter/encounters/the-winstrate-challenge-encounter.test.ts @@ -7,7 +7,7 @@ import GameManager from "#test/testUtils/gameManager"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { runMysteryEncounterToEnd } from "#test/mystery-encounter/encounter-test-utils"; import type BattleScene from "#app/battle-scene"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode"; import { MysteryEncounterTier } from "#enums/mystery-encounter-tier"; import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils"; @@ -299,7 +299,7 @@ describe("The Winstrate Challenge - Mystery Encounter", () => { expect(scene.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name); await game.phaseInterceptor.run(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; @@ -341,7 +341,7 @@ describe("The Winstrate Challenge - Mystery Encounter", () => { expect(scene.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name); await game.phaseInterceptor.run(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; @@ -359,7 +359,7 @@ describe("The Winstrate Challenge - Mystery Encounter", () => { async function skipBattleToNextBattle(game: GameManager, isFinalBattle = false) { game.scene.clearPhaseQueue(); game.scene.clearPhaseQueueSplice(); - const commandUiHandler = game.scene.ui.handlers[Mode.COMMAND]; + const commandUiHandler = game.scene.ui.handlers[UiMode.COMMAND]; commandUiHandler.clear(); game.scene.getEnemyParty().forEach(p => { p.hp = 0; 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 df7bbb9f424..2f910a9250f 100644 --- a/test/mystery-encounter/encounters/trash-to-treasure-encounter.test.ts +++ b/test/mystery-encounter/encounters/trash-to-treasure-encounter.test.ts @@ -20,8 +20,8 @@ import { CommandPhase } from "#app/phases/command-phase"; import { MovePhase } from "#app/phases/move-phase"; import { SelectModifierPhase } from "#app/phases/select-modifier-phase"; import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler"; -import { Mode } from "#app/ui/ui"; -import * as Utils from "#app/utils"; +import { UiMode } from "#enums/ui-mode"; +import * as Utils from "#app/utils/common"; import { Moves } from "#enums/moves"; import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode"; import { MysteryEncounterTier } from "#enums/mystery-encounter-tier"; @@ -246,7 +246,7 @@ describe("Trash to Treasure - Mystery Encounter", () => { expect(scene.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name); await game.phaseInterceptor.run(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; diff --git a/test/mystery-encounter/encounters/weird-dream-encounter.test.ts b/test/mystery-encounter/encounters/weird-dream-encounter.test.ts index fbb88e346a8..f51ab45e4d4 100644 --- a/test/mystery-encounter/encounters/weird-dream-encounter.test.ts +++ b/test/mystery-encounter/encounters/weird-dream-encounter.test.ts @@ -10,7 +10,7 @@ import { skipBattleRunMysteryEncounterRewardsPhase, } from "#test/mystery-encounter/encounter-test-utils"; import type BattleScene from "#app/battle-scene"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler"; import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode"; import { MysteryEncounterTier } from "#enums/mystery-encounter-tier"; @@ -144,7 +144,7 @@ describe("Weird Dream - Mystery Encounter", () => { expect(scene.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name); await game.phaseInterceptor.run(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; @@ -200,7 +200,7 @@ describe("Weird Dream - Mystery Encounter", () => { expect(scene.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name); await game.phaseInterceptor.run(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; diff --git a/test/phases/learn-move-phase.test.ts b/test/phases/learn-move-phase.test.ts index 55b9d8b79d4..019b833d386 100644 --- a/test/phases/learn-move-phase.test.ts +++ b/test/phases/learn-move-phase.test.ts @@ -4,7 +4,7 @@ import GameManager from "#test/testUtils/gameManager"; import { Species } from "#enums/species"; import { Moves } from "#enums/moves"; import { LearnMovePhase } from "#app/phases/learn-move-phase"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { Button } from "#app/enums/buttons"; describe("Learn Move Phase", () => { @@ -52,10 +52,10 @@ describe("Learn Move Phase", () => { await game.doKillOpponents(); // queue up inputs to confirm dialog boxes - game.onNextPrompt("LearnMovePhase", Mode.CONFIRM, () => { + game.onNextPrompt("LearnMovePhase", UiMode.CONFIRM, () => { game.scene.ui.processInput(Button.ACTION); }); - game.onNextPrompt("LearnMovePhase", Mode.SUMMARY, () => { + game.onNextPrompt("LearnMovePhase", UiMode.SUMMARY, () => { for (let x = 0; x < moveSlotNum; x++) { game.scene.ui.processInput(Button.DOWN); } @@ -84,16 +84,16 @@ describe("Learn Move Phase", () => { await game.doKillOpponents(); // queue up inputs to confirm dialog boxes - game.onNextPrompt("LearnMovePhase", Mode.CONFIRM, () => { + game.onNextPrompt("LearnMovePhase", UiMode.CONFIRM, () => { game.scene.ui.processInput(Button.ACTION); }); - game.onNextPrompt("LearnMovePhase", Mode.SUMMARY, () => { + game.onNextPrompt("LearnMovePhase", UiMode.SUMMARY, () => { for (let x = 0; x < 4; x++) { game.scene.ui.processInput(Button.DOWN); // moves down 4 times to the 5th move slot } game.scene.ui.processInput(Button.ACTION); }); - game.onNextPrompt("LearnMovePhase", Mode.CONFIRM, () => { + game.onNextPrompt("LearnMovePhase", UiMode.CONFIRM, () => { game.scene.ui.processInput(Button.ACTION); }); await game.phaseInterceptor.to(LearnMovePhase); diff --git a/test/phases/mystery-encounter-phase.test.ts b/test/phases/mystery-encounter-phase.test.ts index f903932d2cb..34078b65039 100644 --- a/test/phases/mystery-encounter-phase.test.ts +++ b/test/phases/mystery-encounter-phase.test.ts @@ -3,7 +3,7 @@ import GameManager from "#test/testUtils/gameManager"; import Phaser from "phaser"; import { Species } from "#enums/species"; import { MysteryEncounterOptionSelectedPhase, MysteryEncounterPhase } from "#app/phases/mystery-encounter-phases"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { Button } from "#enums/buttons"; import type MysteryEncounterUiHandler from "#app/ui/mystery-encounter-ui-handler"; import { MysteryEncounterType } from "#enums/mystery-encounter-type"; @@ -50,7 +50,7 @@ describe("Mystery Encounter Phases", () => { Species.VOLCARONA, ]); - game.onNextPrompt("MysteryEncounterPhase", Mode.MYSTERY_ENCOUNTER, () => { + game.onNextPrompt("MysteryEncounterPhase", UiMode.MYSTERY_ENCOUNTER, () => { // End phase early for test game.phaseInterceptor.superEndPhase(); }); @@ -61,7 +61,7 @@ describe("Mystery Encounter Phases", () => { MysteryEncounterType.MYSTERIOUS_CHALLENGERS, ); expect(game.scene.mysteryEncounterSaveData.encounteredEvents[0].tier).toEqual(MysteryEncounterTier.GREAT); - expect(game.scene.ui.getMode()).toBe(Mode.MYSTERY_ENCOUNTER); + expect(game.scene.ui.getMode()).toBe(UiMode.MYSTERY_ENCOUNTER); }); it("Selects an option for MysteryEncounterPhase", async () => { @@ -73,7 +73,7 @@ describe("Mystery Encounter Phases", () => { Species.VOLCARONA, ]); - game.onNextPrompt("MysteryEncounterPhase", Mode.MESSAGE, () => { + game.onNextPrompt("MysteryEncounterPhase", UiMode.MESSAGE, () => { const handler = game.scene.ui.getHandler() as MessageUiHandler; handler.processInput(Button.ACTION); }); @@ -89,7 +89,7 @@ describe("Mystery Encounter Phases", () => { await vi.waitFor(() => expect(game.scene.getCurrentPhase()?.constructor.name).toBe(MysteryEncounterOptionSelectedPhase.name), ); - expect(ui.getMode()).toBe(Mode.MESSAGE); + expect(ui.getMode()).toBe(UiMode.MESSAGE); expect(ui.showDialogue).toHaveBeenCalledTimes(1); expect(ui.showText).toHaveBeenCalledTimes(2); expect(ui.showDialogue).toHaveBeenCalledWith( diff --git a/test/phases/phases.test.ts b/test/phases/phases.test.ts index 96225c9151c..2483cfb317f 100644 --- a/test/phases/phases.test.ts +++ b/test/phases/phases.test.ts @@ -2,7 +2,7 @@ import type BattleScene from "#app/battle-scene"; import { LoginPhase } from "#app/phases/login-phase"; import { TitlePhase } from "#app/phases/title-phase"; import { UnavailablePhase } from "#app/phases/unavailable-phase"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import GameManager from "#test/testUtils/gameManager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; @@ -32,7 +32,7 @@ describe("Phases", () => { const loginPhase = new LoginPhase(); scene.unshiftPhase(loginPhase); await game.phaseInterceptor.to(LoginPhase); - expect(scene.ui.getMode()).to.equal(Mode.MESSAGE); + expect(scene.ui.getMode()).to.equal(UiMode.MESSAGE); }); }); @@ -41,7 +41,7 @@ describe("Phases", () => { const titlePhase = new TitlePhase(); scene.unshiftPhase(titlePhase); await game.phaseInterceptor.to(TitlePhase); - expect(scene.ui.getMode()).to.equal(Mode.TITLE); + expect(scene.ui.getMode()).to.equal(UiMode.TITLE); }); }); @@ -50,7 +50,7 @@ describe("Phases", () => { const unavailablePhase = new UnavailablePhase(); scene.unshiftPhase(unavailablePhase); await game.phaseInterceptor.to(UnavailablePhase); - expect(scene.ui.getMode()).to.equal(Mode.UNAVAILABLE); + expect(scene.ui.getMode()).to.equal(UiMode.UNAVAILABLE); }, 20000); }); }); diff --git a/test/phases/select-modifier-phase.test.ts b/test/phases/select-modifier-phase.test.ts index d352acea77a..85f8b472c4a 100644 --- a/test/phases/select-modifier-phase.test.ts +++ b/test/phases/select-modifier-phase.test.ts @@ -6,8 +6,8 @@ import type { CustomModifierSettings } from "#app/modifier/modifier-type"; import { ModifierTypeOption, modifierTypes } from "#app/modifier/modifier-type"; import { SelectModifierPhase } from "#app/phases/select-modifier-phase"; import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler"; -import { Mode } from "#app/ui/ui"; -import { shiftCharCodes } from "#app/utils"; +import { UiMode } from "#enums/ui-mode"; +import { shiftCharCodes } from "#app/utils/common"; import { Abilities } from "#enums/abilities"; import { Button } from "#enums/buttons"; import { Moves } from "#enums/moves"; @@ -51,7 +51,7 @@ describe("SelectModifierPhase", () => { scene.unshiftPhase(selectModifierPhase); await game.phaseInterceptor.to(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); }); it("should generate random modifiers", async () => { @@ -59,7 +59,7 @@ describe("SelectModifierPhase", () => { game.move.select(Moves.FISSURE); await game.phaseInterceptor.to("SelectModifierPhase"); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; @@ -97,7 +97,7 @@ describe("SelectModifierPhase", () => { // TODO: nagivate the ui to reroll somehow //const smphase = scene.getCurrentPhase() as SelectModifierPhase; - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; @@ -106,7 +106,7 @@ describe("SelectModifierPhase", () => { modifierSelectHandler.processInput(Button.ACTION); expect(scene.money).toBe(1000000 - 250); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); expect(modifierSelectHandler.options.length).toEqual(3); }); @@ -125,7 +125,7 @@ describe("SelectModifierPhase", () => { game.move.select(Moves.FISSURE); await game.phaseInterceptor.to("SelectModifierPhase"); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; @@ -134,7 +134,7 @@ describe("SelectModifierPhase", () => { // TODO: nagivate ui to reroll with lock capsule enabled - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); expect(modifierSelectHandler.options.length).toEqual(3); // Reroll with lock can still upgrade expect( @@ -168,7 +168,7 @@ describe("SelectModifierPhase", () => { game.move.select(Moves.SPLASH); await game.phaseInterceptor.to("SelectModifierPhase"); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; @@ -205,7 +205,7 @@ describe("SelectModifierPhase", () => { game.move.select(Moves.SPLASH); await game.phaseInterceptor.to("SelectModifierPhase"); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; @@ -244,7 +244,7 @@ describe("SelectModifierPhase", () => { game.move.select(Moves.SPLASH); await game.phaseInterceptor.run(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; @@ -268,7 +268,7 @@ describe("SelectModifierPhase", () => { game.move.select(Moves.SPLASH); await game.phaseInterceptor.run(SelectModifierPhase); - expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); + expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); const modifierSelectHandler = scene.ui.handlers.find( h => h instanceof ModifierSelectUiHandler, ) as ModifierSelectUiHandler; diff --git a/test/plugins/api/pokerogue-account-api.test.ts b/test/plugins/api/pokerogue-account-api.test.ts index e7e1b2d52b0..3c37451960a 100644 --- a/test/plugins/api/pokerogue-account-api.test.ts +++ b/test/plugins/api/pokerogue-account-api.test.ts @@ -2,7 +2,8 @@ import type { AccountInfoResponse } from "#app/@types/PokerogueAccountApi"; import { SESSION_ID_COOKIE_NAME } from "#app/constants"; import { PokerogueAccountApi } from "#app/plugins/api/pokerogue-account-api"; import { getApiBaseUrl } from "#test/testUtils/testUtils"; -import * as Utils from "#app/utils"; +import * as CookieUtils from "#app/utils/cookies"; +import * as cookies from "#app/utils/cookies"; import { http, HttpResponse } from "msw"; import { beforeAll, afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { initServerForApiTests } from "#test/testUtils/testFileInitialization"; @@ -98,13 +99,13 @@ describe("Pokerogue Account API", () => { const loginParams = { username: "test", password: "test" }; it("should return null and set the cookie on SUCCESS", async () => { - vi.spyOn(Utils, "setCookie"); + vi.spyOn(CookieUtils, "setCookie"); server.use(http.post(`${apiBase}/account/login`, () => HttpResponse.json({ token: "abctest" }))); const error = await accountApi.login(loginParams); expect(error).toBeNull(); - expect(Utils.setCookie).toHaveBeenCalledWith(SESSION_ID_COOKIE_NAME, "abctest"); + expect(cookies.setCookie).toHaveBeenCalledWith(SESSION_ID_COOKIE_NAME, "abctest"); }); it("should return error message and report a warning on FAILURE", async () => { @@ -130,16 +131,16 @@ describe("Pokerogue Account API", () => { describe("Logout", () => { beforeEach(() => { - vi.spyOn(Utils, "removeCookie"); + vi.spyOn(CookieUtils, "removeCookie"); }); it("should remove cookie on success", async () => { - vi.spyOn(Utils, "setCookie"); + vi.spyOn(CookieUtils, "setCookie"); server.use(http.get(`${apiBase}/account/logout`, () => new HttpResponse("", { status: 200 }))); await accountApi.logout(); - expect(Utils.removeCookie).toHaveBeenCalledWith(SESSION_ID_COOKIE_NAME); + expect(cookies.removeCookie).toHaveBeenCalledWith(SESSION_ID_COOKIE_NAME); }); it("should report a warning on and remove cookie on FAILURE", async () => { @@ -147,7 +148,7 @@ describe("Pokerogue Account API", () => { await accountApi.logout(); - expect(Utils.removeCookie).toHaveBeenCalledWith(SESSION_ID_COOKIE_NAME); + expect(cookies.removeCookie).toHaveBeenCalledWith(SESSION_ID_COOKIE_NAME); expect(console.warn).toHaveBeenCalledWith("Log out failed!", expect.any(Error)); }); @@ -156,7 +157,7 @@ describe("Pokerogue Account API", () => { await accountApi.logout(); - expect(Utils.removeCookie).toHaveBeenCalledWith(SESSION_ID_COOKIE_NAME); + expect(cookies.removeCookie).toHaveBeenCalledWith(SESSION_ID_COOKIE_NAME); expect(console.warn).toHaveBeenCalledWith("Log out failed!", expect.any(Error)); }); }); diff --git a/test/reload.test.ts b/test/reload.test.ts index c69c0f9f484..93823e06cce 100644 --- a/test/reload.test.ts +++ b/test/reload.test.ts @@ -1,7 +1,7 @@ import { GameModes } from "#app/game-mode"; import { pokerogueApi } from "#app/plugins/api/pokerogue-api"; import type OptionSelectUiHandler from "#app/ui/settings/option-select-ui-handler"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { Biome } from "#enums/biome"; import { Button } from "#enums/buttons"; import { Moves } from "#enums/moves"; @@ -58,7 +58,7 @@ describe("Reload", () => { // Transition from Wave 10 to Wave 11 in order to trigger biome switch game.move.select(Moves.SPLASH); await game.doKillOpponents(); - game.onNextPrompt("SelectBiomePhase", Mode.OPTION_SELECT, () => { + game.onNextPrompt("SelectBiomePhase", UiMode.OPTION_SELECT, () => { (game.scene.time as MockClock).overrideDelay = null; const optionSelectUiHandler = game.scene.ui.getHandler() as OptionSelectUiHandler; game.scene.time.delayedCall(1010, () => optionSelectUiHandler.processInput(Button.ACTION)); diff --git a/test/settingMenu/rebinding_setting.test.ts b/test/settingMenu/rebinding_setting.test.ts index 28b5d73d7cc..45c647248c4 100644 --- a/test/settingMenu/rebinding_setting.test.ts +++ b/test/settingMenu/rebinding_setting.test.ts @@ -2,7 +2,7 @@ import cfg_keyboard_qwerty from "#app/configs/inputs/cfg_keyboard_qwerty"; import { getKeyWithKeycode, getKeyWithSettingName } from "#app/configs/inputs/configHandler"; import type { InterfaceConfig } from "#app/inputs-controller"; import { SettingKeyboard } from "#app/system/settings/settings-keyboard"; -import { deepCopy } from "#app/utils"; +import { deepCopy } from "#app/utils/common"; import { Button } from "#enums/buttons"; import { Device } from "#enums/devices"; import { InGameManip } from "#test/settingMenu/helpers/inGameManip"; diff --git a/test/system/game_data.test.ts b/test/system/game_data.test.ts index 94e82949fe6..900fb672320 100644 --- a/test/system/game_data.test.ts +++ b/test/system/game_data.test.ts @@ -1,4 +1,4 @@ -import * as BattleScene from "#app/battle-scene"; +import * as bypassLoginModule from "#app/global-vars/bypass-login"; import { pokerogueApi } from "#app/plugins/api/pokerogue-api"; import type { SessionSaveData } from "#app/system/game-data"; import { Abilities } from "#enums/abilities"; @@ -33,13 +33,13 @@ describe("System - Game Data", () => { describe("tryClearSession", () => { beforeEach(() => { - vi.spyOn(BattleScene, "bypassLogin", "get").mockReturnValue(false); + vi.spyOn(bypassLoginModule, "bypassLogin", "get").mockReturnValue(false); vi.spyOn(game.scene.gameData, "getSessionSaveData").mockReturnValue({} as SessionSaveData); vi.spyOn(account, "updateUserInfo").mockImplementation(async () => [true, 1]); }); it("should return [true, true] if bypassLogin is true", async () => { - vi.spyOn(BattleScene, "bypassLogin", "get").mockReturnValue(true); + vi.spyOn(bypassLoginModule, "bypassLogin", "get").mockReturnValue(true); const result = await game.scene.gameData.tryClearSession(0); diff --git a/test/testUtils/gameManager.ts b/test/testUtils/gameManager.ts index 390e71af126..874d8f786b8 100644 --- a/test/testUtils/gameManager.ts +++ b/test/testUtils/gameManager.ts @@ -30,8 +30,8 @@ import type CommandUiHandler from "#app/ui/command-ui-handler"; import type ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler"; import type PartyUiHandler from "#app/ui/party-ui-handler"; import type TargetSelectUiHandler from "#app/ui/target-select-ui-handler"; -import { Mode } from "#app/ui/ui"; -import { isNullOrUndefined } from "#app/utils"; +import { UiMode } from "#enums/ui-mode"; +import { isNullOrUndefined } from "#app/utils/common"; import { BattleStyle } from "#enums/battle-style"; import { Button } from "#enums/buttons"; import { ExpGainsSpeed } from "#enums/exp-gains-speed"; @@ -102,7 +102,7 @@ export default class GameManager { if (!firstTimeScene) { this.scene.reset(false, true); - (this.scene.ui.handlers[Mode.STARTER_SELECT] as StarterSelectUiHandler).clearStarterPreferences(); + (this.scene.ui.handlers[UiMode.STARTER_SELECT] as StarterSelectUiHandler).clearStarterPreferences(); this.scene.clearAllPhases(); // Must be run after phase interceptor has been initialized. @@ -135,7 +135,7 @@ export default class GameManager { * Sets the game mode. * @param mode - The mode to set. */ - setMode(mode: Mode) { + setMode(mode: UiMode) { this.scene.ui?.setMode(mode); } @@ -144,7 +144,7 @@ export default class GameManager { * @param mode - The mode to wait for. * @returns A promise that resolves when the mode is set. */ - waitMode(mode: Mode): Promise { + waitMode(mode: UiMode): Promise { return new Promise(async resolve => { await waitUntil(() => this.scene.ui?.getMode() === mode); return resolve(); @@ -168,7 +168,7 @@ export default class GameManager { */ onNextPrompt( phaseTarget: string, - mode: Mode, + mode: UiMode, callback: () => void, expireFn?: () => void, awaitingActionInput = false, @@ -208,7 +208,7 @@ export default class GameManager { console.log("===to final boss encounter==="); await this.runToTitle(); - this.onNextPrompt("TitlePhase", Mode.TITLE, () => { + this.onNextPrompt("TitlePhase", UiMode.TITLE, () => { this.scene.gameMode = getGameMode(mode); const starters = generateStarter(this.scene, species); const selectStarterPhase = new SelectStarterPhase(); @@ -243,7 +243,7 @@ export default class GameManager { this.onNextPrompt( "TitlePhase", - Mode.TITLE, + UiMode.TITLE, () => { this.scene.gameMode = getGameMode(GameModes.CLASSIC); const starters = generateStarter(this.scene, species); @@ -256,7 +256,7 @@ export default class GameManager { this.onNextPrompt( "EncounterPhase", - Mode.MESSAGE, + UiMode.MESSAGE, () => { const handler = this.scene.ui.getHandler() as BattleMessageUiHandler; handler.processInput(Button.ACTION); @@ -284,9 +284,9 @@ export default class GameManager { if (this.scene.battleStyle === BattleStyle.SWITCH) { this.onNextPrompt( "CheckSwitchPhase", - Mode.CONFIRM, + UiMode.CONFIRM, () => { - this.setMode(Mode.MESSAGE); + this.setMode(UiMode.MESSAGE); this.endPhase(); }, () => this.isCurrentPhase(CommandPhase) || this.isCurrentPhase(TurnInitPhase), @@ -294,9 +294,9 @@ export default class GameManager { this.onNextPrompt( "CheckSwitchPhase", - Mode.CONFIRM, + UiMode.CONFIRM, () => { - this.setMode(Mode.MESSAGE); + this.setMode(UiMode.MESSAGE); this.endPhase(); }, () => this.isCurrentPhase(CommandPhase) || this.isCurrentPhase(TurnInitPhase), @@ -316,7 +316,7 @@ export default class GameManager { selectTarget(movePosition: number, targetIndex?: BattlerIndex) { this.onNextPrompt( "SelectTargetPhase", - Mode.TARGET_SELECT, + UiMode.TARGET_SELECT, () => { const handler = this.scene.ui.getHandler() as TargetSelectUiHandler; const move = (this.scene.getCurrentPhase() as SelectTargetPhase) @@ -351,7 +351,7 @@ export default class GameManager { doSelectModifier() { this.onNextPrompt( "SelectModifierPhase", - Mode.MODIFIER_SELECT, + UiMode.MODIFIER_SELECT, () => { const handler = this.scene.ui.getHandler() as ModifierSelectUiHandler; handler.processInput(Button.CANCEL); @@ -365,7 +365,7 @@ export default class GameManager { this.onNextPrompt( "SelectModifierPhase", - Mode.CONFIRM, + UiMode.CONFIRM, () => { const handler = this.scene.ui.getHandler() as ModifierSelectUiHandler; handler.processInput(Button.ACTION); @@ -427,9 +427,9 @@ export default class GameManager { this.onNextPrompt( "CheckSwitchPhase", - Mode.CONFIRM, + UiMode.CONFIRM, () => { - this.setMode(Mode.MESSAGE); + this.setMode(UiMode.MESSAGE); this.endPhase(); }, () => this.isCurrentPhase(TurnInitPhase), @@ -461,7 +461,7 @@ export default class GameManager { * @param mode - The target mode. * @returns True if the current mode matches the target mode, otherwise false. */ - isCurrentMode(mode: Mode) { + isCurrentMode(mode: UiMode) { return this.scene.ui?.getMode() === mode; } @@ -516,7 +516,7 @@ export default class GameManager { * @param pokemonIndex the index of the pokemon in your party to switch to */ doSwitchPokemon(pokemonIndex: number) { - this.onNextPrompt("CommandPhase", Mode.COMMAND, () => { + this.onNextPrompt("CommandPhase", UiMode.COMMAND, () => { (this.scene.ui.getHandler() as CommandUiHandler).setCursor(2); (this.scene.ui.getHandler() as CommandUiHandler).processInput(Button.ACTION); }); @@ -545,7 +545,7 @@ export default class GameManager { * non-command switch actions happen in SwitchPhase. */ doSelectPartyPokemon(slot: number, inPhase = "SwitchPhase") { - this.onNextPrompt(inPhase, Mode.PARTY, () => { + this.onNextPrompt(inPhase, UiMode.PARTY, () => { const partyHandler = this.scene.ui.getHandler() as PartyUiHandler; partyHandler.setCursor(slot); @@ -560,12 +560,12 @@ export default class GameManager { * @param ballIndex the index of the pokeball to throw */ public doThrowPokeball(ballIndex: number) { - this.onNextPrompt("CommandPhase", Mode.COMMAND, () => { + this.onNextPrompt("CommandPhase", UiMode.COMMAND, () => { (this.scene.ui.getHandler() as CommandUiHandler).setCursor(1); (this.scene.ui.getHandler() as CommandUiHandler).processInput(Button.ACTION); }); - this.onNextPrompt("CommandPhase", Mode.BALL, () => { + this.onNextPrompt("CommandPhase", UiMode.BALL, () => { const ballHandler = this.scene.ui.getHandler() as BallUiHandler; ballHandler.setCursor(ballIndex); ballHandler.processInput(Button.ACTION); // select ball and throw diff --git a/test/testUtils/gameWrapper.ts b/test/testUtils/gameWrapper.ts index 02865701ed0..050e9f13257 100644 --- a/test/testUtils/gameWrapper.ts +++ b/test/testUtils/gameWrapper.ts @@ -1,8 +1,9 @@ // @ts-nocheck - TODO: remove this -import BattleScene, * as battleScene from "#app/battle-scene"; +import BattleScene from "#app/battle-scene"; import { MoveAnim } from "#app/data/battle-anims"; import Pokemon from "#app/field/pokemon"; -import { setCookie, sessionIdKey } from "#app/utils"; +import { sessionIdKey } from "#app/utils/common"; +import { setCookie } from "#app/utils/cookies"; import { blobToString } from "#test/testUtils/gameManagerUtils"; import { MockClock } from "#test/testUtils/mocks/mockClock"; import { MockFetch } from "#test/testUtils/mocks/mockFetch"; @@ -20,6 +21,8 @@ import KeyboardPlugin = Phaser.Input.Keyboard.KeyboardPlugin; import GamepadPlugin = Phaser.Input.Gamepad.GamepadPlugin; import EventEmitter = Phaser.Events.EventEmitter; import UpdateList = Phaser.GameObjects.UpdateList; +// biome-ignore lint/style/noNamespaceImport: Necessary in order to mock the var +import * as bypassLoginModule from "#app/global-vars/bypass-login"; window.URL.createObjectURL = (blob: Blob) => { blobToString(blob).then((data: string) => { @@ -43,7 +46,7 @@ export default class GameWrapper { Phaser.Math.RND.sow(["test"]); // vi.spyOn(Utils, "apiFetch", "get").mockReturnValue(fetch); if (bypassLogin) { - vi.spyOn(battleScene, "bypassLogin", "get").mockReturnValue(true); + vi.spyOn(bypassLoginModule, "bypassLogin", "get").mockReturnValue(true); } this.game = phaserGame; MoveAnim.prototype.getAnim = () => ({ diff --git a/test/testUtils/helpers/challengeModeHelper.ts b/test/testUtils/helpers/challengeModeHelper.ts index 0b7826eda7e..3a4f2adcd09 100644 --- a/test/testUtils/helpers/challengeModeHelper.ts +++ b/test/testUtils/helpers/challengeModeHelper.ts @@ -3,7 +3,7 @@ import type { Species } from "#app/enums/species"; import overrides from "#app/overrides"; import { EncounterPhase } from "#app/phases/encounter-phase"; import { SelectStarterPhase } from "#app/phases/select-starter-phase"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { generateStarter } from "../gameManagerUtils"; import { GameManagerHelper } from "./gameManagerHelper"; import type { Challenge } from "#app/data/challenge"; @@ -41,7 +41,7 @@ export class ChallengeModeHelper extends GameManagerHelper { this.game.override.shiny(false).enemyShiny(false); } - this.game.onNextPrompt("TitlePhase", Mode.TITLE, () => { + this.game.onNextPrompt("TitlePhase", UiMode.TITLE, () => { this.game.scene.gameMode.challenges = this.challenges; const starters = generateStarter(this.game.scene, species); const selectStarterPhase = new SelectStarterPhase(); @@ -66,9 +66,9 @@ export class ChallengeModeHelper extends GameManagerHelper { if (this.game.scene.battleStyle === BattleStyle.SWITCH) { this.game.onNextPrompt( "CheckSwitchPhase", - Mode.CONFIRM, + UiMode.CONFIRM, () => { - this.game.setMode(Mode.MESSAGE); + this.game.setMode(UiMode.MESSAGE); this.game.endPhase(); }, () => this.game.isCurrentPhase(CommandPhase) || this.game.isCurrentPhase(TurnInitPhase), @@ -76,9 +76,9 @@ export class ChallengeModeHelper extends GameManagerHelper { this.game.onNextPrompt( "CheckSwitchPhase", - Mode.CONFIRM, + UiMode.CONFIRM, () => { - this.game.setMode(Mode.MESSAGE); + this.game.setMode(UiMode.MESSAGE); this.game.endPhase(); }, () => this.game.isCurrentPhase(CommandPhase) || this.game.isCurrentPhase(TurnInitPhase), diff --git a/test/testUtils/helpers/classicModeHelper.ts b/test/testUtils/helpers/classicModeHelper.ts index 5b6a38f5747..8e1ac95c733 100644 --- a/test/testUtils/helpers/classicModeHelper.ts +++ b/test/testUtils/helpers/classicModeHelper.ts @@ -6,7 +6,7 @@ import { CommandPhase } from "#app/phases/command-phase"; import { EncounterPhase } from "#app/phases/encounter-phase"; import { SelectStarterPhase } from "#app/phases/select-starter-phase"; import { TurnInitPhase } from "#app/phases/turn-init-phase"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { generateStarter } from "../gameManagerUtils"; import { GameManagerHelper } from "./gameManagerHelper"; @@ -26,7 +26,7 @@ export class ClassicModeHelper extends GameManagerHelper { this.game.override.shiny(false).enemyShiny(false); } - this.game.onNextPrompt("TitlePhase", Mode.TITLE, () => { + this.game.onNextPrompt("TitlePhase", UiMode.TITLE, () => { this.game.scene.gameMode = getGameMode(GameModes.CLASSIC); const starters = generateStarter(this.game.scene, species); const selectStarterPhase = new SelectStarterPhase(); @@ -51,9 +51,9 @@ export class ClassicModeHelper extends GameManagerHelper { if (this.game.scene.battleStyle === BattleStyle.SWITCH) { this.game.onNextPrompt( "CheckSwitchPhase", - Mode.CONFIRM, + UiMode.CONFIRM, () => { - this.game.setMode(Mode.MESSAGE); + this.game.setMode(UiMode.MESSAGE); this.game.endPhase(); }, () => this.game.isCurrentPhase(CommandPhase) || this.game.isCurrentPhase(TurnInitPhase), @@ -61,9 +61,9 @@ export class ClassicModeHelper extends GameManagerHelper { this.game.onNextPrompt( "CheckSwitchPhase", - Mode.CONFIRM, + UiMode.CONFIRM, () => { - this.game.setMode(Mode.MESSAGE); + this.game.setMode(UiMode.MESSAGE); this.game.endPhase(); }, () => this.game.isCurrentPhase(CommandPhase) || this.game.isCurrentPhase(TurnInitPhase), diff --git a/test/testUtils/helpers/dailyModeHelper.ts b/test/testUtils/helpers/dailyModeHelper.ts index 0f5bc84df68..8ee03ce5f89 100644 --- a/test/testUtils/helpers/dailyModeHelper.ts +++ b/test/testUtils/helpers/dailyModeHelper.ts @@ -6,7 +6,7 @@ import { EncounterPhase } from "#app/phases/encounter-phase"; import { TitlePhase } from "#app/phases/title-phase"; import { TurnInitPhase } from "#app/phases/turn-init-phase"; import type SaveSlotSelectUiHandler from "#app/ui/save-slot-select-ui-handler"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { GameManagerHelper } from "./gameManagerHelper"; /** @@ -24,12 +24,12 @@ export class DailyModeHelper extends GameManagerHelper { this.game.override.shiny(false).enemyShiny(false); } - this.game.onNextPrompt("TitlePhase", Mode.TITLE, () => { + this.game.onNextPrompt("TitlePhase", UiMode.TITLE, () => { const titlePhase = new TitlePhase(); titlePhase.initDailyRun(); }); - this.game.onNextPrompt("TitlePhase", Mode.SAVE_SLOT, () => { + this.game.onNextPrompt("TitlePhase", UiMode.SAVE_SLOT, () => { const uihandler = this.game.scene.ui.getHandler(); uihandler.processInput(Button.ACTION); // select first slot. that's fine }); @@ -51,9 +51,9 @@ export class DailyModeHelper extends GameManagerHelper { if (this.game.scene.battleStyle === BattleStyle.SWITCH) { this.game.onNextPrompt( "CheckSwitchPhase", - Mode.CONFIRM, + UiMode.CONFIRM, () => { - this.game.setMode(Mode.MESSAGE); + this.game.setMode(UiMode.MESSAGE); this.game.endPhase(); }, () => this.game.isCurrentPhase(CommandPhase) || this.game.isCurrentPhase(TurnInitPhase), @@ -61,9 +61,9 @@ export class DailyModeHelper extends GameManagerHelper { this.game.onNextPrompt( "CheckSwitchPhase", - Mode.CONFIRM, + UiMode.CONFIRM, () => { - this.game.setMode(Mode.MESSAGE); + this.game.setMode(UiMode.MESSAGE); this.game.endPhase(); }, () => this.game.isCurrentPhase(CommandPhase) || this.game.isCurrentPhase(TurnInitPhase), diff --git a/test/testUtils/helpers/moveHelper.ts b/test/testUtils/helpers/moveHelper.ts index a54028ebca0..edade109966 100644 --- a/test/testUtils/helpers/moveHelper.ts +++ b/test/testUtils/helpers/moveHelper.ts @@ -7,7 +7,7 @@ import type { CommandPhase } from "#app/phases/command-phase"; import { LearnMovePhase } from "#app/phases/learn-move-phase"; import { MoveEffectPhase } from "#app/phases/move-effect-phase"; import { Command } from "#app/ui/command-ui-handler"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { Moves } from "#enums/moves"; import { getMovePosition } from "#test/testUtils/gameManagerUtils"; import { GameManagerHelper } from "#test/testUtils/helpers/gameManagerHelper"; @@ -53,10 +53,10 @@ export class MoveHelper extends GameManagerHelper { public select(move: Moves, pkmIndex: 0 | 1 = 0, targetIndex?: BattlerIndex | null) { const movePosition = getMovePosition(this.game.scene, pkmIndex, move); - this.game.onNextPrompt("CommandPhase", Mode.COMMAND, () => { - this.game.scene.ui.setMode(Mode.FIGHT, (this.game.scene.getCurrentPhase() as CommandPhase).getFieldIndex()); + this.game.onNextPrompt("CommandPhase", UiMode.COMMAND, () => { + this.game.scene.ui.setMode(UiMode.FIGHT, (this.game.scene.getCurrentPhase() as CommandPhase).getFieldIndex()); }); - this.game.onNextPrompt("CommandPhase", Mode.FIGHT, () => { + this.game.onNextPrompt("CommandPhase", UiMode.FIGHT, () => { (this.game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false); }); @@ -76,14 +76,14 @@ export class MoveHelper extends GameManagerHelper { const movePosition = getMovePosition(this.game.scene, pkmIndex, move); this.game.scene.getPlayerParty()[pkmIndex].isTerastallized = false; - this.game.onNextPrompt("CommandPhase", Mode.COMMAND, () => { + this.game.onNextPrompt("CommandPhase", UiMode.COMMAND, () => { this.game.scene.ui.setMode( - Mode.FIGHT, + UiMode.FIGHT, (this.game.scene.getCurrentPhase() as CommandPhase).getFieldIndex(), Command.TERA, ); }); - this.game.onNextPrompt("CommandPhase", Mode.FIGHT, () => { + this.game.onNextPrompt("CommandPhase", UiMode.FIGHT, () => { (this.game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.TERA, movePosition, false); }); @@ -135,16 +135,16 @@ export class MoveHelper extends GameManagerHelper { // if slots are full, queue up inputs to replace existing moves if (this.game.scene.getPlayerParty()[partyIndex].moveset.filter(m => m).length === 4) { - this.game.onNextPrompt("LearnMovePhase", Mode.CONFIRM, () => { + this.game.onNextPrompt("LearnMovePhase", UiMode.CONFIRM, () => { this.game.scene.ui.processInput(Button.ACTION); // "Should a move be forgotten and replaced with XXX?" }); - this.game.onNextPrompt("LearnMovePhase", Mode.SUMMARY, () => { + this.game.onNextPrompt("LearnMovePhase", UiMode.SUMMARY, () => { for (let x = 0; x < (moveSlotIndex ?? 0); x++) { this.game.scene.ui.processInput(Button.DOWN); // Scrolling in summary pane to move position } this.game.scene.ui.processInput(Button.ACTION); if (moveSlotIndex === 4) { - this.game.onNextPrompt("LearnMovePhase", Mode.CONFIRM, () => { + this.game.onNextPrompt("LearnMovePhase", UiMode.CONFIRM, () => { this.game.scene.ui.processInput(Button.ACTION); // "Give up on learning XXX?" }); } diff --git a/test/testUtils/helpers/overridesHelper.ts b/test/testUtils/helpers/overridesHelper.ts index d570a1a4195..6aa382ef59a 100644 --- a/test/testUtils/helpers/overridesHelper.ts +++ b/test/testUtils/helpers/overridesHelper.ts @@ -14,7 +14,7 @@ import { StatusEffect } from "#enums/status-effect"; import type { WeatherType } from "#enums/weather-type"; import { expect, vi } from "vitest"; import { GameManagerHelper } from "./gameManagerHelper"; -import { shiftCharCodes } from "#app/utils"; +import { shiftCharCodes } from "#app/utils/common"; import type { RandomTrainerOverride } from "#app/overrides"; import type { BattleType } from "#enums/battle-type"; diff --git a/test/testUtils/helpers/reloadHelper.ts b/test/testUtils/helpers/reloadHelper.ts index 842cd88b95c..4867a146aaf 100644 --- a/test/testUtils/helpers/reloadHelper.ts +++ b/test/testUtils/helpers/reloadHelper.ts @@ -1,6 +1,6 @@ import { GameManagerHelper } from "./gameManagerHelper"; import { TitlePhase } from "#app/phases/title-phase"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { vi } from "vitest"; import { BattleStyle } from "#app/enums/battle-style"; import { CommandPhase } from "#app/phases/command-phase"; @@ -53,9 +53,9 @@ export class ReloadHelper extends GameManagerHelper { if (this.game.scene.battleStyle === BattleStyle.SWITCH) { this.game.onNextPrompt( "CheckSwitchPhase", - Mode.CONFIRM, + UiMode.CONFIRM, () => { - this.game.setMode(Mode.MESSAGE); + this.game.setMode(UiMode.MESSAGE); this.game.endPhase(); }, () => this.game.isCurrentPhase(CommandPhase) || this.game.isCurrentPhase(TurnInitPhase), @@ -63,9 +63,9 @@ export class ReloadHelper extends GameManagerHelper { this.game.onNextPrompt( "CheckSwitchPhase", - Mode.CONFIRM, + UiMode.CONFIRM, () => { - this.game.setMode(Mode.MESSAGE); + this.game.setMode(UiMode.MESSAGE); this.game.endPhase(); }, () => this.game.isCurrentPhase(CommandPhase) || this.game.isCurrentPhase(TurnInitPhase), diff --git a/test/testUtils/phaseInterceptor.ts b/test/testUtils/phaseInterceptor.ts index 742a6bc8441..3d56c513c00 100644 --- a/test/testUtils/phaseInterceptor.ts +++ b/test/testUtils/phaseInterceptor.ts @@ -43,7 +43,8 @@ import { TurnStartPhase } from "#app/phases/turn-start-phase"; import { UnavailablePhase } from "#app/phases/unavailable-phase"; import { VictoryPhase } from "#app/phases/victory-phase"; import { PartyHealPhase } from "#app/phases/party-heal-phase"; -import UI, { Mode } from "#app/ui/ui"; +import UI from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { SelectBiomePhase } from "#app/phases/select-biome-phase"; import { MysteryEncounterBattlePhase, @@ -64,7 +65,7 @@ import { RevivalBlessingPhase } from "#app/phases/revival-blessing-phase"; export interface PromptHandler { phaseTarget?: string; - mode?: Mode; + mode?: UiMode; callback?: () => void; expireFn?: () => void; awaitingActionInput?: boolean; @@ -487,13 +488,13 @@ export default class PhaseInterceptor { /** * m2m to set mode. - * @param mode - The {@linkcode Mode} to set. + * @param mode - The {@linkcode UiMode} to set. * @param args - Additional arguments to pass to the original method. */ - setMode(mode: Mode, ...args: unknown[]): Promise { + setMode(mode: UiMode, ...args: unknown[]): Promise { const currentPhase = this.scene.getCurrentPhase(); const instance = this.scene.ui; - console.log("setMode", `${Mode[mode]} (=${mode})`, args); + console.log("setMode", `${UiMode[mode]} (=${mode})`, args); const ret = this.originalSetMode.apply(instance, [mode, ...args]); if (!this.phases[currentPhase.constructor.name]) { throw new Error( @@ -546,7 +547,7 @@ export default class PhaseInterceptor { */ addToNextPrompt( phaseTarget: string, - mode: Mode, + mode: UiMode, callback: () => void, expireFn?: () => void, awaitingActionInput = false, diff --git a/test/testUtils/testFileInitialization.ts b/test/testUtils/testFileInitialization.ts index cb2cd57044d..414e34e024b 100644 --- a/test/testUtils/testFileInitialization.ts +++ b/test/testUtils/testFileInitialization.ts @@ -11,7 +11,7 @@ import { initSpecies } from "#app/data/pokemon-species"; import { initAchievements } from "#app/system/achv"; import { initVouchers } from "#app/system/voucher"; import { initStatsKeys } from "#app/ui/game-stats-ui-handler"; -import { setCookie } from "#app/utils"; +import { setCookie } from "#app/utils/cookies"; import { blobToString } from "#test/testUtils/gameManagerUtils"; import { MockConsoleLog } from "#test/testUtils/mocks/mockConsoleLog"; import { mockContext } from "#test/testUtils/mocks/mockContextCanvas"; @@ -21,6 +21,7 @@ import Phaser from "phaser"; import InputText from "phaser3-rex-plugins/plugins/inputtext"; import BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext"; import { manageListeners } from "./listenersManager"; +import { initI18n } from "#app/plugins/i18n"; let wasInitialized = false; /** @@ -87,6 +88,7 @@ export function initTestFile() { // initSpecies(); if (!wasInitialized) { wasInitialized = true; + initI18n(); initVouchers(); initAchievements(); initStatsKeys(); diff --git a/test/ui/starter-select.test.ts b/test/ui/starter-select.test.ts index 1d523c3bbd5..b402e02e2d7 100644 --- a/test/ui/starter-select.test.ts +++ b/test/ui/starter-select.test.ts @@ -9,7 +9,7 @@ import type { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler" import type SaveSlotSelectUiHandler from "#app/ui/save-slot-select-ui-handler"; import type OptionSelectUiHandler from "#app/ui/settings/option-select-ui-handler"; import type StarterSelectUiHandler from "#app/ui/starter-select-ui-handler"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import { Abilities } from "#enums/abilities"; import { Button } from "#enums/buttons"; import { Species } from "#enums/species"; @@ -44,12 +44,12 @@ describe("UI - Starter select", () => { }).length; expect(caughtCount).toBe(Object.keys(allSpecies).length); await game.runToTitle(); - game.onNextPrompt("TitlePhase", Mode.TITLE, () => { + game.onNextPrompt("TitlePhase", UiMode.TITLE, () => { const currentPhase = game.scene.getCurrentPhase() as TitlePhase; currentPhase.gameMode = GameModes.CLASSIC; currentPhase.end(); }); - game.onNextPrompt("SelectStarterPhase", Mode.STARTER_SELECT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.STARTER_SELECT, () => { const handler = game.scene.ui.getHandler() as StarterSelectUiHandler; handler.processInput(Button.RIGHT); handler.processInput(Button.LEFT); @@ -60,7 +60,7 @@ describe("UI - Starter select", () => { let options: OptionSelectItem[] = []; let optionSelectUiHandler: OptionSelectUiHandler | undefined; await new Promise(resolve => { - game.onNextPrompt("SelectStarterPhase", Mode.OPTION_SELECT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.OPTION_SELECT, () => { optionSelectUiHandler = game.scene.ui.getHandler() as OptionSelectUiHandler; options = optionSelectUiHandler.getOptionsWithScroll(); resolve(); @@ -74,15 +74,15 @@ describe("UI - Starter select", () => { optionSelectUiHandler?.processInput(Button.ACTION); await new Promise(resolve => { - game.onNextPrompt("SelectStarterPhase", Mode.STARTER_SELECT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.STARTER_SELECT, () => { const handler = game.scene.ui.getHandler() as StarterSelectUiHandler; handler.processInput(Button.SUBMIT); }); - game.onNextPrompt("SelectStarterPhase", Mode.CONFIRM, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.CONFIRM, () => { const handler = game.scene.ui.getHandler() as StarterSelectUiHandler; handler.processInput(Button.ACTION); }); - game.onNextPrompt("SelectStarterPhase", Mode.SAVE_SLOT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.SAVE_SLOT, () => { const saveSlotSelectUiHandler = game.scene.ui.getHandler() as SaveSlotSelectUiHandler; saveSlotSelectUiHandler.processInput(Button.ACTION); resolve(); @@ -104,12 +104,12 @@ describe("UI - Starter select", () => { }).length; expect(caughtCount).toBe(Object.keys(allSpecies).length); await game.runToTitle(); - game.onNextPrompt("TitlePhase", Mode.TITLE, () => { + game.onNextPrompt("TitlePhase", UiMode.TITLE, () => { const currentPhase = game.scene.getCurrentPhase() as TitlePhase; currentPhase.gameMode = GameModes.CLASSIC; currentPhase.end(); }); - game.onNextPrompt("SelectStarterPhase", Mode.STARTER_SELECT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.STARTER_SELECT, () => { const handler = game.scene.ui.getHandler() as StarterSelectUiHandler; handler.processInput(Button.RIGHT); handler.processInput(Button.LEFT); @@ -121,7 +121,7 @@ describe("UI - Starter select", () => { let options: OptionSelectItem[] = []; let optionSelectUiHandler: OptionSelectUiHandler | undefined; await new Promise(resolve => { - game.onNextPrompt("SelectStarterPhase", Mode.OPTION_SELECT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.OPTION_SELECT, () => { optionSelectUiHandler = game.scene.ui.getHandler() as OptionSelectUiHandler; options = optionSelectUiHandler.getOptionsWithScroll(); resolve(); @@ -135,15 +135,15 @@ describe("UI - Starter select", () => { optionSelectUiHandler?.processInput(Button.ACTION); await new Promise(resolve => { - game.onNextPrompt("SelectStarterPhase", Mode.STARTER_SELECT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.STARTER_SELECT, () => { const handler = game.scene.ui.getHandler() as StarterSelectUiHandler; handler.processInput(Button.SUBMIT); }); - game.onNextPrompt("SelectStarterPhase", Mode.CONFIRM, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.CONFIRM, () => { const handler = game.scene.ui.getHandler() as StarterSelectUiHandler; handler.processInput(Button.ACTION); }); - game.onNextPrompt("SelectStarterPhase", Mode.SAVE_SLOT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.SAVE_SLOT, () => { const saveSlotSelectUiHandler = game.scene.ui.getHandler() as SaveSlotSelectUiHandler; saveSlotSelectUiHandler.processInput(Button.ACTION); resolve(); @@ -166,12 +166,12 @@ describe("UI - Starter select", () => { }).length; expect(caughtCount).toBe(Object.keys(allSpecies).length); await game.runToTitle(); - game.onNextPrompt("TitlePhase", Mode.TITLE, () => { + game.onNextPrompt("TitlePhase", UiMode.TITLE, () => { const currentPhase = game.scene.getCurrentPhase() as TitlePhase; currentPhase.gameMode = GameModes.CLASSIC; currentPhase.end(); }); - game.onNextPrompt("SelectStarterPhase", Mode.STARTER_SELECT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.STARTER_SELECT, () => { const handler = game.scene.ui.getHandler() as StarterSelectUiHandler; handler.processInput(Button.RIGHT); handler.processInput(Button.LEFT); @@ -185,7 +185,7 @@ describe("UI - Starter select", () => { let options: OptionSelectItem[] = []; let optionSelectUiHandler: OptionSelectUiHandler | undefined; await new Promise(resolve => { - game.onNextPrompt("SelectStarterPhase", Mode.OPTION_SELECT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.OPTION_SELECT, () => { optionSelectUiHandler = game.scene.ui.getHandler() as OptionSelectUiHandler; options = optionSelectUiHandler.getOptionsWithScroll(); resolve(); @@ -199,15 +199,15 @@ describe("UI - Starter select", () => { optionSelectUiHandler?.processInput(Button.ACTION); await new Promise(resolve => { - game.onNextPrompt("SelectStarterPhase", Mode.STARTER_SELECT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.STARTER_SELECT, () => { const handler = game.scene.ui.getHandler() as StarterSelectUiHandler; handler.processInput(Button.SUBMIT); }); - game.onNextPrompt("SelectStarterPhase", Mode.CONFIRM, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.CONFIRM, () => { const handler = game.scene.ui.getHandler() as StarterSelectUiHandler; handler.processInput(Button.ACTION); }); - game.onNextPrompt("SelectStarterPhase", Mode.SAVE_SLOT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.SAVE_SLOT, () => { const saveSlotSelectUiHandler = game.scene.ui.getHandler() as SaveSlotSelectUiHandler; saveSlotSelectUiHandler.processInput(Button.ACTION); resolve(); @@ -231,12 +231,12 @@ describe("UI - Starter select", () => { }).length; expect(caughtCount).toBe(Object.keys(allSpecies).length); await game.runToTitle(); - game.onNextPrompt("TitlePhase", Mode.TITLE, () => { + game.onNextPrompt("TitlePhase", UiMode.TITLE, () => { const currentPhase = game.scene.getCurrentPhase() as TitlePhase; currentPhase.gameMode = GameModes.CLASSIC; currentPhase.end(); }); - game.onNextPrompt("SelectStarterPhase", Mode.STARTER_SELECT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.STARTER_SELECT, () => { const handler = game.scene.ui.getHandler() as StarterSelectUiHandler; handler.processInput(Button.RIGHT); handler.processInput(Button.LEFT); @@ -248,7 +248,7 @@ describe("UI - Starter select", () => { let options: OptionSelectItem[] = []; let optionSelectUiHandler: OptionSelectUiHandler | undefined; await new Promise(resolve => { - game.onNextPrompt("SelectStarterPhase", Mode.OPTION_SELECT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.OPTION_SELECT, () => { optionSelectUiHandler = game.scene.ui.getHandler() as OptionSelectUiHandler; options = optionSelectUiHandler.getOptionsWithScroll(); resolve(); @@ -262,15 +262,15 @@ describe("UI - Starter select", () => { optionSelectUiHandler?.processInput(Button.ACTION); await new Promise(resolve => { - game.onNextPrompt("SelectStarterPhase", Mode.STARTER_SELECT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.STARTER_SELECT, () => { const handler = game.scene.ui.getHandler() as StarterSelectUiHandler; handler.processInput(Button.SUBMIT); }); - game.onNextPrompt("SelectStarterPhase", Mode.CONFIRM, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.CONFIRM, () => { const handler = game.scene.ui.getHandler() as StarterSelectUiHandler; handler.processInput(Button.ACTION); }); - game.onNextPrompt("SelectStarterPhase", Mode.SAVE_SLOT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.SAVE_SLOT, () => { const saveSlotSelectUiHandler = game.scene.ui.getHandler() as SaveSlotSelectUiHandler; saveSlotSelectUiHandler.processInput(Button.ACTION); resolve(); @@ -292,12 +292,12 @@ describe("UI - Starter select", () => { }).length; expect(caughtCount).toBe(Object.keys(allSpecies).length); await game.runToTitle(); - game.onNextPrompt("TitlePhase", Mode.TITLE, () => { + game.onNextPrompt("TitlePhase", UiMode.TITLE, () => { const currentPhase = game.scene.getCurrentPhase() as TitlePhase; currentPhase.gameMode = GameModes.CLASSIC; currentPhase.end(); }); - game.onNextPrompt("SelectStarterPhase", Mode.STARTER_SELECT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.STARTER_SELECT, () => { const handler = game.scene.ui.getHandler() as StarterSelectUiHandler; handler.processInput(Button.RIGHT); handler.processInput(Button.LEFT); @@ -309,7 +309,7 @@ describe("UI - Starter select", () => { let options: OptionSelectItem[] = []; let optionSelectUiHandler: OptionSelectUiHandler | undefined; await new Promise(resolve => { - game.onNextPrompt("SelectStarterPhase", Mode.OPTION_SELECT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.OPTION_SELECT, () => { optionSelectUiHandler = game.scene.ui.getHandler() as OptionSelectUiHandler; options = optionSelectUiHandler.getOptionsWithScroll(); resolve(); @@ -323,15 +323,15 @@ describe("UI - Starter select", () => { optionSelectUiHandler?.processInput(Button.ACTION); await new Promise(resolve => { - game.onNextPrompt("SelectStarterPhase", Mode.STARTER_SELECT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.STARTER_SELECT, () => { const handler = game.scene.ui.getHandler() as StarterSelectUiHandler; handler.processInput(Button.SUBMIT); }); - game.onNextPrompt("SelectStarterPhase", Mode.CONFIRM, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.CONFIRM, () => { const handler = game.scene.ui.getHandler() as StarterSelectUiHandler; handler.processInput(Button.ACTION); }); - game.onNextPrompt("SelectStarterPhase", Mode.SAVE_SLOT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.SAVE_SLOT, () => { const saveSlotSelectUiHandler = game.scene.ui.getHandler() as SaveSlotSelectUiHandler; saveSlotSelectUiHandler.processInput(Button.ACTION); resolve(); @@ -352,12 +352,12 @@ describe("UI - Starter select", () => { }).length; expect(caughtCount).toBe(Object.keys(allSpecies).length); await game.runToTitle(); - game.onNextPrompt("TitlePhase", Mode.TITLE, () => { + game.onNextPrompt("TitlePhase", UiMode.TITLE, () => { const currentPhase = game.scene.getCurrentPhase() as TitlePhase; currentPhase.gameMode = GameModes.CLASSIC; currentPhase.end(); }); - game.onNextPrompt("SelectStarterPhase", Mode.STARTER_SELECT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.STARTER_SELECT, () => { const handler = game.scene.ui.getHandler() as StarterSelectUiHandler; handler.processInput(Button.RIGHT); handler.processInput(Button.LEFT); @@ -371,7 +371,7 @@ describe("UI - Starter select", () => { let options: OptionSelectItem[] = []; let optionSelectUiHandler: OptionSelectUiHandler | undefined; await new Promise(resolve => { - game.onNextPrompt("SelectStarterPhase", Mode.OPTION_SELECT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.OPTION_SELECT, () => { optionSelectUiHandler = game.scene.ui.getHandler() as OptionSelectUiHandler; options = optionSelectUiHandler.getOptionsWithScroll(); resolve(); @@ -385,15 +385,15 @@ describe("UI - Starter select", () => { optionSelectUiHandler?.processInput(Button.ACTION); await new Promise(resolve => { - game.onNextPrompt("SelectStarterPhase", Mode.STARTER_SELECT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.STARTER_SELECT, () => { const handler = game.scene.ui.getHandler() as StarterSelectUiHandler; handler.processInput(Button.SUBMIT); }); - game.onNextPrompt("SelectStarterPhase", Mode.CONFIRM, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.CONFIRM, () => { const handler = game.scene.ui.getHandler() as StarterSelectUiHandler; handler.processInput(Button.ACTION); }); - game.onNextPrompt("SelectStarterPhase", Mode.SAVE_SLOT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.SAVE_SLOT, () => { const saveSlotSelectUiHandler = game.scene.ui.getHandler() as SaveSlotSelectUiHandler; saveSlotSelectUiHandler.processInput(Button.ACTION); resolve(); @@ -414,12 +414,12 @@ describe("UI - Starter select", () => { }).length; expect(caughtCount).toBe(Object.keys(allSpecies).length); await game.runToTitle(); - game.onNextPrompt("TitlePhase", Mode.TITLE, () => { + game.onNextPrompt("TitlePhase", UiMode.TITLE, () => { const currentPhase = game.scene.getCurrentPhase() as TitlePhase; currentPhase.gameMode = GameModes.CLASSIC; currentPhase.end(); }); - game.onNextPrompt("SelectStarterPhase", Mode.STARTER_SELECT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.STARTER_SELECT, () => { const handler = game.scene.ui.getHandler() as StarterSelectUiHandler; handler.processInput(Button.RIGHT); handler.processInput(Button.LEFT); @@ -432,7 +432,7 @@ describe("UI - Starter select", () => { let options: OptionSelectItem[] = []; let optionSelectUiHandler: OptionSelectUiHandler | undefined; await new Promise(resolve => { - game.onNextPrompt("SelectStarterPhase", Mode.OPTION_SELECT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.OPTION_SELECT, () => { optionSelectUiHandler = game.scene.ui.getHandler() as OptionSelectUiHandler; options = optionSelectUiHandler.getOptionsWithScroll(); resolve(); @@ -446,15 +446,15 @@ describe("UI - Starter select", () => { optionSelectUiHandler?.processInput(Button.ACTION); await new Promise(resolve => { - game.onNextPrompt("SelectStarterPhase", Mode.STARTER_SELECT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.STARTER_SELECT, () => { const handler = game.scene.ui.getHandler() as StarterSelectUiHandler; handler.processInput(Button.SUBMIT); }); - game.onNextPrompt("SelectStarterPhase", Mode.CONFIRM, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.CONFIRM, () => { const handler = game.scene.ui.getHandler() as StarterSelectUiHandler; handler.processInput(Button.ACTION); }); - game.onNextPrompt("SelectStarterPhase", Mode.SAVE_SLOT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.SAVE_SLOT, () => { const saveSlotSelectUiHandler = game.scene.ui.getHandler() as SaveSlotSelectUiHandler; saveSlotSelectUiHandler.processInput(Button.ACTION); resolve(); @@ -475,12 +475,12 @@ describe("UI - Starter select", () => { }).length; expect(caughtCount).toBe(Object.keys(allSpecies).length); await game.runToTitle(); - game.onNextPrompt("TitlePhase", Mode.TITLE, () => { + game.onNextPrompt("TitlePhase", UiMode.TITLE, () => { const currentPhase = game.scene.getCurrentPhase() as TitlePhase; currentPhase.gameMode = GameModes.CLASSIC; currentPhase.end(); }); - game.onNextPrompt("SelectStarterPhase", Mode.STARTER_SELECT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.STARTER_SELECT, () => { const handler = game.scene.ui.getHandler() as StarterSelectUiHandler; handler.processInput(Button.RIGHT); handler.processInput(Button.RIGHT); @@ -492,7 +492,7 @@ describe("UI - Starter select", () => { let options: OptionSelectItem[] = []; let optionSelectUiHandler: OptionSelectUiHandler | undefined; await new Promise(resolve => { - game.onNextPrompt("SelectStarterPhase", Mode.OPTION_SELECT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.OPTION_SELECT, () => { optionSelectUiHandler = game.scene.ui.getHandler() as OptionSelectUiHandler; options = optionSelectUiHandler.getOptionsWithScroll(); resolve(); @@ -507,7 +507,7 @@ describe("UI - Starter select", () => { let starterSelectUiHandler: StarterSelectUiHandler; await new Promise(resolve => { - game.onNextPrompt("SelectStarterPhase", Mode.STARTER_SELECT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.STARTER_SELECT, () => { starterSelectUiHandler = game.scene.ui.getHandler() as StarterSelectUiHandler; starterSelectUiHandler.processInput(Button.SUBMIT); resolve(); @@ -519,11 +519,11 @@ describe("UI - Starter select", () => { // expect(starterSelectUiHandler.cursorObj.x).toBe(132 + 4 * 18); // expect(starterSelectUiHandler.cursorObj.y).toBe(10); - game.onNextPrompt("SelectStarterPhase", Mode.CONFIRM, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.CONFIRM, () => { const handler = game.scene.ui.getHandler() as StarterSelectUiHandler; handler.processInput(Button.ACTION); }); - game.onNextPrompt("SelectStarterPhase", Mode.SAVE_SLOT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.SAVE_SLOT, () => { const saveSlotSelectUiHandler = game.scene.ui.getHandler() as SaveSlotSelectUiHandler; saveSlotSelectUiHandler.processInput(Button.ACTION); }); @@ -539,12 +539,12 @@ describe("UI - Starter select", () => { }).length; expect(caughtCount).toBe(Object.keys(allSpecies).length); await game.runToTitle(); - game.onNextPrompt("TitlePhase", Mode.TITLE, () => { + game.onNextPrompt("TitlePhase", UiMode.TITLE, () => { const currentPhase = game.scene.getCurrentPhase() as TitlePhase; currentPhase.gameMode = GameModes.CLASSIC; currentPhase.end(); }); - game.onNextPrompt("SelectStarterPhase", Mode.STARTER_SELECT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.STARTER_SELECT, () => { const handler = game.scene.ui.getHandler() as StarterSelectUiHandler; handler.processInput(Button.RIGHT); handler.processInput(Button.RIGHT); @@ -557,7 +557,7 @@ describe("UI - Starter select", () => { let options: OptionSelectItem[] = []; let optionSelectUiHandler: OptionSelectUiHandler | undefined; await new Promise(resolve => { - game.onNextPrompt("SelectStarterPhase", Mode.OPTION_SELECT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.OPTION_SELECT, () => { optionSelectUiHandler = game.scene.ui.getHandler() as OptionSelectUiHandler; options = optionSelectUiHandler.getOptionsWithScroll(); resolve(); @@ -572,7 +572,7 @@ describe("UI - Starter select", () => { let starterSelectUiHandler: StarterSelectUiHandler | undefined; await new Promise(resolve => { - game.onNextPrompt("SelectStarterPhase", Mode.STARTER_SELECT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.STARTER_SELECT, () => { starterSelectUiHandler = game.scene.ui.getHandler() as StarterSelectUiHandler; starterSelectUiHandler.processInput(Button.SUBMIT); resolve(); @@ -585,11 +585,11 @@ describe("UI - Starter select", () => { expect(starterSelectUiHandler?.cursorObj.x).toBe(53); expect(starterSelectUiHandler?.cursorObj.y).toBe(31); - game.onNextPrompt("SelectStarterPhase", Mode.CONFIRM, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.CONFIRM, () => { const handler = game.scene.ui.getHandler() as StarterSelectUiHandler; handler.processInput(Button.ACTION); }); - game.onNextPrompt("SelectStarterPhase", Mode.SAVE_SLOT, () => { + game.onNextPrompt("SelectStarterPhase", UiMode.SAVE_SLOT, () => { const saveSlotSelectUiHandler = game.scene.ui.getHandler() as SaveSlotSelectUiHandler; saveSlotSelectUiHandler.processInput(Button.ACTION); }); diff --git a/test/ui/transfer-item.test.ts b/test/ui/transfer-item.test.ts index cbbdc1d50ee..f0ea8f84005 100644 --- a/test/ui/transfer-item.test.ts +++ b/test/ui/transfer-item.test.ts @@ -4,7 +4,7 @@ import { Moves } from "#app/enums/moves"; import { Species } from "#app/enums/species"; import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler"; import PartyUiHandler, { PartyUiMode } from "#app/ui/party-ui-handler"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import GameManager from "#test/testUtils/gameManager"; import Phaser from "phaser"; import type BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext"; @@ -42,21 +42,21 @@ describe("UI - Transfer Items", () => { game.move.select(Moves.DRAGON_CLAW); - game.onNextPrompt("SelectModifierPhase", Mode.MODIFIER_SELECT, () => { + game.onNextPrompt("SelectModifierPhase", UiMode.MODIFIER_SELECT, () => { expect(game.scene.ui.getHandler()).toBeInstanceOf(ModifierSelectUiHandler); const handler = game.scene.ui.getHandler() as ModifierSelectUiHandler; handler.setCursor(1); handler.processInput(Button.ACTION); - void game.scene.ui.setModeWithoutClear(Mode.PARTY, PartyUiMode.MODIFIER_TRANSFER); + void game.scene.ui.setModeWithoutClear(UiMode.PARTY, PartyUiMode.MODIFIER_TRANSFER); }); await game.phaseInterceptor.to("BattleEndPhase"); }); it("check red tint for held item limit in transfer menu", async () => { - game.onNextPrompt("SelectModifierPhase", Mode.PARTY, () => { + game.onNextPrompt("SelectModifierPhase", UiMode.PARTY, () => { expect(game.scene.ui.getHandler()).toBeInstanceOf(PartyUiHandler); const handler = game.scene.ui.getHandler() as PartyUiHandler; @@ -79,7 +79,7 @@ describe("UI - Transfer Items", () => { }, 20000); it("check transfer option for pokemon to transfer to", async () => { - game.onNextPrompt("SelectModifierPhase", Mode.PARTY, () => { + game.onNextPrompt("SelectModifierPhase", UiMode.PARTY, () => { expect(game.scene.ui.getHandler()).toBeInstanceOf(PartyUiHandler); const handler = game.scene.ui.getHandler() as PartyUiHandler; diff --git a/test/ui/type-hints.test.ts b/test/ui/type-hints.test.ts index fcb71186448..08d9806ec7f 100644 --- a/test/ui/type-hints.test.ts +++ b/test/ui/type-hints.test.ts @@ -3,7 +3,7 @@ import { Moves } from "#app/enums/moves"; import { Species } from "#app/enums/species"; import { CommandPhase } from "#app/phases/command-phase"; import FightUiHandler from "#app/ui/fight-ui-handler"; -import { Mode } from "#app/ui/ui"; +import { UiMode } from "#enums/ui-mode"; import GameManager from "#test/testUtils/gameManager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; @@ -42,14 +42,14 @@ describe("UI - Type Hints", () => { await game.startBattle([Species.RAYQUAZA]); - game.onNextPrompt("CommandPhase", Mode.COMMAND, () => { + game.onNextPrompt("CommandPhase", UiMode.COMMAND, () => { const { ui } = game.scene; const handler = ui.getHandler(); handler.processInput(Button.ACTION); // select "Fight" game.phaseInterceptor.unlock(); }); - game.onNextPrompt("CommandPhase", Mode.FIGHT, () => { + game.onNextPrompt("CommandPhase", UiMode.FIGHT, () => { const { ui } = game.scene; const movesContainer = ui.getByName(FightUiHandler.MOVES_CONTAINER_NAME); const dragonClawText = movesContainer @@ -67,14 +67,14 @@ describe("UI - Type Hints", () => { await game.startBattle([Species.RAYQUAZA]); - game.onNextPrompt("CommandPhase", Mode.COMMAND, () => { + game.onNextPrompt("CommandPhase", UiMode.COMMAND, () => { const { ui } = game.scene; const handler = ui.getHandler(); handler.processInput(Button.ACTION); // select "Fight" game.phaseInterceptor.unlock(); }); - game.onNextPrompt("CommandPhase", Mode.FIGHT, () => { + game.onNextPrompt("CommandPhase", UiMode.FIGHT, () => { const { ui } = game.scene; const movesContainer = ui.getByName(FightUiHandler.MOVES_CONTAINER_NAME); const growlText = movesContainer diff --git a/src/utils.test.ts b/test/utils.test.ts similarity index 95% rename from src/utils.test.ts rename to test/utils.test.ts index cc3f2bb1a04..33f7906738c 100644 --- a/src/utils.test.ts +++ b/test/utils.test.ts @@ -1,5 +1,5 @@ import { expect, describe, it, beforeAll } from "vitest"; -import { randomString, padInt } from "./utils"; +import { randomString, padInt } from "#app/utils/common"; import Phaser from "phaser"; From 65294f408e1c8b26e13fa7ff01d6f42039ed0cfa Mon Sep 17 00:00:00 2001 From: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Date: Sat, 19 Apr 2025 10:04:19 -0500 Subject: [PATCH 13/18] [Bug][UI/UX] Fix type hint after enemy disappears (#5677) * Fix type hint after enemy disappears * Add automated test for type hint bugfix * Make onField default to true * Replace reference to Mode with UiMode and battleType with BattleStyle --- src/data/moves/move.ts | 4 ++-- src/data/terrain.ts | 2 +- src/field/pokemon.ts | 9 +++++++-- src/phases/move-phase.ts | 2 +- test/ui/type-hints.test.ts | 41 ++++++++++++++++++++++++++++++++++++-- 5 files changed, 50 insertions(+), 8 deletions(-) diff --git a/src/data/moves/move.ts b/src/data/moves/move.ts index 513ab3f6a74..26654fee18f 100644 --- a/src/data/moves/move.ts +++ b/src/data/moves/move.ts @@ -8183,7 +8183,7 @@ export type MoveTargetSet = { export function getMoveTargets(user: Pokemon, move: Moves, replaceTarget?: MoveTarget): MoveTargetSet { const variableTarget = new NumberHolder(0); - user.getOpponents().forEach(p => applyMoveAttrs(VariableTargetAttr, user, p, allMoves[move], variableTarget)); + user.getOpponents(false).forEach(p => applyMoveAttrs(VariableTargetAttr, user, p, allMoves[move], variableTarget)); let moveTarget: MoveTarget | undefined; if (allMoves[move].hasAttr(VariableTargetAttr)) { @@ -8195,7 +8195,7 @@ export function getMoveTargets(user: Pokemon, move: Moves, replaceTarget?: MoveT } else if (move === undefined) { moveTarget = MoveTarget.NEAR_ENEMY; } - const opponents = user.getOpponents(); + const opponents = user.getOpponents(false); let set: Pokemon[] = []; let multiple = false; diff --git a/src/data/terrain.ts b/src/data/terrain.ts index 894fb8a7955..5b6063cee68 100644 --- a/src/data/terrain.ts +++ b/src/data/terrain.ts @@ -59,7 +59,7 @@ export class Terrain { // Cancels move if the move has positive priority and targets a Pokemon grounded on the Psychic Terrain return ( move.getPriority(user) > 0 && - user.getOpponents().some(o => targets.includes(o.getBattlerIndex()) && o.isGrounded()) + user.getOpponents(true).some(o => targets.includes(o.getBattlerIndex()) && o.isGrounded()) ); } } diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 0242820dcde..f2e5fd4c2b6 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -3852,12 +3852,17 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { return null; } - getOpponents(): Pokemon[] { + /** + * Returns the pokemon that oppose this one and are active + * + * @param onField - whether to also check if the pokemon is currently on the field (defaults to true) + */ + getOpponents(onField = true): Pokemon[] { return ( (this.isPlayer() ? globalScene.getEnemyField() : globalScene.getPlayerField()) as Pokemon[] - ).filter(p => p.isActive()); + ).filter(p => p.isActive(onField)); } getOpponentDescriptor(): string { diff --git a/src/phases/move-phase.ts b/src/phases/move-phase.ts index f42a2aefa34..7d2848a5d70 100644 --- a/src/phases/move-phase.ts +++ b/src/phases/move-phase.ts @@ -654,7 +654,7 @@ export class MovePhase extends BattlePhase { }), 500, ); - applyMoveAttrs(PreMoveMessageAttr, this.pokemon, this.pokemon.getOpponents()[0], this.move.getMove()); + applyMoveAttrs(PreMoveMessageAttr, this.pokemon, this.pokemon.getOpponents(false)[0], this.move.getMove()); } public showFailedText(failedText: string = i18next.t("battle:attackFailed")): void { diff --git a/test/ui/type-hints.test.ts b/test/ui/type-hints.test.ts index 08d9806ec7f..2051af76754 100644 --- a/test/ui/type-hints.test.ts +++ b/test/ui/type-hints.test.ts @@ -40,7 +40,7 @@ describe("UI - Type Hints", () => { .moveset([Moves.DRAGON_CLAW]); game.settings.typeHints(true); //activate type hints - await game.startBattle([Species.RAYQUAZA]); + await game.classicMode.startBattle([Species.RAYQUAZA]); game.onNextPrompt("CommandPhase", UiMode.COMMAND, () => { const { ui } = game.scene; @@ -65,7 +65,7 @@ describe("UI - Type Hints", () => { it("check status move color", async () => { game.override.enemySpecies(Species.FLORGES).moveset([Moves.GROWL]); - await game.startBattle([Species.RAYQUAZA]); + await game.classicMode.startBattle([Species.RAYQUAZA]); game.onNextPrompt("CommandPhase", UiMode.COMMAND, () => { const { ui } = game.scene; @@ -86,4 +86,41 @@ describe("UI - Type Hints", () => { }); await game.phaseInterceptor.to(CommandPhase); }); + + it("should show the proper hint for a move in doubles after one of the enemy pokemon flees", async () => { + game.override + .enemySpecies(Species.ABRA) + .moveset([Moves.SPLASH, Moves.SHADOW_BALL, Moves.SOAK]) + .enemyMoveset([Moves.SPLASH, Moves.TELEPORT]) + .battleStyle("double"); + + await game.classicMode.startBattle([Species.MAGIKARP, Species.MAGIKARP]); + game.move.select(Moves.SPLASH); + // Use soak to change type of remaining abra to water + game.move.select(Moves.SOAK, 1); + + await game.forceEnemyMove(Moves.SPLASH); + await game.forceEnemyMove(Moves.TELEPORT); + await game.toNextTurn(); + + game.onNextPrompt("CommandPhase", UiMode.COMMAND, () => { + const { ui } = game.scene; + const handler = ui.getHandler(); + handler.processInput(Button.ACTION); // select "Fight" + game.phaseInterceptor.unlock(); + }); + + game.onNextPrompt("CommandPhase", UiMode.FIGHT, () => { + const { ui } = game.scene; + const movesContainer = ui.getByName(FightUiHandler.MOVES_CONTAINER_NAME); + const shadowBallText = movesContainer + .getAll() + .find(text => text.text === i18next.t("move:shadowBall.name"))! as unknown as MockText; + expect.soft(shadowBallText).toBeDefined(); + + expect.soft(shadowBallText.color).toBe(undefined); + ui.getHandler().processInput(Button.ACTION); + }); + await game.phaseInterceptor.to(CommandPhase); + }); }); From bda286cebb7285400925c5eefa3b3f4811549cda Mon Sep 17 00:00:00 2001 From: Chris <75648912+ChrisLolz@users.noreply.github.com> Date: Sat, 19 Apr 2025 17:00:12 -0400 Subject: [PATCH 14/18] [Bug] Fix Login Screen Buttons can be Pressed While Animating (#5170) * destroy containers when processing external containers * make form buttons uninteractible until tweens finished instead * fix holding enter spam * fix conflicts --- src/ui/form-modal-ui-handler.ts | 2 +- src/ui/login-form-ui-handler.ts | 132 +++++++++++++------------ src/ui/modal-ui-handler.ts | 6 +- src/ui/registration-form-ui-handler.ts | 86 ++++++++-------- 4 files changed, 120 insertions(+), 106 deletions(-) diff --git a/src/ui/form-modal-ui-handler.ts b/src/ui/form-modal-ui-handler.ts index e8e67d591d5..8c30b4e0bc4 100644 --- a/src/ui/form-modal-ui-handler.ts +++ b/src/ui/form-modal-ui-handler.ts @@ -124,7 +124,7 @@ export abstract class FormModalUiHandler extends ModalUiHandler { if (this.buttonBgs.length) { this.buttonBgs[0].off("pointerdown"); this.buttonBgs[0].on("pointerdown", () => { - if (this.submitAction) { + if (this.submitAction && globalScene.tweens.getTweensOf(this.modalContainer).length === 0) { this.submitAction(); } }); diff --git a/src/ui/login-form-ui-handler.ts b/src/ui/login-form-ui-handler.ts index 2dfab9c0c40..714a9b39771 100644 --- a/src/ui/login-form-ui-handler.ts +++ b/src/ui/login-form-ui-handler.ts @@ -40,25 +40,9 @@ export default class LoginFormUiHandler extends FormModalUiHandler { setup(): void { super.setup(); + this.buildExternalPartyContainer(); - - this.infoContainer = globalScene.add.container(0, 0); - - this.usernameInfoImage = this.buildInteractableImage("settings_icon", "username-info-icon", { - x: 20, - scale: 0.5, - }); - - this.saveDownloadImage = this.buildInteractableImage("saving_icon", "save-download-icon", { - x: 0, - scale: 0.75, - }); - - this.infoContainer.add(this.usernameInfoImage); - this.infoContainer.add(this.saveDownloadImage); - this.getUi().add(this.infoContainer); - this.infoContainer.setVisible(false); - this.infoContainer.disableInteractive(); + this.buildInfoContainer(); } private buildExternalPartyContainer() { @@ -84,6 +68,26 @@ export default class LoginFormUiHandler extends FormModalUiHandler { this.externalPartyContainer.setVisible(false); } + private buildInfoContainer() { + this.infoContainer = globalScene.add.container(0, 0); + + this.usernameInfoImage = this.buildInteractableImage("settings_icon", "username-info-icon", { + x: 20, + scale: 0.5, + }); + + this.saveDownloadImage = this.buildInteractableImage("saving_icon", "save-download-icon", { + x: 0, + scale: 0.75, + }); + + this.infoContainer.add(this.usernameInfoImage); + this.infoContainer.add(this.saveDownloadImage); + this.getUi().add(this.infoContainer); + this.infoContainer.setVisible(false); + this.infoContainer.disableInteractive(); + } + override getModalTitle(_config?: ModalConfig): string { let key = "menu:login"; if (import.meta.env.VITE_SERVER_URL === "https://apibeta.pokerogue.net") { @@ -143,27 +147,29 @@ export default class LoginFormUiHandler extends FormModalUiHandler { this.processExternalProvider(config); const originalLoginAction = this.submitAction; this.submitAction = _ => { - // Prevent overlapping overrides on action modification - this.submitAction = originalLoginAction; - this.sanitizeInputs(); + if (globalScene.tweens.getTweensOf(this.modalContainer).length === 0) { + // Prevent overlapping overrides on action modification + this.submitAction = originalLoginAction; + this.sanitizeInputs(); globalScene.ui.setMode(UiMode.LOADING, { buttonActions: [] }); - const onFail = error => { + const onFail = error => { globalScene.ui.setMode(UiMode.LOGIN_FORM, Object.assign(config, { errorMessage: error?.trim() })); - globalScene.ui.playError(); - }; - if (!this.inputs[0].text) { - return onFail(i18next.t("menu:emptyUsername")); - } - - const [usernameInput, passwordInput] = this.inputs; - - pokerogueApi.account.login({ username: usernameInput.text, password: passwordInput.text }).then(error => { - if (!error && originalLoginAction) { - originalLoginAction(); - } else { - onFail(error); + globalScene.ui.playError(); + }; + if (!this.inputs[0].text) { + return onFail(i18next.t("menu:emptyUsername")); } - }); + + const [usernameInput, passwordInput] = this.inputs; + + pokerogueApi.account.login({ username: usernameInput.text, password: passwordInput.text }).then(error => { + if (!error && originalLoginAction) { + originalLoginAction(); + } else { + onFail(error); + } + }); + } }; return true; @@ -221,34 +227,36 @@ export default class LoginFormUiHandler extends FormModalUiHandler { }; this.usernameInfoImage.on("pointerdown", () => { - const localStorageKeys = Object.keys(localStorage); // this gets the keys for localStorage - const keyToFind = "data_"; - const dataKeys = localStorageKeys.filter(ls => ls.indexOf(keyToFind) >= 0); - if (dataKeys.length > 0 && dataKeys.length <= 2) { - const options: OptionSelectItem[] = []; - for (let i = 0; i < dataKeys.length; i++) { - options.push({ - label: dataKeys[i].replace(keyToFind, ""), - handler: () => { - globalScene.ui.revertMode(); - this.infoContainer.disableInteractive(); - return true; - }, - }); - } + if (globalScene.tweens.getTweensOf(this.infoContainer).length === 0) { + const localStorageKeys = Object.keys(localStorage); // this gets the keys for localStorage + const keyToFind = "data_"; + const dataKeys = localStorageKeys.filter(ls => ls.indexOf(keyToFind) >= 0); + if (dataKeys.length > 0 && dataKeys.length <= 2) { + const options: OptionSelectItem[] = []; + for (let i = 0; i < dataKeys.length; i++) { + options.push({ + label: dataKeys[i].replace(keyToFind, ""), + handler: () => { + globalScene.ui.revertMode(); + this.infoContainer.disableInteractive(); + return true; + }, + }); + } globalScene.ui.setOverlayMode(UiMode.OPTION_SELECT, { - options: options, - delay: 1000, - }); - this.infoContainer.setInteractive( - new Phaser.Geom.Rectangle(0, 0, globalScene.game.canvas.width, globalScene.game.canvas.height), - Phaser.Geom.Rectangle.Contains, - ); - } else { - if (dataKeys.length > 2) { - return onFail(this.ERR_TOO_MANY_SAVES); + options: options, + delay: 1000, + }); + this.infoContainer.setInteractive( + new Phaser.Geom.Rectangle(0, 0, globalScene.game.canvas.width, globalScene.game.canvas.height), + Phaser.Geom.Rectangle.Contains, + ); + } else { + if (dataKeys.length > 2) { + return onFail(this.ERR_TOO_MANY_SAVES); + } + return onFail(this.ERR_NO_SAVES); } - return onFail(this.ERR_NO_SAVES); } }); diff --git a/src/ui/modal-ui-handler.ts b/src/ui/modal-ui-handler.ts index a3b94296d3f..56c1c2c3fcf 100644 --- a/src/ui/modal-ui-handler.ts +++ b/src/ui/modal-ui-handler.ts @@ -134,7 +134,11 @@ export abstract class ModalUiHandler extends UiHandler { for (let a = 0; a < this.buttonBgs.length; a++) { if (a < this.buttonBgs.length) { - this.buttonBgs[a].on("pointerdown", _ => config.buttonActions[a]()); + this.buttonBgs[a].on("pointerdown", _ => { + if (globalScene.tweens.getTweensOf(this.modalContainer).length === 0) { + config.buttonActions[a](); + } + }); } } diff --git a/src/ui/registration-form-ui-handler.ts b/src/ui/registration-form-ui-handler.ts index bb10efc5869..3d4613c21d6 100644 --- a/src/ui/registration-form-ui-handler.ts +++ b/src/ui/registration-form-ui-handler.ts @@ -98,51 +98,53 @@ export default class RegistrationFormUiHandler extends FormModalUiHandler { const originalRegistrationAction = this.submitAction; this.submitAction = _ => { - // Prevent overlapping overrides on action modification - this.submitAction = originalRegistrationAction; - this.sanitizeInputs(); + if (globalScene.tweens.getTweensOf(this.modalContainer).length === 0) { + // Prevent overlapping overrides on action modification + this.submitAction = originalRegistrationAction; + this.sanitizeInputs(); globalScene.ui.setMode(UiMode.LOADING, { buttonActions: [] }); - const onFail = error => { + const onFail = error => { globalScene.ui.setMode(UiMode.REGISTRATION_FORM, Object.assign(config, { errorMessage: error?.trim() })); - globalScene.ui.playError(); - const errorMessageFontSize = languageSettings[i18next.resolvedLanguage!]?.errorMessageFontSize; - if (errorMessageFontSize) { - this.errorMessage.setFontSize(errorMessageFontSize); - } - }; - if (!this.inputs[0].text) { - return onFail(i18next.t("menu:emptyUsername")); - } - if (!this.inputs[1].text) { - return onFail(this.getReadableErrorMessage("invalid password")); - } - if (this.inputs[1].text !== this.inputs[2].text) { - return onFail(i18next.t("menu:passwordNotMatchingConfirmPassword")); - } - const [usernameInput, passwordInput] = this.inputs; - pokerogueApi.account - .register({ - username: usernameInput.text, - password: passwordInput.text, - }) - .then(registerError => { - if (!registerError) { - pokerogueApi.account - .login({ - username: usernameInput.text, - password: passwordInput.text, - }) - .then(loginError => { - if (!loginError) { - originalRegistrationAction?.(); - } else { - onFail(loginError); - } - }); - } else { - onFail(registerError); + globalScene.ui.playError(); + const errorMessageFontSize = languageSettings[i18next.resolvedLanguage!]?.errorMessageFontSize; + if (errorMessageFontSize) { + this.errorMessage.setFontSize(errorMessageFontSize); } - }); + }; + if (!this.inputs[0].text) { + return onFail(i18next.t("menu:emptyUsername")); + } + if (!this.inputs[1].text) { + return onFail(this.getReadableErrorMessage("invalid password")); + } + if (this.inputs[1].text !== this.inputs[2].text) { + return onFail(i18next.t("menu:passwordNotMatchingConfirmPassword")); + } + const [usernameInput, passwordInput] = this.inputs; + pokerogueApi.account + .register({ + username: usernameInput.text, + password: passwordInput.text, + }) + .then(registerError => { + if (!registerError) { + pokerogueApi.account + .login({ + username: usernameInput.text, + password: passwordInput.text, + }) + .then(loginError => { + if (!loginError) { + originalRegistrationAction?.(); + } else { + onFail(loginError); + } + }); + } else { + onFail(registerError); + } + }); + } }; return true; From 8515cadd7735c0046a9185dec936f208f07c2281 Mon Sep 17 00:00:00 2001 From: Blitzy <118096277+Blitz425@users.noreply.github.com> Date: Sun, 20 Apr 2025 00:20:07 -0500 Subject: [PATCH 15/18] [Balance] Update Gym Leader Teams and Teras (#5670) * Update Gym Leader Teams * Set Tera slots for Gym Leaders * Change Giovanni's Specialty Type to Ground --- Co-authored-by: damocleas --- src/data/balance/signature-species.ts | 134 +++++++++++++------------- src/data/trainers/trainer-config.ts | 132 ++++++++++++------------- 2 files changed, 133 insertions(+), 133 deletions(-) diff --git a/src/data/balance/signature-species.ts b/src/data/balance/signature-species.ts index a1b73af40cd..e2fecaa12ff 100644 --- a/src/data/balance/signature-species.ts +++ b/src/data/balance/signature-species.ts @@ -11,87 +11,87 @@ export type SignatureSpecies = { */ export const signatureSpecies: SignatureSpecies = { // Gym Leaders- Kanto - BROCK: [Species.GEODUDE, Species.ONIX], - MISTY: [Species.STARYU, Species.PSYDUCK], - LT_SURGE: [Species.VOLTORB, Species.PIKACHU, Species.ELECTABUZZ], + BROCK: [Species.ONIX, Species.GEODUDE, [Species.OMANYTE, Species.KABUTO], Species.AERODACTYL], + MISTY: [Species.STARYU, Species.PSYDUCK, Species.WOOPER, Species.LAPRAS], + LT_SURGE: [Species.PICHU, Species.VOLTORB, Species.ELEKID, Species.JOLTEON], ERIKA: [Species.ODDISH, Species.BELLSPROUT, Species.TANGELA, Species.HOPPIP], - JANINE: [Species.VENONAT, Species.SPINARAK, Species.ZUBAT], - SABRINA: [Species.ABRA, Species.MR_MIME, Species.ESPEON], - BLAINE: [Species.GROWLITHE, Species.PONYTA, Species.MAGMAR], - GIOVANNI: [Species.SANDILE, Species.MURKROW, Species.NIDORAN_M, Species.NIDORAN_F], + JANINE: [Species.VENONAT, Species.SPINARAK, Species.ZUBAT, Species.KOFFING], + SABRINA: [Species.ABRA, Species.MR_MIME, Species.SMOOCHUM, Species.ESPEON], + BLAINE: [Species.GROWLITHE, Species.PONYTA, Species.MAGBY, Species.VULPIX], + GIOVANNI: [Species.RHYHORN, Species.MEOWTH, [Species.NIDORAN_F, Species.NIDORAN_M], Species.DIGLETT], // Tera Ground Meowth // Gym Leaders- Johto - FALKNER: [Species.PIDGEY, Species.HOOTHOOT, Species.DODUO], - BUGSY: [Species.SCYTHER, Species.HERACROSS, Species.SHUCKLE, Species.PINSIR], - WHITNEY: [Species.JIGGLYPUFF, Species.MILTANK, Species.AIPOM, Species.GIRAFARIG], - MORTY: [Species.GASTLY, Species.MISDREAVUS, Species.SABLEYE], - CHUCK: [Species.POLIWRATH, Species.MANKEY], - JASMINE: [Species.MAGNEMITE, Species.STEELIX], - PRYCE: [Species.SEEL, Species.SWINUB], - CLAIR: [Species.DRATINI, Species.HORSEA, Species.GYARADOS], + FALKNER: [Species.PIDGEY, Species.HOOTHOOT, Species.NATU, Species.MURKROW], + BUGSY: [Species.SCYTHER, Species.SHUCKLE, Species.YANMA, [Species.PINSIR, Species.HERACROSS]], + WHITNEY: [Species.MILTANK, Species.AIPOM, Species.IGGLYBUFF, [Species.GIRAFARIG, Species.STANTLER]], + MORTY: [Species.GASTLY, Species.MISDREAVUS, Species.DUSKULL, Species.SABLEYE], + CHUCK: [Species.POLIWRATH, Species.MANKEY, Species.TYROGUE, Species.MACHOP], + JASMINE: [Species.STEELIX, Species.MAGNEMITE, Species.PINECO, Species.SKARMORY], + PRYCE: [Species.SWINUB, Species.SEEL, Species.SHELLDER, Species.SNEASEL], + CLAIR: [Species.HORSEA, Species.DRATINI, Species.MAGIKARP, Species.DRUDDIGON], // Tera Dragon Magikarp // Gym Leaders- Hoenn - ROXANNE: [Species.GEODUDE, Species.NOSEPASS], - BRAWLY: [Species.MACHOP, Species.MAKUHITA], - WATTSON: [Species.MAGNEMITE, Species.VOLTORB, Species.ELECTRIKE], - FLANNERY: [Species.SLUGMA, Species.TORKOAL, Species.NUMEL], - NORMAN: [Species.SLAKOTH, Species.SPINDA, Species.ZIGZAGOON, Species.KECLEON], + ROXANNE: [Species.NOSEPASS, Species.GEODUDE, [Species.LILEEP, Species.ANORITH], Species.ARON], + BRAWLY: [Species.MAKUHITA, Species.MACHOP, Species.MEDITITE, Species.SHROOMISH], + WATTSON: [Species.ELECTRIKE, Species.VOLTORB, Species.MAGNEMITE, [Species.PLUSLE, Species.MINUN]], + FLANNERY: [Species.TORKOAL, Species.SLUGMA, Species.NUMEL, Species.HOUNDOUR], + NORMAN: [Species.SLAKOTH, Species.KECLEON, Species.WHISMUR, Species.ZANGOOSE], WINONA: [Species.SWABLU, Species.WINGULL, Species.TROPIUS, Species.SKARMORY], - TATE: [Species.SOLROCK, Species.NATU, Species.CHIMECHO, Species.GALLADE], - LIZA: [Species.LUNATONE, Species.SPOINK, Species.BALTOY, Species.GARDEVOIR], - JUAN: [Species.HORSEA, Species.BARBOACH, Species.SPHEAL, Species.RELICANTH], + TATE: [Species.SOLROCK, Species.NATU, Species.CHINGLING, Species.GALLADE], + LIZA: [Species.LUNATONE, Species.BALTOY, Species.SPOINK, Species.GARDEVOIR], + JUAN: [Species.HORSEA, Species.SPHEAL, Species.BARBOACH, Species.CORPHISH], // Gym Leaders- Sinnoh - ROARK: [Species.CRANIDOS, Species.LARVITAR, Species.GEODUDE], - GARDENIA: [Species.ROSELIA, Species.TANGELA, Species.TURTWIG], - MAYLENE: [Species.LUCARIO, Species.MEDITITE, Species.CHIMCHAR], + ROARK: [Species.CRANIDOS, Species.GEODUDE, Species.NOSEPASS, Species.LARVITAR], + GARDENIA: [Species.BUDEW, Species.CHERUBI, Species.TURTWIG, Species.LEAFEON], + MAYLENE: [Species.RIOLU, Species.MEDITITE, Species.CHIMCHAR, Species.CROAGUNK], CRASHER_WAKE: [Species.BUIZEL, Species.WOOPER, Species.PIPLUP, Species.MAGIKARP], - FANTINA: [Species.MISDREAVUS, Species.DRIFLOON, Species.SPIRITOMB], - BYRON: [Species.SHIELDON, Species.BRONZOR, Species.AGGRON], - CANDICE: [Species.SNEASEL, Species.SNOVER, Species.SNORUNT], - VOLKNER: [Species.SHINX, Species.CHINCHOU, Species.ROTOM], + FANTINA: [Species.MISDREAVUS, Species.DRIFLOON, Species.DUSKULL, Species.SPIRITOMB], + BYRON: [Species.SHIELDON, Species.BRONZOR, Species.ARON, Species.SKARMORY], + CANDICE: [Species.FROSLASS, Species.SNOVER, Species.SNEASEL, Species.GLACEON], + VOLKNER: [Species.ELEKID, Species.SHINX, Species.CHINCHOU, Species.ROTOM], // Gym Leaders- Unova - CILAN: [Species.PANSAGE, Species.FOONGUS, Species.PETILIL], - CHILI: [Species.PANSEAR, Species.DARUMAKA, Species.NUMEL], - CRESS: [Species.PANPOUR, Species.TYMPOLE, Species.SLOWPOKE], - CHEREN: [Species.LILLIPUP, Species.MINCCINO, Species.PIDOVE], - LENORA: [Species.PATRAT, Species.DEERLING, Species.AUDINO], - ROXIE: [Species.VENIPEDE, Species.TRUBBISH, Species.SKORUPI], - BURGH: [Species.SEWADDLE, Species.SHELMET, Species.KARRABLAST], - ELESA: [Species.EMOLGA, Species.BLITZLE, Species.JOLTIK], - CLAY: [Species.DRILBUR, Species.SANDILE, Species.GOLETT], - SKYLA: [Species.DUCKLETT, Species.WOOBAT, Species.RUFFLET], - BRYCEN: [Species.CRYOGONAL, Species.VANILLITE, Species.CUBCHOO], - DRAYDEN: [Species.DRUDDIGON, Species.AXEW, Species.DEINO], - MARLON: [Species.WAILMER, Species.FRILLISH, Species.TIRTOUGA], + CILAN: [Species.PANSAGE, Species.SNIVY, Species.MARACTUS, Species.FERROSEED], + CHILI: [Species.PANSEAR, Species.TEPIG, Species.HEATMOR, Species.DARUMAKA], + CRESS: [Species.PANPOUR, Species.OSHAWOTT, Species.BASCULIN, Species.TYMPOLE], + CHEREN: [Species.LILLIPUP, Species.MINCCINO, Species.PIDOVE, Species.BOUFFALANT], + LENORA: [Species.PATRAT, Species.DEERLING, Species.AUDINO, Species.BRAVIARY], + ROXIE: [Species.VENIPEDE, Species.KOFFING, Species.TRUBBISH, Species.TOXEL], + BURGH: [Species.SEWADDLE, Species.DWEBBLE, [Species.KARRABLAST, Species.SHELMET], Species.DURANT], + ELESA: [Species.BLITZLE, Species.EMOLGA, Species.JOLTIK, Species.TYNAMO], + CLAY: [Species.DRILBUR, Species.SANDILE, Species.TYMPOLE, Species.GOLETT], + SKYLA: [Species.DUCKLETT, Species.WOOBAT, [Species.RUFFLET, Species.VULLABY], Species.ARCHEN], + BRYCEN: [Species.CRYOGONAL, Species.VANILLITE, Species.CUBCHOO, Species.GALAR_DARUMAKA], + DRAYDEN: [Species.AXEW, Species.DRUDDIGON, Species.TRAPINCH, Species.DEINO], + MARLON: [Species.FRILLISH, Species.TIRTOUGA, Species.WAILMER, Species.MANTYKE], // Gym Leaders- Kalos - VIOLA: [Species.SURSKIT, Species.SCATTERBUG], - GRANT: [Species.AMAURA, Species.TYRUNT], - KORRINA: [Species.HAWLUCHA, Species.LUCARIO, Species.MIENFOO], - RAMOS: [Species.SKIDDO, Species.HOPPIP, Species.BELLSPROUT], - CLEMONT: [Species.HELIOPTILE, Species.MAGNEMITE, Species.EMOLGA], - VALERIE: [Species.SYLVEON, Species.MAWILE, Species.MR_MIME], - OLYMPIA: [Species.ESPURR, Species.SIGILYPH, Species.SLOWKING], - WULFRIC: [Species.BERGMITE, Species.SNOVER, Species.CRYOGONAL], + VIOLA: [Species.SCATTERBUG, Species.SURSKIT, Species.CUTIEFLY, Species.BLIPBUG], + GRANT: [Species.TYRUNT, Species.AMAURA, Species.BINACLE, Species.DWEBBLE], + KORRINA: [Species.RIOLU, Species.MIENFOO, Species.HAWLUCHA, Species.PANCHAM], + RAMOS: [Species.SKIDDO, Species.HOPPIP, Species.BELLSPROUT, [Species.PHANTUMP, Species.PUMPKABOO]], + CLEMONT: [Species.HELIOPTILE, Species.MAGNEMITE, Species.DEDENNE, Species.ROTOM], + VALERIE: [Species.SYLVEON, Species.MAWILE, Species.MR_MIME, [Species.SPRITZEE, Species.SWIRLIX]], + OLYMPIA: [Species.ESPURR, Species.SIGILYPH, Species.INKAY, Species.SLOWKING], + WULFRIC: [Species.BERGMITE, Species.SNOVER, Species.CRYOGONAL, Species.SWINUB], // Gym Leaders- Galar - MILO: [Species.GOSSIFLEUR, Species.APPLIN, Species.BOUNSWEET], - NESSA: [Species.CHEWTLE, Species.ARROKUDA, Species.WIMPOD], - KABU: [Species.SIZZLIPEDE, Species.VULPIX, Species.TORKOAL], - BEA: [Species.GALAR_FARFETCHD, Species.MACHOP, Species.CLOBBOPUS], - ALLISTER: [Species.GALAR_YAMASK, Species.GALAR_CORSOLA, Species.GASTLY], - OPAL: [Species.MILCERY, Species.TOGETIC, Species.GALAR_WEEZING], - BEDE: [Species.HATENNA, Species.GALAR_PONYTA, Species.GARDEVOIR], - GORDIE: [Species.ROLYCOLY, Species.STONJOURNER, Species.BINACLE], - MELONY: [Species.SNOM, Species.GALAR_DARUMAKA, Species.GALAR_MR_MIME], - PIERS: [Species.GALAR_ZIGZAGOON, Species.SCRAGGY, Species.INKAY], - MARNIE: [Species.IMPIDIMP, Species.PURRLOIN, Species.MORPEKO], - RAIHAN: [Species.DURALUDON, Species.TURTONATOR, Species.GOOMY], + MILO: [Species.GOSSIFLEUR, Species.SEEDOT, Species.APPLIN, Species.LOTAD], + NESSA: [Species.CHEWTLE, Species.WIMPOD, Species.ARROKUDA, Species.MAREANIE], + KABU: [Species.SIZZLIPEDE, Species.VULPIX, Species.GROWLITHE, Species.TORKOAL], + BEA: [Species.MACHOP, Species.GALAR_FARFETCHD, Species.CLOBBOPUS, Species.FALINKS], + ALLISTER: [Species.GASTLY, Species.GALAR_YAMASK, Species.GALAR_CORSOLA, Species.SINISTEA], + OPAL: [Species.MILCERY, Species.GALAR_WEEZING, Species.TOGEPI, Species.MAWILE], + BEDE: [Species.HATENNA, Species.GALAR_PONYTA, Species.GARDEVOIR, Species.SYLVEON], + GORDIE: [Species.ROLYCOLY, [Species.SHUCKLE, Species.BINACLE], Species.STONJOURNER, Species.LARVITAR], + MELONY: [Species.LAPRAS, Species.SNOM, Species.EISCUE, [Species.GALAR_MR_MIME, Species.GALAR_DARUMAKA]], + PIERS: [Species.GALAR_ZIGZAGOON, Species.SCRAGGY, Species.TOXEL, Species.INKAY], // Tera Dark Toxel + MARNIE: [Species.IMPIDIMP, Species.MORPEKO, Species.PURRLOIN, Species.CROAGUNK], // Tera Dark Croagunk + RAIHAN: [Species.DURALUDON, Species.TRAPINCH, Species.GOOMY, Species.TURTONATOR], // Gym Leaders- Paldea; First slot is Tera - KATY: [Species.TEDDIURSA, Species.NYMBLE, Species.TAROUNTULA], // Tera Bug Teddiursa - BRASSIUS: [Species.SUDOWOODO, Species.BRAMBLIN, Species.SMOLIV], // Tera Grass Sudowoodo - IONO: [Species.MISDREAVUS, Species.TADBULB, Species.WATTREL], // Tera Ghost Misdreavus + KATY: [Species.TEDDIURSA, Species.NYMBLE, Species.TAROUNTULA, Species.RELLOR], // Tera Bug Teddiursa + BRASSIUS: [Species.BONSLY, Species.SMOLIV, Species.BRAMBLIN, Species.SUNKERN], // Tera Grass Bonsly + IONO: [Species.MISDREAVUS, Species.TADBULB, Species.WATTREL, Species.MAGNEMITE], // Tera Ghost Misdreavus KOFU: [Species.CRABRAWLER, Species.VELUZA, Species.WIGLETT, Species.WINGULL], // Tera Water Crabrawler LARRY: [Species.STARLY, Species.DUNSPARCE, Species.LECHONK, Species.KOMALA], // Tera Normal Starly RYME: [Species.TOXEL, Species.GREAVARD, Species.SHUPPET, Species.MIMIKYU], // Tera Ghost Toxel TULIP: [Species.FLABEBE, Species.FLITTLE, Species.RALTS, Species.GIRAFARIG], // Tera Psychic Flabebe - GRUSHA: [Species.SWABLU, Species.CETODDLE, Species.CUBCHOO, Species.ALOLA_VULPIX], // Tera Ice Swablu + GRUSHA: [Species.SWABLU, Species.CETODDLE, Species.SNOM, Species.CUBCHOO], // Tera Ice Swablu // Elite Four- Kanto LORELEI: [ diff --git a/src/data/trainers/trainer-config.ts b/src/data/trainers/trainer-config.ts index fec1d4757e7..a2e62e6761b 100644 --- a/src/data/trainers/trainer-config.ts +++ b/src/data/trainers/trainer-config.ts @@ -2579,252 +2579,252 @@ export const trainerConfigs: TrainerConfigs = { ), [TrainerType.BROCK]: new TrainerConfig((t = TrainerType.BROCK)) - .initForGymLeader(signatureSpecies["BROCK"], true, PokemonType.ROCK) + .initForGymLeader(signatureSpecies["BROCK"], true, PokemonType.ROCK, false, -1) .setBattleBgm("battle_kanto_gym") .setMixedBattleBgm("battle_kanto_gym"), [TrainerType.MISTY]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["MISTY"], false, PokemonType.WATER) + .initForGymLeader(signatureSpecies["MISTY"], false, PokemonType.WATER, false, -1) .setBattleBgm("battle_kanto_gym") .setMixedBattleBgm("battle_kanto_gym"), [TrainerType.LT_SURGE]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["LT_SURGE"], true, PokemonType.ELECTRIC) + .initForGymLeader(signatureSpecies["LT_SURGE"], true, PokemonType.ELECTRIC, false, -1) .setBattleBgm("battle_kanto_gym") .setMixedBattleBgm("battle_kanto_gym"), [TrainerType.ERIKA]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["ERIKA"], false, PokemonType.GRASS) + .initForGymLeader(signatureSpecies["ERIKA"], false, PokemonType.GRASS, false, -1) .setBattleBgm("battle_kanto_gym") .setMixedBattleBgm("battle_kanto_gym"), [TrainerType.JANINE]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["JANINE"], false, PokemonType.POISON) + .initForGymLeader(signatureSpecies["JANINE"], false, PokemonType.POISON, false, -1) .setBattleBgm("battle_kanto_gym") .setMixedBattleBgm("battle_kanto_gym"), [TrainerType.SABRINA]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["SABRINA"], false, PokemonType.PSYCHIC) + .initForGymLeader(signatureSpecies["SABRINA"], false, PokemonType.PSYCHIC, false, -1) .setBattleBgm("battle_kanto_gym") .setMixedBattleBgm("battle_kanto_gym"), [TrainerType.BLAINE]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["BLAINE"], true, PokemonType.FIRE) + .initForGymLeader(signatureSpecies["BLAINE"], true, PokemonType.FIRE, false, -1) .setBattleBgm("battle_kanto_gym") .setMixedBattleBgm("battle_kanto_gym"), [TrainerType.GIOVANNI]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["GIOVANNI"], true, PokemonType.DARK) + .initForGymLeader(signatureSpecies["GIOVANNI"], true, PokemonType.GROUND, false, -2) .setBattleBgm("battle_kanto_gym") .setMixedBattleBgm("battle_kanto_gym"), [TrainerType.FALKNER]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["FALKNER"], true, PokemonType.FLYING) + .initForGymLeader(signatureSpecies["FALKNER"], true, PokemonType.FLYING, false, -1) .setBattleBgm("battle_johto_gym") .setMixedBattleBgm("battle_johto_gym"), [TrainerType.BUGSY]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["BUGSY"], true, PokemonType.BUG) + .initForGymLeader(signatureSpecies["BUGSY"], true, PokemonType.BUG, false, -1) .setBattleBgm("battle_johto_gym") .setMixedBattleBgm("battle_johto_gym"), [TrainerType.WHITNEY]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["WHITNEY"], false, PokemonType.NORMAL) + .initForGymLeader(signatureSpecies["WHITNEY"], false, PokemonType.NORMAL, false, -1) .setBattleBgm("battle_johto_gym") .setMixedBattleBgm("battle_johto_gym"), [TrainerType.MORTY]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["MORTY"], true, PokemonType.GHOST) + .initForGymLeader(signatureSpecies["MORTY"], true, PokemonType.GHOST, false, -1) .setBattleBgm("battle_johto_gym") .setMixedBattleBgm("battle_johto_gym"), [TrainerType.CHUCK]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["CHUCK"], true, PokemonType.FIGHTING) + .initForGymLeader(signatureSpecies["CHUCK"], true, PokemonType.FIGHTING, false, -1) .setBattleBgm("battle_johto_gym") .setMixedBattleBgm("battle_johto_gym"), [TrainerType.JASMINE]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["JASMINE"], false, PokemonType.STEEL) + .initForGymLeader(signatureSpecies["JASMINE"], false, PokemonType.STEEL, false, -1) .setBattleBgm("battle_johto_gym") .setMixedBattleBgm("battle_johto_gym"), [TrainerType.PRYCE]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["PRYCE"], true, PokemonType.ICE) + .initForGymLeader(signatureSpecies["PRYCE"], true, PokemonType.ICE, false, -1) .setBattleBgm("battle_johto_gym") .setMixedBattleBgm("battle_johto_gym"), [TrainerType.CLAIR]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["CLAIR"], false, PokemonType.DRAGON) + .initForGymLeader(signatureSpecies["CLAIR"], false, PokemonType.DRAGON, false, -3) .setBattleBgm("battle_johto_gym") .setMixedBattleBgm("battle_johto_gym"), [TrainerType.ROXANNE]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["ROXANNE"], false, PokemonType.ROCK) + .initForGymLeader(signatureSpecies["ROXANNE"], false, PokemonType.ROCK, false, -1) .setBattleBgm("battle_hoenn_gym") .setMixedBattleBgm("battle_hoenn_gym"), [TrainerType.BRAWLY]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["BRAWLY"], true, PokemonType.FIGHTING) + .initForGymLeader(signatureSpecies["BRAWLY"], true, PokemonType.FIGHTING, false, -1) .setBattleBgm("battle_hoenn_gym") .setMixedBattleBgm("battle_hoenn_gym"), [TrainerType.WATTSON]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["WATTSON"], true, PokemonType.ELECTRIC) + .initForGymLeader(signatureSpecies["WATTSON"], true, PokemonType.ELECTRIC, false, -1) .setBattleBgm("battle_hoenn_gym") .setMixedBattleBgm("battle_hoenn_gym"), [TrainerType.FLANNERY]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["FLANNERY"], false, PokemonType.FIRE) + .initForGymLeader(signatureSpecies["FLANNERY"], false, PokemonType.FIRE, false, -1) .setBattleBgm("battle_hoenn_gym") .setMixedBattleBgm("battle_hoenn_gym"), [TrainerType.NORMAN]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["NORMAN"], true, PokemonType.NORMAL) + .initForGymLeader(signatureSpecies["NORMAN"], true, PokemonType.NORMAL, false, -1) .setBattleBgm("battle_hoenn_gym") .setMixedBattleBgm("battle_hoenn_gym"), [TrainerType.WINONA]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["WINONA"], false, PokemonType.FLYING) + .initForGymLeader(signatureSpecies["WINONA"], false, PokemonType.FLYING, false, -1) .setBattleBgm("battle_hoenn_gym") .setMixedBattleBgm("battle_hoenn_gym"), [TrainerType.TATE]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["TATE"], true, PokemonType.PSYCHIC) + .initForGymLeader(signatureSpecies["TATE"], true, PokemonType.PSYCHIC, false, -1) .setBattleBgm("battle_hoenn_gym") .setMixedBattleBgm("battle_hoenn_gym") .setHasDouble("tate_liza_double") .setDoubleTrainerType(TrainerType.LIZA) .setDoubleTitle("gym_leader_double"), [TrainerType.LIZA]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["LIZA"], false, PokemonType.PSYCHIC) + .initForGymLeader(signatureSpecies["LIZA"], false, PokemonType.PSYCHIC, false, -1) .setBattleBgm("battle_hoenn_gym") .setMixedBattleBgm("battle_hoenn_gym") .setHasDouble("liza_tate_double") .setDoubleTrainerType(TrainerType.TATE) .setDoubleTitle("gym_leader_double"), [TrainerType.JUAN]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["JUAN"], true, PokemonType.WATER) + .initForGymLeader(signatureSpecies["JUAN"], true, PokemonType.WATER, false, -1) .setBattleBgm("battle_hoenn_gym") .setMixedBattleBgm("battle_hoenn_gym"), [TrainerType.ROARK]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["ROARK"], true, PokemonType.ROCK) + .initForGymLeader(signatureSpecies["ROARK"], true, PokemonType.ROCK, false, -1) .setBattleBgm("battle_sinnoh_gym") .setMixedBattleBgm("battle_sinnoh_gym"), [TrainerType.GARDENIA]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["GARDENIA"], false, PokemonType.GRASS) + .initForGymLeader(signatureSpecies["GARDENIA"], false, PokemonType.GRASS, false, -1) .setBattleBgm("battle_sinnoh_gym") .setMixedBattleBgm("battle_sinnoh_gym"), [TrainerType.MAYLENE]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["MAYLENE"], false, PokemonType.FIGHTING) + .initForGymLeader(signatureSpecies["MAYLENE"], false, PokemonType.FIGHTING, false, -1) .setBattleBgm("battle_sinnoh_gym") .setMixedBattleBgm("battle_sinnoh_gym"), [TrainerType.CRASHER_WAKE]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["CRASHER_WAKE"], true, PokemonType.WATER) + .initForGymLeader(signatureSpecies["CRASHER_WAKE"], true, PokemonType.WATER, false, -1) .setBattleBgm("battle_sinnoh_gym") .setMixedBattleBgm("battle_sinnoh_gym"), [TrainerType.FANTINA]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["FANTINA"], false, PokemonType.GHOST) + .initForGymLeader(signatureSpecies["FANTINA"], false, PokemonType.GHOST, false, -1) .setBattleBgm("battle_sinnoh_gym") .setMixedBattleBgm("battle_sinnoh_gym"), [TrainerType.BYRON]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["BYRON"], true, PokemonType.STEEL) + .initForGymLeader(signatureSpecies["BYRON"], true, PokemonType.STEEL, false, -1) .setBattleBgm("battle_sinnoh_gym") .setMixedBattleBgm("battle_sinnoh_gym"), [TrainerType.CANDICE]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["CANDICE"], false, PokemonType.ICE) + .initForGymLeader(signatureSpecies["CANDICE"], false, PokemonType.ICE, false, -1) .setBattleBgm("battle_sinnoh_gym") .setMixedBattleBgm("battle_sinnoh_gym"), [TrainerType.VOLKNER]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["VOLKNER"], true, PokemonType.ELECTRIC) + .initForGymLeader(signatureSpecies["VOLKNER"], true, PokemonType.ELECTRIC, false, -1) .setBattleBgm("battle_sinnoh_gym") .setMixedBattleBgm("battle_sinnoh_gym"), [TrainerType.CILAN]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["CILAN"], true, PokemonType.GRASS) + .initForGymLeader(signatureSpecies["CILAN"], true, PokemonType.GRASS, false, -1) .setMixedBattleBgm("battle_unova_gym"), [TrainerType.CHILI]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["CHILI"], true, PokemonType.FIRE) + .initForGymLeader(signatureSpecies["CHILI"], true, PokemonType.FIRE, false, -1) .setMixedBattleBgm("battle_unova_gym"), [TrainerType.CRESS]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["CRESS"], true, PokemonType.WATER) + .initForGymLeader(signatureSpecies["CRESS"], true, PokemonType.WATER, false, -1) .setMixedBattleBgm("battle_unova_gym"), [TrainerType.CHEREN]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["CHEREN"], true, PokemonType.NORMAL) + .initForGymLeader(signatureSpecies["CHEREN"], true, PokemonType.NORMAL, false, -1) .setMixedBattleBgm("battle_unova_gym"), [TrainerType.LENORA]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["LENORA"], false, PokemonType.NORMAL) + .initForGymLeader(signatureSpecies["LENORA"], false, PokemonType.NORMAL, false, -1) .setMixedBattleBgm("battle_unova_gym"), [TrainerType.ROXIE]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["ROXIE"], false, PokemonType.POISON) + .initForGymLeader(signatureSpecies["ROXIE"], false, PokemonType.POISON, false, -1) .setMixedBattleBgm("battle_unova_gym"), [TrainerType.BURGH]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["BURGH"], true, PokemonType.BUG) + .initForGymLeader(signatureSpecies["BURGH"], true, PokemonType.BUG, false, -1) .setMixedBattleBgm("battle_unova_gym"), [TrainerType.ELESA]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["ELESA"], false, PokemonType.ELECTRIC) + .initForGymLeader(signatureSpecies["ELESA"], false, PokemonType.ELECTRIC, false, -1) .setMixedBattleBgm("battle_unova_gym"), [TrainerType.CLAY]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["CLAY"], true, PokemonType.GROUND) + .initForGymLeader(signatureSpecies["CLAY"], true, PokemonType.GROUND, false, -1) .setMixedBattleBgm("battle_unova_gym"), [TrainerType.SKYLA]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["SKYLA"], false, PokemonType.FLYING) + .initForGymLeader(signatureSpecies["SKYLA"], false, PokemonType.FLYING, false, -1) .setMixedBattleBgm("battle_unova_gym"), [TrainerType.BRYCEN]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["BRYCEN"], true, PokemonType.ICE) + .initForGymLeader(signatureSpecies["BRYCEN"], true, PokemonType.ICE, false, -1) .setMixedBattleBgm("battle_unova_gym"), [TrainerType.DRAYDEN]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["DRAYDEN"], true, PokemonType.DRAGON) + .initForGymLeader(signatureSpecies["DRAYDEN"], true, PokemonType.DRAGON, false, -1) .setMixedBattleBgm("battle_unova_gym"), [TrainerType.MARLON]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["MARLON"], true, PokemonType.WATER) + .initForGymLeader(signatureSpecies["MARLON"], true, PokemonType.WATER, false, -1) .setMixedBattleBgm("battle_unova_gym"), [TrainerType.VIOLA]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["VIOLA"], false, PokemonType.BUG) + .initForGymLeader(signatureSpecies["VIOLA"], false, PokemonType.BUG, false, -1) .setMixedBattleBgm("battle_kalos_gym"), [TrainerType.GRANT]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["GRANT"], true, PokemonType.ROCK) + .initForGymLeader(signatureSpecies["GRANT"], true, PokemonType.ROCK, false, -1) .setMixedBattleBgm("battle_kalos_gym"), [TrainerType.KORRINA]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["KORRINA"], false, PokemonType.FIGHTING) + .initForGymLeader(signatureSpecies["KORRINA"], false, PokemonType.FIGHTING, false, -1) .setMixedBattleBgm("battle_kalos_gym"), [TrainerType.RAMOS]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["RAMOS"], true, PokemonType.GRASS) + .initForGymLeader(signatureSpecies["RAMOS"], true, PokemonType.GRASS, false, -1) .setMixedBattleBgm("battle_kalos_gym"), [TrainerType.CLEMONT]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["CLEMONT"], true, PokemonType.ELECTRIC) + .initForGymLeader(signatureSpecies["CLEMONT"], true, PokemonType.ELECTRIC, false, -1) .setMixedBattleBgm("battle_kalos_gym"), [TrainerType.VALERIE]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["VALERIE"], false, PokemonType.FAIRY) + .initForGymLeader(signatureSpecies["VALERIE"], false, PokemonType.FAIRY, false, -1) .setMixedBattleBgm("battle_kalos_gym"), [TrainerType.OLYMPIA]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["OLYMPIA"], false, PokemonType.PSYCHIC) + .initForGymLeader(signatureSpecies["OLYMPIA"], false, PokemonType.PSYCHIC, false, -1) .setMixedBattleBgm("battle_kalos_gym"), [TrainerType.WULFRIC]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["WULFRIC"], true, PokemonType.ICE) + .initForGymLeader(signatureSpecies["WULFRIC"], true, PokemonType.ICE, false, -1) .setMixedBattleBgm("battle_kalos_gym"), [TrainerType.MILO]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["MILO"], true, PokemonType.GRASS) + .initForGymLeader(signatureSpecies["MILO"], true, PokemonType.GRASS, false, -1) .setMixedBattleBgm("battle_galar_gym"), [TrainerType.NESSA]: new TrainerConfig(++t) .setName("Nessa") - .initForGymLeader(signatureSpecies["NESSA"], false, PokemonType.WATER) + .initForGymLeader(signatureSpecies["NESSA"], false, PokemonType.WATER, false, -1) .setMixedBattleBgm("battle_galar_gym"), [TrainerType.KABU]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["KABU"], true, PokemonType.FIRE) + .initForGymLeader(signatureSpecies["KABU"], true, PokemonType.FIRE, false, -1) .setMixedBattleBgm("battle_galar_gym"), [TrainerType.BEA]: new TrainerConfig(++t) .setName("Bea") - .initForGymLeader(signatureSpecies["BEA"], false, PokemonType.FIGHTING) + .initForGymLeader(signatureSpecies["BEA"], false, PokemonType.FIGHTING, false, -1) .setMixedBattleBgm("battle_galar_gym"), [TrainerType.ALLISTER]: new TrainerConfig(++t) .setName("Allister") - .initForGymLeader(signatureSpecies["ALLISTER"], true, PokemonType.GHOST) + .initForGymLeader(signatureSpecies["ALLISTER"], true, PokemonType.GHOST, false, -1) .setMixedBattleBgm("battle_galar_gym"), [TrainerType.OPAL]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["OPAL"], false, PokemonType.FAIRY) + .initForGymLeader(signatureSpecies["OPAL"], false, PokemonType.FAIRY, false, -1) .setMixedBattleBgm("battle_galar_gym"), [TrainerType.BEDE]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["BEDE"], true, PokemonType.FAIRY) + .initForGymLeader(signatureSpecies["BEDE"], true, PokemonType.FAIRY, false, -1) .setMixedBattleBgm("battle_galar_gym"), [TrainerType.GORDIE]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["GORDIE"], true, PokemonType.ROCK) + .initForGymLeader(signatureSpecies["GORDIE"], true, PokemonType.ROCK, false, -1) .setMixedBattleBgm("battle_galar_gym"), [TrainerType.MELONY]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["MELONY"], false, PokemonType.ICE) + .initForGymLeader(signatureSpecies["MELONY"], false, PokemonType.ICE, false, -1) .setMixedBattleBgm("battle_galar_gym"), [TrainerType.PIERS]: new TrainerConfig(++t) - .initForGymLeader(signatureSpecies["PIERS"], true, PokemonType.DARK) + .initForGymLeader(signatureSpecies["PIERS"], true, PokemonType.DARK, false, -3) .setHasDouble("piers_marnie_double") .setDoubleTrainerType(TrainerType.MARNIE) .setDoubleTitle("gym_leader_double") .setMixedBattleBgm("battle_galar_gym"), [TrainerType.MARNIE]: new TrainerConfig(++t) .setName("Marnie") - .initForGymLeader(signatureSpecies["MARNIE"], false, PokemonType.DARK) + .initForGymLeader(signatureSpecies["MARNIE"], false, PokemonType.DARK, false, -4) .setHasDouble("marnie_piers_double") .setDoubleTrainerType(TrainerType.PIERS) .setDoubleTitle("gym_leader_double") .setMixedBattleBgm("battle_galar_gym"), [TrainerType.RAIHAN]: new TrainerConfig(++t) .setName("Raihan") - .initForGymLeader(signatureSpecies["RAIHAN"], true, PokemonType.DRAGON) + .initForGymLeader(signatureSpecies["RAIHAN"], true, PokemonType.DRAGON, false, -1) .setMixedBattleBgm("battle_galar_gym"), [TrainerType.KATY]: new TrainerConfig(++t) .initForGymLeader(signatureSpecies["KATY"], false, PokemonType.BUG, true, -1) From 2cf0b51299ef78f1313410441d1ffd6458552813 Mon Sep 17 00:00:00 2001 From: Dean <69436131+emdeann@users.noreply.github.com> Date: Sun, 20 Apr 2025 11:14:19 -0700 Subject: [PATCH 16/18] [Bug] Properly handle suppression with Illusion (#5671) * Remove extra attributes on neutralizing gas * Add IllusionBreakAbAttr to applyOnLose * Add test case --- src/data/abilities/ability.ts | 45 ++++++++++++++++++--------------- test/abilities/illusion.test.ts | 14 ++++++++++ 2 files changed, 39 insertions(+), 20 deletions(-) diff --git a/src/data/abilities/ability.ts b/src/data/abilities/ability.ts index 55a1a4eb902..27c3cb69073 100644 --- a/src/data/abilities/ability.ts +++ b/src/data/abilities/ability.ts @@ -2219,18 +2219,6 @@ export class PostSummonMessageAbAttr extends PostSummonAbAttr { } } -/** - * Removes illusions when a Pokemon is summoned. - */ -export class PostSummonRemoveIllusionAbAttr extends PostSummonAbAttr { - applyPostSummon(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean { - for (const pokemon of globalScene.getField(true)) { - pokemon.breakIllusion(); - } - return true; - } -} - export class PostSummonUnnamedMessageAbAttr extends PostSummonAbAttr { //Attr doesn't force pokemon name on the message private message: string; @@ -5177,7 +5165,14 @@ export class IllusionPreSummonAbAttr extends PreSummonAbAttr { } } -export class IllusionBreakAbAttr extends PostDefendAbAttr { +export class IllusionBreakAbAttr extends AbAttr { + override apply(pokemon: Pokemon, _passive: boolean, _simulated: boolean, _cancelled: BooleanHolder | null, _args: any[]): void { + pokemon.breakIllusion(); + pokemon.summonData.illusionBroken = true; + } +} + +export class PostDefendIllusionBreakAbAttr extends PostDefendAbAttr { /** * Destroy the illusion upon taking damage * @@ -6269,7 +6264,7 @@ export function applyOnGainAbAttrs( } /** - * Clears primal weather/neutralizing gas during the turn if {@linkcode pokemon}'s ability corresponds to one + * Applies ability attributes which activate when the ability is lost or suppressed (i.e. primal weather) */ export function applyOnLoseAbAttrs(pokemon: Pokemon, passive = false, simulated = false, ...args: any[]): void { applySingleAbAttrs( @@ -6281,6 +6276,17 @@ export function applyOnLoseAbAttrs(pokemon: Pokemon, passive = false, simulated args, true, simulated); + + applySingleAbAttrs( + pokemon, + passive, + IllusionBreakAbAttr, + (attr, passive) => attr.apply(pokemon, passive, simulated, null, args), + (attr, passive) => attr.canApply(pokemon, passive, simulated, args), + args, + true, + simulated + ) } /** @@ -6780,11 +6786,12 @@ export function initAbilities() { return isNullOrUndefined(movePhase); }, 1.3), new Ability(Abilities.ILLUSION, 5) - //The pokemon generate an illusion if it's available + // The Pokemon generate an illusion if it's available .attr(IllusionPreSummonAbAttr, false) - //The pokemon loses his illusion when he is damaged by a move - .attr(IllusionBreakAbAttr, true) - //Illusion is available again after a battle + .attr(IllusionBreakAbAttr) + // The Pokemon loses its illusion when damaged by a move + .attr(PostDefendIllusionBreakAbAttr, true) + // Illusion is available again after a battle .conditionalAttr((pokemon) => pokemon.isAllowedInBattle(), IllusionPostBattleAbAttr, false) .uncopiable() .bypassFaint(), @@ -7198,8 +7205,6 @@ export function initAbilities() { .attr(PreLeaveFieldRemoveSuppressAbilitiesSourceAbAttr) .uncopiable() .attr(NoTransformAbilityAbAttr) - .attr(PostSummonMessageAbAttr, (pokemon: Pokemon) => i18next.t("abilityTriggers:postSummonNeutralizingGas", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) })) - .attr(PostSummonRemoveIllusionAbAttr) .bypassFaint(), new Ability(Abilities.PASTEL_VEIL, 8) .attr(PostSummonUserFieldRemoveStatusEffectAbAttr, StatusEffect.POISON, StatusEffect.TOXIC) diff --git a/test/abilities/illusion.test.ts b/test/abilities/illusion.test.ts index 382d7d74a08..b7c116a1b67 100644 --- a/test/abilities/illusion.test.ts +++ b/test/abilities/illusion.test.ts @@ -142,4 +142,18 @@ describe("Abilities - Illusion", () => { expect(zoroark.isShiny(true)).equals(true); expect(zoroark.getPokeball(true)).equals(PokeballType.GREAT_BALL); }); + + it("breaks when suppressed", async () => { + game.override.moveset(Moves.GASTRO_ACID); + await game.classicMode.startBattle([Species.MAGIKARP]); + const zorua = game.scene.getEnemyPokemon()!; + + expect(!!zorua.summonData?.illusion).toBe(true); + + game.move.select(Moves.GASTRO_ACID); + await game.phaseInterceptor.to(BerryPhase); + + expect(zorua.isFullHp()).toBe(true); + expect(!!zorua.summonData?.illusion).toBe(false); + }); }); From d0be6a9274862456ca806e0869833a45d9fe21b6 Mon Sep 17 00:00:00 2001 From: zaccie Date: Mon, 21 Apr 2025 06:33:17 +1200 Subject: [PATCH 17/18] [Bug] Fix order of operations when displaying enemy Boss level (#5685) * order of operations in creating boss battleInfo fixed a bug where because of an order of operations error in this file it ignored the position update of the boss life value set in battle-info.ts (around line 562) --- src/field/pokemon.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index f2e5fd4c2b6..6356f723a79 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -7162,8 +7162,8 @@ export class EnemyPokemon extends Pokemon { initBattleInfo(): void { if (!this.battleInfo) { this.battleInfo = new EnemyBattleInfo(); - this.battleInfo.updateBossSegments(this); this.battleInfo.initInfo(this); + this.battleInfo.updateBossSegments(this); } else { this.battleInfo.updateBossSegments(this); } From b89b945b11ce8891b28f595cc7ab70266e08cb37 Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Sun, 20 Apr 2025 11:51:06 -0700 Subject: [PATCH 18/18] [Dev] Fix imports in `overrides.ts` and `illusion.test.ts` (#5686) --- src/overrides.ts | 8 ++++---- test/abilities/illusion.test.ts | 26 ++++++++++++-------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/overrides.ts b/src/overrides.ts index d36cfbfac98..7e6a46f2f85 100644 --- a/src/overrides.ts +++ b/src/overrides.ts @@ -2,10 +2,11 @@ import { type PokeballCounts } from "#app/battle-scene"; import { EvolutionItem } from "#app/data/balance/pokemon-evolutions"; import { Gender } from "#app/data/gender"; import { FormChangeItem } from "#app/data/pokemon-forms"; -import { Variant } from "#app/sprites/variant"; import { type ModifierOverride } from "#app/modifier/modifier-type"; +import { Variant } from "#app/sprites/variant"; import { Unlockables } from "#app/system/unlockables"; import { Abilities } from "#enums/abilities"; +import { BattleType } from "#enums/battle-type"; import { BerryType } from "#enums/berry-type"; import { Biome } from "#enums/biome"; import { EggTier } from "#enums/egg-type"; @@ -15,13 +16,12 @@ import { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { PokeballType } from "#enums/pokeball"; import { PokemonType } from "#enums/pokemon-type"; import { Species } from "#enums/species"; -import { BATTLE_STATS, Stat } from "#enums/stat"; +import { Stat } from "#enums/stat"; import { StatusEffect } from "#enums/status-effect"; import { TimeOfDay } from "#enums/time-of-day"; +import { TrainerType } from "#enums/trainer-type"; import { VariantTier } from "#enums/variant-tier"; import { WeatherType } from "#enums/weather-type"; -import { TrainerType } from "#enums/trainer-type"; -import { BattleType } from "#enums/battle-type"; /** * This comment block exists to prevent IDEs from automatically removing unused imports diff --git a/test/abilities/illusion.test.ts b/test/abilities/illusion.test.ts index b7c116a1b67..c743a59ef00 100644 --- a/test/abilities/illusion.test.ts +++ b/test/abilities/illusion.test.ts @@ -1,13 +1,11 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; -import Phaser from "phaser"; -import GameManager from "#test/testUtils/gameManager"; -import { Species } from "#enums/species"; -import { TurnEndPhase } from "#app/phases/turn-end-phase"; -import { Moves } from "#enums/moves"; -import { Abilities } from "#enums/abilities"; -import { PokeballType } from "#app/enums/pokeball"; import { Gender } from "#app/data/gender"; -import { BerryPhase } from "#app/phases/berry-phase"; +import { PokeballType } from "#app/enums/pokeball"; +import { Abilities } from "#enums/abilities"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; +import GameManager from "#test/testUtils/gameManager"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; describe("Abilities - Illusion", () => { let phaserGame: Phaser.Game; @@ -48,7 +46,7 @@ describe("Abilities - Illusion", () => { await game.classicMode.startBattle([Species.AXEW]); game.move.select(Moves.TACKLE); - await game.phaseInterceptor.to(TurnEndPhase); + await game.phaseInterceptor.to("TurnEndPhase"); const zorua = game.scene.getEnemyPokemon()!; @@ -60,7 +58,7 @@ describe("Abilities - Illusion", () => { await game.classicMode.startBattle([Species.AXEW]); game.move.select(Moves.WORRY_SEED); - await game.phaseInterceptor.to(TurnEndPhase); + await game.phaseInterceptor.to("TurnEndPhase"); const zorua = game.scene.getEnemyPokemon()!; @@ -114,7 +112,7 @@ describe("Abilities - Illusion", () => { game.move.select(Moves.FLARE_BLITZ); - await game.phaseInterceptor.to(TurnEndPhase); + await game.phaseInterceptor.to("TurnEndPhase"); const zoroark = game.scene.getPlayerPokemon()!; @@ -132,7 +130,7 @@ describe("Abilities - Illusion", () => { game.doSwitchPokemon(1); - await game.phaseInterceptor.to(TurnEndPhase); + await game.phaseInterceptor.to("TurnEndPhase"); const zoroark = game.scene.getPlayerPokemon()!; @@ -151,7 +149,7 @@ describe("Abilities - Illusion", () => { expect(!!zorua.summonData?.illusion).toBe(true); game.move.select(Moves.GASTRO_ACID); - await game.phaseInterceptor.to(BerryPhase); + await game.phaseInterceptor.to("BerryPhase"); expect(zorua.isFullHp()).toBe(true); expect(!!zorua.summonData?.illusion).toBe(false);