forked from pagefaultgames/pokerogue
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
186 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { Abilities } from "#enums/abilities"; | ||
import { Moves } from "#enums/moves"; | ||
import { Species } from "#enums/species"; | ||
import GameManager from "#test/utils/gameManager"; | ||
import Phaser from "phaser"; | ||
import { afterEach, beforeAll, beforeEach, describe, it, expect } from "vitest"; | ||
|
||
describe("Abilities - Arena Trap", () => { | ||
let phaserGame: Phaser.Game; | ||
let game: GameManager; | ||
const TIMEOUT = 20 * 1000; | ||
|
||
beforeAll(() => { | ||
phaserGame = new Phaser.Game({ | ||
type: Phaser.HEADLESS, | ||
}); | ||
}); | ||
|
||
afterEach(() => { | ||
game.phaseInterceptor.restoreOg(); | ||
}); | ||
|
||
beforeEach(() => { | ||
game = new GameManager(phaserGame); | ||
game.override | ||
.moveset(Moves.SPLASH) | ||
.ability(Abilities.ARENA_TRAP) | ||
.enemySpecies(Species.RALTS) | ||
.enemyAbility(Abilities.BALL_FETCH) | ||
.enemyMoveset(Moves.TELEPORT); | ||
}); | ||
|
||
// TODO: Enable test when Issue #935 is addressed | ||
it.todo("should not allow grounded Pokémon to flee", async () => { | ||
game.override.battleType("single"); | ||
|
||
await game.classicMode.startBattle(); | ||
|
||
const enemy = game.scene.getEnemyPokemon(); | ||
|
||
game.move.select(Moves.SPLASH); | ||
|
||
await game.toNextTurn(); | ||
|
||
expect(enemy).toBe(game.scene.getEnemyPokemon()); | ||
}, TIMEOUT); | ||
|
||
it("should guarantee double battle with any one LURE", async () => { | ||
game.override | ||
.startingModifier([ | ||
{ name: "LURE" }, | ||
]) | ||
.startingWave(2); | ||
|
||
await game.classicMode.startBattle(); | ||
|
||
expect(game.scene.getEnemyField().length).toBe(2); | ||
}, TIMEOUT); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { Stat } from "#app/enums/stat"; | ||
import { Abilities } from "#enums/abilities"; | ||
import { Moves } from "#enums/moves"; | ||
import GameManager from "#test/utils/gameManager"; | ||
import Phaser from "phaser"; | ||
import { afterEach, beforeAll, beforeEach, describe, it, expect } from "vitest"; | ||
|
||
describe("Abilities - Illuminate", () => { | ||
let phaserGame: Phaser.Game; | ||
let game: GameManager; | ||
const TIMEOUT = 20 * 1000; | ||
|
||
beforeAll(() => { | ||
phaserGame = new Phaser.Game({ | ||
type: Phaser.HEADLESS, | ||
}); | ||
}); | ||
|
||
afterEach(() => { | ||
game.phaseInterceptor.restoreOg(); | ||
}); | ||
|
||
beforeEach(() => { | ||
game = new GameManager(phaserGame); | ||
game.override | ||
.moveset(Moves.SPLASH) | ||
.ability(Abilities.ILLUMINATE) | ||
.enemyAbility(Abilities.BALL_FETCH) | ||
.enemyMoveset(Moves.SAND_ATTACK); | ||
}); | ||
|
||
it("should prevent ACC stat stage from being lowered", async () => { | ||
game.override.battleType("single"); | ||
|
||
await game.classicMode.startBattle(); | ||
|
||
const player = game.scene.getPlayerPokemon()!; | ||
|
||
expect(player.getStatStage(Stat.ACC)).toBe(0); | ||
|
||
game.move.select(Moves.SPLASH); | ||
|
||
await game.toNextTurn(); | ||
|
||
expect(player.getStatStage(Stat.ACC)).toBe(0); | ||
}, TIMEOUT); | ||
|
||
it("should guarantee double battle with any one LURE", async () => { | ||
game.override | ||
.startingModifier([ | ||
{ name: "LURE" }, | ||
]) | ||
.startingWave(2); | ||
|
||
await game.classicMode.startBattle(); | ||
|
||
expect(game.scene.getEnemyField().length).toBe(2); | ||
}, TIMEOUT); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { BattlerIndex } from "#app/battle"; | ||
import { MoveEffectPhase } from "#app/phases/move-effect-phase"; | ||
import { MoveEndPhase } from "#app/phases/move-end-phase"; | ||
import { Abilities } from "#enums/abilities"; | ||
import { Moves } from "#enums/moves"; | ||
import { Species } from "#enums/species"; | ||
import GameManager from "#test/utils/gameManager"; | ||
import Phaser from "phaser"; | ||
import { afterEach, beforeAll, beforeEach, describe, it, expect, vi } from "vitest"; | ||
|
||
describe("Abilities - No Guard", () => { | ||
let phaserGame: Phaser.Game; | ||
let game: GameManager; | ||
const TIMEOUT = 20 * 1000; | ||
|
||
beforeAll(() => { | ||
phaserGame = new Phaser.Game({ | ||
type: Phaser.HEADLESS, | ||
}); | ||
}); | ||
|
||
afterEach(() => { | ||
game.phaseInterceptor.restoreOg(); | ||
}); | ||
|
||
beforeEach(() => { | ||
game = new GameManager(phaserGame); | ||
game.override | ||
.moveset(Moves.ZAP_CANNON) | ||
.ability(Abilities.NO_GUARD) | ||
.enemyLevel(200) | ||
.enemyAbility(Abilities.BALL_FETCH) | ||
.enemyMoveset(Moves.SPLASH); | ||
}); | ||
|
||
it("should make moves always hit regardless of move accuracy", async () => { | ||
game.override.battleType("single"); | ||
|
||
await game.classicMode.startBattle([ | ||
Species.REGIELEKI | ||
]); | ||
|
||
game.move.select(Moves.ZAP_CANNON); | ||
|
||
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]); | ||
|
||
await game.phaseInterceptor.to(MoveEffectPhase, false); | ||
|
||
const moveEffectPhase = game.scene.getCurrentPhase() as MoveEffectPhase; | ||
vi.spyOn(moveEffectPhase, "hitCheck"); | ||
|
||
await game.phaseInterceptor.to(MoveEndPhase); | ||
|
||
expect(moveEffectPhase.hitCheck).toHaveReturnedWith(true); | ||
}, TIMEOUT); | ||
|
||
it("should guarantee double battle with any one LURE", async () => { | ||
game.override | ||
.startingModifier([ | ||
{ name: "LURE" }, | ||
]) | ||
.startingWave(2); | ||
|
||
await game.classicMode.startBattle(); | ||
|
||
expect(game.scene.getEnemyField().length).toBe(2); | ||
}, TIMEOUT); | ||
}); |