mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-05 23:19:25 +02:00
Cleaned up shields down tests; added more tests
This commit is contained in:
parent
800b8c9905
commit
330c7f169c
@ -2,14 +2,17 @@ import { Status } from "#data/status-effect";
|
||||
import { AbilityId } from "#enums/ability-id";
|
||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
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 { QuietFormChangePhase } from "#phases/quiet-form-change-phase";
|
||||
import { TurnEndPhase } from "#phases/turn-end-phase";
|
||||
import { GameManager } from "#test/test-utils/game-manager";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
|
||||
describe("Abilities - Shields Down", () => {
|
||||
const redMeteorForm = 0;
|
||||
const redCoreForm = 7;
|
||||
const orangeCoreForm = 8;
|
||||
|
||||
describe("Abilities - SHIELDS DOWN", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
let game: GameManager;
|
||||
|
||||
@ -25,159 +28,159 @@ describe("Abilities - SHIELDS DOWN", () => {
|
||||
|
||||
beforeEach(() => {
|
||||
game = new GameManager(phaserGame);
|
||||
const moveToUse = MoveId.SPLASH;
|
||||
game.override
|
||||
.battleStyle("single")
|
||||
.ability(AbilityId.SHIELDS_DOWN)
|
||||
.moveset([moveToUse])
|
||||
.enemyMoveset([MoveId.TACKLE]);
|
||||
.enemySpecies(SpeciesId.PSYDUCK)
|
||||
.enemyMoveset(MoveId.SPLASH);
|
||||
});
|
||||
|
||||
test("check if fainted pokemon switched to base form on arena reset", async () => {
|
||||
const meteorForm = 0,
|
||||
coreForm = 7;
|
||||
game.override.startingWave(4).starterForms({
|
||||
[SpeciesId.MINIOR]: coreForm,
|
||||
});
|
||||
it.each([0, 1, 2, 3, 4, 5, 6])(
|
||||
"should change from Meteor Form to Core Form on entry/turn end based on HP - form index %i",
|
||||
async meteorIndex => {
|
||||
game.override.starterForms({
|
||||
// Start in meteor form
|
||||
[SpeciesId.MINIOR]: meteorIndex,
|
||||
});
|
||||
|
||||
await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MINIOR]);
|
||||
|
||||
const minior = game.scene.getPlayerParty()[1];
|
||||
expect(minior.formIndex).toBe(meteorIndex);
|
||||
minior.hp *= 0.49;
|
||||
|
||||
// Switch to minior - should change to Core due to being <50% HP
|
||||
game.doSwitchPokemon(1);
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(minior.formIndex).toBe(meteorIndex + 7);
|
||||
|
||||
// Use roost to regain 50% HP; should transform back into Meteor Form at turn end
|
||||
game.move.use(MoveId.ROOST);
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(minior.formIndex).toBe(meteorIndex);
|
||||
},
|
||||
);
|
||||
|
||||
it("check if fainted pokemon switched to base form on arena reset", async () => {
|
||||
game.override.startingWave(4).starterForms({
|
||||
[SpeciesId.MINIOR]: redCoreForm,
|
||||
});
|
||||
await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MINIOR]);
|
||||
|
||||
const minior = game.scene.getPlayerParty().find(p => p.species.speciesId === SpeciesId.MINIOR)!;
|
||||
expect(minior).not.toBe(undefined);
|
||||
expect(minior.formIndex).toBe(coreForm);
|
||||
const minior = game.scene.getPlayerParty()[1];
|
||||
expect(minior.formIndex).toBe(redCoreForm);
|
||||
|
||||
minior.hp = 0;
|
||||
minior.status = new Status(StatusEffect.FAINT);
|
||||
expect(minior.isFainted()).toBe(true);
|
||||
|
||||
game.move.select(MoveId.SPLASH);
|
||||
game.move.use(MoveId.SPLASH);
|
||||
await game.doKillOpponents();
|
||||
await game.phaseInterceptor.to(TurnEndPhase);
|
||||
await game.toEndOfTurn();
|
||||
game.doSelectModifier();
|
||||
await game.phaseInterceptor.to(QuietFormChangePhase);
|
||||
await game.phaseInterceptor.to("QuietFormChangePhase");
|
||||
|
||||
expect(minior.formIndex).toBe(meteorForm);
|
||||
expect(minior.formIndex).toBe(redMeteorForm);
|
||||
});
|
||||
|
||||
test("should ignore non-volatile status moves", async () => {
|
||||
game.override.enemyMoveset([MoveId.SPORE]);
|
||||
|
||||
await game.classicMode.startBattle([SpeciesId.MINIOR]);
|
||||
game.move.select(MoveId.SPLASH);
|
||||
await game.phaseInterceptor.to(TurnEndPhase);
|
||||
|
||||
expect(game.scene.getPlayerPokemon()!.status).toBe(undefined);
|
||||
});
|
||||
|
||||
test("should still ignore non-volatile status moves used by a pokemon with mold breaker", async () => {
|
||||
// TODO: Move to mold breaker test file
|
||||
it("should ignore Mold Breaker", async () => {
|
||||
game.override.enemyAbility(AbilityId.MOLD_BREAKER).enemyMoveset([MoveId.SPORE]);
|
||||
|
||||
await game.classicMode.startBattle([SpeciesId.MINIOR]);
|
||||
|
||||
game.move.select(MoveId.SPLASH);
|
||||
await game.move.selectEnemyMove(MoveId.SPORE);
|
||||
await game.phaseInterceptor.to(TurnEndPhase);
|
||||
game.move.use(MoveId.SPLASH);
|
||||
await game.move.forceEnemyMove(MoveId.SPORE);
|
||||
await game.toEndOfTurn();
|
||||
|
||||
expect(game.scene.getPlayerPokemon()!.status).toBe(undefined);
|
||||
expect(game.field.getPlayerPokemon()).toHaveStatusEffect(StatusEffect.NONE);
|
||||
});
|
||||
|
||||
test("should ignore non-volatile secondary status effects", async () => {
|
||||
game.override.enemyMoveset([MoveId.NUZZLE]);
|
||||
|
||||
it("should ignore non-volatile status effects & Yawn in Meteor Form", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.MINIOR]);
|
||||
|
||||
game.move.select(MoveId.SPLASH);
|
||||
await game.phaseInterceptor.to(TurnEndPhase);
|
||||
|
||||
expect(game.scene.getPlayerPokemon()!.status).toBe(undefined);
|
||||
});
|
||||
|
||||
test("should ignore status moves even through mold breaker", async () => {
|
||||
game.override.enemyMoveset([MoveId.SPORE]).enemyAbility(AbilityId.MOLD_BREAKER);
|
||||
|
||||
await game.classicMode.startBattle([SpeciesId.MINIOR]);
|
||||
|
||||
game.move.select(MoveId.SPLASH);
|
||||
|
||||
await game.phaseInterceptor.to(TurnEndPhase);
|
||||
|
||||
expect(game.scene.getPlayerPokemon()!.status).toBe(undefined);
|
||||
});
|
||||
|
||||
// toxic spikes currently does not poison flying types when gravity is in effect
|
||||
test.todo("should become poisoned by toxic spikes when grounded", async () => {
|
||||
game.override
|
||||
.enemyMoveset([MoveId.GRAVITY, MoveId.TOXIC_SPIKES, MoveId.SPLASH])
|
||||
.moveset([MoveId.GRAVITY, MoveId.SPLASH]);
|
||||
|
||||
await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MINIOR]);
|
||||
|
||||
// turn 1
|
||||
game.move.select(MoveId.GRAVITY);
|
||||
await game.move.selectEnemyMove(MoveId.TOXIC_SPIKES);
|
||||
game.move.use(MoveId.SPLASH);
|
||||
await game.move.forceEnemyMove(MoveId.NUZZLE);
|
||||
await game.toNextTurn();
|
||||
|
||||
const minior = game.field.getPlayerPokemon();
|
||||
expect(minior).toHaveStatusEffect(StatusEffect.NONE);
|
||||
|
||||
game.move.use(MoveId.SPLASH);
|
||||
await game.move.forceEnemyMove(MoveId.YAWN);
|
||||
await game.toEndOfTurn();
|
||||
|
||||
expect(game.field.getEnemyPokemon()).toHaveUsedMove({ move: MoveId.YAWN, result: MoveResult.FAIL });
|
||||
});
|
||||
|
||||
it("should not ignore non-volatile status effects & Yawn in Core Form", async () => {
|
||||
game.override.starterForms({
|
||||
// Note: we specifically check orange core due to a bug where only Red Core Minior was immune to status
|
||||
[SpeciesId.MINIOR]: orangeCoreForm,
|
||||
});
|
||||
await game.classicMode.startBattle([SpeciesId.MINIOR]);
|
||||
|
||||
game.move.use(MoveId.SPLASH);
|
||||
await game.move.forceEnemyMove(MoveId.NUZZLE);
|
||||
await game.toEndOfTurn();
|
||||
|
||||
const minior = game.field.getPlayerPokemon();
|
||||
expect(minior).toHaveStatusEffect(StatusEffect.PARALYSIS);
|
||||
|
||||
minior.status = null;
|
||||
|
||||
game.move.use(MoveId.SPLASH);
|
||||
await game.move.forceEnemyMove(MoveId.YAWN);
|
||||
await game.toEndOfTurn();
|
||||
|
||||
expect(game.field.getEnemyPokemon()).toHaveUsedMove({ move: MoveId.YAWN, result: MoveResult.SUCCESS });
|
||||
});
|
||||
|
||||
// TODO: Gravity does not make a Pokemon be considered as "grounded" for hazards
|
||||
it.todo("should be poisoned by toxic spikes when Gravity is active before changing forms", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MINIOR]);
|
||||
|
||||
// Change minior to core form in a state where it would revert on switch
|
||||
const minior = game.scene.getPlayerParty()[1];
|
||||
minior.formIndex = redCoreForm;
|
||||
|
||||
game.move.use(MoveId.GRAVITY);
|
||||
await game.move.forceEnemyMove(MoveId.TOXIC_SPIKES);
|
||||
await game.toNextTurn();
|
||||
|
||||
// turn 2
|
||||
game.doSwitchPokemon(1);
|
||||
await game.move.selectEnemyMove(MoveId.SPLASH);
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(game.scene.getPlayerPokemon()!.species.speciesId).toBe(SpeciesId.MINIOR);
|
||||
expect(game.scene.getPlayerPokemon()!.species.formIndex).toBe(0);
|
||||
expect(game.scene.getPlayerPokemon()!.status?.effect).toBe(StatusEffect.POISON);
|
||||
expect(minior.species.speciesId).toBe(SpeciesId.MINIOR);
|
||||
expect(minior.formIndex).toBe(0);
|
||||
expect(minior.isGrounded()).toBe(true);
|
||||
expect(minior).toHaveStatusEffect(StatusEffect.POISON);
|
||||
});
|
||||
|
||||
test("should ignore yawn", async () => {
|
||||
game.override.enemyMoveset([MoveId.YAWN]);
|
||||
|
||||
await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MINIOR]);
|
||||
|
||||
game.move.select(MoveId.SPLASH);
|
||||
await game.move.selectEnemyMove(MoveId.YAWN);
|
||||
|
||||
await game.phaseInterceptor.to(TurnEndPhase);
|
||||
expect(game.scene.getPlayerPokemon()!.findTag(tag => tag.tagType === BattlerTagType.DROWSY)).toBe(undefined);
|
||||
});
|
||||
|
||||
test("should not ignore volatile status effects", async () => {
|
||||
it("should not ignore volatile status effects", async () => {
|
||||
game.override.enemyMoveset([MoveId.CONFUSE_RAY]);
|
||||
|
||||
await game.classicMode.startBattle([SpeciesId.MINIOR]);
|
||||
|
||||
game.move.select(MoveId.SPLASH);
|
||||
await game.move.selectEnemyMove(MoveId.CONFUSE_RAY);
|
||||
game.move.use(MoveId.SPLASH);
|
||||
await game.move.forceEnemyMove(MoveId.CONFUSE_RAY);
|
||||
|
||||
await game.phaseInterceptor.to(TurnEndPhase);
|
||||
await game.toEndOfTurn();
|
||||
|
||||
expect(game.scene.getPlayerPokemon()!.findTag(tag => tag.tagType === BattlerTagType.CONFUSED)).not.toBe(undefined);
|
||||
});
|
||||
|
||||
// the `NoTransformAbilityAbAttr` attribute is not checked anywhere, so this test cannot pass.
|
||||
test.todo("ditto should not be immune to status after transforming", async () => {
|
||||
game.override.enemySpecies(SpeciesId.DITTO).enemyAbility(AbilityId.IMPOSTER).moveset([MoveId.SPLASH, MoveId.SPORE]);
|
||||
|
||||
// TODO: The `NoTransformAbilityAbAttr` attribute is not checked anywhere, so this test cannot pass.
|
||||
// TODO: Move this to a transform test
|
||||
it.todo("should not activate when transformed", async () => {
|
||||
game.override.enemyAbility(AbilityId.IMPOSTER);
|
||||
await game.classicMode.startBattle([SpeciesId.MINIOR]);
|
||||
|
||||
game.move.select(MoveId.SPORE);
|
||||
await game.move.selectEnemyMove(MoveId.SPLASH);
|
||||
game.move.use(MoveId.SPORE);
|
||||
await game.toEndOfTurn();
|
||||
|
||||
await game.phaseInterceptor.to(TurnEndPhase);
|
||||
expect(game.scene.getEnemyPokemon()!.status?.effect).toBe(StatusEffect.SLEEP);
|
||||
});
|
||||
|
||||
test("should not prevent minior from receiving the fainted status effect in trainer battles", async () => {
|
||||
game.override
|
||||
.enemyMoveset([MoveId.TACKLE])
|
||||
.moveset([MoveId.THUNDERBOLT])
|
||||
.startingLevel(100)
|
||||
.startingWave(5)
|
||||
.enemySpecies(SpeciesId.MINIOR);
|
||||
await game.classicMode.startBattle([SpeciesId.REGIELEKI]);
|
||||
const minior = game.scene.getEnemyPokemon()!;
|
||||
|
||||
game.move.select(MoveId.THUNDERBOLT);
|
||||
await game.toNextTurn();
|
||||
expect(minior.isFainted()).toBe(true);
|
||||
expect(minior.status?.effect).toBe(StatusEffect.FAINT);
|
||||
expect(game.field.getEnemyPokemon()).toHaveStatusEffect(StatusEffect.SLEEP);
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user