mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 17:12:44 +02:00
Condensed all status immunity tests under 1 roof
This commit is contained in:
parent
b9a4e631db
commit
059b9b2a95
@ -4453,7 +4453,7 @@ export class PreSetStatusAbAttr extends AbAttr {
|
|||||||
_pokemon: Pokemon,
|
_pokemon: Pokemon,
|
||||||
_passive: boolean,
|
_passive: boolean,
|
||||||
_simulated: boolean,
|
_simulated: boolean,
|
||||||
_effect: StatusEffect | undefined,
|
_effect: StatusEffect,
|
||||||
_cancelled: BooleanHolder,
|
_cancelled: BooleanHolder,
|
||||||
_args: any[],
|
_args: any[],
|
||||||
): boolean {
|
): boolean {
|
||||||
@ -4464,7 +4464,7 @@ export class PreSetStatusAbAttr extends AbAttr {
|
|||||||
_pokemon: Pokemon,
|
_pokemon: Pokemon,
|
||||||
_passive: boolean,
|
_passive: boolean,
|
||||||
_simulated: boolean,
|
_simulated: boolean,
|
||||||
_effect: StatusEffect | undefined,
|
_effect: StatusEffect,
|
||||||
_cancelled: BooleanHolder,
|
_cancelled: BooleanHolder,
|
||||||
_args: any[],
|
_args: any[],
|
||||||
): void {}
|
): void {}
|
||||||
|
@ -583,7 +583,7 @@ export function applyPostStatStageChangeAbAttrs<K extends AbAttrString>(
|
|||||||
export function applyPreSetStatusAbAttrs<K extends AbAttrString>(
|
export function applyPreSetStatusAbAttrs<K extends AbAttrString>(
|
||||||
attrType: AbAttrMap[K] extends PreSetStatusAbAttr ? K : never,
|
attrType: AbAttrMap[K] extends PreSetStatusAbAttr ? K : never,
|
||||||
pokemon: Pokemon,
|
pokemon: Pokemon,
|
||||||
effect: StatusEffect | undefined,
|
effect: StatusEffect,
|
||||||
cancelled: BooleanHolder,
|
cancelled: BooleanHolder,
|
||||||
simulated = false,
|
simulated = false,
|
||||||
...args: any[]
|
...args: any[]
|
||||||
|
@ -1,51 +0,0 @@
|
|||||||
import { AbilityId } from "#enums/ability-id";
|
|
||||||
import { MoveId } from "#enums/move-id";
|
|
||||||
import { SpeciesId } from "#enums/species-id";
|
|
||||||
import { StatusEffect } from "#enums/status-effect";
|
|
||||||
import GameManager from "#test/testUtils/gameManager";
|
|
||||||
import Phaser from "phaser";
|
|
||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
||||||
|
|
||||||
describe("Abilities - Insomnia", () => {
|
|
||||||
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
|
|
||||||
.moveset([MoveId.SPLASH])
|
|
||||||
.ability(AbilityId.BALL_FETCH)
|
|
||||||
.battleStyle("single")
|
|
||||||
.disableCrits()
|
|
||||||
.enemySpecies(SpeciesId.MAGIKARP)
|
|
||||||
.enemyAbility(AbilityId.BALL_FETCH)
|
|
||||||
.enemyMoveset(MoveId.SPLASH);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should remove sleep when gained", async () => {
|
|
||||||
game.override
|
|
||||||
.ability(AbilityId.INSOMNIA)
|
|
||||||
.enemyAbility(AbilityId.BALL_FETCH)
|
|
||||||
.moveset(MoveId.SKILL_SWAP)
|
|
||||||
.enemyMoveset(MoveId.SPLASH);
|
|
||||||
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
|
||||||
const enemy = game.scene.getEnemyPokemon();
|
|
||||||
enemy?.trySetStatus(StatusEffect.SLEEP);
|
|
||||||
expect(enemy?.status?.effect).toBe(StatusEffect.SLEEP);
|
|
||||||
|
|
||||||
game.move.select(MoveId.SKILL_SWAP);
|
|
||||||
await game.phaseInterceptor.to("BerryPhase");
|
|
||||||
|
|
||||||
expect(enemy?.status).toBeNull();
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,51 +0,0 @@
|
|||||||
import { AbilityId } from "#enums/ability-id";
|
|
||||||
import { MoveId } from "#enums/move-id";
|
|
||||||
import { SpeciesId } from "#enums/species-id";
|
|
||||||
import { StatusEffect } from "#enums/status-effect";
|
|
||||||
import GameManager from "#test/testUtils/gameManager";
|
|
||||||
import Phaser from "phaser";
|
|
||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
||||||
|
|
||||||
describe("Abilities - Limber", () => {
|
|
||||||
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
|
|
||||||
.moveset([MoveId.SPLASH])
|
|
||||||
.ability(AbilityId.BALL_FETCH)
|
|
||||||
.battleStyle("single")
|
|
||||||
.disableCrits()
|
|
||||||
.enemySpecies(SpeciesId.MAGIKARP)
|
|
||||||
.enemyAbility(AbilityId.BALL_FETCH)
|
|
||||||
.enemyMoveset(MoveId.SPLASH);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should remove paralysis when gained", async () => {
|
|
||||||
game.override
|
|
||||||
.ability(AbilityId.LIMBER)
|
|
||||||
.enemyAbility(AbilityId.BALL_FETCH)
|
|
||||||
.moveset(MoveId.SKILL_SWAP)
|
|
||||||
.enemyMoveset(MoveId.SPLASH);
|
|
||||||
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
|
||||||
const enemy = game.scene.getEnemyPokemon();
|
|
||||||
enemy?.trySetStatus(StatusEffect.PARALYSIS);
|
|
||||||
expect(enemy?.status?.effect).toBe(StatusEffect.PARALYSIS);
|
|
||||||
|
|
||||||
game.move.select(MoveId.SKILL_SWAP);
|
|
||||||
await game.phaseInterceptor.to("BerryPhase");
|
|
||||||
|
|
||||||
expect(enemy?.status).toBeNull();
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,51 +0,0 @@
|
|||||||
import { AbilityId } from "#enums/ability-id";
|
|
||||||
import { MoveId } from "#enums/move-id";
|
|
||||||
import { SpeciesId } from "#enums/species-id";
|
|
||||||
import { StatusEffect } from "#enums/status-effect";
|
|
||||||
import GameManager from "#test/testUtils/gameManager";
|
|
||||||
import Phaser from "phaser";
|
|
||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
||||||
|
|
||||||
describe("Abilities - Magma Armor", () => {
|
|
||||||
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
|
|
||||||
.moveset([MoveId.SPLASH])
|
|
||||||
.ability(AbilityId.BALL_FETCH)
|
|
||||||
.battleStyle("single")
|
|
||||||
.disableCrits()
|
|
||||||
.enemySpecies(SpeciesId.MAGIKARP)
|
|
||||||
.enemyAbility(AbilityId.BALL_FETCH)
|
|
||||||
.enemyMoveset(MoveId.SPLASH);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should remove freeze when gained", async () => {
|
|
||||||
game.override
|
|
||||||
.ability(AbilityId.MAGMA_ARMOR)
|
|
||||||
.enemyAbility(AbilityId.BALL_FETCH)
|
|
||||||
.moveset(MoveId.SKILL_SWAP)
|
|
||||||
.enemyMoveset(MoveId.SPLASH);
|
|
||||||
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
|
||||||
const enemy = game.scene.getEnemyPokemon();
|
|
||||||
enemy?.trySetStatus(StatusEffect.FREEZE);
|
|
||||||
expect(enemy?.status?.effect).toBe(StatusEffect.FREEZE);
|
|
||||||
|
|
||||||
game.move.select(MoveId.SKILL_SWAP);
|
|
||||||
await game.phaseInterceptor.to("BerryPhase");
|
|
||||||
|
|
||||||
expect(enemy?.status).toBeNull();
|
|
||||||
});
|
|
||||||
});
|
|
90
test/abilities/status-immunity-ab-attrs.test.ts
Normal file
90
test/abilities/status-immunity-ab-attrs.test.ts
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
import { allMoves } from "#app/data/data-lists";
|
||||||
|
import { StatusEffectAttr } from "#app/data/moves/move";
|
||||||
|
import { toReadableString } from "#app/utils/common";
|
||||||
|
import { AbilityId } from "#enums/ability-id";
|
||||||
|
import { MoveId } from "#enums/move-id";
|
||||||
|
import { MoveResult } from "#enums/move-result";
|
||||||
|
import { SpeciesId } from "#enums/species-id";
|
||||||
|
import { StatusEffect } from "#enums/status-effect";
|
||||||
|
import GameManager from "#test/testUtils/gameManager";
|
||||||
|
import Phaser from "phaser";
|
||||||
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
|
|
||||||
|
describe.each<{ name: string; ability: AbilityId; status: StatusEffect }>([
|
||||||
|
{ name: "Vital Spirit", ability: AbilityId.VITAL_SPIRIT, status: StatusEffect.SLEEP },
|
||||||
|
{ name: "Insomnia", ability: AbilityId.INSOMNIA, status: StatusEffect.SLEEP },
|
||||||
|
{ name: "Immunity", ability: AbilityId.IMMUNITY, status: StatusEffect.POISON },
|
||||||
|
{ name: "Magma Armor", ability: AbilityId.MAGMA_ARMOR, status: StatusEffect.FREEZE },
|
||||||
|
{ name: "Limber", ability: AbilityId.LIMBER, status: StatusEffect.PARALYSIS },
|
||||||
|
{ name: "Thermal Exchange", ability: AbilityId.THERMAL_EXCHANGE, status: StatusEffect.BURN },
|
||||||
|
{ name: "Water Veil", ability: AbilityId.WATER_VEIL, status: StatusEffect.BURN },
|
||||||
|
{ name: "Water Bubble", ability: AbilityId.WATER_BUBBLE, status: StatusEffect.BURN },
|
||||||
|
])("Abilities - $name", ({ ability, status }) => {
|
||||||
|
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
|
||||||
|
.battleStyle("single")
|
||||||
|
.disableCrits()
|
||||||
|
.startingLevel(100)
|
||||||
|
.enemySpecies(SpeciesId.MAGIKARP)
|
||||||
|
.enemyAbility(ability)
|
||||||
|
.enemyMoveset(MoveId.SPLASH);
|
||||||
|
|
||||||
|
// Mock Lumina Crash and Spore to be our status-inflicting moves of choice
|
||||||
|
vi.spyOn(allMoves[MoveId.LUMINA_CRASH], "attrs", "get").mockReturnValue([new StatusEffectAttr(status, false)]);
|
||||||
|
vi.spyOn(allMoves[MoveId.SPORE], "attrs", "get").mockReturnValue([new StatusEffectAttr(status, false)]);
|
||||||
|
});
|
||||||
|
|
||||||
|
const statusStr = toReadableString(StatusEffect[status]);
|
||||||
|
|
||||||
|
it(`should prevent application of ${statusStr} without failing damaging moves`, async () => {
|
||||||
|
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
||||||
|
|
||||||
|
const karp = game.field.getEnemyPokemon();
|
||||||
|
expect(karp.canSetStatus(status)).toBe(false);
|
||||||
|
|
||||||
|
game.move.use(MoveId.LUMINA_CRASH);
|
||||||
|
await game.toEndOfTurn();
|
||||||
|
|
||||||
|
expect(karp.status?.effect).toBeUndefined();
|
||||||
|
expect(game.field.getPlayerPokemon().getLastXMoves()[0].result).toBe(MoveResult.SUCCESS);
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should cure ${statusStr} upon being gained`, async () => {
|
||||||
|
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
||||||
|
|
||||||
|
const feebas = game.field.getPlayerPokemon();
|
||||||
|
feebas.doSetStatus(status);
|
||||||
|
expect(feebas.status?.effect).toBe(status);
|
||||||
|
|
||||||
|
game.move.use(MoveId.SKILL_SWAP);
|
||||||
|
await game.toEndOfTurn();
|
||||||
|
|
||||||
|
expect(feebas.status?.effect).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
// TODO: This does not propagate failures currently
|
||||||
|
it.todo(`should cause status moves inflicting ${statusStr} to count as failed`, async () => {
|
||||||
|
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
||||||
|
|
||||||
|
game.move.use(MoveId.SPORE);
|
||||||
|
await game.toEndOfTurn();
|
||||||
|
|
||||||
|
const karp = game.field.getEnemyPokemon();
|
||||||
|
expect(karp.status?.effect).toBeUndefined();
|
||||||
|
expect(game.field.getPlayerPokemon().getLastXMoves()[0].result).toBe(MoveResult.FAIL);
|
||||||
|
});
|
||||||
|
});
|
@ -1,51 +0,0 @@
|
|||||||
import { AbilityId } from "#enums/ability-id";
|
|
||||||
import { MoveId } from "#enums/move-id";
|
|
||||||
import { SpeciesId } from "#enums/species-id";
|
|
||||||
import { StatusEffect } from "#enums/status-effect";
|
|
||||||
import GameManager from "#test/testUtils/gameManager";
|
|
||||||
import Phaser from "phaser";
|
|
||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
||||||
|
|
||||||
describe("Abilities - Thermal Exchange", () => {
|
|
||||||
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
|
|
||||||
.moveset([MoveId.SPLASH])
|
|
||||||
.ability(AbilityId.BALL_FETCH)
|
|
||||||
.battleStyle("single")
|
|
||||||
.disableCrits()
|
|
||||||
.enemySpecies(SpeciesId.MAGIKARP)
|
|
||||||
.enemyAbility(AbilityId.BALL_FETCH)
|
|
||||||
.enemyMoveset(MoveId.SPLASH);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should remove burn when gained", async () => {
|
|
||||||
game.override
|
|
||||||
.ability(AbilityId.THERMAL_EXCHANGE)
|
|
||||||
.enemyAbility(AbilityId.BALL_FETCH)
|
|
||||||
.moveset(MoveId.SKILL_SWAP)
|
|
||||||
.enemyMoveset(MoveId.SPLASH);
|
|
||||||
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
|
||||||
const enemy = game.scene.getEnemyPokemon();
|
|
||||||
enemy?.trySetStatus(StatusEffect.BURN);
|
|
||||||
expect(enemy?.status?.effect).toBe(StatusEffect.BURN);
|
|
||||||
|
|
||||||
game.move.select(MoveId.SKILL_SWAP);
|
|
||||||
await game.phaseInterceptor.to("BerryPhase");
|
|
||||||
|
|
||||||
expect(enemy?.status).toBeNull();
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,51 +0,0 @@
|
|||||||
import { AbilityId } from "#enums/ability-id";
|
|
||||||
import { MoveId } from "#enums/move-id";
|
|
||||||
import { SpeciesId } from "#enums/species-id";
|
|
||||||
import { StatusEffect } from "#enums/status-effect";
|
|
||||||
import GameManager from "#test/testUtils/gameManager";
|
|
||||||
import Phaser from "phaser";
|
|
||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
||||||
|
|
||||||
describe("Abilities - Vital Spirit", () => {
|
|
||||||
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
|
|
||||||
.moveset([MoveId.SPLASH])
|
|
||||||
.ability(AbilityId.BALL_FETCH)
|
|
||||||
.battleStyle("single")
|
|
||||||
.disableCrits()
|
|
||||||
.enemySpecies(SpeciesId.MAGIKARP)
|
|
||||||
.enemyAbility(AbilityId.BALL_FETCH)
|
|
||||||
.enemyMoveset(MoveId.SPLASH);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should remove sleep when gained", async () => {
|
|
||||||
game.override
|
|
||||||
.ability(AbilityId.INSOMNIA)
|
|
||||||
.enemyAbility(AbilityId.BALL_FETCH)
|
|
||||||
.moveset(MoveId.SKILL_SWAP)
|
|
||||||
.enemyMoveset(MoveId.SPLASH);
|
|
||||||
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
|
||||||
const enemy = game.scene.getEnemyPokemon();
|
|
||||||
enemy?.trySetStatus(StatusEffect.SLEEP);
|
|
||||||
expect(enemy?.status?.effect).toBe(StatusEffect.SLEEP);
|
|
||||||
|
|
||||||
game.move.select(MoveId.SKILL_SWAP);
|
|
||||||
await game.phaseInterceptor.to("BerryPhase");
|
|
||||||
|
|
||||||
expect(enemy?.status).toBeNull();
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,51 +0,0 @@
|
|||||||
import { AbilityId } from "#enums/ability-id";
|
|
||||||
import { MoveId } from "#enums/move-id";
|
|
||||||
import { SpeciesId } from "#enums/species-id";
|
|
||||||
import { StatusEffect } from "#enums/status-effect";
|
|
||||||
import GameManager from "#test/testUtils/gameManager";
|
|
||||||
import Phaser from "phaser";
|
|
||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
||||||
|
|
||||||
describe("Abilities - Water Bubble", () => {
|
|
||||||
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
|
|
||||||
.moveset([MoveId.SPLASH])
|
|
||||||
.ability(AbilityId.BALL_FETCH)
|
|
||||||
.battleStyle("single")
|
|
||||||
.disableCrits()
|
|
||||||
.enemySpecies(SpeciesId.MAGIKARP)
|
|
||||||
.enemyAbility(AbilityId.BALL_FETCH)
|
|
||||||
.enemyMoveset(MoveId.SPLASH);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should remove burn when gained", async () => {
|
|
||||||
game.override
|
|
||||||
.ability(AbilityId.THERMAL_EXCHANGE)
|
|
||||||
.enemyAbility(AbilityId.BALL_FETCH)
|
|
||||||
.moveset(MoveId.SKILL_SWAP)
|
|
||||||
.enemyMoveset(MoveId.SPLASH);
|
|
||||||
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
|
||||||
const enemy = game.scene.getEnemyPokemon();
|
|
||||||
enemy?.trySetStatus(StatusEffect.BURN);
|
|
||||||
expect(enemy?.status?.effect).toBe(StatusEffect.BURN);
|
|
||||||
|
|
||||||
game.move.select(MoveId.SKILL_SWAP);
|
|
||||||
await game.phaseInterceptor.to("BerryPhase");
|
|
||||||
|
|
||||||
expect(enemy?.status).toBeNull();
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,51 +0,0 @@
|
|||||||
import { AbilityId } from "#enums/ability-id";
|
|
||||||
import { MoveId } from "#enums/move-id";
|
|
||||||
import { SpeciesId } from "#enums/species-id";
|
|
||||||
import { StatusEffect } from "#enums/status-effect";
|
|
||||||
import GameManager from "#test/testUtils/gameManager";
|
|
||||||
import Phaser from "phaser";
|
|
||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
||||||
|
|
||||||
describe("Abilities - Water Veil", () => {
|
|
||||||
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
|
|
||||||
.moveset([MoveId.SPLASH])
|
|
||||||
.ability(AbilityId.BALL_FETCH)
|
|
||||||
.battleStyle("single")
|
|
||||||
.disableCrits()
|
|
||||||
.enemySpecies(SpeciesId.MAGIKARP)
|
|
||||||
.enemyAbility(AbilityId.BALL_FETCH)
|
|
||||||
.enemyMoveset(MoveId.SPLASH);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should remove burn when gained", async () => {
|
|
||||||
game.override
|
|
||||||
.ability(AbilityId.THERMAL_EXCHANGE)
|
|
||||||
.enemyAbility(AbilityId.BALL_FETCH)
|
|
||||||
.moveset(MoveId.SKILL_SWAP)
|
|
||||||
.enemyMoveset(MoveId.SPLASH);
|
|
||||||
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
|
||||||
const enemy = game.scene.getEnemyPokemon();
|
|
||||||
enemy?.trySetStatus(StatusEffect.BURN);
|
|
||||||
expect(enemy?.status?.effect).toBe(StatusEffect.BURN);
|
|
||||||
|
|
||||||
game.move.select(MoveId.SKILL_SWAP);
|
|
||||||
await game.phaseInterceptor.to("BerryPhase");
|
|
||||||
|
|
||||||
expect(enemy?.status).toBeNull();
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,12 +1,11 @@
|
|||||||
import { AbilityId } from "#enums/ability-id";
|
|
||||||
import { MoveId } from "#enums/move-id";
|
|
||||||
import { SpeciesId } from "#enums/species-id";
|
import { SpeciesId } from "#enums/species-id";
|
||||||
import { StatusEffect } from "#enums/status-effect";
|
|
||||||
import GameManager from "#test/testUtils/gameManager";
|
|
||||||
import Phaser from "phaser";
|
|
||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||||
|
import GameManager from "#test/testUtils/gameManager";
|
||||||
|
import { MoveId } from "#enums/move-id";
|
||||||
|
import { AbilityId } from "#enums/ability-id";
|
||||||
|
import { StatusEffect } from "#enums/status-effect";
|
||||||
|
|
||||||
describe("Abilities - Immunity", () => {
|
describe("Spec - Pokemon Functions", () => {
|
||||||
let phaserGame: Phaser.Game;
|
let phaserGame: Phaser.Game;
|
||||||
let game: GameManager;
|
let game: GameManager;
|
||||||
|
|
||||||
@ -23,29 +22,29 @@ describe("Abilities - Immunity", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
game = new GameManager(phaserGame);
|
game = new GameManager(phaserGame);
|
||||||
game.override
|
game.override
|
||||||
.moveset([MoveId.SPLASH])
|
|
||||||
.ability(AbilityId.BALL_FETCH)
|
|
||||||
.battleStyle("single")
|
.battleStyle("single")
|
||||||
.disableCrits()
|
.disableCrits()
|
||||||
|
.startingLevel(100)
|
||||||
.enemySpecies(SpeciesId.MAGIKARP)
|
.enemySpecies(SpeciesId.MAGIKARP)
|
||||||
.enemyAbility(AbilityId.BALL_FETCH)
|
.enemyAbility(AbilityId.BALL_FETCH)
|
||||||
|
.ability(AbilityId.BALL_FETCH)
|
||||||
.enemyMoveset(MoveId.SPLASH);
|
.enemyMoveset(MoveId.SPLASH);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should remove poison when gained", async () => {
|
describe("doSetStatus", () => {
|
||||||
game.override
|
it("should change the Pokemon's status, ignoring feasibility checks", async () => {
|
||||||
.ability(AbilityId.IMMUNITY)
|
await game.classicMode.startBattle([SpeciesId.ACCELGOR]);
|
||||||
.enemyAbility(AbilityId.BALL_FETCH)
|
|
||||||
.moveset(MoveId.SKILL_SWAP)
|
|
||||||
.enemyMoveset(MoveId.SPLASH);
|
|
||||||
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
|
||||||
const enemy = game.scene.getEnemyPokemon();
|
|
||||||
enemy?.trySetStatus(StatusEffect.POISON);
|
|
||||||
expect(enemy?.status?.effect).toBe(StatusEffect.POISON);
|
|
||||||
|
|
||||||
game.move.select(MoveId.SKILL_SWAP);
|
const player = game.field.getPlayerPokemon();
|
||||||
await game.phaseInterceptor.to("BerryPhase");
|
|
||||||
|
|
||||||
expect(enemy?.status).toBeNull();
|
expect(player.status?.effect).toBeUndefined();
|
||||||
|
player.doSetStatus(StatusEffect.BURN);
|
||||||
|
expect(player.status?.effect).toBe(StatusEffect.BURN);
|
||||||
|
|
||||||
|
expect(player.canSetStatus(StatusEffect.SLEEP)).toBe(false);
|
||||||
|
player.doSetStatus(StatusEffect.SLEEP, 5);
|
||||||
|
expect(player.status?.effect).toBe(StatusEffect.SLEEP);
|
||||||
|
expect(player.status?.sleepTurnsRemaining).toBe(5);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
@ -74,7 +74,7 @@ describe("Moves - Beat Up", () => {
|
|||||||
|
|
||||||
const playerPokemon = game.scene.getPlayerPokemon()!;
|
const playerPokemon = game.scene.getPlayerPokemon()!;
|
||||||
|
|
||||||
game.scene.getPlayerParty()[1].trySetStatus(StatusEffect.BURN);
|
game.scene.getPlayerParty()[1].doSetStatus(StatusEffect.BURN);
|
||||||
|
|
||||||
game.move.select(MoveId.BEAT_UP);
|
game.move.select(MoveId.BEAT_UP);
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import GameManager from "#test/testUtils/gameManager";
|
|||||||
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("MoveId - Rest", () => {
|
describe("Move - Rest", () => {
|
||||||
let phaserGame: Phaser.Game;
|
let phaserGame: Phaser.Game;
|
||||||
let game: GameManager;
|
let game: GameManager;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user