mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-06 08:22:16 +02:00
Update tests
This commit is contained in:
parent
b59f437ef8
commit
9e1bcf1dce
@ -2,11 +2,7 @@ import { BattlerIndex } from "#app/battle";
|
|||||||
import { allAbilities, PostDefendContactApplyStatusEffectAbAttr } from "#app/data/ability";
|
import { allAbilities, PostDefendContactApplyStatusEffectAbAttr } from "#app/data/ability";
|
||||||
import { Abilities } from "#app/enums/abilities";
|
import { Abilities } from "#app/enums/abilities";
|
||||||
import { StatusEffect } from "#app/enums/status-effect";
|
import { StatusEffect } from "#app/enums/status-effect";
|
||||||
import { CommandPhase } from "#app/phases/command-phase";
|
|
||||||
import { SelectTargetPhase } from "#app/phases/select-target-phase";
|
|
||||||
import { TurnEndPhase } from "#app/phases/turn-end-phase";
|
|
||||||
import GameManager from "#app/test/utils/gameManager";
|
import GameManager from "#app/test/utils/gameManager";
|
||||||
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
|
|
||||||
import { Moves } from "#enums/moves";
|
import { Moves } from "#enums/moves";
|
||||||
import { Species } from "#enums/species";
|
import { Species } from "#enums/species";
|
||||||
import Phaser from "phaser";
|
import Phaser from "phaser";
|
||||||
@ -41,137 +37,114 @@ describe("Moves - Safeguard", () => {
|
|||||||
.ability(Abilities.BALL_FETCH);
|
.ability(Abilities.BALL_FETCH);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("protects from damaging moves with additional effects",
|
it("protects from damaging moves with additional effects", async () => {
|
||||||
async () => {
|
await game.startBattle();
|
||||||
await game.startBattle();
|
const enemy = game.scene.getEnemyPokemon()!;
|
||||||
const enemy = game.scene.getEnemyPokemon()!;
|
|
||||||
|
|
||||||
game.doAttack(getMovePosition(game.scene, 0, Moves.NUZZLE));
|
game.move.select(Moves.NUZZLE);
|
||||||
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
||||||
await game.toNextTurn();
|
await game.toNextTurn();
|
||||||
|
|
||||||
expect(enemy.status).toBeUndefined();
|
expect(enemy.status).toBeUndefined();
|
||||||
}, TIMEOUT
|
}, TIMEOUT);
|
||||||
);
|
|
||||||
|
|
||||||
it("protects from status moves",
|
it("protects from status moves", async () => {
|
||||||
async () => {
|
await game.startBattle();
|
||||||
await game.startBattle();
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||||
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
|
||||||
|
|
||||||
game.doAttack(getMovePosition(game.scene, 0, Moves.SPORE));
|
game.move.select(Moves.SPORE);
|
||||||
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
||||||
await game.toNextTurn();
|
await game.toNextTurn();
|
||||||
|
|
||||||
expect(enemyPokemon.status).toBeUndefined();
|
expect(enemyPokemon.status).toBeUndefined();
|
||||||
}, TIMEOUT
|
}, TIMEOUT);
|
||||||
);
|
|
||||||
|
|
||||||
it("protects from confusion",
|
it("protects from confusion", async () => {
|
||||||
async () => {
|
game.override.moveset([Moves.CONFUSE_RAY]);
|
||||||
game.override.moveset([Moves.CONFUSE_RAY]);
|
await game.startBattle();
|
||||||
await game.startBattle();
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||||
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
|
||||||
|
|
||||||
game.doAttack(getMovePosition(game.scene, 0, Moves.CONFUSE_RAY));
|
game.move.select(Moves.CONFUSE_RAY);
|
||||||
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
||||||
await game.toNextTurn();
|
await game.toNextTurn();
|
||||||
|
|
||||||
expect(enemyPokemon.summonData.tags).toEqual([]);
|
expect(enemyPokemon.summonData.tags).toEqual([]);
|
||||||
}, TIMEOUT
|
}, TIMEOUT);
|
||||||
);
|
|
||||||
|
|
||||||
it("protects ally from status",
|
it("protects ally from status", async () => {
|
||||||
async () => {
|
game.override.battleType("double");
|
||||||
game.override.battleType("double");
|
|
||||||
|
|
||||||
await game.startBattle();
|
await game.startBattle();
|
||||||
|
|
||||||
game.doAttack(getMovePosition(game.scene, 0, Moves.SPORE));
|
game.move.select(Moves.SPORE, 0, BattlerIndex.ENEMY_2);
|
||||||
await game.phaseInterceptor.to(SelectTargetPhase, false);
|
game.move.select(Moves.NUZZLE, 1, BattlerIndex.ENEMY_2);
|
||||||
game.doSelectTarget(BattlerIndex.ENEMY_2);
|
|
||||||
|
|
||||||
await game.phaseInterceptor.to(CommandPhase);
|
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY_2]);
|
||||||
|
|
||||||
game.doAttack(getMovePosition(game.scene, 1, Moves.NUZZLE));
|
await game.phaseInterceptor.to("BerryPhase");
|
||||||
await game.phaseInterceptor.to(SelectTargetPhase, false);
|
|
||||||
game.doSelectTarget(BattlerIndex.ENEMY_2);
|
|
||||||
|
|
||||||
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY_2]);
|
const enemyPokemon = game.scene.getEnemyField();
|
||||||
|
|
||||||
await game.phaseInterceptor.to(TurnEndPhase);
|
expect(enemyPokemon[0].status).toBeUndefined();
|
||||||
|
expect(enemyPokemon[1].status).toBeUndefined();
|
||||||
|
}, TIMEOUT);
|
||||||
|
|
||||||
const enemyPokemon = game.scene.getEnemyField();
|
it("protects from Yawn", async () => {
|
||||||
|
await game.startBattle();
|
||||||
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||||
|
|
||||||
expect(enemyPokemon[0].status).toBeUndefined();
|
game.move.select(Moves.YAWN);
|
||||||
expect(enemyPokemon[1].status).toBeUndefined();
|
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
||||||
}, TIMEOUT
|
await game.toNextTurn();
|
||||||
);
|
|
||||||
|
|
||||||
it("protects from Yawn",
|
expect(enemyPokemon.summonData.tags).toEqual([]);
|
||||||
async () => {
|
}, TIMEOUT);
|
||||||
await game.startBattle();
|
|
||||||
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
|
||||||
|
|
||||||
game.doAttack(getMovePosition(game.scene, 0, Moves.YAWN));
|
it("doesn't protect from already existing Yawn", async () => {
|
||||||
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
await game.startBattle();
|
||||||
await game.toNextTurn();
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||||
|
|
||||||
expect(enemyPokemon.summonData.tags).toEqual([]);
|
game.move.select(Moves.YAWN);
|
||||||
}, TIMEOUT
|
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
|
||||||
);
|
await game.toNextTurn();
|
||||||
|
|
||||||
it("doesn't protect from already existing Yawn",
|
game.move.select(Moves.SPLASH);
|
||||||
async () => {
|
await game.toNextTurn();
|
||||||
await game.startBattle();
|
|
||||||
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
|
||||||
|
|
||||||
game.doAttack(getMovePosition(game.scene, 0, Moves.YAWN));
|
expect(enemyPokemon.status?.effect).toEqual(StatusEffect.SLEEP);
|
||||||
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
|
}, TIMEOUT);
|
||||||
await game.toNextTurn();
|
|
||||||
|
|
||||||
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
|
it("doesn't protect from self-inflicted via Rest or Flame Orb", async () => {
|
||||||
await game.toNextTurn();
|
game.override.enemyHeldItems([{name: "FLAME_ORB"}]);
|
||||||
|
await game.startBattle();
|
||||||
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||||
|
|
||||||
expect(enemyPokemon.status?.effect).toEqual(StatusEffect.SLEEP);
|
game.move.select(Moves.SPLASH);
|
||||||
}, TIMEOUT
|
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
||||||
);
|
await game.toNextTurn();
|
||||||
|
|
||||||
it("doesn't protect from self-inflicted via Rest or Flame Orb",
|
expect(enemyPokemon.status?.effect).toEqual(StatusEffect.BURN);
|
||||||
async () => {
|
|
||||||
game.override.enemyHeldItems([{name: "FLAME_ORB"}]);
|
|
||||||
await game.startBattle();
|
|
||||||
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
|
||||||
|
|
||||||
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
|
game.override.enemyMoveset(Array(4).fill(Moves.REST));
|
||||||
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
game.move.select(Moves.SPLASH);
|
||||||
await game.toNextTurn();
|
await game.toNextTurn();
|
||||||
|
|
||||||
expect(enemyPokemon.status?.effect).toEqual(StatusEffect.BURN);
|
expect(enemyPokemon.status?.effect).toEqual(StatusEffect.SLEEP);
|
||||||
|
}, TIMEOUT);
|
||||||
|
|
||||||
game.override.enemyMoveset(Array(4).fill(Moves.REST));
|
it("protects from ability-inflicted status", async () => {
|
||||||
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
|
game.override.ability(Abilities.STATIC);
|
||||||
await game.toNextTurn();
|
vi.spyOn(allAbilities[Abilities.STATIC].getAttrs(PostDefendContactApplyStatusEffectAbAttr)[0], "chance", "get").mockReturnValue(100);
|
||||||
|
await game.startBattle();
|
||||||
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||||
|
|
||||||
expect(enemyPokemon.status?.effect).toEqual(StatusEffect.SLEEP);
|
game.move.select(Moves.SPLASH);
|
||||||
}, TIMEOUT
|
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
||||||
);
|
await game.toNextTurn();
|
||||||
|
game.override.enemyMoveset(Array(4).fill(Moves.TACKLE));
|
||||||
|
game.move.select(Moves.SPLASH);
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
it("protects from ability-inflicted status",
|
expect(enemyPokemon.status).toBeUndefined();
|
||||||
async () => {
|
}, TIMEOUT);
|
||||||
game.override.ability(Abilities.STATIC);
|
|
||||||
vi.spyOn(allAbilities[Abilities.STATIC].getAttrs(PostDefendContactApplyStatusEffectAbAttr)[0], "chance", "get").mockReturnValue(100);
|
|
||||||
await game.startBattle();
|
|
||||||
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
|
||||||
|
|
||||||
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
|
|
||||||
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
|
||||||
await game.toNextTurn();
|
|
||||||
game.override.enemyMoveset(Array(4).fill(Moves.TACKLE));
|
|
||||||
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
|
|
||||||
await game.toNextTurn();
|
|
||||||
|
|
||||||
expect(enemyPokemon.status).toBeUndefined();
|
|
||||||
}, TIMEOUT
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user