[Bug] Fix purify (#2697)
This commit is contained in:
parent
6865b6b846
commit
fd586ecd8e
|
@ -7577,9 +7577,9 @@ export function initMoves() {
|
||||||
new AttackMove(Moves.SMART_STRIKE, Type.STEEL, MoveCategory.PHYSICAL, 70, -1, 10, -1, 0, 7),
|
new AttackMove(Moves.SMART_STRIKE, Type.STEEL, MoveCategory.PHYSICAL, 70, -1, 10, -1, 0, 7),
|
||||||
new StatusMove(Moves.PURIFY, Type.POISON, -1, 20, -1, 0, 7)
|
new StatusMove(Moves.PURIFY, Type.POISON, -1, 20, -1, 0, 7)
|
||||||
.condition(
|
.condition(
|
||||||
(user: Pokemon, target: Pokemon, move: Move) => isNonVolatileStatusEffect(user.status?.effect))
|
(user: Pokemon, target: Pokemon, move: Move) => isNonVolatileStatusEffect(target.status?.effect))
|
||||||
.attr(HealAttr, 0.5)
|
.attr(HealAttr, 0.5)
|
||||||
.attr(HealStatusEffectAttr, true, ...getNonVolatileStatusEffects())
|
.attr(HealStatusEffectAttr, false, ...getNonVolatileStatusEffects())
|
||||||
.triageMove(),
|
.triageMove(),
|
||||||
new AttackMove(Moves.REVELATION_DANCE, Type.NORMAL, MoveCategory.SPECIAL, 90, 100, 15, -1, 0, 7)
|
new AttackMove(Moves.REVELATION_DANCE, Type.NORMAL, MoveCategory.SPECIAL, 90, 100, 15, -1, 0, 7)
|
||||||
.danceMove()
|
.danceMove()
|
||||||
|
|
|
@ -0,0 +1,81 @@
|
||||||
|
import {afterEach, beforeAll, beforeEach, describe, expect, test, vi} from "vitest";
|
||||||
|
import Phaser from "phaser";
|
||||||
|
import GameManager from "#app/test/utils/gameManager";
|
||||||
|
import * as overrides from "#app/overrides";
|
||||||
|
import {
|
||||||
|
MoveEndPhase,
|
||||||
|
} from "#app/phases";
|
||||||
|
import {getMovePosition} from "#app/test/utils/gameManagerUtils";
|
||||||
|
import { Moves } from "#enums/moves";
|
||||||
|
import { Species } from "#enums/species";
|
||||||
|
import { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon.js";
|
||||||
|
import { Status, StatusEffect } from "#app/data/status-effect.js";
|
||||||
|
|
||||||
|
const TIMEOUT = 20 * 1000;
|
||||||
|
|
||||||
|
describe("Moves - Purify", () => {
|
||||||
|
let phaserGame: Phaser.Game;
|
||||||
|
let game: GameManager;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
phaserGame = new Phaser.Game({
|
||||||
|
type: Phaser.HEADLESS,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
game.phaseInterceptor.restoreOg();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
game = new GameManager(phaserGame);
|
||||||
|
vi.spyOn(overrides, "SINGLE_BATTLE_OVERRIDE", "get").mockReturnValue(true);
|
||||||
|
|
||||||
|
vi.spyOn(overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.PYUKUMUKU);
|
||||||
|
vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(10);
|
||||||
|
vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.PURIFY, Moves.SIZZLY_SLIDE]);
|
||||||
|
|
||||||
|
vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP);
|
||||||
|
vi.spyOn(overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(10);
|
||||||
|
vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test(
|
||||||
|
"Purify heals opponent status effect and restores user hp",
|
||||||
|
async () => {
|
||||||
|
await game.startBattle();
|
||||||
|
|
||||||
|
const enemyPokemon: EnemyPokemon = game.scene.getEnemyPokemon();
|
||||||
|
const playerPokemon: PlayerPokemon = game.scene.getPlayerPokemon();
|
||||||
|
|
||||||
|
playerPokemon.hp = playerPokemon.getMaxHp() - 1;
|
||||||
|
enemyPokemon.status = new Status(StatusEffect.BURN);
|
||||||
|
|
||||||
|
game.doAttack(getMovePosition(game.scene, 0, Moves.PURIFY));
|
||||||
|
await game.phaseInterceptor.to(MoveEndPhase);
|
||||||
|
|
||||||
|
expect(enemyPokemon.status).toBe(undefined);
|
||||||
|
expect(playerPokemon.hp).toBe(playerPokemon.getMaxHp());
|
||||||
|
},
|
||||||
|
TIMEOUT
|
||||||
|
);
|
||||||
|
|
||||||
|
test(
|
||||||
|
"Purify does not heal if opponent doesnt have any status effect",
|
||||||
|
async () => {
|
||||||
|
await game.startBattle();
|
||||||
|
|
||||||
|
const playerPokemon: PlayerPokemon = game.scene.getPlayerPokemon();
|
||||||
|
|
||||||
|
playerPokemon.hp = playerPokemon.getMaxHp() - 1;
|
||||||
|
const playerInitialHp = playerPokemon.hp;
|
||||||
|
|
||||||
|
game.doAttack(getMovePosition(game.scene, 0, Moves.PURIFY));
|
||||||
|
await game.phaseInterceptor.to(MoveEndPhase);
|
||||||
|
|
||||||
|
expect(playerPokemon.hp).toBe(playerInitialHp);
|
||||||
|
},
|
||||||
|
TIMEOUT
|
||||||
|
);
|
||||||
|
|
||||||
|
});
|
Loading…
Reference in New Issue