mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-29 21:12:45 +02:00
* Move game-mode to its own file Reduces circular imports to 325 * Move battler-index to own file Reduces circular deps to 314 * Move trainer-variant to own file Reduces circ deps to 313 * Move enums in pokemon to their own file * Move arena-tag-type to its own file * Move pokemon-moves to its own file * Move command to own file * Move learnMoveType to own file * Move form change item to own file * Move battlerTagLapseType to own file * Move anim enums to own shared file * Move enums out of challenges * Move species form change triggers to own file Reduces circ imports to 291 * Update test importing pokemon move * Replace move attribute imports with string names * Untangle circular deps from game data * Fix missing string call in switch summon phase * Apply kev's suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Ensure ChargeMove's is method calls super * Use InstanceType for proper narrowing * Apply kev's suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
164 lines
6.4 KiB
TypeScript
164 lines
6.4 KiB
TypeScript
import { BattlerIndex } from "#enums/battler-index";
|
|
import { allMoves } from "#app/data/data-lists";
|
|
import { DamageAnimPhase } from "#app/phases/damage-anim-phase";
|
|
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
|
|
import { MoveId } from "#enums/move-id";
|
|
import type Move from "#app/data/moves/move";
|
|
import { SpeciesId } from "#enums/species-id";
|
|
import GameManager from "#test/testUtils/gameManager";
|
|
import Phaser from "phaser";
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
|
|
|
describe("Moves - Dynamax Cannon", () => {
|
|
let phaserGame: Phaser.Game;
|
|
let game: GameManager;
|
|
|
|
let dynamaxCannon: Move;
|
|
|
|
beforeAll(() => {
|
|
phaserGame = new Phaser.Game({
|
|
type: Phaser.HEADLESS,
|
|
});
|
|
});
|
|
|
|
afterEach(() => {
|
|
game.phaseInterceptor.restoreOg();
|
|
});
|
|
|
|
beforeEach(() => {
|
|
dynamaxCannon = allMoves[MoveId.DYNAMAX_CANNON];
|
|
game = new GameManager(phaserGame);
|
|
|
|
game.override
|
|
.moveset(MoveId.DYNAMAX_CANNON)
|
|
.startingLevel(200)
|
|
.levelCap(10)
|
|
.battleStyle("single")
|
|
.disableCrits()
|
|
.enemySpecies(SpeciesId.MAGIKARP)
|
|
.enemyMoveset(MoveId.SPLASH);
|
|
|
|
// Note that, for Waves 1-10, the level cap is 10
|
|
game.override.startingWave(1);
|
|
game.override.battleStyle("single");
|
|
game.override.disableCrits();
|
|
|
|
game.override.enemySpecies(SpeciesId.MAGIKARP);
|
|
game.override.enemyMoveset([MoveId.SPLASH, MoveId.SPLASH, MoveId.SPLASH, MoveId.SPLASH]);
|
|
|
|
vi.spyOn(dynamaxCannon, "calculateBattlePower");
|
|
});
|
|
|
|
it("should return 100 power against an enemy below level cap", async () => {
|
|
game.override.enemyLevel(1);
|
|
await game.classicMode.startBattle([SpeciesId.ETERNATUS]);
|
|
|
|
game.move.select(dynamaxCannon.id);
|
|
|
|
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
|
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(dynamaxCannon.id);
|
|
await game.phaseInterceptor.to(DamageAnimPhase, false);
|
|
expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(100);
|
|
}, 20000);
|
|
|
|
it("should return 100 power against an enemy at level cap", async () => {
|
|
game.override.enemyLevel(10);
|
|
await game.classicMode.startBattle([SpeciesId.ETERNATUS]);
|
|
|
|
game.move.select(dynamaxCannon.id);
|
|
|
|
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
|
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(dynamaxCannon.id);
|
|
await game.phaseInterceptor.to(DamageAnimPhase, false);
|
|
expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(100);
|
|
}, 20000);
|
|
|
|
it("should return 120 power against an enemy 1% above level cap", async () => {
|
|
game.override.enemyLevel(101);
|
|
await game.classicMode.startBattle([SpeciesId.ETERNATUS]);
|
|
|
|
game.move.select(dynamaxCannon.id);
|
|
|
|
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
|
const phase = game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase;
|
|
expect(phase.move.id).toBe(dynamaxCannon.id);
|
|
// Force level cap to be 100
|
|
vi.spyOn(game.scene, "getMaxExpLevel").mockReturnValue(100);
|
|
await game.phaseInterceptor.to(DamageAnimPhase, false);
|
|
expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(120);
|
|
}, 20000);
|
|
|
|
it("should return 140 power against an enemy 2% above level capp", async () => {
|
|
game.override.enemyLevel(102);
|
|
await game.classicMode.startBattle([SpeciesId.ETERNATUS]);
|
|
|
|
game.move.select(dynamaxCannon.id);
|
|
|
|
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
|
const phase = game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase;
|
|
expect(phase.move.id).toBe(dynamaxCannon.id);
|
|
// Force level cap to be 100
|
|
vi.spyOn(game.scene, "getMaxExpLevel").mockReturnValue(100);
|
|
await game.phaseInterceptor.to(DamageAnimPhase, false);
|
|
expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(140);
|
|
}, 20000);
|
|
|
|
it("should return 160 power against an enemy 3% above level cap", async () => {
|
|
game.override.enemyLevel(103);
|
|
await game.classicMode.startBattle([SpeciesId.ETERNATUS]);
|
|
|
|
game.move.select(dynamaxCannon.id);
|
|
|
|
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
|
const phase = game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase;
|
|
expect(phase.move.id).toBe(dynamaxCannon.id);
|
|
// Force level cap to be 100
|
|
vi.spyOn(game.scene, "getMaxExpLevel").mockReturnValue(100);
|
|
await game.phaseInterceptor.to(DamageAnimPhase, false);
|
|
expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(160);
|
|
}, 20000);
|
|
|
|
it("should return 180 power against an enemy 4% above level cap", async () => {
|
|
game.override.enemyLevel(104);
|
|
await game.classicMode.startBattle([SpeciesId.ETERNATUS]);
|
|
|
|
game.move.select(dynamaxCannon.id);
|
|
|
|
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
|
const phase = game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase;
|
|
expect(phase.move.id).toBe(dynamaxCannon.id);
|
|
// Force level cap to be 100
|
|
vi.spyOn(game.scene, "getMaxExpLevel").mockReturnValue(100);
|
|
await game.phaseInterceptor.to(DamageAnimPhase, false);
|
|
expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(180);
|
|
}, 20000);
|
|
|
|
it("should return 200 power against an enemy 5% above level cap", async () => {
|
|
game.override.enemyLevel(105);
|
|
await game.classicMode.startBattle([SpeciesId.ETERNATUS]);
|
|
|
|
game.move.select(dynamaxCannon.id);
|
|
|
|
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
|
const phase = game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase;
|
|
expect(phase.move.id).toBe(dynamaxCannon.id);
|
|
// Force level cap to be 100
|
|
vi.spyOn(game.scene, "getMaxExpLevel").mockReturnValue(100);
|
|
await game.phaseInterceptor.to(DamageAnimPhase, false);
|
|
expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(200);
|
|
}, 20000);
|
|
|
|
it("should return 200 power against an enemy way above level cap", async () => {
|
|
game.override.enemyLevel(999);
|
|
await game.classicMode.startBattle([SpeciesId.ETERNATUS]);
|
|
|
|
game.move.select(dynamaxCannon.id);
|
|
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
|
|
|
|
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
|
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(dynamaxCannon.id);
|
|
await game.phaseInterceptor.to(DamageAnimPhase, false);
|
|
expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(200);
|
|
}, 20000);
|
|
});
|