mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-24 15:56:22 +00:00
[Test] Update Zen Mode test (#4845)
This commit is contained in:
parent
efa9f119a0
commit
6799594bbb
@ -1,14 +1,8 @@
|
|||||||
import { BattlerIndex } from "#app/battle";
|
|
||||||
import { Status } from "#app/data/status-effect";
|
import { Status } from "#app/data/status-effect";
|
||||||
import { DamagePhase } from "#app/phases/damage-phase";
|
|
||||||
import { SwitchSummonPhase } from "#app/phases/switch-summon-phase";
|
|
||||||
import { Mode } from "#app/ui/ui";
|
|
||||||
import { Abilities } from "#enums/abilities";
|
import { Abilities } from "#enums/abilities";
|
||||||
import { Moves } from "#enums/moves";
|
import { Moves } from "#enums/moves";
|
||||||
import { Species } from "#enums/species";
|
import { Species } from "#enums/species";
|
||||||
import { Stat } from "#enums/stat";
|
|
||||||
import { StatusEffect } from "#enums/status-effect";
|
import { StatusEffect } from "#enums/status-effect";
|
||||||
import { SwitchType } from "#enums/switch-type";
|
|
||||||
import GameManager from "#test/utils/gameManager";
|
import GameManager from "#test/utils/gameManager";
|
||||||
import Phaser from "phaser";
|
import Phaser from "phaser";
|
||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||||
@ -34,78 +28,60 @@ describe("Abilities - ZEN MODE", () => {
|
|||||||
game = new GameManager(phaserGame);
|
game = new GameManager(phaserGame);
|
||||||
game.override
|
game.override
|
||||||
.battleType("single")
|
.battleType("single")
|
||||||
.enemySpecies(Species.RATTATA)
|
.disableCrits()
|
||||||
.enemyAbility(Abilities.HYDRATION)
|
.enemySpecies(Species.MAGIKARP)
|
||||||
|
.enemyAbility(Abilities.BALL_FETCH)
|
||||||
|
.enemyLevel(5)
|
||||||
.ability(Abilities.ZEN_MODE)
|
.ability(Abilities.ZEN_MODE)
|
||||||
.startingLevel(100)
|
|
||||||
.moveset(Moves.SPLASH)
|
.moveset(Moves.SPLASH)
|
||||||
.enemyMoveset(Moves.TACKLE);
|
.enemyMoveset(Moves.SEISMIC_TOSS);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("shouldn't change form when taking damage if not dropping below 50% HP", async () => {
|
it("shouldn't change form when taking damage if not dropping below 50% HP", async () => {
|
||||||
await game.classicMode.startBattle([ Species.DARMANITAN ]);
|
await game.classicMode.startBattle([ Species.DARMANITAN ]);
|
||||||
const player = game.scene.getPlayerPokemon()!;
|
const darmanitan = game.scene.getPlayerPokemon()!;
|
||||||
player.stats[Stat.HP] = 100;
|
expect(darmanitan.formIndex).toBe(baseForm);
|
||||||
player.hp = 100;
|
|
||||||
expect(player.formIndex).toBe(baseForm);
|
|
||||||
|
|
||||||
game.move.select(Moves.SPLASH);
|
game.move.select(Moves.SPLASH);
|
||||||
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
await game.toNextTurn();
|
||||||
await game.phaseInterceptor.to("BerryPhase");
|
|
||||||
|
|
||||||
expect(player.hp).toBeLessThan(100);
|
expect(darmanitan.getHpRatio()).toBeLessThan(1);
|
||||||
expect(player.formIndex).toBe(baseForm);
|
expect(darmanitan.getHpRatio()).toBeGreaterThan(0.5);
|
||||||
|
expect(darmanitan.formIndex).toBe(baseForm);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should change form when falling below 50% HP", async () => {
|
it("should change form when falling below 50% HP", async () => {
|
||||||
await game.classicMode.startBattle([ Species.DARMANITAN ]);
|
await game.classicMode.startBattle([ Species.DARMANITAN ]);
|
||||||
|
|
||||||
const player = game.scene.getPlayerPokemon()!;
|
const darmanitan = game.scene.getPlayerPokemon()!;
|
||||||
player.stats[Stat.HP] = 1000;
|
darmanitan.hp = (darmanitan.getMaxHp() / 2) + 1;
|
||||||
player.hp = 100;
|
expect(darmanitan.formIndex).toBe(baseForm);
|
||||||
expect(player.formIndex).toBe(baseForm);
|
|
||||||
|
|
||||||
game.move.select(Moves.SPLASH);
|
game.move.select(Moves.SPLASH);
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
expect(darmanitan.getHpRatio()).toBeLessThan(0.5);
|
||||||
await game.phaseInterceptor.to("QuietFormChangePhase");
|
expect(darmanitan.formIndex).toBe(zenForm);
|
||||||
await game.phaseInterceptor.to("TurnInitPhase", false);
|
|
||||||
|
|
||||||
expect(player.hp).not.toBe(100);
|
|
||||||
expect(player.formIndex).toBe(zenForm);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should stay zen mode when fainted", async () => {
|
it("should stay zen mode when fainted", async () => {
|
||||||
await game.classicMode.startBattle([ Species.DARMANITAN, Species.CHARIZARD ]);
|
await game.classicMode.startBattle([ Species.DARMANITAN, Species.CHARIZARD ]);
|
||||||
const player = game.scene.getPlayerPokemon()!;
|
const darmanitan = game.scene.getPlayerPokemon()!;
|
||||||
player.stats[Stat.HP] = 1000;
|
darmanitan.hp = (darmanitan.getMaxHp() / 2) + 1;
|
||||||
player.hp = 100;
|
expect(darmanitan.formIndex).toBe(baseForm);
|
||||||
expect(player.formIndex).toBe(baseForm);
|
|
||||||
|
|
||||||
game.move.select(Moves.SPLASH);
|
game.move.select(Moves.SPLASH);
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
expect(darmanitan.getHpRatio()).toBeLessThan(0.5);
|
||||||
await game.phaseInterceptor.to(DamagePhase, false);
|
expect(darmanitan.formIndex).toBe(zenForm);
|
||||||
const damagePhase = game.scene.getCurrentPhase() as DamagePhase;
|
|
||||||
damagePhase.updateAmount(80);
|
|
||||||
await game.phaseInterceptor.to("QuietFormChangePhase");
|
|
||||||
|
|
||||||
expect(player.hp).not.toBe(100);
|
game.move.select(Moves.SPLASH);
|
||||||
expect(player.formIndex).toBe(zenForm);
|
await game.killPokemon(darmanitan);
|
||||||
|
game.doSelectPartyPokemon(1);
|
||||||
await game.killPokemon(player);
|
await game.toNextTurn();
|
||||||
expect(player.isFainted()).toBe(true);
|
|
||||||
|
|
||||||
await game.phaseInterceptor.to("TurnStartPhase");
|
|
||||||
game.onNextPrompt("SwitchPhase", Mode.PARTY, () => {
|
|
||||||
game.scene.unshiftPhase(new SwitchSummonPhase(game.scene, SwitchType.SWITCH, 0, 1, false));
|
|
||||||
game.scene.ui.setMode(Mode.MESSAGE);
|
|
||||||
});
|
|
||||||
game.onNextPrompt("SwitchPhase", Mode.MESSAGE, () => {
|
|
||||||
game.endPhase();
|
|
||||||
});
|
|
||||||
await game.phaseInterceptor.to("PostSummonPhase");
|
|
||||||
|
|
||||||
|
expect(darmanitan.isFainted()).toBe(true);
|
||||||
expect(game.scene.getPlayerParty()[1].formIndex).toBe(zenForm);
|
expect(game.scene.getPlayerParty()[1].formIndex).toBe(zenForm);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -117,7 +93,8 @@ describe("Abilities - ZEN MODE", () => {
|
|||||||
|
|
||||||
await game.classicMode.startBattle([ Species.MAGIKARP, Species.DARMANITAN ]);
|
await game.classicMode.startBattle([ Species.MAGIKARP, Species.DARMANITAN ]);
|
||||||
|
|
||||||
const darmanitan = game.scene.getPlayerParty().find((p) => p.species.speciesId === Species.DARMANITAN)!;
|
const darmanitan = game.scene.getPlayerParty()[1];
|
||||||
|
darmanitan.hp = 1;
|
||||||
expect(darmanitan.formIndex).toBe(zenForm);
|
expect(darmanitan.formIndex).toBe(zenForm);
|
||||||
|
|
||||||
darmanitan.hp = 0;
|
darmanitan.hp = 0;
|
||||||
@ -126,9 +103,7 @@ describe("Abilities - ZEN MODE", () => {
|
|||||||
|
|
||||||
game.move.select(Moves.SPLASH);
|
game.move.select(Moves.SPLASH);
|
||||||
await game.doKillOpponents();
|
await game.doKillOpponents();
|
||||||
await game.phaseInterceptor.to("TurnEndPhase");
|
await game.toNextWave();
|
||||||
game.doSelectModifier();
|
|
||||||
await game.phaseInterceptor.to("QuietFormChangePhase");
|
|
||||||
|
|
||||||
expect(darmanitan.formIndex).toBe(baseForm);
|
expect(darmanitan.formIndex).toBe(baseForm);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user