pokerogue/test/abilities/corrosion.test.ts
Bertie690 6c03181621
[Bug] Refactored status code, fixed Rest/Sleep Talk status checks (#5872)
* Reworked status code, fixed bugs and added Rest tests

* Fixed rest bug

* Fixed bugs, split up status code, re-added required Rest parameter

* Cleaned up comments and such

* Added edge case to rest about locales

* Maybe did stuff

* Split up `trySetStatus` fully; fixed rest turn order display to match mainline

* Reverted healing changes to move to other PR

* Fixed message code a bit

* Condensed all status immunity tests under 1 roof

* Fixed the tests

* Added pollen puff tests back again

* Fixed swallow test

* Reverted swallow test

fixing in other prs

* Fixed pollen puff

* Fixed cirrc dep isuse

* fixed stockpile to no longer fail on stack full

* Fixed rest thing...?

* readded swallow conds

* Fixed tests

* wip

* Fixed tests

* Added pokemon heal phase to the turn queue

* ddddd

* Fixed the tests

* Fixed corrosion test

* Ran linting

* Fixed infiltrator bug

* Fix pokemon.ts

* Update move.ts

* Update corrosion.test.ts

* Update pokemon.ts documentation

* Remove missed line in TSDocs

* Update pokemon.ts

Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>

* Update modifier.ts

Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>

* Update modifier.ts

Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>

* Update obtain-status-effect-phase.ts

* Fix merge issues and apply Biome

* Revert pokemon-heal-phase.ts

* ddddd

* Fixed test file syntax err

* Update toxic spikes status set text to be quiet

* ran biome

* ran boime

* Prevent rest failure message from displaying outside of move phase

---------

Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-08-20 08:45:09 -05:00

89 lines
2.8 KiB
TypeScript

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/test-utils/game-manager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Abilities - Corrosion", () => {
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")
.criticalHits(false)
.enemySpecies(SpeciesId.GRIMER)
.ability(AbilityId.CORROSION)
.enemyAbility(AbilityId.NO_GUARD)
.enemyMoveset(MoveId.SPLASH);
});
it.each<{ name: string; species: SpeciesId }>([
{ name: "Poison", species: SpeciesId.GRIMER },
{ name: "Steel", species: SpeciesId.KLINK },
])("should grant the user the ability to poison $name-type opponents", async ({ species }) => {
game.override.enemySpecies(species);
await game.classicMode.startBattle([SpeciesId.SALANDIT]);
const enemy = game.field.getEnemyPokemon();
expect(enemy.status?.effect).toBeUndefined();
game.move.use(MoveId.POISON_GAS);
await game.toEndOfTurn();
expect(enemy.status?.effect).toBe(StatusEffect.POISON);
});
it("should not affect Toxic Spikes", async () => {
await game.classicMode.startBattle([SpeciesId.SALANDIT]);
game.move.use(MoveId.TOXIC_SPIKES);
await game.doKillOpponents();
await game.toNextWave();
const enemyPokemon = game.field.getEnemyPokemon();
expect(enemyPokemon.status).toBeUndefined();
});
it("should not affect an opponent's Synchronize ability", async () => {
game.override.enemyAbility(AbilityId.SYNCHRONIZE);
await game.classicMode.startBattle([SpeciesId.ARBOK]);
const playerPokemon = game.field.getPlayerPokemon();
const enemyPokemon = game.field.getEnemyPokemon();
expect(enemyPokemon.status?.effect).toBeUndefined();
game.move.use(MoveId.TOXIC);
await game.toEndOfTurn();
expect(enemyPokemon.status?.effect).toBe(StatusEffect.TOXIC);
expect(playerPokemon.status?.effect).toBeUndefined();
});
it("should affect the user's held Toxic Orb", async () => {
game.override.startingHeldItems([{ name: "TOXIC_ORB", count: 1 }]);
await game.classicMode.startBattle([SpeciesId.SALAZZLE]);
const salazzle = game.field.getPlayerPokemon();
expect(salazzle.status?.effect).toBeUndefined();
game.move.use(MoveId.SPLASH);
await game.toNextTurn();
expect(salazzle.status?.effect).toBe(StatusEffect.TOXIC);
});
});