Fiexd remainig tests

This commit is contained in:
Bertie690 2025-06-23 19:23:01 -04:00
parent abd6c73e7a
commit ef2e646936
4 changed files with 16 additions and 19 deletions

View File

@ -28,11 +28,11 @@ describe("Abilities - Screen Cleaner", () => {
});
it("removes Aurora Veil", async () => {
game.override.moveset([MoveId.HAIL]).enemyMoveset(MoveId.AURORA_VEIL);
game.override.enemyMoveset(MoveId.AURORA_VEIL);
await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MAGIKARP]);
game.move.select(MoveId.HAIL);
game.move.use(MoveId.HAIL);
await game.phaseInterceptor.to(TurnEndPhase);
expect(game.scene.arena.getTag(ArenaTagType.AURORA_VEIL)).toBeDefined();
@ -49,7 +49,7 @@ describe("Abilities - Screen Cleaner", () => {
await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MAGIKARP]);
game.move.select(MoveId.SPLASH);
game.move.use(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
expect(game.scene.arena.getTag(ArenaTagType.LIGHT_SCREEN)).toBeDefined();
@ -66,7 +66,7 @@ describe("Abilities - Screen Cleaner", () => {
await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MAGIKARP]);
game.move.select(MoveId.SPLASH);
game.move.use(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
expect(game.scene.arena.getTag(ArenaTagType.REFLECT)).toBeDefined();

View File

@ -103,7 +103,7 @@ describe("Moves - Gastro Acid", () => {
game.move.use(MoveId.WATER_GUN);
await game.toNextTurn();
// water gun should've dealt damage due to suppressed Water Absorb
expect(enemyPokemon.hp).toBe(enemyPokemon.getMaxHp());
expect(enemyPokemon.hp).toBeLessThan(enemyPokemon.getMaxHp());
game.move.use(MoveId.SPORE);
await game.toEndOfTurn();

View File

@ -6,6 +6,7 @@ import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { ArenaTrapTag } from "#app/data/arena-tag";
import { ArenaTagSide } from "#enums/arena-tag-side";
import { BattlerIndex } from "#enums/battler-index";
describe("Moves - Spikes", () => {
let phaserGame: Phaser.Game;
@ -81,12 +82,12 @@ describe("Moves - Spikes", () => {
});
it("should work when all targets fainted", async () => {
game.override.enemySpecies(SpeciesId.DIGLETT).battleStyle("double").startingLevel(50);
await game.classicMode.startBattle([SpeciesId.RAYQUAZA]);
game.override.enemySpecies(SpeciesId.DIGLETT).battleStyle("double").startingLevel(1000);
await game.classicMode.startBattle([SpeciesId.RAYQUAZA, SpeciesId.SHUCKLE]);
game.move.use(MoveId.SPIKES);
await game.doKillOpponents();
await game.phaseInterceptor.to("TurnEndPhase");
game.move.use(MoveId.HYPER_VOICE, BattlerIndex.PLAYER);
game.move.use(MoveId.SPIKES, BattlerIndex.PLAYER_2);
await game.toNextWave();
expect(game.scene.arena.getTagOnSide(ArenaTrapTag, ArenaTagSide.ENEMY)).toBeDefined();
});

View File

@ -12,7 +12,6 @@ import overrides from "#app/overrides";
import { CheckSwitchPhase } from "#app/phases/check-switch-phase";
import { CommandPhase } from "#app/phases/command-phase";
import { EncounterPhase } from "#app/phases/encounter-phase";
import { FaintPhase } from "#app/phases/faint-phase";
import { LoginPhase } from "#app/phases/login-phase";
import { MovePhase } from "#app/phases/move-phase";
import { MysteryEncounterPhase } from "#app/phases/mystery-encounter-phases";
@ -452,17 +451,14 @@ export default class GameManager {
}
/**
* Faints a player or enemy pokemon instantly by setting their HP to 0.
* Faint a player or enemy pokemon instantly by setting their HP to 0.
* @param pokemon - The player/enemy pokemon being fainted
* @returns A promise that resolves once the fainted pokemon's FaintPhase finishes running.
* @returns A Promise that resolves once the fainted pokemon's FaintPhase finishes running.
*/
async killPokemon(pokemon: PlayerPokemon | EnemyPokemon) {
return new Promise<void>(async (resolve, reject) => {
pokemon.hp = 0;
this.scene.phaseManager.pushPhase(new FaintPhase(pokemon.getBattlerIndex(), true));
await this.phaseInterceptor.to(FaintPhase).catch(e => reject(e));
resolve();
});
pokemon.hp = 0;
this.scene.phaseManager.pushNew("FaintPhase", pokemon.getBattlerIndex(), true);
await this.phaseInterceptor.to("FaintPhase");
}
/**