mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-02-24 04:57:34 +00:00
[Test] move util func to gameManager.ts (#3494)
This commit is contained in:
parent
0e0ed10ce0
commit
4b16b64eed
@ -26,7 +26,6 @@ import TargetSelectUiHandler from "#app/ui/target-select-ui-handler.js";
|
|||||||
import { OverridesHelper } from "./overridesHelper";
|
import { OverridesHelper } from "./overridesHelper";
|
||||||
import { ModifierTypeOption, modifierTypes } from "#app/modifier/modifier-type.js";
|
import { ModifierTypeOption, modifierTypes } from "#app/modifier/modifier-type.js";
|
||||||
import overrides from "#app/overrides.js";
|
import overrides from "#app/overrides.js";
|
||||||
import { removeEnemyHeldItems } from "./testUtils";
|
|
||||||
import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler.js";
|
import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler.js";
|
||||||
import { MoveHelper } from "./moveHelper";
|
import { MoveHelper } from "./moveHelper";
|
||||||
import { vi } from "vitest";
|
import { vi } from "vitest";
|
||||||
@ -137,7 +136,7 @@ export default class GameManager {
|
|||||||
|
|
||||||
await this.phaseInterceptor.run(EncounterPhase);
|
await this.phaseInterceptor.run(EncounterPhase);
|
||||||
if (overrides.OPP_HELD_ITEMS_OVERRIDE.length === 0) {
|
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);
|
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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { Moves } from "#app/enums/moves.js";
|
import { Moves } from "#app/enums/moves.js";
|
||||||
import i18next, { type ParseKeys } from "i18next";
|
import i18next, { type ParseKeys } from "i18next";
|
||||||
import { vi } from "vitest";
|
import { vi } from "vitest";
|
||||||
import GameManager from "./gameManager";
|
|
||||||
|
|
||||||
/** Ready to use array of Moves.SPLASH x4 */
|
/** Ready to use array of Moves.SPLASH x4 */
|
||||||
export const SPLASH_ONLY = [Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH];
|
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) {
|
export function arrayOfRange(start: integer, end: integer) {
|
||||||
return Array.from({ length: end - start }, (_v, k) => k + start);
|
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");
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user