mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-26 09:19:31 +02:00
Imprison and Taunt Tests
This commit is contained in:
parent
1f09561518
commit
11de99b43c
@ -4,8 +4,8 @@ import { Abilities } from "#enums/abilities";
|
||||
import GameManager from "#test/utils/gameManager";
|
||||
import Phaser from "phaser";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
import { MoveResult } from "#app/field/pokemon";
|
||||
import { BattlerTagType } from "#app/enums/battler-tag-type";
|
||||
import { ArenaTagType } from "#app/enums/arena-tag-type";
|
||||
|
||||
describe("Moves - Imprison", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
@ -25,28 +25,75 @@ describe("Moves - Imprison", () => {
|
||||
game.override
|
||||
.battleType("single")
|
||||
.enemyAbility(Abilities.BALL_FETCH)
|
||||
.enemyMoveset([Moves.IMPRISON, Moves.SPLASH])
|
||||
.enemyMoveset([Moves.IMPRISON, Moves.SPLASH, Moves.GROWL])
|
||||
.enemySpecies(Species.SHUCKLE)
|
||||
.moveset([Moves.GROWL]);
|
||||
.moveset([Moves.TRANSFORM, Moves.SPLASH]);
|
||||
});
|
||||
|
||||
it("Pokemon should not be able to use the same move consecutively", async () => {
|
||||
it("Pokemon under Imprison cannot use shared moves", async () => {
|
||||
await game.classicMode.startBattle([Species.REGIELEKI]);
|
||||
|
||||
const playerPokemon = game.scene.getPlayerPokemon();
|
||||
|
||||
// First turn, Player Pokemon fails usin
|
||||
game.move.select(Moves.GROWL);
|
||||
game.move.select(Moves.TRANSFORM);
|
||||
await game.forceEnemyMove(Moves.IMPRISON);
|
||||
await game.toNextTurn();
|
||||
const move1 = playerPokemon?.getLastXMoves(1)[0]!;
|
||||
expect(move1.move).toBe(Moves.GROWL);
|
||||
expect(move1.result).toBe(MoveResult.SUCCESS);
|
||||
expect(playerPokemon?.getTag(BattlerTagType.IMPRISON)).toBeDefined();
|
||||
const playerMoveset = playerPokemon!.getMoveset().map(x => x?.moveId);
|
||||
const enemyMoveset = game.scene.getEnemyPokemon()!.getMoveset().map(x => x?.moveId);
|
||||
expect(enemyMoveset.includes(playerMoveset[0])).toBeTruthy();
|
||||
const imprisonArenaTag = game.scene.arena.getTag(ArenaTagType.IMPRISON);
|
||||
const imprisonBattlerTag = playerPokemon!.getTag(BattlerTagType.IMPRISON);
|
||||
expect(imprisonArenaTag).toBeDefined();
|
||||
expect(imprisonBattlerTag).toBeDefined();
|
||||
|
||||
// Second turn, Taunt forces Struggle to occur
|
||||
game.move.select(Moves.GROWL);
|
||||
// Second turn, Imprison forces Struggle to occur
|
||||
game.move.select(Moves.SPLASH);
|
||||
await game.forceEnemyMove(Moves.SPLASH);
|
||||
await game.toNextTurn();
|
||||
const move1 = playerPokemon?.getLastXMoves(1)[0]!;
|
||||
expect(move1.move).toBe(Moves.STRUGGLE);
|
||||
});
|
||||
|
||||
it("Imprison applies to Pokemon switched into Battle", async () => {
|
||||
game.override.battleType("single");
|
||||
await game.classicMode.startBattle([Species.REGIELEKI, Species.BULBASAUR]);
|
||||
|
||||
const playerPokemon1 = game.scene.getPlayerPokemon();
|
||||
|
||||
game.move.select(Moves.SPLASH);
|
||||
await game.forceEnemyMove(Moves.IMPRISON);
|
||||
await game.toNextTurn();
|
||||
const imprisonArenaTag = game.scene.arena.getTag(ArenaTagType.IMPRISON);
|
||||
const imprisonBattlerTag1 = playerPokemon1!.getTag(BattlerTagType.IMPRISON);
|
||||
expect(imprisonArenaTag).toBeDefined();
|
||||
expect(imprisonBattlerTag1).toBeDefined();
|
||||
|
||||
// Second turn, Imprison forces Struggle to occur
|
||||
game.doSwitchPokemon(1);
|
||||
await game.forceEnemyMove(Moves.SPLASH);
|
||||
await game.toNextTurn();
|
||||
const playerPokemon2 = game.scene.getPlayerPokemon();
|
||||
const imprisonBattlerTag2 = playerPokemon2!.getTag(BattlerTagType.IMPRISON);
|
||||
expect(playerPokemon1).not.toEqual(playerPokemon2);
|
||||
expect(imprisonBattlerTag2).toBeDefined();
|
||||
});
|
||||
|
||||
it("The effects of Imprison only end when the source is no longer active", async () => {
|
||||
game.override.battleType("single");
|
||||
game.override.moveset([Moves.SPLASH, Moves.IMPRISON]);
|
||||
await game.classicMode.startBattle([Species.REGIELEKI, Species.BULBASAUR]);
|
||||
|
||||
const playerPokemon = game.scene.getPlayerPokemon();
|
||||
const enemyPokemon = game.scene.getEnemyPokemon();
|
||||
game.move.select(Moves.IMPRISON);
|
||||
await game.forceEnemyMove(Moves.IMPRISON);
|
||||
await game.toNextTurn();
|
||||
expect(game.scene.arena.getTag(ArenaTagType.IMPRISON)).toBeDefined();
|
||||
expect(enemyPokemon!.getTag(BattlerTagType.IMPRISON)).toBeDefined();
|
||||
game.doSwitchPokemon(1);
|
||||
await game.forceEnemyMove(Moves.SPLASH);
|
||||
await game.toNextTurn();
|
||||
expect(playerPokemon?.isActive(true)).toBeFalsy();
|
||||
expect(enemyPokemon!.getTag(BattlerTagType.IMPRISON)).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
@ -35,7 +35,7 @@ describe("Moves - Taunt", () => {
|
||||
|
||||
const playerPokemon = game.scene.getPlayerPokemon();
|
||||
|
||||
// First turn, Player Pokemon succeeds using Growl
|
||||
// First turn, Player Pokemon succeeds using Growl without Torment
|
||||
game.move.select(Moves.GROWL);
|
||||
await game.forceEnemyMove(Moves.TAUNT);
|
||||
await game.toNextTurn();
|
||||
|
Loading…
Reference in New Issue
Block a user