2024-08-22 06:49:33 -07:00
|
|
|
import { BattleStat } from "#app/data/battle-stat";
|
|
|
|
import { Abilities } from "#app/enums/abilities";
|
|
|
|
import { Moves } from "#app/enums/moves";
|
|
|
|
import { Species } from "#app/enums/species";
|
|
|
|
import { CommandPhase } from "#app/phases/command-phase";
|
|
|
|
import { MessagePhase } from "#app/phases/message-phase";
|
2024-08-06 07:06:25 -07:00
|
|
|
import GameManager from "#test/utils/gameManager";
|
|
|
|
import { SPLASH_ONLY } from "#test/utils/testUtils";
|
2024-08-22 06:49:33 -07:00
|
|
|
import Phaser from "phaser";
|
|
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
|
2024-06-22 11:35:25 -04:00
|
|
|
|
|
|
|
const TIMEOUT = 20 * 1000;
|
|
|
|
|
|
|
|
describe("Abilities - COSTAR", () => {
|
|
|
|
let phaserGame: Phaser.Game;
|
|
|
|
let game: GameManager;
|
|
|
|
|
|
|
|
beforeAll(() => {
|
|
|
|
phaserGame = new Phaser.Game({
|
|
|
|
type: Phaser.HEADLESS,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
game.phaseInterceptor.restoreOg();
|
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
game = new GameManager(phaserGame);
|
2024-07-25 14:48:48 -07:00
|
|
|
game.override.battleType("double");
|
2024-07-25 15:35:20 -07:00
|
|
|
game.override.ability(Abilities.COSTAR);
|
2024-07-25 15:51:05 -07:00
|
|
|
game.override.moveset([Moves.SPLASH, Moves.NASTY_PLOT]);
|
2024-07-25 15:18:14 -07:00
|
|
|
game.override.enemyMoveset(SPLASH_ONLY);
|
2024-06-22 11:35:25 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
test(
|
|
|
|
"ability copies positive stat changes",
|
|
|
|
async () => {
|
2024-07-25 15:05:32 -07:00
|
|
|
game.override.enemyAbility(Abilities.BALL_FETCH);
|
2024-07-08 13:37:22 -07:00
|
|
|
|
2024-06-22 11:35:25 -04:00
|
|
|
await game.startBattle([Species.MAGIKARP, Species.MAGIKARP, Species.FLAMIGO]);
|
|
|
|
|
|
|
|
let [leftPokemon, rightPokemon] = game.scene.getPlayerField();
|
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.NASTY_PLOT);
|
2024-06-22 11:35:25 -04:00
|
|
|
await game.phaseInterceptor.to(CommandPhase);
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.SPLASH, 1);
|
2024-06-22 11:35:25 -04:00
|
|
|
await game.toNextTurn();
|
|
|
|
|
|
|
|
expect(leftPokemon.summonData.battleStats[BattleStat.SPATK]).toBe(+2);
|
|
|
|
expect(rightPokemon.summonData.battleStats[BattleStat.SPATK]).toBe(0);
|
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.SPLASH);
|
2024-06-22 11:35:25 -04:00
|
|
|
await game.phaseInterceptor.to(CommandPhase);
|
|
|
|
game.doSwitchPokemon(2);
|
|
|
|
await game.phaseInterceptor.to(MessagePhase);
|
|
|
|
|
|
|
|
[leftPokemon, rightPokemon] = game.scene.getPlayerField();
|
|
|
|
expect(leftPokemon.summonData.battleStats[BattleStat.SPATK]).toBe(+2);
|
|
|
|
expect(rightPokemon.summonData.battleStats[BattleStat.SPATK]).toBe(+2);
|
|
|
|
},
|
|
|
|
TIMEOUT,
|
|
|
|
);
|
|
|
|
|
|
|
|
test(
|
|
|
|
"ability copies negative stat changes",
|
|
|
|
async () => {
|
2024-07-25 15:05:32 -07:00
|
|
|
game.override.enemyAbility(Abilities.INTIMIDATE);
|
2024-06-22 11:35:25 -04:00
|
|
|
|
|
|
|
await game.startBattle([Species.MAGIKARP, Species.MAGIKARP, Species.FLAMIGO]);
|
|
|
|
|
|
|
|
let [leftPokemon, rightPokemon] = game.scene.getPlayerField();
|
|
|
|
|
|
|
|
expect(leftPokemon.summonData.battleStats[BattleStat.ATK]).toBe(-2);
|
|
|
|
expect(leftPokemon.summonData.battleStats[BattleStat.ATK]).toBe(-2);
|
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.SPLASH);
|
2024-06-22 11:35:25 -04:00
|
|
|
await game.phaseInterceptor.to(CommandPhase);
|
|
|
|
game.doSwitchPokemon(2);
|
|
|
|
await game.phaseInterceptor.to(MessagePhase);
|
|
|
|
|
|
|
|
[leftPokemon, rightPokemon] = game.scene.getPlayerField();
|
|
|
|
expect(leftPokemon.summonData.battleStats[BattleStat.ATK]).toBe(-2);
|
|
|
|
expect(rightPokemon.summonData.battleStats[BattleStat.ATK]).toBe(-2);
|
|
|
|
},
|
|
|
|
TIMEOUT,
|
|
|
|
);
|
|
|
|
});
|