mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-04 07:22:19 +02:00
Fixed test
This commit is contained in:
parent
c06c1bfbaf
commit
4cd9399681
@ -2,6 +2,7 @@ import { getPokemonNameWithAffix } from "#app/messages";
|
|||||||
import { getEnumValues, toReadableString } from "#app/utils/common";
|
import { getEnumValues, toReadableString } from "#app/utils/common";
|
||||||
import { AbilityId } from "#enums/ability-id";
|
import { AbilityId } from "#enums/ability-id";
|
||||||
import { MoveId } from "#enums/move-id";
|
import { MoveId } from "#enums/move-id";
|
||||||
|
import { MoveResult } from "#enums/move-result";
|
||||||
import { SpeciesId } from "#enums/species-id";
|
import { SpeciesId } from "#enums/species-id";
|
||||||
import { WeatherType } from "#enums/weather-type";
|
import { WeatherType } from "#enums/weather-type";
|
||||||
import GameManager from "#test/testUtils/gameManager";
|
import GameManager from "#test/testUtils/gameManager";
|
||||||
@ -9,7 +10,7 @@ import i18next from "i18next";
|
|||||||
import Phaser from "phaser";
|
import Phaser from "phaser";
|
||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||||
|
|
||||||
describe("Moves - Recovery Moves", () => {
|
describe("Moves - Recovery Moves - ", () => {
|
||||||
let phaserGame: Phaser.Game;
|
let phaserGame: Phaser.Game;
|
||||||
let game: GameManager;
|
let game: GameManager;
|
||||||
|
|
||||||
@ -19,30 +20,33 @@ describe("Moves - Recovery Moves", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
game.phaseInterceptor.restoreOg();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
game = new GameManager(phaserGame);
|
||||||
|
game.override
|
||||||
|
.ability(AbilityId.BALL_FETCH)
|
||||||
|
.battleStyle("single")
|
||||||
|
.criticalHits(false)
|
||||||
|
.enemySpecies(SpeciesId.MAGIKARP)
|
||||||
|
.enemyAbility(AbilityId.BALL_FETCH)
|
||||||
|
.enemyMoveset(MoveId.SPLASH)
|
||||||
|
.startingLevel(100)
|
||||||
|
.enemyLevel(100);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
describe.each<{ name: string; move: MoveId }>([
|
describe.each<{ name: string; move: MoveId }>([
|
||||||
{ name: "Recover", move: MoveId.RECOVER },
|
{ name: "Recover", move: MoveId.RECOVER },
|
||||||
{ name: "Soft-Boiled", move: MoveId.SOFT_BOILED },
|
{ name: "Soft-Boiled", move: MoveId.SOFT_BOILED },
|
||||||
{ name: "Milk Drink", move: MoveId.MILK_DRINK },
|
{ name: "Milk Drink", move: MoveId.MILK_DRINK },
|
||||||
{ name: "Slack Off", move: MoveId.SLACK_OFF },
|
{ name: "Slack Off", move: MoveId.SLACK_OFF },
|
||||||
{ name: "Roost", move: MoveId.ROOST },
|
{ name: "Roost", move: MoveId.ROOST },
|
||||||
])("Normal Recovery Moves - $name", ({ move }) => {
|
{ name: "Weather-based Healing Moves", move: MoveId.SYNTHESIS },
|
||||||
afterEach(() => {
|
{ name: "Shore Up", move: MoveId.SHORE_UP },
|
||||||
game.phaseInterceptor.restoreOg();
|
])("$name", ({ move }) => {
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
game = new GameManager(phaserGame);
|
|
||||||
game.override
|
|
||||||
.ability(AbilityId.BALL_FETCH)
|
|
||||||
.battleStyle("single")
|
|
||||||
.criticalHits(false)
|
|
||||||
.enemySpecies(SpeciesId.MAGIKARP)
|
|
||||||
.enemyAbility(AbilityId.BALL_FETCH)
|
|
||||||
.enemyMoveset(MoveId.SPLASH)
|
|
||||||
.startingLevel(100)
|
|
||||||
.enemyLevel(100);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should heal 50% of the user's maximum HP", async () => {
|
it("should heal 50% of the user's maximum HP", async () => {
|
||||||
await game.classicMode.startBattle([SpeciesId.BLISSEY]);
|
await game.classicMode.startBattle([SpeciesId.BLISSEY]);
|
||||||
|
|
||||||
@ -56,7 +60,7 @@ describe("Moves - Recovery Moves", () => {
|
|||||||
expect(game.phaseInterceptor.log).toContain("PokemonHealPhase");
|
expect(game.phaseInterceptor.log).toContain("PokemonHealPhase");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should display message and fail if used at full HP", async () => {
|
it("should display message without adding phase if used at full HP", async () => {
|
||||||
await game.classicMode.startBattle([SpeciesId.BLISSEY]);
|
await game.classicMode.startBattle([SpeciesId.BLISSEY]);
|
||||||
|
|
||||||
game.move.use(move);
|
game.move.use(move);
|
||||||
@ -73,29 +77,12 @@ describe("Moves - Recovery Moves", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Weather-based Healing moves", () => {
|
describe("Weather-based Healing Moves", () => {
|
||||||
afterEach(() => {
|
|
||||||
game.phaseInterceptor.restoreOg();
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
game = new GameManager(phaserGame);
|
|
||||||
game.override
|
|
||||||
.ability(AbilityId.BALL_FETCH)
|
|
||||||
.battleStyle("single")
|
|
||||||
.criticalHits(false)
|
|
||||||
.enemySpecies(SpeciesId.MAGIKARP)
|
|
||||||
.enemyAbility(AbilityId.BALL_FETCH)
|
|
||||||
.enemyMoveset(MoveId.SPLASH)
|
|
||||||
.startingLevel(100)
|
|
||||||
.enemyLevel(100);
|
|
||||||
});
|
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
{ name: "Harsh Sunlight", ability: AbilityId.DROUGHT },
|
{ name: "Harsh Sunlight", weather: WeatherType.SUNNY },
|
||||||
{ name: "Extremely Harsh Sunlight", ability: AbilityId.DESOLATE_LAND },
|
{ name: "Extremely Harsh Sunlight", weather: WeatherType.HARSH_SUN },
|
||||||
])("should heal 66% of the user's maximum HP under $name", async ({ ability }) => {
|
])("should heal 66% of the user's maximum HP under $name", async ({ weather }) => {
|
||||||
game.override.passiveAbility(ability);
|
game.override.weather(weather);
|
||||||
await game.classicMode.startBattle([SpeciesId.BLISSEY]);
|
await game.classicMode.startBattle([SpeciesId.BLISSEY]);
|
||||||
|
|
||||||
const blissey = game.field.getPlayerPokemon();
|
const blissey = game.field.getPlayerPokemon();
|
||||||
@ -107,8 +94,10 @@ describe("Moves - Recovery Moves", () => {
|
|||||||
expect(blissey.getHpRatio()).toBeCloseTo(0.66, 1);
|
expect(blissey.getHpRatio()).toBeCloseTo(0.66, 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
const nonSunWTs = getEnumValues(WeatherType)
|
const nonSunWTs = (getEnumValues(WeatherType) as WeatherType[])
|
||||||
.filter(wt => ![WeatherType.NONE, WeatherType.STRONG_WINDS].includes(wt))
|
.filter(
|
||||||
|
wt => ![WeatherType.SUNNY, WeatherType.HARSH_SUN, WeatherType.NONE, WeatherType.STRONG_WINDS].includes(wt),
|
||||||
|
)
|
||||||
.map(wt => ({
|
.map(wt => ({
|
||||||
name: toReadableString(WeatherType[wt]),
|
name: toReadableString(WeatherType[wt]),
|
||||||
weather: wt,
|
weather: wt,
|
||||||
@ -142,25 +131,8 @@ describe("Moves - Recovery Moves", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("Shore Up", () => {
|
describe("Shore Up", () => {
|
||||||
afterEach(() => {
|
it("should heal 66% of the user's maximum HP in a sandstorm", async () => {
|
||||||
game.phaseInterceptor.restoreOg();
|
game.override.weather(WeatherType.SANDSTORM);
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
game = new GameManager(phaserGame);
|
|
||||||
game.override
|
|
||||||
.ability(AbilityId.BALL_FETCH)
|
|
||||||
.battleStyle("single")
|
|
||||||
.criticalHits(false)
|
|
||||||
.enemySpecies(SpeciesId.MAGIKARP)
|
|
||||||
.enemyAbility(AbilityId.BALL_FETCH)
|
|
||||||
.enemyMoveset(MoveId.SPLASH)
|
|
||||||
.startingLevel(100)
|
|
||||||
.enemyLevel(100);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should heal 66% of the user's maximum HP under sandstorm", async () => {
|
|
||||||
game.override.ability(AbilityId.SAND_STREAM);
|
|
||||||
await game.classicMode.startBattle([SpeciesId.BLISSEY]);
|
await game.classicMode.startBattle([SpeciesId.BLISSEY]);
|
||||||
|
|
||||||
const blissey = game.field.getPlayerPokemon();
|
const blissey = game.field.getPlayerPokemon();
|
||||||
|
Loading…
Reference in New Issue
Block a user