[Test] move util func to gameManager.ts (#3494)

This commit is contained in:
Adrian T. 2024-08-12 12:56:31 +08:00 committed by GitHub
parent 0e0ed10ce0
commit 4b16b64eed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 13 deletions

View File

@ -26,7 +26,6 @@ import TargetSelectUiHandler from "#app/ui/target-select-ui-handler.js";
import { OverridesHelper } from "./overridesHelper";
import { ModifierTypeOption, modifierTypes } from "#app/modifier/modifier-type.js";
import overrides from "#app/overrides.js";
import { removeEnemyHeldItems } from "./testUtils";
import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler.js";
import { MoveHelper } from "./moveHelper";
import { vi } from "vitest";
@ -137,7 +136,7 @@ export default class GameManager {
await this.phaseInterceptor.run(EncounterPhase);
if (overrides.OPP_HELD_ITEMS_OVERRIDE.length === 0) {
removeEnemyHeldItems(this);
this.removeEnemyHeldItems();
}
}
@ -405,4 +404,13 @@ export default class GameManager {
vi.spyOn(this.scene.getCurrentPhase() as TurnStartPhase, "getOrder").mockReturnValue(order);
}
/**
* Removes all held items from enemy pokemon
*/
removeEnemyHeldItems(): void {
this.scene.clearEnemyHeldItemModifiers();
this.scene.clearEnemyModifiers();
console.log("Enemy held items removed");
}
}

View File

@ -1,7 +1,6 @@
import { Moves } from "#app/enums/moves.js";
import i18next, { type ParseKeys } from "i18next";
import { vi } from "vitest";
import GameManager from "./gameManager";
/** Ready to use array of Moves.SPLASH x4 */
export const SPLASH_ONLY = [Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH];
@ -26,13 +25,3 @@ export function mockI18next() {
export function arrayOfRange(start: integer, end: integer) {
return Array.from({ length: end - start }, (_v, k) => k + start);
}
/**
* Removes all held items from enemy pokemon
* @param game The {@link GameManager} instance
*/
export function removeEnemyHeldItems(game: GameManager): void {
game.scene.clearEnemyHeldItemModifiers();
game.scene.clearEnemyModifiers();
console.log("Enemy held items removed");
}