[Biome] Add "no unused imports" rule (#5580)

* Apply Biome to files

* Add `lint/correctness/noUnusedImports` rule

* Apply rule

* Remove obsolete eslint directives

* Fix variable naming in `game-speed.ts`
This commit is contained in:
NightKev 2025-03-29 03:24:23 -07:00 committed by GitHub
parent a727375730
commit 25b9fa7933
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
30 changed files with 79 additions and 117 deletions

View File

@ -50,7 +50,8 @@
"noUndeclaredVariables": "off",
"noUnusedVariables": "error",
"noSwitchDeclarations": "warn", // TODO: refactor and make this an error
"noVoidTypeReturn": "warn" // TODO: Refactor and make this an error
"noVoidTypeReturn": "warn", // TODO: Refactor and make this an error
"noUnusedImports": "error"
},
"style": {
"noVar": "error",

View File

@ -30,7 +30,6 @@ import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode
import { modifierTypes } from "#app/modifier/modifier-type";
import { PokemonType } from "#enums/pokemon-type";
import { getPokeballTintColor } from "#app/data/pokeball";
import type { PokemonHeldItemModifier } from "#app/modifier/modifier";
/** the i18n namespace for the encounter */
const namespace = "mysteryEncounters/theExpertPokemonBreeder";

View File

@ -332,7 +332,6 @@ export function initMysteryEncounters() {
});
// Add ANY biome encounters to biome map
// eslint-disable-next-line
let _encounterBiomeTableLog = "";
mysteryEncountersByBiome.forEach((biomeEncounters, biome) => {
anyBiomeEncounters.forEach(encounter => {

View File

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

View File

@ -214,7 +214,7 @@ const commonSplashMessages = [
"bornToBeAWinner",
"onARollout",
"itsAlwaysNightDeepInTheAbyss",
"folksThisIsInsane"
"folksThisIsInsane",
];
//#region Seasonal Messages
@ -224,10 +224,7 @@ const seasonalSplashMessages: Season[] = [
name: "New Year's",
start: "01-01",
end: "01-15",
messages: [
"newYears.happyNewYear",
"newYears.andAHappyNewYear"
],
messages: ["newYears.happyNewYear", "newYears.andAHappyNewYear"],
},
{
name: "Valentines",
@ -239,7 +236,7 @@ const seasonalSplashMessages: Season[] = [
"valentines.applinForYou",
"valentines.thePowerOfLoveIsThreeThirtyBST",
"valentines.haveAHeartScale",
"valentines.i<3You"
"valentines.i<3You",
],
},
{
@ -279,7 +276,7 @@ const seasonalSplashMessages: Season[] = [
"aprilFools.nowWithQuickTimeEncounters",
"aprilFools.timeYourInputsForHigherCatchrate",
"aprilFools.certifiedButtonSimulator",
"aprilFools.iHopeYouGetSuckerPunched"
"aprilFools.iHopeYouGetSuckerPunched",
],
},
{
@ -293,7 +290,7 @@ const seasonalSplashMessages: Season[] = [
"halloween.mayContainSpiders",
"halloween.spookyScarySkeledirge",
"halloween.gourgeistUsedTrickOrTreat",
"halloween.letsSnuggleForever"
"halloween.letsSnuggleForever",
],
},
{
@ -316,7 +313,7 @@ const seasonalSplashMessages: Season[] = [
"winterHoliday.tisTheSeasonToBeSpeSpa",
"winterHoliday.deckTheHalls",
"winterHoliday.saveScummingGetsYouOnTheNaughtyList",
"winterHoliday.badTrainersGetRolycoly"
"winterHoliday.badTrainersGetRolycoly",
],
},
];

View File

@ -1,5 +1,4 @@
import { globalScene } from "#app/global-scene";
import type { ModifierTypeFunc } from "#app/modifier/modifier-type";
import { Mode } from "#app/ui/ui";
import i18next from "i18next";
import { ModifierRewardPhase } from "./modifier-reward-phase";

View File

@ -29,7 +29,7 @@ export class MessagePhase extends Phase {
if (this.text.indexOf("$") > -1) {
const pokename: string[] = [];
const repname = [ "#POKEMON1", "#POKEMON2" ];
const repname = ["#POKEMON1", "#POKEMON2"];
for (let p = 0; p < globalScene.getPlayerField().length; p++) {
pokename.push(globalScene.getPlayerField()[p].getNameToRender());
this.text = this.text.split(pokename[p]).join(repname[p]);

View File

@ -1,5 +1,4 @@
import { globalScene } from "#app/global-scene";
import type { BattlerIndex } from "#app/battle";
import { BattlerTagLapseType } from "#app/data/battler-tags";
import { PokemonPhase } from "./pokemon-phase";

View File

@ -1,5 +1,4 @@
import { globalScene } from "#app/global-scene";
import type { BattlerIndex } from "#app/battle";
import { applyAbAttrs, applyPostSummonAbAttrs, CommanderAbAttr, PostSummonAbAttr } from "#app/data/ability";
import { ArenaTrapTag } from "#app/data/arena-tag";
import { StatusEffect } from "#app/enums/status-effect";

View File

@ -5,8 +5,8 @@ import type BattleScene from "#app/battle-scene";
import { globalScene } from "#app/global-scene";
import * as Utils from "../utils";
type FadeIn = typeof FadeIn;
type FadeOut = typeof FadeOut;
type FadeInType = typeof FadeIn;
type FadeOutType = typeof FadeOut;
export function initGameSpeed() {
const thisArg = this as BattleScene;
@ -101,7 +101,7 @@ export function initGameSpeed() {
const originalFadeOut = SoundFade.fadeOut;
SoundFade.fadeOut = ((_scene: Phaser.Scene, sound: Phaser.Sound.BaseSound, duration: number, destroy?: boolean) =>
originalFadeOut(globalScene, sound, transformValue(duration), destroy)) as FadeOut;
originalFadeOut(globalScene, sound, transformValue(duration), destroy)) as FadeOutType;
const originalFadeIn = SoundFade.fadeIn;
SoundFade.fadeIn = ((
@ -110,5 +110,5 @@ export function initGameSpeed() {
duration: number,
endVolume?: number,
startVolume?: number,
) => originalFadeIn(globalScene, sound, transformValue(duration), endVolume, startVolume)) as FadeIn;
) => originalFadeIn(globalScene, sound, transformValue(duration), endVolume, startVolume)) as FadeInType;
}

View File

@ -14,7 +14,6 @@ import { Moves } from "#enums/moves";
import type { Species } from "#enums/species";
import { CustomPokemonData } from "#app/data/custom-pokemon-data";
import type { PokemonType } from "#enums/pokemon-type";
import { getSpeciesFormChangeMessage } from "#app/data/pokemon-forms";
export default class PokemonData {
public id: number;

View File

@ -950,7 +950,7 @@ export function setSetting(setting: string, value: number): boolean {
},
{
label: "Català",
handler: () => changeLocaleHandler("ca-ES")
handler: () => changeLocaleHandler("ca-ES"),
},
{
label: i18next.t("settings:back"),

View File

@ -77,7 +77,7 @@ export default abstract class MessageUiHandler extends AwaitableUiHandler {
const actionPattern = /@(c|d|s|f)\{(.*?)\}/;
let actionMatch: RegExpExecArray | null;
const pokename: string[] = [];
const repname = [ "#POKEMON1", "#POKEMON2" ];
const repname = ["#POKEMON1", "#POKEMON2"];
for (let p = 0; p < globalScene.getPlayerField().length; p++) {
pokename.push(globalScene.getPlayerField()[p].getNameToRender());
text = text.split(pokename[p]).join(repname[p]);

View File

@ -1150,15 +1150,14 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
});
this.blockInput = false;
} else {
ui.revertMode()
.then(() => {
console.log("exitCallback", this.exitCallback);
if (this.exitCallback instanceof Function) {
const exitCallback = this.exitCallback;
this.exitCallback = null;
exitCallback();
}
});
ui.revertMode().then(() => {
console.log("exitCallback", this.exitCallback);
if (this.exitCallback instanceof Function) {
const exitCallback = this.exitCallback;
this.exitCallback = null;
exitCallback();
}
});
success = true;
}
} else {

View File

@ -12,7 +12,7 @@ import { getStarterValueFriendshipCap, speciesStarterCosts, POKERUS_STARTER_COUN
import { catchableSpecies } from "#app/data/balance/biomes";
import { PokemonType } from "#enums/pokemon-type";
import type { DexAttrProps, DexEntry, StarterAttributes, StarterPreferences } from "#app/system/game-data";
import { AbilityAttr, DexAttr, loadStarterPreferences, saveStarterPreferences } from "#app/system/game-data";
import { AbilityAttr, DexAttr, loadStarterPreferences } from "#app/system/game-data";
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";

View File

@ -1,6 +1,6 @@
import type { CandyUpgradeNotificationChangedEvent } from "#app/events/battle-scene";
import { BattleSceneEventType } from "#app/events/battle-scene";
import { pokemonEvolutions, pokemonPrevolutions } from "#app/data/balance/pokemon-evolutions";
import { pokemonPrevolutions } from "#app/data/balance/pokemon-evolutions";
import type { Variant } from "#app/data/variant";
import { getVariantTint, getVariantIcon } from "#app/data/variant";
import { argbFromRgba } from "@material/material-color-utilities";
@ -19,7 +19,7 @@ import { pokemonFormChanges } from "#app/data/pokemon-forms";
import type { LevelMoves } from "#app/data/balance/pokemon-level-moves";
import { pokemonFormLevelMoves, pokemonSpeciesLevelMoves } from "#app/data/balance/pokemon-level-moves";
import type PokemonSpecies from "#app/data/pokemon-species";
import { allSpecies, getPokemonSpecies, getPokemonSpeciesForm, getPokerusStarters } from "#app/data/pokemon-species";
import { allSpecies, getPokemonSpeciesForm, getPokerusStarters } from "#app/data/pokemon-species";
import { getStarterValueFriendshipCap, speciesStarterCosts, POKERUS_STARTER_COUNT } from "#app/data/balance/starters";
import { PokemonType } from "#enums/pokemon-type";
import { GameModes } from "#app/game-mode";

View File

@ -329,7 +329,7 @@ export default class UI extends Phaser.GameObjects.Container {
promptDelay?: number | null,
): void {
const pokename: string[] = [];
const repname = [ "#POKEMON1", "#POKEMON2" ];
const repname = ["#POKEMON1", "#POKEMON2"];
for (let p = 0; p < globalScene.getPlayerField().length; p++) {
pokename.push(globalScene.getPlayerField()[p].getNameToRender());
text = text.split(pokename[p]).join(repname[p]);

View File

@ -135,10 +135,8 @@ describe("Abilities - Desolate Land", () => {
});
it("should lift after fleeing from a wild pokemon", async () => {
game.override
.enemyAbility(Abilities.DESOLATE_LAND)
.ability(Abilities.BALL_FETCH);
await game.classicMode.startBattle([ Species.MAGIKARP ]);
game.override.enemyAbility(Abilities.DESOLATE_LAND).ability(Abilities.BALL_FETCH);
await game.classicMode.startBattle([Species.MAGIKARP]);
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.HARSH_SUN);
vi.spyOn(game.scene.getPlayerPokemon()!, "randSeedInt").mockReturnValue(0);

View File

@ -40,17 +40,23 @@ describe("Abilities - Flower Gift", () => {
*
* @returns Two numbers, the first being the damage done to the target without flower gift active, the second being the damage done with flower gift active
*/
const testDamageDealt = async (game: GameManager, move: Moves, allyAttacker: boolean, allyAbility = Abilities.BALL_FETCH, enemyAbility = Abilities.BALL_FETCH): Promise<[number, number]> => {
const testDamageDealt = async (
game: GameManager,
move: Moves,
allyAttacker: boolean,
allyAbility = Abilities.BALL_FETCH,
enemyAbility = Abilities.BALL_FETCH,
): Promise<[number, number]> => {
game.override.battleType("double");
game.override.moveset([ Moves.SPLASH, Moves.SUNNY_DAY, move, Moves.HEAL_PULSE ]);
game.override.enemyMoveset([ Moves.SPLASH, Moves.HEAL_PULSE ]);
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;
const attacker_index = allyAttacker ? BattlerIndex.PLAYER_2 : BattlerIndex.ENEMY;
const ally_move = allyAttacker ? move : Moves.SPLASH;
const enemy_move = allyAttacker ? Moves.SPLASH : move;
const ally_target = allyAttacker ? BattlerIndex.ENEMY : null;
await game.classicMode.startBattle([ Species.CHERRIM, Species.MAGIKARP ]);
await game.classicMode.startBattle([Species.CHERRIM, Species.MAGIKARP]);
const target = allyAttacker ? game.scene.getEnemyField()[0] : game.scene.getPlayerField()[1];
const initialHp = target.getMaxHp();
@ -64,7 +70,7 @@ describe("Abilities - Flower Gift", () => {
await game.forceEnemyMove(enemy_move, BattlerIndex.PLAYER_2);
await game.forceEnemyMove(Moves.SPLASH);
// Ensure sunny day is used last.
await game.setTurnOrder([ attacker_index, target_index, BattlerIndex.ENEMY_2, BattlerIndex.PLAYER ]);
await game.setTurnOrder([attacker_index, target_index, BattlerIndex.ENEMY_2, BattlerIndex.PLAYER]);
await game.phaseInterceptor.to(TurnEndPhase);
const damageWithoutGift = initialHp - target.hp;
@ -75,14 +81,13 @@ describe("Abilities - Flower Gift", () => {
game.move.select(ally_move, 1, ally_target);
await game.forceEnemyMove(enemy_move, BattlerIndex.PLAYER_2);
await game.forceEnemyMove(Moves.SPLASH);
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY_2, target_index, attacker_index ]);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY_2, target_index, attacker_index]);
await game.phaseInterceptor.to(TurnEndPhase);
const damageWithGift = initialHp - target.hp;
return [ damageWithoutGift, damageWithGift ];
return [damageWithoutGift, damageWithGift];
};
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
@ -129,22 +134,28 @@ describe("Abilities - Flower Gift", () => {
});
it("should not increase the damage of an ally using an ability ignoring move", async () => {
const [ damageWithGift, damageWithoutGift ] = await testDamageDealt(game, Moves.SUNSTEEL_STRIKE, true);
const [damageWithGift, damageWithoutGift] = await testDamageDealt(game, Moves.SUNSTEEL_STRIKE, true);
expect(damageWithGift).toBe(damageWithoutGift);
});
it("should not increase the damage of a mold breaker ally", async () => {
const [ damageWithGift, damageWithoutGift ] = await testDamageDealt(game, Moves.TACKLE, true, Abilities.MOLD_BREAKER);
const [damageWithGift, damageWithoutGift] = await testDamageDealt(game, Moves.TACKLE, true, Abilities.MOLD_BREAKER);
expect(damageWithGift).toBe(damageWithoutGift);
});
it("should decrease the damage an ally takes from a special attack", async () => {
const [ damageWithoutGift, damageWithGift ] = await testDamageDealt(game, Moves.MUD_SLAP, false);
const [damageWithoutGift, damageWithGift] = await testDamageDealt(game, Moves.MUD_SLAP, false);
expect(damageWithGift).toBeLessThan(damageWithoutGift);
});
it("should not decrease the damage an ally takes from a mold breaker enemy using a special attack", async () => {
const [ damageWithoutGift, damageWithGift ] = await testDamageDealt(game, Moves.MUD_SLAP, false, Abilities.BALL_FETCH, Abilities.MOLD_BREAKER);
it("should not decrease the damage an ally takes from a mold breaker enemy using a special attack", async () => {
const [damageWithoutGift, damageWithGift] = await testDamageDealt(
game,
Moves.MUD_SLAP,
false,
Abilities.BALL_FETCH,
Abilities.MOLD_BREAKER,
);
expect(damageWithGift).toBe(damageWithoutGift);
});
@ -168,7 +179,7 @@ describe("Abilities - Flower Gift", () => {
it("reverts to Overcast Form when the Pokémon loses Flower Gift, changes form under Harsh Sunlight/Sunny when it regains it", async () => {
game.override.enemyMoveset([Moves.SKILL_SWAP]).weather(WeatherType.HARSH_SUN);
game.override.moveset([ Moves.SKILL_SWAP ]);
game.override.moveset([Moves.SKILL_SWAP]);
await game.classicMode.startBattle([Species.CHERRIM]);

View File

@ -160,10 +160,8 @@ describe("Abilities - Neutralizing Gas", () => {
});
it("should deactivate after fleeing from a wild pokemon", async () => {
game.override
.enemyAbility(Abilities.NEUTRALIZING_GAS)
.ability(Abilities.BALL_FETCH);
await game.classicMode.startBattle([ Species.MAGIKARP ]);
game.override.enemyAbility(Abilities.NEUTRALIZING_GAS).ability(Abilities.BALL_FETCH);
await game.classicMode.startBattle([Species.MAGIKARP]);
expect(game.scene.arena.getTag(ArenaTagType.NEUTRALIZING_GAS)).toBeDefined();
vi.spyOn(game.scene.getPlayerPokemon()!, "randSeedInt").mockReturnValue(0);

View File

@ -24,7 +24,7 @@ describe("Abilities - Victory Star", () => {
beforeEach(() => {
game = new GameManager(phaserGame);
game.override
.moveset([ Moves.TACKLE, Moves.SPLASH ])
.moveset([Moves.TACKLE, Moves.SPLASH])
.battleType("double")
.disableCrits()
.enemySpecies(Species.MAGIKARP)
@ -33,7 +33,7 @@ describe("Abilities - Victory Star", () => {
});
it("should increase the accuracy of its user", async () => {
await game.classicMode.startBattle([ Species.VICTINI, Species.MAGIKARP ]);
await game.classicMode.startBattle([Species.VICTINI, Species.MAGIKARP]);
const user = game.scene.getPlayerField()[0];
@ -46,7 +46,7 @@ describe("Abilities - Victory Star", () => {
});
it("should increase the accuracy of its user's ally", async () => {
await game.classicMode.startBattle([ Species.MAGIKARP, Species.VICTINI ]);
await game.classicMode.startBattle([Species.MAGIKARP, Species.VICTINI]);
const ally = game.scene.getPlayerField()[0];
vi.spyOn(ally, "getAccuracyMultiplier");

View File

@ -1,4 +1,3 @@
import { allAbilities } from "#app/data/ability";
import { allMoves } from "#app/data/moves/move";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import { Abilities } from "#enums/abilities";

View File

@ -9,7 +9,7 @@ describe("Data - Splash Messages", () => {
// Make sure to adjust this test if the weight is changed!
it("should add contain 15 `battlesWon` splash messages", () => {
const battlesWonMessages = getSplashMessages().filter((message) => message === "splashMessages:battlesWon");
const battlesWonMessages = getSplashMessages().filter(message => message === "splashMessages:battlesWon");
expect(battlesWonMessages).toHaveLength(15);
});

View File

@ -26,7 +26,7 @@ describe("Items - Reviver Seed", () => {
beforeEach(() => {
game = new GameManager(phaserGame);
game.override
.moveset([ Moves.SPLASH, Moves.TACKLE, Moves.ENDURE ])
.moveset([Moves.SPLASH, Moves.TACKLE, Moves.ENDURE])
.ability(Abilities.BALL_FETCH)
.battleType("single")
.disableCrits()
@ -47,13 +47,10 @@ describe("Items - Reviver Seed", () => {
{ moveType: "Fixed Damage Move", move: Moves.SEISMIC_TOSS },
{ moveType: "Final Gambit", move: Moves.FINAL_GAMBIT },
{ moveType: "Counter", move: Moves.COUNTER },
{ moveType: "OHKO", move: Moves.SHEER_COLD }
{ moveType: "OHKO", move: Moves.SHEER_COLD },
])("should activate the holder's reviver seed from a $moveType", async ({ move }) => {
game.override
.enemyLevel(100)
.startingLevel(1)
.enemyMoveset(move);
await game.classicMode.startBattle([ Species.MAGIKARP, Species.FEEBAS ]);
game.override.enemyLevel(100).startingLevel(1).enemyMoveset(move);
await game.classicMode.startBattle([Species.MAGIKARP, Species.FEEBAS]);
const player = game.scene.getPlayerPokemon()!;
player.damageAndUpdate(player.hp - 1);
@ -67,11 +64,8 @@ describe("Items - Reviver Seed", () => {
});
it("should activate the holder's reviver seed from confusion self-hit", async () => {
game.override
.enemyLevel(1)
.startingLevel(100)
.enemyMoveset(Moves.SPLASH);
await game.classicMode.startBattle([ Species.MAGIKARP, Species.FEEBAS ]);
game.override.enemyLevel(1).startingLevel(100).enemyMoveset(Moves.SPLASH);
await game.classicMode.startBattle([Species.MAGIKARP, Species.FEEBAS]);
const player = game.scene.getPlayerPokemon()!;
player.damageAndUpdate(player.hp - 1);
player.addTag(BattlerTagType.CONFUSED, 3);
@ -100,7 +94,7 @@ describe("Items - Reviver Seed", () => {
.enemySpecies(Species.MAGIKARP)
.moveset(move)
.enemyMoveset(Moves.ENDURE);
await game.classicMode.startBattle([ Species.MAGIKARP, Species.FEEBAS ]);
await game.classicMode.startBattle([Species.MAGIKARP, Species.FEEBAS]);
const enemy = game.scene.getEnemyPokemon()!;
enemy.damageAndUpdate(enemy.hp - 1);
@ -124,7 +118,7 @@ describe("Items - Reviver Seed", () => {
.moveset(move)
.enemyAbility(Abilities.LIQUID_OOZE)
.enemyMoveset(Moves.SPLASH);
await game.classicMode.startBattle([ Species.GASTLY, Species.FEEBAS ]);
await game.classicMode.startBattle([Species.GASTLY, Species.FEEBAS]);
const player = game.scene.getPlayerPokemon()!;
player.damageAndUpdate(player.hp - 1);
@ -145,13 +139,13 @@ describe("Items - Reviver Seed", () => {
.moveset(Moves.DESTINY_BOND)
.startingHeldItems([]) // reset held items to nothing so user doesn't revive and not trigger Destiny Bond
.enemyMoveset(Moves.TACKLE);
await game.classicMode.startBattle([ Species.MAGIKARP, Species.FEEBAS ]);
await game.classicMode.startBattle([Species.MAGIKARP, Species.FEEBAS]);
const player = game.scene.getPlayerPokemon()!;
player.damageAndUpdate(player.hp - 1);
const enemy = game.scene.getEnemyPokemon()!;
game.move.select(Moves.DESTINY_BOND);
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemy.isFainted()).toBeTruthy();

View File

@ -22,7 +22,7 @@ describe("Moves - Endure", () => {
beforeEach(() => {
game = new GameManager(phaserGame);
game.override
.moveset([ Moves.THUNDER, Moves.BULLET_SEED, Moves.TOXIC, Moves.SHEER_COLD ])
.moveset([Moves.THUNDER, Moves.BULLET_SEED, Moves.TOXIC, Moves.SHEER_COLD])
.ability(Abilities.SKILL_LINK)
.startingLevel(100)
.battleType("single")
@ -51,7 +51,7 @@ describe("Moves - Endure", () => {
});
it("should let the pokemon survive against OHKO moves", async () => {
await game.classicMode.startBattle([ Species.MAGIKARP ]);
await game.classicMode.startBattle([Species.MAGIKARP]);
const enemy = game.scene.getEnemyPokemon()!;
game.move.select(Moves.SHEER_COLD);
@ -74,7 +74,7 @@ describe("Moves - Endure", () => {
.enemySpecies(Species.MAGIKARP)
.moveset(move)
.enemyMoveset(Moves.ENDURE);
await game.classicMode.startBattle([ Species.MAGIKARP, Species.FEEBAS ]);
await game.classicMode.startBattle([Species.MAGIKARP, Species.FEEBAS]);
const enemy = game.scene.getEnemyPokemon()!;
enemy.damageAndUpdate(enemy.hp - 1);

View File

@ -116,12 +116,8 @@ 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
await game.classicMode.startBattle([ Species.ARCEUS, Species.GIRATINA ]);
game.override.battleType("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];

View File

@ -1,31 +1,25 @@
/* eslint-disable */
// @ts-nocheck
// @ts-nocheck - TODO: remove this
import BattleScene, * as battleScene from "#app/battle-scene";
import { MoveAnim } from "#app/data/battle-anims";
import Pokemon from "#app/field/pokemon";
import * as Utils from "#app/utils";
import { blobToString } from "#test/testUtils/gameManagerUtils";
import { MockClock } from "#test/testUtils/mocks/mockClock";
import { MockConsoleLog } from "#test/testUtils/mocks/mockConsoleLog";
import { MockFetch } from "#test/testUtils/mocks/mockFetch";
import MockLoader from "#test/testUtils/mocks/mockLoader";
import { mockLocalStorage } from "#test/testUtils/mocks/mockLocalStorage";
import { MockImage } from "#test/testUtils/mocks/mocksContainer/mockImage";
import MockTextureManager from "#test/testUtils/mocks/mockTextureManager";
import fs from "node:fs";
import Phaser from "phaser";
import InputText from "phaser3-rex-plugins/plugins/inputtext";
import BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext";
import { vi } from "vitest";
import { version } from "../../package.json";
import { MockGameObjectCreator } from "./mocks/mockGameObjectCreator";
import { MockTimedEventManager } from "./mocks/mockTimedEventManager";
import InputManager = Phaser.Input.InputManager;
import KeyboardManager = Phaser.Input.Keyboard.KeyboardManager;
import KeyboardPlugin = Phaser.Input.Keyboard.KeyboardPlugin;
import GamepadPlugin = Phaser.Input.Gamepad.GamepadPlugin;
import EventEmitter = Phaser.Events.EventEmitter;
import UpdateList = Phaser.GameObjects.UpdateList;
import { version } from "../../package.json";
import { MockTimedEventManager } from "./mocks/mockTimedEventManager";
window.URL.createObjectURL = (blob: Blob) => {
blobToString(blob).then((data: string) => {

View File

@ -1,9 +1,6 @@
import type { Variant } from "#app/data/variant";
import { Weather } from "#app/data/weather";
import { Abilities } from "#app/enums/abilities";
import * as GameMode from "#app/game-mode";
import type { GameModes } from "#app/game-mode";
import { getGameMode } from "#app/game-mode";
import type { ModifierOverride } from "#app/modifier/modifier-type";
import type { BattleStyle } from "#app/overrides";
import Overrides, { defaultOverrides } from "#app/overrides";

View File

@ -1,4 +1,3 @@
import { off } from "process";
import type { MockGameObject } from "../mockGameObject";
export default class MockRectangle implements MockGameObject {

View File

@ -1,17 +1,4 @@
import "vitest-canvas-mock";
import { initLoggedInUser } from "#app/account";
import { initAbilities } from "#app/data/ability";
import { initBiomes } from "#app/data/balance/biomes";
import { initEggMoves } from "#app/data/balance/egg-moves";
import { initPokemonPrevolutions } from "#app/data/balance/pokemon-evolutions";
import { initMoves } from "#app/data/moves/move";
import { initMysteryEncounters } from "#app/data/mystery-encounters/mystery-encounters";
import { initPokemonForms } from "#app/data/pokemon-forms";
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 { afterAll, beforeAll, vi } from "vitest";
import { initTestFile } from "./testUtils/testFileInitialization";
@ -20,13 +7,11 @@ import { initTestFile } from "./testUtils/testFileInitialization";
/** Mock the override import to always return default values, ignoring any custom overrides. */
vi.mock("#app/overrides", async importOriginal => {
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
const { defaultOverrides } = await importOriginal<typeof import("#app/overrides")>();
return {
default: defaultOverrides,
defaultOverrides,
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
} satisfies typeof import("#app/overrides");
});