2024-10-06 23:29:57 -04:00
|
|
|
import { BattlerIndex } from "#app/battle";
|
|
|
|
import { allMoves } from "#app/data/move";
|
2024-11-25 14:15:39 -08:00
|
|
|
import { DamageAnimPhase } from "#app/phases/damage-anim-phase";
|
2024-10-03 11:17:51 -04:00
|
|
|
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
|
|
|
|
import { MoveEndPhase } from "#app/phases/move-end-phase";
|
|
|
|
import { TurnEndPhase } from "#app/phases/turn-end-phase";
|
|
|
|
import { Abilities } from "#enums/abilities";
|
|
|
|
import { Moves } from "#enums/moves";
|
|
|
|
import { Species } from "#enums/species";
|
|
|
|
import { Stat } from "#enums/stat";
|
2025-02-22 22:52:07 -06:00
|
|
|
import GameManager from "#test/testUtils/gameManager";
|
2024-10-03 11:17:51 -04:00
|
|
|
import Phaser from "phaser";
|
2024-10-06 23:29:57 -04:00
|
|
|
import { afterEach, beforeAll, beforeEach, describe, it, expect, vi } from "vitest";
|
2024-10-03 11:17:51 -04:00
|
|
|
|
|
|
|
describe("Moves - Scale Shot", () => {
|
|
|
|
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.SCALE_SHOT ])
|
2024-10-03 11:17:51 -04:00
|
|
|
.battleType("single")
|
|
|
|
.disableCrits()
|
|
|
|
.ability(Abilities.NO_GUARD)
|
|
|
|
.passiveAbility(Abilities.SKILL_LINK)
|
2024-10-06 23:29:57 -04:00
|
|
|
.enemyMoveset(Moves.SPLASH)
|
|
|
|
.enemyLevel(3);
|
2024-10-03 11:17:51 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
it("applies stat changes after last hit", async () => {
|
2024-10-06 23:29:57 -04:00
|
|
|
game.override.enemySpecies(Species.FORRETRESS);
|
|
|
|
|
|
|
|
await game.classicMode.startBattle([ Species.MINCCINO ]);
|
2024-10-03 11:17:51 -04:00
|
|
|
const minccino = game.scene.getPlayerPokemon()!;
|
|
|
|
game.move.select(Moves.SCALE_SHOT);
|
2024-10-06 23:29:57 -04:00
|
|
|
|
|
|
|
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
|
|
|
|
|
2024-10-03 11:17:51 -04:00
|
|
|
await game.phaseInterceptor.to(MoveEffectPhase);
|
2024-11-25 14:15:39 -08:00
|
|
|
await game.phaseInterceptor.to(DamageAnimPhase);
|
2024-10-06 23:29:57 -04:00
|
|
|
|
|
|
|
//check that stats haven't changed after one or two hits have occurred
|
2024-10-03 11:17:51 -04:00
|
|
|
await game.phaseInterceptor.to(MoveEffectPhase);
|
2024-10-06 23:29:57 -04:00
|
|
|
expect(minccino.getStatStage(Stat.DEF)).toBe(0);
|
|
|
|
expect(minccino.getStatStage(Stat.SPD)).toBe(0);
|
|
|
|
|
|
|
|
//check that stats changed on last hit
|
2024-10-03 11:17:51 -04:00
|
|
|
await game.phaseInterceptor.to(MoveEndPhase);
|
2024-10-06 23:29:57 -04:00
|
|
|
expect(minccino.getStatStage(Stat.DEF)).toBe(-1);
|
|
|
|
expect(minccino.getStatStage(Stat.SPD)).toBe(1);
|
2024-10-03 11:17:51 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
it("unaffected by sheer force", async () => {
|
2024-10-06 23:29:57 -04:00
|
|
|
const moveToCheck = allMoves[Moves.SCALE_SHOT];
|
|
|
|
const basePower = moveToCheck.power;
|
|
|
|
|
|
|
|
game.override.enemySpecies(Species.WOBBUFFET);
|
|
|
|
|
|
|
|
vi.spyOn(moveToCheck, "calculateBattlePower");
|
|
|
|
|
|
|
|
await game.classicMode.startBattle([ Species.MINCCINO ]);
|
2024-10-03 11:17:51 -04:00
|
|
|
const minccino = game.scene.getPlayerPokemon()!;
|
2024-10-06 23:29:57 -04:00
|
|
|
|
2024-10-03 11:17:51 -04:00
|
|
|
game.move.select(Moves.SCALE_SHOT);
|
|
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
2024-10-06 23:29:57 -04:00
|
|
|
|
2024-10-03 11:17:51 -04:00
|
|
|
//effect not nullified by sheer force
|
2024-10-06 23:29:57 -04:00
|
|
|
expect(minccino.getStatStage(Stat.DEF)).toBe(-1);
|
|
|
|
expect(minccino.getStatStage(Stat.SPD)).toBe(1);
|
|
|
|
|
|
|
|
//power not boosted by sheer force
|
|
|
|
expect(moveToCheck.calculateBattlePower).toHaveReturnedWith(basePower);
|
2024-10-03 11:17:51 -04:00
|
|
|
});
|
|
|
|
});
|