mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-06 00:12:16 +02:00
Adjusts unit tests, adds one more for doubles
This commit is contained in:
parent
b65b55a00e
commit
37c97c02ef
@ -1,12 +1,10 @@
|
|||||||
import { BattleStat } from "#app/data/battle-stat";
|
import { BattleStat } from "#app/data/battle-stat";
|
||||||
import { allMoves } from "#app/data/move";
|
import { allMoves } from "#app/data/move";
|
||||||
import { MoveEndPhase } from "#app/phases/move-end-phase";
|
import { CommandPhase } from "#app/phases/command-phase";
|
||||||
import { TurnInitPhase } from "#app/phases/turn-init-phase";
|
|
||||||
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 GameManager from "#test/utils/gameManager";
|
import GameManager from "#test/utils/gameManager";
|
||||||
import { SPLASH_ONLY } from "#test/utils/testUtils";
|
|
||||||
import Phaser from "phaser";
|
import Phaser from "phaser";
|
||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
|
|
||||||
@ -26,57 +24,86 @@ describe("Moves - Freezy Frost", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
game = new GameManager(phaserGame);
|
game = new GameManager(phaserGame);
|
||||||
|
|
||||||
game.override.battleType("single");
|
game.override
|
||||||
|
.battleType("single")
|
||||||
|
.enemySpecies(Species.RATTATA)
|
||||||
|
.enemyLevel(100)
|
||||||
|
.enemyMoveset([Moves.HOWL, Moves.HOWL, Moves.HOWL, Moves.HOWL])
|
||||||
|
.enemyAbility(Abilities.BALL_FETCH)
|
||||||
|
.startingLevel(100)
|
||||||
|
.moveset([Moves.FREEZY_FROST, Moves.HOWL, Moves.SPLASH])
|
||||||
|
.ability(Abilities.BALL_FETCH);
|
||||||
|
|
||||||
game.override.enemySpecies(Species.RATTATA);
|
|
||||||
game.override.enemyLevel(100);
|
|
||||||
game.override.enemyMoveset(SPLASH_ONLY);
|
|
||||||
game.override.enemyAbility(Abilities.NONE);
|
|
||||||
|
|
||||||
game.override.startingLevel(100);
|
|
||||||
game.override.moveset([Moves.FREEZY_FROST, Moves.SWORDS_DANCE, Moves.CHARM, Moves.SPLASH]);
|
|
||||||
vi.spyOn(allMoves[Moves.FREEZY_FROST], "accuracy", "get").mockReturnValue(100);
|
vi.spyOn(allMoves[Moves.FREEZY_FROST], "accuracy", "get").mockReturnValue(100);
|
||||||
game.override.ability(Abilities.NONE);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Uses Swords Dance to raise own ATK by 2, Charm to lower enemy ATK by 2, player uses Freezy Frost to clear all stat changes", { timeout: 10000 }, async () => {
|
it(
|
||||||
await game.startBattle([Species.RATTATA]);
|
"should clear stat changes of user and opponent",
|
||||||
const user = game.scene.getPlayerPokemon()!;
|
async () => {
|
||||||
const enemy = game.scene.getEnemyPokemon()!;
|
await game.startBattle([Species.SHUCKLE]);
|
||||||
expect(user.summonData.battleStats[BattleStat.ATK]).toBe(0);
|
const user = game.scene.getPlayerPokemon()!;
|
||||||
expect(enemy.summonData.battleStats[BattleStat.ATK]).toBe(0);
|
const enemy = game.scene.getEnemyPokemon()!;
|
||||||
|
|
||||||
game.move.select(Moves.SWORDS_DANCE);
|
game.move.select(Moves.HOWL);
|
||||||
await game.phaseInterceptor.to(TurnInitPhase);
|
await game.toNextTurn();
|
||||||
|
|
||||||
game.move.select(Moves.CHARM);
|
const userAtkBefore = user.summonData.battleStats[BattleStat.ATK];
|
||||||
await game.phaseInterceptor.to(TurnInitPhase);
|
const enemyAtkBefore = enemy.summonData.battleStats[BattleStat.ATK];
|
||||||
const userAtkBefore = user.summonData.battleStats[BattleStat.ATK];
|
expect(userAtkBefore).toBe(1);
|
||||||
const enemyAtkBefore = enemy.summonData.battleStats[BattleStat.ATK];
|
expect(enemyAtkBefore).toBe(1);
|
||||||
expect(userAtkBefore).toBe(2);
|
|
||||||
expect(enemyAtkBefore).toBe(-2);
|
|
||||||
|
|
||||||
game.move.select(Moves.FREEZY_FROST);
|
game.move.select(Moves.FREEZY_FROST);
|
||||||
await game.phaseInterceptor.to(TurnInitPhase);
|
await game.toNextTurn();
|
||||||
expect(user.summonData.battleStats[BattleStat.ATK]).toBe(0);
|
|
||||||
expect(enemy.summonData.battleStats[BattleStat.ATK]).toBe(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("Uses Swords Dance to raise own ATK by 2, Charm to lower enemy ATK by 2, enemy uses Freezy Frost to clear all stat changes", { timeout: 10000 }, async () => {
|
expect(user.summonData.battleStats[BattleStat.ATK]).toBe(0);
|
||||||
game.override.enemyMoveset([Moves.FREEZY_FROST, Moves.FREEZY_FROST, Moves.FREEZY_FROST, Moves.FREEZY_FROST]);
|
expect(enemy.summonData.battleStats[BattleStat.ATK]).toBe(0);
|
||||||
await game.startBattle([Species.SHUCKLE]); // Shuckle for slower Swords Dance on first turn so Freezy Frost doesn't affect it.
|
});
|
||||||
const user = game.scene.getPlayerPokemon()!;
|
|
||||||
expect(user.summonData.battleStats[BattleStat.ATK]).toBe(0);
|
|
||||||
|
|
||||||
game.move.select(Moves.SWORDS_DANCE);
|
it(
|
||||||
await game.phaseInterceptor.to(TurnInitPhase);
|
"should clear all stat changes even when enemy uses the move",
|
||||||
|
async () => {
|
||||||
|
game.override.enemyMoveset([Moves.FREEZY_FROST, Moves.FREEZY_FROST, Moves.FREEZY_FROST, Moves.FREEZY_FROST]);
|
||||||
|
await game.startBattle([Species.SHUCKLE]); // Shuckle for slower Howl on first turn so Freezy Frost doesn't affect it.
|
||||||
|
const user = game.scene.getPlayerPokemon()!;
|
||||||
|
|
||||||
const userAtkBefore = user.summonData.battleStats[BattleStat.ATK];
|
game.move.select(Moves.HOWL);
|
||||||
expect(userAtkBefore).toBe(2);
|
await game.toNextTurn();
|
||||||
|
|
||||||
game.move.select(Moves.SPLASH);
|
const userAtkBefore = user.summonData.battleStats[BattleStat.ATK];
|
||||||
await game.phaseInterceptor.to(MoveEndPhase);
|
expect(userAtkBefore).toBe(1);
|
||||||
expect(user.summonData.battleStats[BattleStat.ATK]).toBe(0);
|
|
||||||
});
|
game.move.select(Moves.SPLASH);
|
||||||
|
await game.toNextTurn();
|
||||||
|
expect(user.summonData.battleStats[BattleStat.ATK]).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it(
|
||||||
|
"should clear all stat changes in double battle",
|
||||||
|
async () => {
|
||||||
|
game.override.battleType("double");
|
||||||
|
await game.startBattle([Species.SHUCKLE, Species.RATTATA]);
|
||||||
|
const [leftPlayer, rightPlayer] = game.scene.getPlayerField();
|
||||||
|
const [leftOpp, rightOpp] = game.scene.getEnemyField();
|
||||||
|
|
||||||
|
game.move.select(Moves.HOWL, 0);
|
||||||
|
await game.phaseInterceptor.to(CommandPhase);
|
||||||
|
game.move.select(Moves.SPLASH, 1);
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
expect(leftPlayer.summonData.battleStats[BattleStat.ATK]).toBe(1);
|
||||||
|
expect(rightPlayer.summonData.battleStats[BattleStat.ATK]).toBe(1);
|
||||||
|
expect(leftOpp.summonData.battleStats[BattleStat.ATK]).toBe(2); // Both enemies use Howl
|
||||||
|
expect(rightOpp.summonData.battleStats[BattleStat.ATK]).toBe(2);
|
||||||
|
|
||||||
|
game.move.select(Moves.FREEZY_FROST, 0, leftOpp.getBattlerIndex());
|
||||||
|
await game.phaseInterceptor.to(CommandPhase);
|
||||||
|
game.move.select(Moves.SPLASH, 1);
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
expect(leftPlayer.summonData.battleStats[BattleStat.ATK]).toBe(0);
|
||||||
|
expect(rightPlayer.summonData.battleStats[BattleStat.ATK]).toBe(0);
|
||||||
|
expect(leftOpp.summonData.battleStats[BattleStat.ATK]).toBe(0);
|
||||||
|
expect(rightOpp.summonData.battleStats[BattleStat.ATK]).toBe(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user