Final tests before documentation

This commit is contained in:
frutescens 2024-09-24 13:48:32 -07:00
parent c1a2b76800
commit 542ac83dfd
3 changed files with 26 additions and 19 deletions

View File

@ -4,8 +4,9 @@ import { Abilities } from "#enums/abilities";
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";
import { MoveResult } from "#app/field/pokemon";
import { BattlerTagType } from "#app/enums/battler-tag-type"; import { BattlerTagType } from "#app/enums/battler-tag-type";
import { ArenaTagType } from "#app/enums/arena-tag-type";
import { BattlerIndex } from "#app/battle";
describe("Moves - Aroma Veil", () => { describe("Moves - Aroma Veil", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -23,32 +24,39 @@ describe("Moves - Aroma Veil", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override game.override
.battleType("single") .battleType("double")
.enemyAbility(Abilities.BALL_FETCH) .enemyAbility(Abilities.BALL_FETCH)
.enemyMoveset([Moves.TAUNT, Moves.SPLASH]) .enemyMoveset([Moves.HEAL_BLOCK, Moves.IMPRISON, Moves.SPLASH])
.enemySpecies(Species.SHUCKLE) .enemySpecies(Species.SHUCKLE)
.ability(Abilities.AROMA_VEIL)
.moveset([Moves.GROWL]); .moveset([Moves.GROWL]);
}); });
it("Pokemon should not be able to use the same move consecutively", async () => { it("Aroma Veil protects the Pokemon's side against most Move Restriction Battler Tags", async () => {
await game.classicMode.startBattle([Species.REGIELEKI]); await game.classicMode.startBattle([Species.REGIELEKI, Species.BULBASAUR]);
const playerPokemon = game.scene.getPlayerPokemon(); const playerPokemon = game.scene.getParty()!;
// First turn, Player Pokemon fails usin
game.move.select(Moves.GROWL); game.move.select(Moves.GROWL);
await game.forceEnemyMove(Moves.TAUNT); game.move.select(Moves.GROWL);
await game.forceEnemyMove(Moves.HEAL_BLOCK);
await game.toNextTurn(); await game.toNextTurn();
const move1 = playerPokemon?.getLastXMoves(1)[0]!; expect(playerPokemon[0].getTag(BattlerTagType.HEAL_BLOCK)).toBeUndefined();
expect(move1.move).toBe(Moves.GROWL); expect(playerPokemon[1].getTag(BattlerTagType.HEAL_BLOCK)).toBeUndefined();
expect(move1.result).toBe(MoveResult.SUCCESS); });
expect(playerPokemon?.getTag(BattlerTagType.TAUNT)).toBeDefined();
it("Aroma Veil does not protect against Imprison", async () => {
await game.classicMode.startBattle([Species.REGIELEKI, Species.BULBASAUR]);
const playerPokemon = game.scene.getParty()!;
// Second turn, Taunt forces Struggle to occur
game.move.select(Moves.GROWL); game.move.select(Moves.GROWL);
game.move.select(Moves.GROWL);
await game.forceEnemyMove(Moves.IMPRISON, BattlerIndex.PLAYER);
await game.forceEnemyMove(Moves.SPLASH); await game.forceEnemyMove(Moves.SPLASH);
await game.toNextTurn(); await game.toNextTurn();
const move2 = playerPokemon?.getLastXMoves(1)[0]!; expect(game.scene.arena.getTag(ArenaTagType.IMPRISON)).toBeDefined();
expect(move2.move).toBe(Moves.STRUGGLE); expect(playerPokemon[0].getTag(BattlerTagType.IMPRISON)).toBeDefined();
expect(playerPokemon[1].getTag(BattlerTagType.IMPRISON)).toBeDefined();
}); });
}); });

View File

@ -55,7 +55,6 @@ describe("Moves - Imprison", () => {
}); });
it("Imprison applies to Pokemon switched into Battle", async () => { it("Imprison applies to Pokemon switched into Battle", async () => {
game.override.battleType("single");
await game.classicMode.startBattle([Species.REGIELEKI, Species.BULBASAUR]); await game.classicMode.startBattle([Species.REGIELEKI, Species.BULBASAUR]);
const playerPokemon1 = game.scene.getPlayerPokemon(); const playerPokemon1 = game.scene.getPlayerPokemon();
@ -79,14 +78,13 @@ describe("Moves - Imprison", () => {
}); });
it("The effects of Imprison only end when the source is no longer active", async () => { 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]); game.override.moveset([Moves.SPLASH, Moves.IMPRISON]);
await game.classicMode.startBattle([Species.REGIELEKI, Species.BULBASAUR]); await game.classicMode.startBattle([Species.REGIELEKI, Species.BULBASAUR]);
const playerPokemon = game.scene.getPlayerPokemon(); const playerPokemon = game.scene.getPlayerPokemon();
const enemyPokemon = game.scene.getEnemyPokemon(); const enemyPokemon = game.scene.getEnemyPokemon();
game.move.select(Moves.IMPRISON); game.move.select(Moves.IMPRISON);
await game.forceEnemyMove(Moves.IMPRISON); await game.forceEnemyMove(Moves.GROWL);
await game.toNextTurn(); await game.toNextTurn();
expect(game.scene.arena.getTag(ArenaTagType.IMPRISON)).toBeDefined(); expect(game.scene.arena.getTag(ArenaTagType.IMPRISON)).toBeDefined();
expect(enemyPokemon!.getTag(BattlerTagType.IMPRISON)).toBeDefined(); expect(enemyPokemon!.getTag(BattlerTagType.IMPRISON)).toBeDefined();
@ -94,6 +92,7 @@ describe("Moves - Imprison", () => {
await game.forceEnemyMove(Moves.SPLASH); await game.forceEnemyMove(Moves.SPLASH);
await game.toNextTurn(); await game.toNextTurn();
expect(playerPokemon?.isActive(true)).toBeFalsy(); expect(playerPokemon?.isActive(true)).toBeFalsy();
expect(game.scene.arena.getTag(ArenaTagType.IMPRISON)).toBeUndefined();
expect(enemyPokemon!.getTag(BattlerTagType.IMPRISON)).toBeUndefined(); expect(enemyPokemon!.getTag(BattlerTagType.IMPRISON)).toBeUndefined();
}); });
}); });

View File

@ -35,7 +35,7 @@ describe("Moves - Taunt", () => {
const playerPokemon = game.scene.getPlayerPokemon(); const playerPokemon = game.scene.getPlayerPokemon();
// First turn, Player Pokemon succeeds using Growl without Torment // First turn, Player Pokemon succeeds using Growl without Taunt
game.move.select(Moves.GROWL); game.move.select(Moves.GROWL);
await game.forceEnemyMove(Moves.TAUNT); await game.forceEnemyMove(Moves.TAUNT);
await game.toNextTurn(); await game.toNextTurn();