2024-10-03 11:49:33 -04:00
|
|
|
import { StatusEffect } from "#app/enums/status-effect";
|
|
|
|
import { CommandPhase } from "#app/phases/command-phase";
|
|
|
|
import { Abilities } from "#enums/abilities";
|
|
|
|
import { Moves } from "#enums/moves";
|
|
|
|
import { Species } from "#enums/species";
|
2025-02-22 22:52:07 -06:00
|
|
|
import GameManager from "#test/testUtils/gameManager";
|
2024-10-03 11:49:33 -04:00
|
|
|
import Phaser from "phaser";
|
|
|
|
import { afterEach, beforeAll, beforeEach, describe, it, expect, vi } from "vitest";
|
|
|
|
|
|
|
|
describe("Moves - Heal Bell", () => {
|
|
|
|
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
|
2024-10-04 13:08:31 +08:00
|
|
|
.moveset([ Moves.HEAL_BELL, Moves.SPLASH ])
|
2024-10-03 11:49:33 -04:00
|
|
|
.statusEffect(StatusEffect.BURN)
|
|
|
|
.battleType("double")
|
|
|
|
.enemyAbility(Abilities.BALL_FETCH)
|
|
|
|
.enemyMoveset(Moves.SPLASH);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should cure status effect of the user, its ally, and all party pokemon", async () => {
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.RATTATA, Species.RATTATA, Species.RATTATA ]);
|
2024-11-03 18:53:52 -08:00
|
|
|
const [ leftPlayer, rightPlayer, partyPokemon ] = game.scene.getPlayerParty();
|
2024-10-03 11:49:33 -04:00
|
|
|
|
|
|
|
vi.spyOn(leftPlayer, "resetStatus");
|
|
|
|
vi.spyOn(rightPlayer, "resetStatus");
|
|
|
|
vi.spyOn(partyPokemon, "resetStatus");
|
|
|
|
|
|
|
|
game.move.select(Moves.HEAL_BELL, 0);
|
|
|
|
await game.phaseInterceptor.to(CommandPhase);
|
|
|
|
game.move.select(Moves.SPLASH, 1);
|
|
|
|
await game.toNextTurn();
|
|
|
|
|
|
|
|
expect(leftPlayer.resetStatus).toHaveBeenCalledOnce();
|
|
|
|
expect(rightPlayer.resetStatus).toHaveBeenCalledOnce();
|
|
|
|
expect(partyPokemon.resetStatus).toHaveBeenCalledOnce();
|
|
|
|
|
|
|
|
expect(leftPlayer.status?.effect).toBeUndefined();
|
|
|
|
expect(rightPlayer.status?.effect).toBeUndefined();
|
|
|
|
expect(partyPokemon.status?.effect).toBeUndefined();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should not cure status effect of the target/target's allies", async () => {
|
|
|
|
game.override.enemyStatusEffect(StatusEffect.BURN);
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.RATTATA, Species.RATTATA ]);
|
|
|
|
const [ leftOpp, rightOpp ] = game.scene.getEnemyField();
|
2024-10-03 11:49:33 -04:00
|
|
|
|
|
|
|
vi.spyOn(leftOpp, "resetStatus");
|
|
|
|
vi.spyOn(rightOpp, "resetStatus");
|
|
|
|
|
|
|
|
game.move.select(Moves.HEAL_BELL, 0);
|
|
|
|
await game.phaseInterceptor.to(CommandPhase);
|
|
|
|
game.move.select(Moves.SPLASH, 1);
|
|
|
|
await game.toNextTurn();
|
|
|
|
|
|
|
|
expect(leftOpp.resetStatus).toHaveBeenCalledTimes(0);
|
|
|
|
expect(rightOpp.resetStatus).toHaveBeenCalledTimes(0);
|
|
|
|
|
|
|
|
expect(leftOpp.status?.effect).toBeTruthy();
|
|
|
|
expect(rightOpp.status?.effect).toBeTruthy();
|
|
|
|
|
|
|
|
expect(leftOpp.status?.effect).toBe(StatusEffect.BURN);
|
|
|
|
expect(rightOpp.status?.effect).toBe(StatusEffect.BURN);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should not cure status effect of allies ON FIELD with Soundproof, should still cure allies in party", async () => {
|
|
|
|
game.override.ability(Abilities.SOUNDPROOF);
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.RATTATA, Species.RATTATA, Species.RATTATA ]);
|
2024-11-03 18:53:52 -08:00
|
|
|
const [ leftPlayer, rightPlayer, partyPokemon ] = game.scene.getPlayerParty();
|
2024-10-03 11:49:33 -04:00
|
|
|
|
|
|
|
vi.spyOn(leftPlayer, "resetStatus");
|
|
|
|
vi.spyOn(rightPlayer, "resetStatus");
|
|
|
|
vi.spyOn(partyPokemon, "resetStatus");
|
|
|
|
|
|
|
|
game.move.select(Moves.HEAL_BELL, 0);
|
|
|
|
await game.phaseInterceptor.to(CommandPhase);
|
|
|
|
game.move.select(Moves.SPLASH, 1);
|
|
|
|
await game.toNextTurn();
|
|
|
|
|
|
|
|
expect(leftPlayer.resetStatus).toHaveBeenCalledOnce();
|
|
|
|
expect(rightPlayer.resetStatus).toHaveBeenCalledTimes(0);
|
|
|
|
expect(partyPokemon.resetStatus).toHaveBeenCalledOnce();
|
|
|
|
|
|
|
|
expect(leftPlayer.status?.effect).toBeUndefined();
|
|
|
|
expect(rightPlayer.status?.effect).toBe(StatusEffect.BURN);
|
|
|
|
expect(partyPokemon.status?.effect).toBeUndefined();
|
|
|
|
});
|
|
|
|
});
|