2024-07-25 15:51:05 -07:00
|
|
|
import { BattleStat } from "#app/data/battle-stat";
|
|
|
|
import { Stat } from "#app/data/pokemon-stat";
|
2024-08-06 07:06:25 -07:00
|
|
|
import GameManager from "#test/utils/gameManager";
|
|
|
|
import { getMovePosition } from "#test/utils/gameManagerUtils";
|
2024-07-25 15:51:05 -07:00
|
|
|
import { Command } from "#app/ui/command-ui-handler";
|
|
|
|
import { Mode } from "#app/ui/ui";
|
2024-06-13 18:44:23 -04:00
|
|
|
import { Abilities } from "#enums/abilities";
|
|
|
|
import { Moves } from "#enums/moves";
|
|
|
|
import { Species } from "#enums/species";
|
2024-07-25 15:51:05 -07:00
|
|
|
import Phaser from "phaser";
|
|
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
2024-08-19 03:23:52 +01:00
|
|
|
import { CommandPhase } from "#app/phases/command-phase.js";
|
|
|
|
import { EnemyCommandPhase } from "#app/phases/enemy-command-phase.js";
|
|
|
|
import { TurnInitPhase } from "#app/phases/turn-init-phase.js";
|
2024-06-08 00:33:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
describe("Moves - Growth", () => {
|
|
|
|
let phaserGame: Phaser.Game;
|
|
|
|
let game: GameManager;
|
|
|
|
|
|
|
|
beforeAll(() => {
|
|
|
|
phaserGame = new Phaser.Game({
|
|
|
|
type: Phaser.HEADLESS,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
game.phaseInterceptor.restoreOg();
|
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
game = new GameManager(phaserGame);
|
|
|
|
const moveToUse = Moves.GROWTH;
|
2024-07-25 14:48:48 -07:00
|
|
|
game.override.battleType("single");
|
2024-07-25 14:57:47 -07:00
|
|
|
game.override.enemySpecies(Species.RATTATA);
|
2024-07-25 15:05:32 -07:00
|
|
|
game.override.enemyAbility(Abilities.MOXIE);
|
2024-07-25 15:35:20 -07:00
|
|
|
game.override.ability(Abilities.INSOMNIA);
|
2024-07-25 15:29:19 -07:00
|
|
|
game.override.startingLevel(2000);
|
2024-07-25 15:51:05 -07:00
|
|
|
game.override.moveset([moveToUse]);
|
2024-07-25 15:18:14 -07:00
|
|
|
game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]);
|
2024-06-08 00:33:45 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
it("GROWTH", async() => {
|
|
|
|
const moveToUse = Moves.GROWTH;
|
|
|
|
await game.startBattle([
|
|
|
|
Species.MIGHTYENA,
|
|
|
|
Species.MIGHTYENA,
|
|
|
|
]);
|
|
|
|
let battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
|
|
|
|
expect(battleStatsPokemon[Stat.SPATK]).toBe(0);
|
|
|
|
|
|
|
|
const battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
|
|
|
expect(battleStatsOpponent[BattleStat.SPATK]).toBe(0);
|
|
|
|
|
|
|
|
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
|
|
|
|
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
|
|
|
|
});
|
|
|
|
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => {
|
|
|
|
const movePosition = getMovePosition(game.scene, 0, moveToUse);
|
|
|
|
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false);
|
|
|
|
});
|
|
|
|
await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(TurnInitPhase);
|
|
|
|
battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
|
|
|
|
expect(battleStatsPokemon[BattleStat.SPATK]).toBe(1);
|
|
|
|
}, 20000);
|
|
|
|
});
|