mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 09:02:47 +02:00
* Rename `Abilities` to `AbilityId` * Rename `abilities.ts` to `ability-id.ts` * Rename `Moves` to `MoveId` * Rename `moves.ts` to `move-id.ts` * Rename `Species` to `SpeciesId` * Rename `species.ts` to `species-id.ts` * Rename `Biome` to `BiomeId` * Rename `biome.ts` to `biome-id.ts` * Replace `Abilities` with `AbilityId` in comments * Replace `Biome` with `BiomeId` in comments * Replace `Moves` with `MoveId` in comments * Replace `Species` with `SpeciesId` in comments
114 lines
3.8 KiB
TypeScript
114 lines
3.8 KiB
TypeScript
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
import Phaser from "phaser";
|
|
import GameManager from "#test/testUtils/gameManager";
|
|
import { MoveId } from "#enums/move-id";
|
|
import { Stat } from "#enums/stat";
|
|
import { SpeciesId } from "#enums/species-id";
|
|
import { TurnEndPhase } from "#app/phases/turn-end-phase";
|
|
import { AbilityId } from "#enums/ability-id";
|
|
import { BattlerTagType } from "#enums/battler-tag-type";
|
|
|
|
describe("Moves - Power Trick", () => {
|
|
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
|
|
.battleStyle("single")
|
|
.enemyAbility(AbilityId.BALL_FETCH)
|
|
.enemyMoveset(MoveId.SPLASH)
|
|
.enemySpecies(SpeciesId.MEW)
|
|
.enemyLevel(200)
|
|
.moveset([MoveId.POWER_TRICK])
|
|
.ability(AbilityId.BALL_FETCH);
|
|
});
|
|
|
|
it("swaps the user's ATK and DEF stats", async () => {
|
|
await game.classicMode.startBattle([SpeciesId.SHUCKLE]);
|
|
|
|
const player = game.scene.getPlayerPokemon()!;
|
|
const baseATK = player.getStat(Stat.ATK, false);
|
|
const baseDEF = player.getStat(Stat.DEF, false);
|
|
|
|
game.move.select(MoveId.POWER_TRICK);
|
|
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
|
|
|
expect(player.getStat(Stat.ATK, false)).toBe(baseDEF);
|
|
expect(player.getStat(Stat.DEF, false)).toBe(baseATK);
|
|
expect(player.getTag(BattlerTagType.POWER_TRICK)).toBeDefined();
|
|
});
|
|
|
|
it("resets initial ATK and DEF stat swap when used consecutively", async () => {
|
|
await game.classicMode.startBattle([SpeciesId.SHUCKLE]);
|
|
|
|
const player = game.scene.getPlayerPokemon()!;
|
|
const baseATK = player.getStat(Stat.ATK, false);
|
|
const baseDEF = player.getStat(Stat.DEF, false);
|
|
|
|
game.move.select(MoveId.POWER_TRICK);
|
|
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
|
|
|
game.move.select(MoveId.POWER_TRICK);
|
|
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
|
|
|
expect(player.getStat(Stat.ATK, false)).toBe(baseATK);
|
|
expect(player.getStat(Stat.DEF, false)).toBe(baseDEF);
|
|
expect(player.getTag(BattlerTagType.POWER_TRICK)).toBeUndefined();
|
|
});
|
|
|
|
it("should pass effect when using BATON_PASS", async () => {
|
|
await game.classicMode.startBattle([SpeciesId.SHUCKLE, SpeciesId.SHUCKLE]);
|
|
await game.override.moveset([MoveId.POWER_TRICK, MoveId.BATON_PASS]);
|
|
|
|
const player = game.scene.getPlayerPokemon()!;
|
|
player.addTag(BattlerTagType.POWER_TRICK);
|
|
|
|
game.move.select(MoveId.BATON_PASS);
|
|
game.doSelectPartyPokemon(1);
|
|
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
|
|
|
const switchedPlayer = game.scene.getPlayerPokemon()!;
|
|
const baseATK = switchedPlayer.getStat(Stat.ATK);
|
|
const baseDEF = switchedPlayer.getStat(Stat.DEF);
|
|
|
|
expect(switchedPlayer.getStat(Stat.ATK, false)).toBe(baseDEF);
|
|
expect(switchedPlayer.getStat(Stat.DEF, false)).toBe(baseATK);
|
|
expect(switchedPlayer.getTag(BattlerTagType.POWER_TRICK)).toBeDefined();
|
|
});
|
|
|
|
it("should remove effect after using Transform", async () => {
|
|
await game.classicMode.startBattle([SpeciesId.SHUCKLE, SpeciesId.SHUCKLE]);
|
|
await game.override.moveset([MoveId.POWER_TRICK, MoveId.TRANSFORM]);
|
|
|
|
const player = game.scene.getPlayerPokemon()!;
|
|
player.addTag(BattlerTagType.POWER_TRICK);
|
|
|
|
game.move.select(MoveId.TRANSFORM);
|
|
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
|
|
|
const enemy = game.scene.getEnemyPokemon()!;
|
|
const baseATK = enemy.getStat(Stat.ATK);
|
|
const baseDEF = enemy.getStat(Stat.DEF);
|
|
|
|
expect(player.getStat(Stat.ATK, false)).toBe(baseATK);
|
|
expect(player.getStat(Stat.DEF, false)).toBe(baseDEF);
|
|
expect(player.getTag(BattlerTagType.POWER_TRICK)).toBeUndefined();
|
|
});
|
|
});
|