2024-09-10 00:54:31 +08:00
|
|
|
import { Moves } from "#app/enums/moves";
|
|
|
|
import { Species } from "#app/enums/species";
|
|
|
|
import { Stat } from "#app/enums/stat";
|
|
|
|
import { Abilities } from "#enums/abilities";
|
2025-02-22 22:52:07 -06:00
|
|
|
import GameManager from "#test/testUtils/gameManager";
|
2024-09-10 00:54:31 +08:00
|
|
|
import Phaser from "phaser";
|
|
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
|
|
|
|
|
|
describe("Moves - Power Shift", () => {
|
|
|
|
let phaserGame: Phaser.Game;
|
|
|
|
let game: GameManager;
|
|
|
|
beforeAll(() => {
|
|
|
|
phaserGame = new Phaser.Game({
|
|
|
|
type: Phaser.HEADLESS,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
game.phaseInterceptor.restoreOg();
|
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
game = new GameManager(phaserGame);
|
|
|
|
game.override
|
2024-10-04 13:08:31 +08:00
|
|
|
.moveset([ Moves.POWER_SHIFT, Moves.BULK_UP ])
|
2024-09-10 00:54:31 +08:00
|
|
|
.battleType("single")
|
|
|
|
.ability(Abilities.BALL_FETCH)
|
|
|
|
.enemyAbility(Abilities.BALL_FETCH)
|
2024-09-10 03:02:11 +08:00
|
|
|
.enemyMoveset(Moves.SPLASH);
|
2024-09-10 00:54:31 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
it("switches the user's raw Attack stat with its raw Defense stat", async () => {
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
2024-09-10 00:54:31 +08:00
|
|
|
|
|
|
|
const playerPokemon = game.scene.getPlayerPokemon()!;
|
|
|
|
|
|
|
|
playerPokemon.setStat(Stat.ATK, 10, false);
|
|
|
|
playerPokemon.setStat(Stat.DEF, 20, false);
|
|
|
|
|
|
|
|
game.move.select(Moves.BULK_UP);
|
|
|
|
|
|
|
|
await game.phaseInterceptor.to("TurnEndPhase");
|
|
|
|
|
|
|
|
// Stat stages are increased by 1
|
|
|
|
expect(playerPokemon.getStatStageMultiplier(Stat.ATK)).toBe(1.5);
|
|
|
|
expect(playerPokemon.getStatStageMultiplier(Stat.DEF)).toBe(1.5);
|
|
|
|
|
|
|
|
await game.toNextTurn();
|
|
|
|
|
|
|
|
game.move.select(Moves.POWER_SHIFT);
|
|
|
|
|
|
|
|
await game.phaseInterceptor.to("TurnEndPhase");
|
|
|
|
|
|
|
|
// Effective stats are calculated correctly
|
|
|
|
expect(playerPokemon.getEffectiveStat(Stat.ATK)).toBe(30);
|
|
|
|
expect(playerPokemon.getEffectiveStat(Stat.DEF)).toBe(15);
|
|
|
|
// Raw stats are swapped
|
|
|
|
expect(playerPokemon.getStat(Stat.ATK, false)).toBe(20);
|
|
|
|
expect(playerPokemon.getStat(Stat.DEF, false)).toBe(10);
|
2024-09-20 14:05:45 -07:00
|
|
|
});
|
2024-09-10 00:54:31 +08:00
|
|
|
});
|