2024-09-17 19:41:46 -07:00
|
|
|
import { BattlerIndex } from "#app/battle";
|
|
|
|
import { allMoves } from "#app/data/move";
|
|
|
|
import { BattlerTagType } from "#app/enums/battler-tag-type";
|
2025-01-12 15:33:05 -08:00
|
|
|
import type { DamageCalculationResult } from "#app/field/pokemon";
|
2024-09-17 19:41:46 -07:00
|
|
|
import { Abilities } from "#enums/abilities";
|
|
|
|
import { Moves } from "#enums/moves";
|
|
|
|
import { Species } from "#enums/species";
|
2025-02-22 22:52:07 -06:00
|
|
|
import GameManager from "#test/testUtils/gameManager";
|
2024-09-17 19:41:46 -07:00
|
|
|
import Phaser from "phaser";
|
|
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
|
|
|
|
|
|
|
describe("Moves - Steamroller", () => {
|
|
|
|
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-10-04 13:08:31 +08:00
|
|
|
game.override.moveset([ Moves.STEAMROLLER ]).battleType("single").enemyAbility(Abilities.BALL_FETCH);
|
2024-09-17 19:41:46 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
it("should always hit a minimzed target with double damage", async () => {
|
|
|
|
game.override.enemySpecies(Species.DITTO).enemyMoveset(Moves.MINIMIZE);
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.IRON_BOULDER ]);
|
2024-09-17 19:41:46 -07:00
|
|
|
|
|
|
|
const ditto = game.scene.getEnemyPokemon()!;
|
|
|
|
vi.spyOn(ditto, "getAttackDamage");
|
|
|
|
ditto.hp = 5000;
|
|
|
|
const steamroller = allMoves[Moves.STEAMROLLER];
|
|
|
|
vi.spyOn(steamroller, "calculateBattleAccuracy");
|
|
|
|
const ironBoulder = game.scene.getPlayerPokemon()!;
|
|
|
|
vi.spyOn(ironBoulder, "getAccuracyMultiplier");
|
|
|
|
// Turn 1
|
|
|
|
game.move.select(Moves.STEAMROLLER);
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
|
2024-09-17 19:41:46 -07:00
|
|
|
await game.toNextTurn();
|
|
|
|
// Turn 2
|
|
|
|
game.move.select(Moves.STEAMROLLER);
|
|
|
|
await game.toNextTurn();
|
|
|
|
|
2024-10-04 13:08:31 +08:00
|
|
|
const [ dmgCalcTurn1, dmgCalcTurn2 ]: DamageCalculationResult[] = vi
|
2024-09-17 19:41:46 -07:00
|
|
|
.mocked(ditto.getAttackDamage)
|
|
|
|
.mock.results.map((r) => r.value);
|
|
|
|
|
|
|
|
expect(dmgCalcTurn2.damage).toBeGreaterThanOrEqual(dmgCalcTurn1.damage * 2);
|
|
|
|
expect(ditto.getTag(BattlerTagType.MINIMIZED)).toBeDefined();
|
|
|
|
expect(steamroller.calculateBattleAccuracy).toHaveReturnedWith(-1);
|
|
|
|
});
|
|
|
|
});
|