Update first-attack-double-power.test.ts

This commit is contained in:
Bertie690 2025-05-20 23:38:15 -04:00 committed by GitHub
parent 0fa44d13a5
commit 3f5d78266a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,8 +9,8 @@ import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi, type MockInstance } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi, type MockInstance } from "vitest";
describe.each<{ name: string; move: Moves }>([ describe.each<{ name: string; move: Moves }>([
{ name: "Fishious Rend", move: Moves.FISHIOUS_REND },
{ name: "Bolt Beak", move: Moves.BOLT_BEAK }, { name: "Bolt Beak", move: Moves.BOLT_BEAK },
{ name: "Fishious Rend", move: Moves.FISHIOUS_REND },
])("Moves - $name", ({ move }) => { ])("Moves - $name", ({ move }) => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
let game: GameManager; let game: GameManager;
@ -35,14 +35,14 @@ describe.each<{ name: string; move: Moves }>([
.battleType(BattleType.TRAINER) .battleType(BattleType.TRAINER)
.disableCrits() .disableCrits()
.enemyLevel(100) .enemyLevel(100)
.enemySpecies(Species.MAGIKARP) .enemySpecies(Species.DRACOVISH)
.enemyAbility(Abilities.BALL_FETCH) .enemyAbility(Abilities.BALL_FETCH)
.enemyMoveset(Moves.SPLASH); .enemyMoveset(Moves.SPLASH);
powerSpy = vi.spyOn(allMoves[move], "calculateBattlePower"); powerSpy = vi.spyOn(allMoves[move], "calculateBattlePower");
}); });
it("should double power when the user moves after the target", async () => { it("should double power if the user moves before the target", async () => {
await game.classicMode.startBattle([Species.FEEBAS]); await game.classicMode.startBattle([Species.FEEBAS]);
// turn 1: enemy, then player (no boost) // turn 1: enemy, then player (no boost)
@ -54,7 +54,20 @@ describe.each<{ name: string; move: Moves }>([
// turn 2: player, then enemy (boost) // turn 2: player, then enemy (boost)
game.move.select(move); game.move.select(move);
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]); await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.toNextTurn();
expect(powerSpy).toHaveLastReturnedWith(allMoves[move].power * 2);
});
it("should only consider the selected target in Double Battles", async () => {
game.override.battleStyle("double").moveset([move, Moves.SPLASH]);
await game.classicMode.startBattle([Species.FEEBAS, Species.MILOTIC]);
// Use move after everyone but P1 and enemy 1 have already moved
game.move.select(move, BattlerIndex.PLAYER, BattlerIndex.ENEMY);
game.move.select(Moves.SPLASH, BattlerIndex.PLAYER_2);
await game.setTurnOrder([BattlerIndex.PLAYER_2, BattlerIndex.ENEMY_2, BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.toNextTurn(); await game.toNextTurn();
expect(powerSpy).toHaveLastReturnedWith(allMoves[move].power * 2); expect(powerSpy).toHaveLastReturnedWith(allMoves[move].power * 2);
@ -74,8 +87,8 @@ describe.each<{ name: string; move: Moves }>([
it.todo.each<{ type: string; allyMove: Moves }>([ it.todo.each<{ type: string; allyMove: Moves }>([
{ type: "a Dancer-induced", allyMove: Moves.FIERY_DANCE }, { type: "a Dancer-induced", allyMove: Moves.FIERY_DANCE },
{ type: "an Instructed", allyMove: Moves.INSTRUCT }, { type: "an Instructed", allyMove: Moves.INSTRUCT },
])("should double power if $type move is used as the target's first action", async ({ allyMove }) => { ])("should double power if $type move is used as the target's first action that turn", async ({ allyMove }) => {
game.override.battleStyle("double").moveset([move, allyMove]).ability(Abilities.DANCER); game.override.battleStyle("double").moveset([move, allyMove]).enemyAbility(Abilities.DANCER);
await game.classicMode.startBattle([Species.DRACOVISH, Species.ARCTOZOLT]); await game.classicMode.startBattle([Species.DRACOVISH, Species.ARCTOZOLT]);
// Simulate enemy having used splash last turn to allow Instruct to copy it // Simulate enemy having used splash last turn to allow Instruct to copy it