mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-08 09:22:17 +02:00
Update tests
This commit is contained in:
parent
0692ef4fe7
commit
97b1c8ce54
@ -1,5 +1,5 @@
|
||||
import { ChargeAnim, MoveChargeAnim, initMoveAnim, loadMoveAnimAssets } from "./battle-anims";
|
||||
import { BattleEndPhase, MoveEndPhase, MovePhase, NewBattlePhase, PartyStatusCurePhase, PokemonHealPhase, StatChangePhase, SwitchPhase, SwitchSummonPhase } from "../phases";
|
||||
import { BattleEndPhase, MessagePhase, MoveEndPhase, MovePhase, NewBattlePhase, PartyStatusCurePhase, PokemonHealPhase, StatChangePhase, SwitchPhase, SwitchSummonPhase } from "../phases";
|
||||
import { BattleStat, getBattleStatName } from "./battle-stat";
|
||||
import { EncoreTag, GulpMissileTag, HelpingHandTag, SemiInvulnerableTag, StockpilingTag, TypeBoostTag } from "./battler-tags";
|
||||
import { getPokemonNameWithAffix } from "../messages";
|
||||
|
@ -1,24 +1,16 @@
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
import Phaser from "phaser";
|
||||
import GameManager from "#app/test/utils/gameManager";
|
||||
import * as overrides from "#app/overrides";
|
||||
import {
|
||||
CommandPhase,
|
||||
SelectTargetPhase,
|
||||
TurnEndPhase,
|
||||
} from "#app/phases";
|
||||
import { CommandPhase, SelectTargetPhase, TurnEndPhase } from "#app/phases";
|
||||
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { Species } from "#enums/species";
|
||||
import { BattlerIndex } from "#app/battle.js";
|
||||
import { Stat } from "#app/data/pokemon-stat";
|
||||
import { ArenaTagType } from "#app/enums/arena-tag-type.js";
|
||||
import { ArenaTagSide } from "#app/data/arena-tag.js";
|
||||
import { Abilities } from "#app/enums/abilities.js";
|
||||
import { mockTurnOrder } from "../utils/testUtils";
|
||||
|
||||
const TIMEOUT = 20 * 1000;
|
||||
|
||||
const SAFEGUARD = Moves.SAFEGUARD;
|
||||
|
||||
describe("Moves - Safeguard", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
let game: GameManager;
|
||||
@ -35,57 +27,46 @@ describe("Moves - Safeguard", () => {
|
||||
|
||||
beforeEach(() => {
|
||||
game = new GameManager(phaserGame);
|
||||
vi.spyOn(overrides, "SINGLE_BATTLE_OVERRIDE", "get").mockReturnValue(true);
|
||||
vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.AMOONGUSS);
|
||||
vi.spyOn(overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.DEOXYS);
|
||||
vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100);
|
||||
vi.spyOn(overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100);
|
||||
vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPORE, Moves.SPORE, Moves.SPORE, Moves.SPORE]);
|
||||
vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SAFEGUARD, Moves.SAFEGUARD, Moves.SAFEGUARD, Moves.SAFEGUARD]);
|
||||
game.override
|
||||
.battleType("single")
|
||||
.enemySpecies(Species.DRATINI)
|
||||
.enemyMoveset(Array(4).fill(Moves.SAFEGUARD))
|
||||
.enemyAbility(Abilities.BALL_FETCH)
|
||||
.enemyLevel(5)
|
||||
.starterSpecies(Species.DRATINI)
|
||||
.moveset([Moves.NUZZLE, Moves.SPORE])
|
||||
.ability(Abilities.BALL_FETCH);
|
||||
});
|
||||
it("protects from nuzzle status",
|
||||
async () => {
|
||||
await game.startBattle();
|
||||
const enemy = game.scene.getEnemyPokemon()!;
|
||||
|
||||
vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SENTRET);
|
||||
vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.NUZZLE,
|
||||
Moves.NUZZLE,
|
||||
Moves.NUZZLE,
|
||||
Moves.NUZZLE]);
|
||||
await game.startBattle([Species.DEOXYS]);
|
||||
const enemyPokemon = game.scene.getEnemyField();
|
||||
const playerPokemon = game.scene.getPlayerField();
|
||||
game.doAttack(getMovePosition(game.scene, 0, Moves.NUZZLE));
|
||||
await mockTurnOrder(game, [BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
||||
await game.toNextTurn();
|
||||
|
||||
game.doAttack(getMovePosition(game.scene, 0, SAFEGUARD));
|
||||
|
||||
expect(enemyPokemon[0].status).toBe(undefined);
|
||||
expect(playerPokemon[0].status).toBe(undefined);
|
||||
expect(enemy.status).toBeUndefined();
|
||||
}, TIMEOUT
|
||||
);
|
||||
it("protects from spore",
|
||||
async () => {
|
||||
|
||||
await game.startBattle([Species.DEOXYS]);
|
||||
const enemyPokemon = game.scene.getEnemyField();
|
||||
const playerPokemon = game.scene.getPlayerField();
|
||||
await game.startBattle();
|
||||
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||
|
||||
game.doAttack(getMovePosition(game.scene, 0, Moves.SAFEGUARD));
|
||||
game.doAttack(getMovePosition(game.scene, 0, Moves.SPORE));
|
||||
await mockTurnOrder(game, [BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(enemyPokemon[0].status).toBe(undefined);
|
||||
expect(playerPokemon[0].status).toBe(undefined);
|
||||
expect(enemyPokemon.status).toBeUndefined();
|
||||
}, TIMEOUT
|
||||
);
|
||||
it("protects ally from status",
|
||||
async () => {
|
||||
vi.spyOn(overrides, "SINGLE_BATTLE_OVERRIDE", "get").mockReturnValue(false);
|
||||
vi.spyOn(overrides, "DOUBLE_BATTLE_OVERRIDE", "get").mockReturnValue(true);
|
||||
game.override.battleType("double");
|
||||
|
||||
vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.DEOXYS);
|
||||
vi.spyOn(overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.AMOONGUSS);
|
||||
vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SAFEGUARD, Moves.SAFEGUARD, Moves.SAFEGUARD, Moves.SAFEGUARD]);
|
||||
vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPORE, Moves.NUZZLE, Moves.SPORE, Moves.SPORE]);
|
||||
|
||||
await game.startBattle([Species.AMOONGUSS, Species.FURRET]);
|
||||
game.scene.currentBattle.enemyParty[1].stats[Stat.SPD] = 1;
|
||||
await game.startBattle();
|
||||
|
||||
game.doAttack(getMovePosition(game.scene, 0, Moves.SPORE));
|
||||
await game.phaseInterceptor.to(SelectTargetPhase, false);
|
||||
@ -97,28 +78,14 @@ describe("Moves - Safeguard", () => {
|
||||
await game.phaseInterceptor.to(SelectTargetPhase, false);
|
||||
game.doSelectTarget(BattlerIndex.ENEMY_2);
|
||||
|
||||
await mockTurnOrder(game, [BattlerIndex.ENEMY, BattlerIndex.PLAYER, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY_2]);
|
||||
|
||||
await game.phaseInterceptor.to(TurnEndPhase);
|
||||
|
||||
const enemyPokemon = game.scene.getEnemyField();
|
||||
const playerPokemon = game.scene.getPlayerField();
|
||||
|
||||
expect(enemyPokemon[0].status).toBe(undefined);
|
||||
expect(enemyPokemon[1].status).toBe(undefined);
|
||||
expect(playerPokemon[0].status).toBe(undefined);
|
||||
expect(playerPokemon[1].status).toBe(undefined);
|
||||
}, TIMEOUT
|
||||
);
|
||||
it("applys arena tag for 5 turns",
|
||||
async () => {
|
||||
|
||||
await game.startBattle([Species.DEOXYS]);
|
||||
|
||||
for (let i=0;i<5;i++) {
|
||||
game.doAttack(getMovePosition(game.scene, 0, Moves.SAFEGUARD));
|
||||
await game.phaseInterceptor.to(CommandPhase);
|
||||
}
|
||||
|
||||
expect(game.scene.arena.getTagOnSide(ArenaTagType.SAFEGUARD, ArenaTagSide.PLAYER)).toBeUndefined();
|
||||
expect(enemyPokemon[0].status).toBeUndefined();
|
||||
expect(enemyPokemon[1].status).toBeUndefined();
|
||||
}, TIMEOUT
|
||||
);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user