This commit is contained in:
Dean 2025-03-04 11:15:14 -08:00
parent 52da7e1050
commit 3af4defdae

View File

@ -1,4 +1,5 @@
import { BattlerIndex } from "#app/battle";
import { PostSummonWeatherChangeAbAttr } from "#app/data/ability";
import { Abilities } from "#enums/abilities";
import { ArenaTagType } from "#enums/arena-tag-type";
import { Moves } from "#enums/moves";
@ -7,7 +8,7 @@ import { Species } from "#enums/species";
import { Stat } from "#enums/stat";
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, vi } from "vitest";
describe("Abilities - Neutralizing Gas", () => {
let phaserGame: Phaser.Game;
@ -162,4 +163,25 @@ describe("Abilities - Neutralizing Gas", () => {
expect(game.scene.arena.getTag(ArenaTagType.NEUTRALIZING_GAS)).toBeUndefined();
});
it("should not activate abilities of pokemon no longer on the field", async () => {
game.override
.battleType("single")
.ability(Abilities.NEUTRALIZING_GAS)
.enemyAbility(Abilities.DELTA_STREAM);
await game.classicMode.startBattle([ Species.MAGIKARP ]);
const enemy = game.scene.getEnemyPokemon()!;
const weatherChangeAttr = enemy.getAbilityAttrs(PostSummonWeatherChangeAbAttr, false)[0];
vi.spyOn(weatherChangeAttr, "applyPostSummon");
expect(game.scene.arena.getTag(ArenaTagType.NEUTRALIZING_GAS)).toBeDefined();
game.move.select(Moves.SPLASH);
await game.killPokemon(enemy);
await game.killPokemon(game.scene.getPlayerPokemon()!);
expect(game.scene.arena.getTag(ArenaTagType.NEUTRALIZING_GAS)).toBeUndefined();
expect(weatherChangeAttr.applyPostSummon).not.toHaveBeenCalled();
});
});