mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-01-18 06:51:08 +00:00
[Test] Remove held items from all tests when there are no item overrides (#3358)
This commit is contained in:
parent
32d4102594
commit
a301507f80
@ -8,15 +8,10 @@ import { generateStarter, getMovePosition } from "#app/test/utils/gameManagerUti
|
|||||||
import { Command } from "#app/ui/command-ui-handler";
|
import { Command } from "#app/ui/command-ui-handler";
|
||||||
import { Status, StatusEffect } from "#app/data/status-effect";
|
import { Status, StatusEffect } from "#app/data/status-effect";
|
||||||
import { GameModes, getGameMode } from "#app/game-mode";
|
import { GameModes, getGameMode } from "#app/game-mode";
|
||||||
import {
|
import { CommandPhase, DamagePhase, EncounterPhase, EnemyCommandPhase, SelectStarterPhase, TurnInitPhase } from "#app/phases";
|
||||||
CommandPhase, DamagePhase, EncounterPhase,
|
|
||||||
EnemyCommandPhase, SelectStarterPhase,
|
|
||||||
TurnInitPhase,
|
|
||||||
} from "#app/phases";
|
|
||||||
import { Abilities } from "#enums/abilities";
|
import { Abilities } from "#enums/abilities";
|
||||||
import { Moves } from "#enums/moves";
|
import { Moves } from "#enums/moves";
|
||||||
import { Species } from "#enums/species";
|
import { Species } from "#enums/species";
|
||||||
import { removeEnemyHeldItems } from "../utils/testUtils";
|
|
||||||
|
|
||||||
describe("Abilities - Intimidate", () => {
|
describe("Abilities - Intimidate", () => {
|
||||||
let phaserGame: Phaser.Game;
|
let phaserGame: Phaser.Game;
|
||||||
@ -45,7 +40,6 @@ describe("Abilities - Intimidate", () => {
|
|||||||
|
|
||||||
it("single - wild with switch", async () => {
|
it("single - wild with switch", async () => {
|
||||||
await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]);
|
await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]);
|
||||||
removeEnemyHeldItems(game.scene);
|
|
||||||
game.onNextPrompt(
|
game.onNextPrompt(
|
||||||
"CheckSwitchPhase",
|
"CheckSwitchPhase",
|
||||||
Mode.CONFIRM,
|
Mode.CONFIRM,
|
||||||
@ -76,7 +70,6 @@ describe("Abilities - Intimidate", () => {
|
|||||||
it("single - boss should only trigger once then switch", async () => {
|
it("single - boss should only trigger once then switch", async () => {
|
||||||
game.override.startingWave(10);
|
game.override.startingWave(10);
|
||||||
await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]);
|
await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]);
|
||||||
removeEnemyHeldItems(game.scene);
|
|
||||||
game.onNextPrompt(
|
game.onNextPrompt(
|
||||||
"CheckSwitchPhase",
|
"CheckSwitchPhase",
|
||||||
Mode.CONFIRM,
|
Mode.CONFIRM,
|
||||||
@ -106,7 +99,6 @@ describe("Abilities - Intimidate", () => {
|
|||||||
it("single - trainer should only trigger once with switch", async () => {
|
it("single - trainer should only trigger once with switch", async () => {
|
||||||
game.override.startingWave(5);
|
game.override.startingWave(5);
|
||||||
await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]);
|
await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]);
|
||||||
removeEnemyHeldItems(game.scene);
|
|
||||||
game.onNextPrompt(
|
game.onNextPrompt(
|
||||||
"CheckSwitchPhase",
|
"CheckSwitchPhase",
|
||||||
Mode.CONFIRM,
|
Mode.CONFIRM,
|
||||||
@ -137,7 +129,6 @@ describe("Abilities - Intimidate", () => {
|
|||||||
game.override.battleType("double");
|
game.override.battleType("double");
|
||||||
game.override.startingWave(5);
|
game.override.startingWave(5);
|
||||||
await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]);
|
await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]);
|
||||||
removeEnemyHeldItems(game.scene);
|
|
||||||
game.onNextPrompt(
|
game.onNextPrompt(
|
||||||
"CheckSwitchPhase",
|
"CheckSwitchPhase",
|
||||||
Mode.CONFIRM,
|
Mode.CONFIRM,
|
||||||
@ -164,7 +155,6 @@ describe("Abilities - Intimidate", () => {
|
|||||||
game.override.battleType("double");
|
game.override.battleType("double");
|
||||||
game.override.startingWave(3);
|
game.override.startingWave(3);
|
||||||
await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]);
|
await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]);
|
||||||
removeEnemyHeldItems(game.scene);
|
|
||||||
game.onNextPrompt(
|
game.onNextPrompt(
|
||||||
"CheckSwitchPhase",
|
"CheckSwitchPhase",
|
||||||
Mode.CONFIRM,
|
Mode.CONFIRM,
|
||||||
@ -191,7 +181,6 @@ describe("Abilities - Intimidate", () => {
|
|||||||
game.override.battleType("double");
|
game.override.battleType("double");
|
||||||
game.override.startingWave(10);
|
game.override.startingWave(10);
|
||||||
await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]);
|
await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]);
|
||||||
removeEnemyHeldItems(game.scene);
|
|
||||||
game.onNextPrompt(
|
game.onNextPrompt(
|
||||||
"CheckSwitchPhase",
|
"CheckSwitchPhase",
|
||||||
Mode.CONFIRM,
|
Mode.CONFIRM,
|
||||||
@ -218,7 +207,6 @@ describe("Abilities - Intimidate", () => {
|
|||||||
game.override.startingWave(2);
|
game.override.startingWave(2);
|
||||||
game.override.moveset([Moves.AERIAL_ACE]);
|
game.override.moveset([Moves.AERIAL_ACE]);
|
||||||
await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]);
|
await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]);
|
||||||
removeEnemyHeldItems(game.scene);
|
|
||||||
let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
||||||
expect(battleStatsOpponent[BattleStat.ATK]).toBe(-1);
|
expect(battleStatsOpponent[BattleStat.ATK]).toBe(-1);
|
||||||
let battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
|
let battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
|
||||||
@ -245,7 +233,6 @@ describe("Abilities - Intimidate", () => {
|
|||||||
game.override.startingWave(2);
|
game.override.startingWave(2);
|
||||||
game.override.moveset([Moves.SPLASH]);
|
game.override.moveset([Moves.SPLASH]);
|
||||||
await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]);
|
await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]);
|
||||||
removeEnemyHeldItems(game.scene);
|
|
||||||
let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
||||||
expect(battleStatsOpponent[BattleStat.ATK]).toBe(-1);
|
expect(battleStatsOpponent[BattleStat.ATK]).toBe(-1);
|
||||||
let battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
|
let battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
|
||||||
@ -271,7 +258,6 @@ describe("Abilities - Intimidate", () => {
|
|||||||
game.override.enemyMoveset([Moves.VOLT_SWITCH, Moves.VOLT_SWITCH, Moves.VOLT_SWITCH, Moves.VOLT_SWITCH]);
|
game.override.enemyMoveset([Moves.VOLT_SWITCH, Moves.VOLT_SWITCH, Moves.VOLT_SWITCH, Moves.VOLT_SWITCH]);
|
||||||
game.override.startingWave(5);
|
game.override.startingWave(5);
|
||||||
await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]);
|
await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]);
|
||||||
removeEnemyHeldItems(game.scene);
|
|
||||||
let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
||||||
expect(battleStatsOpponent[BattleStat.ATK]).toBe(-1);
|
expect(battleStatsOpponent[BattleStat.ATK]).toBe(-1);
|
||||||
let battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
|
let battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
|
||||||
@ -311,7 +297,6 @@ describe("Abilities - Intimidate", () => {
|
|||||||
game.override.enemyMoveset([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]);
|
game.override.enemyMoveset([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]);
|
||||||
game.override.startingWave(5);
|
game.override.startingWave(5);
|
||||||
await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]);
|
await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]);
|
||||||
removeEnemyHeldItems(game.scene);
|
|
||||||
let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
||||||
expect(battleStatsOpponent[BattleStat.ATK]).toBe(-1);
|
expect(battleStatsOpponent[BattleStat.ATK]).toBe(-1);
|
||||||
let battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
|
let battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
|
||||||
@ -351,7 +336,6 @@ describe("Abilities - Intimidate", () => {
|
|||||||
game.override.startingWave(3);
|
game.override.startingWave(3);
|
||||||
vi.spyOn(Overrides, "OPP_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{ name: "COIN_CASE" }]);
|
vi.spyOn(Overrides, "OPP_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{ name: "COIN_CASE" }]);
|
||||||
await game.runToSummon([Species.MIGHTYENA]);
|
await game.runToSummon([Species.MIGHTYENA]);
|
||||||
removeEnemyHeldItems(game.scene);
|
|
||||||
await game.phaseInterceptor.to(CommandPhase, false);
|
await game.phaseInterceptor.to(CommandPhase, false);
|
||||||
const battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
const battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
||||||
expect(battleStatsOpponent[BattleStat.ATK]).toBe(-1);
|
expect(battleStatsOpponent[BattleStat.ATK]).toBe(-1);
|
||||||
@ -378,7 +362,6 @@ describe("Abilities - Intimidate", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
await game.phaseInterceptor.run(EncounterPhase);
|
await game.phaseInterceptor.run(EncounterPhase);
|
||||||
removeEnemyHeldItems(game.scene);
|
|
||||||
|
|
||||||
await game.phaseInterceptor.to(CommandPhase, false);
|
await game.phaseInterceptor.to(CommandPhase, false);
|
||||||
const battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
const battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
||||||
|
@ -8,7 +8,7 @@ import { Moves } from "#enums/moves";
|
|||||||
import { Species } from "#enums/species";
|
import { Species } from "#enums/species";
|
||||||
import Phaser from "phaser";
|
import Phaser from "phaser";
|
||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||||
import { removeEnemyHeldItems, SPLASH_ONLY } from "../utils/testUtils";
|
import { SPLASH_ONLY } from "../utils/testUtils";
|
||||||
|
|
||||||
describe("Moves - Octolock", () => {
|
describe("Moves - Octolock", () => {
|
||||||
describe("integration tests", () => {
|
describe("integration tests", () => {
|
||||||
@ -41,7 +41,6 @@ describe("Moves - Octolock", () => {
|
|||||||
|
|
||||||
it("Reduces DEf and SPDEF by 1 each turn", { timeout: 10000 }, async () => {
|
it("Reduces DEf and SPDEF by 1 each turn", { timeout: 10000 }, async () => {
|
||||||
await game.startBattle([Species.GRAPPLOCT]);
|
await game.startBattle([Species.GRAPPLOCT]);
|
||||||
removeEnemyHeldItems(game.scene);
|
|
||||||
|
|
||||||
const enemyPokemon = game.scene.getEnemyField();
|
const enemyPokemon = game.scene.getEnemyField();
|
||||||
|
|
||||||
@ -63,7 +62,6 @@ describe("Moves - Octolock", () => {
|
|||||||
|
|
||||||
it("Traps the target pokemon", { timeout: 10000 }, async () => {
|
it("Traps the target pokemon", { timeout: 10000 }, async () => {
|
||||||
await game.startBattle([Species.GRAPPLOCT]);
|
await game.startBattle([Species.GRAPPLOCT]);
|
||||||
removeEnemyHeldItems(game.scene);
|
|
||||||
|
|
||||||
const enemyPokemon = game.scene.getEnemyField();
|
const enemyPokemon = game.scene.getEnemyField();
|
||||||
|
|
||||||
|
@ -1,17 +1,7 @@
|
|||||||
import GameWrapper from "#app/test/utils/gameWrapper";
|
import GameWrapper from "#app/test/utils/gameWrapper";
|
||||||
import { Mode } from "#app/ui/ui";
|
import { Mode } from "#app/ui/ui";
|
||||||
import { generateStarter, waitUntil } from "#app/test/utils/gameManagerUtils";
|
import { generateStarter, waitUntil } from "#app/test/utils/gameManagerUtils";
|
||||||
import {
|
import { CommandPhase, EncounterPhase, FaintPhase, LoginPhase, NewBattlePhase, SelectStarterPhase, SelectTargetPhase, TitlePhase, TurnEndPhase, TurnInitPhase, TurnStartPhase } from "#app/phases";
|
||||||
CommandPhase,
|
|
||||||
EncounterPhase,
|
|
||||||
FaintPhase,
|
|
||||||
LoginPhase,
|
|
||||||
NewBattlePhase,
|
|
||||||
SelectStarterPhase,
|
|
||||||
SelectTargetPhase,
|
|
||||||
TitlePhase, TurnEndPhase, TurnInitPhase,
|
|
||||||
TurnStartPhase,
|
|
||||||
} from "#app/phases";
|
|
||||||
import BattleScene from "#app/battle-scene.js";
|
import BattleScene from "#app/battle-scene.js";
|
||||||
import PhaseInterceptor from "#app/test/utils/phaseInterceptor";
|
import PhaseInterceptor from "#app/test/utils/phaseInterceptor";
|
||||||
import TextInterceptor from "#app/test/utils/TextInterceptor";
|
import TextInterceptor from "#app/test/utils/TextInterceptor";
|
||||||
@ -36,6 +26,8 @@ import { BattlerIndex } from "#app/battle.js";
|
|||||||
import TargetSelectUiHandler from "#app/ui/target-select-ui-handler.js";
|
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 { removeEnemyHeldItems } from "./testUtils";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to manage the game state and transitions between phases.
|
* Class to manage the game state and transitions between phases.
|
||||||
@ -140,6 +132,9 @@ export default class GameManager {
|
|||||||
});
|
});
|
||||||
|
|
||||||
await this.phaseInterceptor.run(EncounterPhase);
|
await this.phaseInterceptor.run(EncounterPhase);
|
||||||
|
if (overrides.OPP_HELD_ITEMS_OVERRIDE.length === 0) {
|
||||||
|
removeEnemyHeldItems(this.scene);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,4 +34,5 @@ export function arrayOfRange(start: integer, end: integer) {
|
|||||||
export function removeEnemyHeldItems(scene: BattleScene) {
|
export function removeEnemyHeldItems(scene: BattleScene) {
|
||||||
scene.clearEnemyHeldItemModifiers();
|
scene.clearEnemyHeldItemModifiers();
|
||||||
scene.clearEnemyModifiers();
|
scene.clearEnemyModifiers();
|
||||||
|
console.log("Enemy held items removed");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user