Changing tests for illuminate, no guard, arena trap and commander to directly check the chance of a double battle.
This commit is contained in:
parent
851bb7e544
commit
1752663f80
|
@ -45,16 +45,27 @@ describe("Abilities - Arena Trap", () => {
|
||||||
expect(enemy).toBe(game.scene.getEnemyPokemon());
|
expect(enemy).toBe(game.scene.getEnemyPokemon());
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should guarantee double battle with any one LURE", async () => {
|
it("should increase the chance of double battles", async () => {
|
||||||
game.override
|
game.override
|
||||||
.startingModifier([
|
.moveset(Moves.SPLASH)
|
||||||
{ name: "LURE" },
|
.ability(Abilities.ARENA_TRAP)
|
||||||
])
|
.enemySpecies(Species.SUNKERN)
|
||||||
.startingWave(2);
|
.enemyAbility(Abilities.BALL_FETCH)
|
||||||
|
.enemyMoveset(Moves.SPLASH)
|
||||||
|
.startingWave(9);
|
||||||
|
|
||||||
|
vi.spyOn(game.scene, "getDoubleBattleChance");
|
||||||
await game.classicMode.startBattle();
|
await game.classicMode.startBattle();
|
||||||
|
|
||||||
expect(game.scene.getEnemyField().length).toBe(2);
|
game.move.select(Moves.SPLASH);
|
||||||
|
await game.doKillOpponents();
|
||||||
|
await game.toNextWave();
|
||||||
|
expect(game.scene.getDoubleBattleChance).toHaveLastReturnedWith(8);
|
||||||
|
|
||||||
|
game.move.select(Moves.SPLASH);
|
||||||
|
await game.doKillOpponents();
|
||||||
|
await game.toNextWave();
|
||||||
|
expect(game.scene.getDoubleBattleChance).toHaveLastReturnedWith(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -222,3 +222,45 @@ describe("Abilities - Commander", () => {
|
||||||
expect(enemy.isFullHp()).toBeTruthy();
|
expect(enemy.isFullHp()).toBeTruthy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("Abilities - Commander", () => {
|
||||||
|
let phaserGame: Phaser.Game;
|
||||||
|
let game: GameManager;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
phaserGame = new Phaser.Game({
|
||||||
|
type: Phaser.HEADLESS,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
game.phaseInterceptor.restoreOg();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
game = new GameManager(phaserGame);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should increase the chance of double battles", async () => {
|
||||||
|
game.override
|
||||||
|
.moveset(Moves.SPLASH)
|
||||||
|
.ability(Abilities.COMMANDER)
|
||||||
|
.enemySpecies(Species.SUNKERN)
|
||||||
|
.enemyAbility(Abilities.BALL_FETCH)
|
||||||
|
.enemyMoveset(Moves.SPLASH)
|
||||||
|
.startingWave(9);
|
||||||
|
|
||||||
|
vi.spyOn(game.scene, "getDoubleBattleChance");
|
||||||
|
await game.classicMode.startBattle();
|
||||||
|
|
||||||
|
game.move.select(Moves.SPLASH);
|
||||||
|
await game.doKillOpponents();
|
||||||
|
await game.toNextWave();
|
||||||
|
expect(game.scene.getDoubleBattleChance).toHaveLastReturnedWith(8);
|
||||||
|
|
||||||
|
game.move.select(Moves.SPLASH);
|
||||||
|
await game.doKillOpponents();
|
||||||
|
await game.toNextWave();
|
||||||
|
expect(game.scene.getDoubleBattleChance).toHaveLastReturnedWith(2);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import { Stat } from "#app/enums/stat";
|
import { Stat } from "#app/enums/stat";
|
||||||
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 GameManager from "#test/utils/gameManager";
|
import GameManager from "#test/utils/gameManager";
|
||||||
import Phaser from "phaser";
|
import Phaser from "phaser";
|
||||||
import { afterEach, beforeAll, beforeEach, describe, it, expect } from "vitest";
|
import { afterEach, beforeAll, beforeEach, describe, it, expect, vi } from "vitest";
|
||||||
|
|
||||||
describe("Abilities - Illuminate", () => {
|
describe("Abilities - Illuminate", () => {
|
||||||
let phaserGame: Phaser.Game;
|
let phaserGame: Phaser.Game;
|
||||||
|
@ -44,15 +45,26 @@ describe("Abilities - Illuminate", () => {
|
||||||
expect(player.getStatStage(Stat.ACC)).toBe(0);
|
expect(player.getStatStage(Stat.ACC)).toBe(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should guarantee double battle with any one LURE", async () => {
|
it("should increase the chance of double battles", async () => {
|
||||||
game.override
|
game.override
|
||||||
.startingModifier([
|
.moveset(Moves.SPLASH)
|
||||||
{ name: "LURE" },
|
.ability(Abilities.ILLUMINATE)
|
||||||
])
|
.enemySpecies(Species.SUNKERN)
|
||||||
.startingWave(2);
|
.enemyAbility(Abilities.BALL_FETCH)
|
||||||
|
.enemyMoveset(Moves.SPLASH)
|
||||||
|
.startingWave(9);
|
||||||
|
|
||||||
|
vi.spyOn(game.scene, "getDoubleBattleChance");
|
||||||
await game.classicMode.startBattle();
|
await game.classicMode.startBattle();
|
||||||
|
|
||||||
expect(game.scene.getEnemyField().length).toBe(2);
|
game.move.select(Moves.SPLASH);
|
||||||
|
await game.doKillOpponents();
|
||||||
|
await game.toNextWave();
|
||||||
|
expect(game.scene.getDoubleBattleChance).toHaveLastReturnedWith(8);
|
||||||
|
|
||||||
|
game.move.select(Moves.SPLASH);
|
||||||
|
await game.doKillOpponents();
|
||||||
|
await game.toNextWave();
|
||||||
|
expect(game.scene.getDoubleBattleChance).toHaveLastReturnedWith(2);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -53,15 +53,28 @@ describe("Abilities - No Guard", () => {
|
||||||
expect(moveEffectPhase.hitCheck).toHaveReturnedWith(true);
|
expect(moveEffectPhase.hitCheck).toHaveReturnedWith(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should guarantee double battle with any one LURE", async () => {
|
|
||||||
game.override
|
|
||||||
.startingModifier([
|
|
||||||
{ name: "LURE" },
|
|
||||||
])
|
|
||||||
.startingWave(2);
|
|
||||||
|
|
||||||
|
it("should increase the chance of double battles", async () => {
|
||||||
|
game.override
|
||||||
|
.moveset(Moves.SPLASH)
|
||||||
|
.ability(Abilities.NO_GUARD)
|
||||||
|
.enemySpecies(Species.SUNKERN)
|
||||||
|
.enemyAbility(Abilities.BALL_FETCH)
|
||||||
|
.enemyMoveset(Moves.SPLASH)
|
||||||
|
.startingWave(9);
|
||||||
|
|
||||||
|
vi.spyOn(game.scene, "getDoubleBattleChance");
|
||||||
await game.classicMode.startBattle();
|
await game.classicMode.startBattle();
|
||||||
|
|
||||||
expect(game.scene.getEnemyField().length).toBe(2);
|
game.move.select(Moves.SPLASH);
|
||||||
|
await game.doKillOpponents();
|
||||||
|
await game.toNextWave();
|
||||||
|
expect(game.scene.getDoubleBattleChance).toHaveLastReturnedWith(8);
|
||||||
|
|
||||||
|
game.move.select(Moves.SPLASH);
|
||||||
|
await game.doKillOpponents();
|
||||||
|
await game.toNextWave();
|
||||||
|
expect(game.scene.getDoubleBattleChance).toHaveLastReturnedWith(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue