mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-24 00:09:31 +02:00
Add tests
This commit is contained in:
parent
4bcbfc5a3e
commit
aca3083cc0
@ -1,8 +1,9 @@
|
||||
import { BattlerIndex } from "#app/battle";
|
||||
import { StatusEffect } from "#app/data/status-effect";
|
||||
import { toDmgValue } from "#app/utils";
|
||||
import { Abilities } from "#enums/abilities";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { Species } from "#enums/species";
|
||||
import { StatusEffect } from "#app/data/status-effect";
|
||||
import { Stat } from "#enums/stat";
|
||||
import GameManager from "#test/utils/gameManager";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
@ -223,4 +224,17 @@ describe("Abilities - Disguise", () => {
|
||||
expect(mimikyu.formIndex).toBe(bustedForm);
|
||||
expect(mimikyu.hp).toBe(maxHp - disguiseDamage);
|
||||
});
|
||||
|
||||
it("doesn't trigger if user is behind a substitute", async () => {
|
||||
game.override
|
||||
.enemyMoveset(Moves.SUBSTITUTE)
|
||||
.moveset(Moves.POWER_TRIP);
|
||||
await game.classicMode.startBattle();
|
||||
|
||||
game.move.select(Moves.POWER_TRIP);
|
||||
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(game.scene.getEnemyPokemon()!.formIndex).toBe(disguisedForm);
|
||||
});
|
||||
});
|
||||
|
@ -1,13 +1,14 @@
|
||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
import { StatusEffect } from "#enums/status-effect";
|
||||
import { BattlerIndex } from "#app/battle";
|
||||
import Pokemon from "#app/field/pokemon";
|
||||
import GameManager from "#test/utils/gameManager";
|
||||
import { Abilities } from "#enums/abilities";
|
||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { Species } from "#enums/species";
|
||||
import { Stat } from "#enums/stat";
|
||||
import { StatusEffect } from "#enums/status-effect";
|
||||
import GameManager from "#test/utils/gameManager";
|
||||
import Phaser from "phaser";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { Stat } from "#enums/stat";
|
||||
|
||||
describe("Abilities - Gulp Missile", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
@ -40,8 +41,9 @@ describe("Abilities - Gulp Missile", () => {
|
||||
beforeEach(() => {
|
||||
game = new GameManager(phaserGame);
|
||||
game.override
|
||||
.disableCrits()
|
||||
.battleType("single")
|
||||
.moveset([Moves.SURF, Moves.DIVE, Moves.SPLASH])
|
||||
.moveset([Moves.SURF, Moves.DIVE, Moves.SPLASH, Moves.SUBSTITUTE])
|
||||
.enemySpecies(Species.SNORLAX)
|
||||
.enemyAbility(Abilities.BALL_FETCH)
|
||||
.enemyMoveset(Moves.SPLASH)
|
||||
@ -234,6 +236,25 @@ describe("Abilities - Gulp Missile", () => {
|
||||
expect(game.scene.getEnemyPokemon()!.getStatStage(Stat.DEF)).toBe(-1);
|
||||
});
|
||||
|
||||
it("doesn't trigger if user is behind a substitute", async () => {
|
||||
game.override
|
||||
.enemyAbility(Abilities.STURDY)
|
||||
.enemyMoveset([Moves.SPLASH, Moves.POWER_TRIP]);
|
||||
await game.classicMode.startBattle([Species.CRAMORANT]);
|
||||
|
||||
game.move.select(Moves.SURF);
|
||||
await game.forceEnemyMove(Moves.SPLASH);
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(game.scene.getPlayerPokemon()!.formIndex).toBe(GULPING_FORM);
|
||||
|
||||
game.move.select(Moves.SUBSTITUTE);
|
||||
await game.forceEnemyMove(Moves.POWER_TRIP);
|
||||
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(game.scene.getPlayerPokemon()!.formIndex).toBe(GULPING_FORM);
|
||||
});
|
||||
|
||||
it("cannot be suppressed", async () => {
|
||||
game.override.enemyMoveset(Moves.GASTRO_ACID);
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { BattlerIndex } from "#app/battle";
|
||||
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
|
||||
import { MoveEndPhase } from "#app/phases/move-end-phase";
|
||||
import { QuietFormChangePhase } from "#app/phases/quiet-form-change-phase";
|
||||
@ -36,7 +37,7 @@ describe("Abilities - Ice Face", () => {
|
||||
});
|
||||
|
||||
it("takes no damage from physical move and transforms to Noice", async () => {
|
||||
await game.startBattle([Species.HITMONLEE]);
|
||||
await game.classicMode.startBattle([Species.HITMONLEE]);
|
||||
|
||||
game.move.select(Moves.TACKLE);
|
||||
|
||||
@ -52,7 +53,7 @@ describe("Abilities - Ice Face", () => {
|
||||
it("takes no damage from the first hit of multihit physical move and transforms to Noice", async () => {
|
||||
game.override.moveset([Moves.SURGING_STRIKES]);
|
||||
game.override.enemyLevel(1);
|
||||
await game.startBattle([Species.HITMONLEE]);
|
||||
await game.classicMode.startBattle([Species.HITMONLEE]);
|
||||
|
||||
game.move.select(Moves.SURGING_STRIKES);
|
||||
|
||||
@ -78,7 +79,7 @@ describe("Abilities - Ice Face", () => {
|
||||
});
|
||||
|
||||
it("takes damage from special moves", async () => {
|
||||
await game.startBattle([Species.MAGIKARP]);
|
||||
await game.classicMode.startBattle([Species.MAGIKARP]);
|
||||
|
||||
game.move.select(Moves.ICE_BEAM);
|
||||
|
||||
@ -92,7 +93,7 @@ describe("Abilities - Ice Face", () => {
|
||||
});
|
||||
|
||||
it("takes effects from status moves", async () => {
|
||||
await game.startBattle([Species.MAGIKARP]);
|
||||
await game.classicMode.startBattle([Species.MAGIKARP]);
|
||||
|
||||
game.move.select(Moves.TOXIC_THREAD);
|
||||
|
||||
@ -108,7 +109,7 @@ describe("Abilities - Ice Face", () => {
|
||||
game.override.moveset([Moves.QUICK_ATTACK]);
|
||||
game.override.enemyMoveset([Moves.HAIL, Moves.HAIL, Moves.HAIL, Moves.HAIL]);
|
||||
|
||||
await game.startBattle([Species.MAGIKARP]);
|
||||
await game.classicMode.startBattle([Species.MAGIKARP]);
|
||||
|
||||
game.move.select(Moves.QUICK_ATTACK);
|
||||
|
||||
@ -130,7 +131,7 @@ describe("Abilities - Ice Face", () => {
|
||||
game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]);
|
||||
game.override.moveset([Moves.SNOWSCAPE]);
|
||||
|
||||
await game.startBattle([Species.EISCUE, Species.NINJASK]);
|
||||
await game.classicMode.startBattle([Species.EISCUE, Species.NINJASK]);
|
||||
|
||||
game.move.select(Moves.SNOWSCAPE);
|
||||
|
||||
@ -157,7 +158,7 @@ describe("Abilities - Ice Face", () => {
|
||||
game.override.enemySpecies(Species.SHUCKLE);
|
||||
game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]);
|
||||
|
||||
await game.startBattle([Species.EISCUE]);
|
||||
await game.classicMode.startBattle([Species.EISCUE]);
|
||||
|
||||
game.move.select(Moves.HAIL);
|
||||
const eiscue = game.scene.getPlayerPokemon()!;
|
||||
@ -176,7 +177,7 @@ describe("Abilities - Ice Face", () => {
|
||||
it("persists form change when switched out", async () => {
|
||||
game.override.enemyMoveset([Moves.QUICK_ATTACK, Moves.QUICK_ATTACK, Moves.QUICK_ATTACK, Moves.QUICK_ATTACK]);
|
||||
|
||||
await game.startBattle([Species.EISCUE, Species.MAGIKARP]);
|
||||
await game.classicMode.startBattle([Species.EISCUE, Species.MAGIKARP]);
|
||||
|
||||
game.move.select(Moves.ICE_BEAM);
|
||||
|
||||
@ -205,7 +206,7 @@ describe("Abilities - Ice Face", () => {
|
||||
[Species.EISCUE]: noiceForm,
|
||||
});
|
||||
|
||||
await game.startBattle([Species.EISCUE]);
|
||||
await game.classicMode.startBattle([Species.EISCUE]);
|
||||
|
||||
const eiscue = game.scene.getPlayerPokemon()!;
|
||||
|
||||
@ -222,10 +223,23 @@ describe("Abilities - Ice Face", () => {
|
||||
expect(eiscue.getTag(BattlerTagType.ICE_FACE)).not.toBe(undefined);
|
||||
});
|
||||
|
||||
it("doesn't trigger if user is behind a substitute", async () => {
|
||||
game.override
|
||||
.enemyMoveset(Moves.SUBSTITUTE)
|
||||
.moveset(Moves.POWER_TRIP);
|
||||
await game.classicMode.startBattle();
|
||||
|
||||
game.move.select(Moves.POWER_TRIP);
|
||||
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(game.scene.getEnemyPokemon()!.formIndex).toBe(icefaceForm);
|
||||
});
|
||||
|
||||
it("cannot be suppressed", async () => {
|
||||
game.override.moveset([Moves.GASTRO_ACID]);
|
||||
|
||||
await game.startBattle([Species.MAGIKARP]);
|
||||
await game.classicMode.startBattle([Species.MAGIKARP]);
|
||||
|
||||
game.move.select(Moves.GASTRO_ACID);
|
||||
|
||||
@ -241,7 +255,7 @@ describe("Abilities - Ice Face", () => {
|
||||
it("cannot be swapped with another ability", async () => {
|
||||
game.override.moveset([Moves.SKILL_SWAP]);
|
||||
|
||||
await game.startBattle([Species.MAGIKARP]);
|
||||
await game.classicMode.startBattle([Species.MAGIKARP]);
|
||||
|
||||
game.move.select(Moves.SKILL_SWAP);
|
||||
|
||||
@ -257,7 +271,7 @@ describe("Abilities - Ice Face", () => {
|
||||
it("cannot be copied", async () => {
|
||||
game.override.ability(Abilities.TRACE);
|
||||
|
||||
await game.startBattle([Species.MAGIKARP]);
|
||||
await game.classicMode.startBattle([Species.MAGIKARP]);
|
||||
|
||||
game.move.select(Moves.SIMPLE_BEAM);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user