[Test] Replace `doAttack()` with `move.select()` in tests (#3567)

* Consolidate `doSelectTarget()` into `doAttack()`

* Fix ternary

* Add error message to aid in debugging tests

* Update docs

* [Test] Change `doAttack()` to `selectMove()`

* Add `select()` to `src/test/utils/helpers/moveHelper.ts`

* Replace instances of `game.selectMove()` with `game.move.select()`

* Fix imports

* Replace `selectMove()` with `move.select()` helper

Fix broken tests for Pastel Veil and Sweet Veil

* Update tsdocs
This commit is contained in:
NightKev 2024-08-22 06:49:33 -07:00 committed by GitHub
parent 10f1a96ed6
commit 828897316e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
167 changed files with 1827 additions and 2378 deletions

View File

@ -1,15 +1,15 @@
import { CommandPhase } from "#app/phases/command-phase";
import { MessagePhase } from "#app/phases/message-phase";
import { TurnInitPhase } from "#app/phases/turn-init-phase";
import i18next, { initI18n } from "#app/plugins/i18n";
import GameManager from "#test/utils/gameManager";
import { Mode } from "#app/ui/ui";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import { CommandPhase } from "#app/phases/command-phase.js";
import { MessagePhase } from "#app/phases/message-phase.js";
import { TurnInitPhase } from "#app/phases/turn-init-phase.js";
describe("Ability Timing", () => {

View File

@ -1,13 +1,12 @@
import { allMoves } from "#app/data/move.js";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { allMoves } from "#app/data/move";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import { MoveEffectPhase } from "#app/phases/move-effect-phase.js";
describe("Abilities - Aura Break", () => {
let phaserGame: Phaser.Game;
@ -42,7 +41,7 @@ describe("Abilities - Aura Break", () => {
vi.spyOn(moveToCheck, "calculateBattlePower");
await game.startBattle([Species.PIKACHU]);
game.doAttack(getMovePosition(game.scene, 0, Moves.MOONBLAST));
game.move.select(Moves.MOONBLAST);
await game.phaseInterceptor.to(MoveEffectPhase);
expect(moveToCheck.calculateBattlePower).toHaveReturnedWith(expect.closeTo(basePower * auraBreakMultiplier));
@ -56,7 +55,7 @@ describe("Abilities - Aura Break", () => {
vi.spyOn(moveToCheck, "calculateBattlePower");
await game.startBattle([Species.PIKACHU]);
game.doAttack(getMovePosition(game.scene, 0, Moves.DARK_PULSE));
game.move.select(Moves.DARK_PULSE);
await game.phaseInterceptor.to(MoveEffectPhase);
expect(moveToCheck.calculateBattlePower).toHaveReturnedWith(expect.closeTo(basePower * auraBreakMultiplier));

View File

@ -1,14 +1,13 @@
import { allMoves } from "#app/data/move.js";
import { Abilities } from "#app/enums/abilities.js";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { allMoves } from "#app/data/move";
import { Abilities } from "#app/enums/abilities";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import { MoveEffectPhase } from "#app/phases/move-effect-phase.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
describe("Abilities - Battery", () => {
let phaserGame: Phaser.Game;
@ -43,8 +42,8 @@ describe("Abilities - Battery", () => {
await game.startBattle([Species.PIKACHU, Species.CHARJABUG]);
game.doAttack(getMovePosition(game.scene, 0, Moves.DAZZLING_GLEAM));
game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH));
game.move.select(Moves.DAZZLING_GLEAM);
game.move.select(Moves.SPLASH, 1);
await game.phaseInterceptor.to(MoveEffectPhase);
expect(moveToCheck.calculateBattlePower).toHaveReturnedWith(basePower * batteryMultiplier);
@ -58,8 +57,8 @@ describe("Abilities - Battery", () => {
await game.startBattle([Species.PIKACHU, Species.CHARJABUG]);
game.doAttack(getMovePosition(game.scene, 0, Moves.BREAKING_SWIPE));
game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH));
game.move.select(Moves.BREAKING_SWIPE);
game.move.select(Moves.SPLASH, 1);
await game.phaseInterceptor.to(MoveEffectPhase);
expect(moveToCheck.calculateBattlePower).toHaveReturnedWith(basePower);
@ -73,8 +72,8 @@ describe("Abilities - Battery", () => {
await game.startBattle([Species.CHARJABUG, Species.PIKACHU]);
game.doAttack(getMovePosition(game.scene, 0, Moves.DAZZLING_GLEAM));
game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH));
game.move.select(Moves.DAZZLING_GLEAM);
game.move.select(Moves.SPLASH, 1);
await game.phaseInterceptor.to(TurnEndPhase);
expect(moveToCheck.calculateBattlePower).toHaveReturnedWith(basePower);

View File

@ -1,11 +1,10 @@
import { Status, StatusEffect } from "#app/data/status-effect.js";
import { QuietFormChangePhase } from "#app/phases/quiet-form-change-phase.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
import { Status, StatusEffect } from "#app/data/status-effect";
import { QuietFormChangePhase } from "#app/phases/quiet-form-change-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
const TIMEOUT = 20 * 1000;
@ -53,7 +52,7 @@ describe("Abilities - BATTLE BOND", () => {
greninja!.status = new Status(StatusEffect.FAINT);
expect(greninja!.isFainted()).toBe(true);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.doKillOpponents();
await game.phaseInterceptor.to(TurnEndPhase);
game.doSelectModifier();

View File

@ -1,14 +1,13 @@
import { BattleStat } from "#app/data/battle-stat.js";
import { Abilities } from "#app/enums/abilities.js";
import { Moves } from "#app/enums/moves.js";
import { Species } from "#app/enums/species.js";
import { BattleStat } from "#app/data/battle-stat";
import { Abilities } from "#app/enums/abilities";
import { Moves } from "#app/enums/moves";
import { Species } from "#app/enums/species";
import { CommandPhase } from "#app/phases/command-phase";
import { MessagePhase } from "#app/phases/message-phase";
import GameManager from "#test/utils/gameManager";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import { CommandPhase } from "#app/phases/command-phase.js";
import { MessagePhase } from "#app/phases/message-phase.js";
const TIMEOUT = 20 * 1000;
@ -44,15 +43,15 @@ describe("Abilities - COSTAR", () => {
let [leftPokemon, rightPokemon] = game.scene.getPlayerField();
game.doAttack(getMovePosition(game.scene, 0, Moves.NASTY_PLOT));
game.move.select(Moves.NASTY_PLOT);
await game.phaseInterceptor.to(CommandPhase);
game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH));
game.move.select(Moves.SPLASH, 1);
await game.toNextTurn();
expect(leftPokemon.summonData.battleStats[BattleStat.SPATK]).toBe(+2);
expect(rightPokemon.summonData.battleStats[BattleStat.SPATK]).toBe(0);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(CommandPhase);
game.doSwitchPokemon(2);
await game.phaseInterceptor.to(MessagePhase);
@ -76,7 +75,7 @@ describe("Abilities - COSTAR", () => {
expect(leftPokemon.summonData.battleStats[BattleStat.ATK]).toBe(-2);
expect(leftPokemon.summonData.battleStats[BattleStat.ATK]).toBe(-2);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(CommandPhase);
game.doSwitchPokemon(2);
await game.phaseInterceptor.to(MessagePhase);

View File

@ -1,18 +1,17 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { BattleStat } from "#app/data/battle-stat";
import { StatusEffect } from "#app/data/status-effect";
import { CommandPhase } from "#app/phases/command-phase";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import { MoveEndPhase } from "#app/phases/move-end-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { TurnInitPhase } from "#app/phases/turn-init-phase";
import { Mode } from "#app/ui/ui";
import { toDmgValue } from "#app/utils";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import { StatusEffect } from "#app/data/status-effect.js";
import { BattleStat } from "#app/data/battle-stat.js";
import GameManager from "#test/utils/gameManager";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { SPLASH_ONLY } from "../utils/testUtils";
import { toDmgValue } from "#app/utils";
import { Mode } from "#app/ui/ui.js";
import { MoveEffectPhase } from "#app/phases/move-effect-phase.js";
import { MoveEndPhase } from "#app/phases/move-end-phase.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
import { TurnInitPhase } from "#app/phases/turn-init-phase.js";
import { CommandPhase } from "#app/phases/command-phase.js";
const TIMEOUT = 20 * 1000;
@ -52,7 +51,7 @@ describe("Abilities - Disguise", () => {
expect(mimikyu.formIndex).toBe(disguisedForm);
game.doAttack(getMovePosition(game.scene, 0, Moves.SHADOW_SNEAK));
game.move.select(Moves.SHADOW_SNEAK);
await game.phaseInterceptor.to(MoveEndPhase);
@ -67,7 +66,7 @@ describe("Abilities - Disguise", () => {
expect(mimikyu.formIndex).toBe(disguisedForm);
game.doAttack(getMovePosition(game.scene, 0, Moves.VACUUM_WAVE));
game.move.select(Moves.VACUUM_WAVE);
await game.phaseInterceptor.to(MoveEndPhase);
@ -85,7 +84,7 @@ describe("Abilities - Disguise", () => {
expect(mimikyu.formIndex).toBe(disguisedForm);
game.doAttack(getMovePosition(game.scene, 0, Moves.SURGING_STRIKES));
game.move.select(Moves.SURGING_STRIKES);
// First hit
await game.phaseInterceptor.to(MoveEffectPhase);
@ -104,7 +103,7 @@ describe("Abilities - Disguise", () => {
const mimikyu = game.scene.getEnemyPokemon()!;
expect(mimikyu.hp).toBe(mimikyu.getMaxHp());
game.doAttack(getMovePosition(game.scene, 0, Moves.TOXIC_THREAD));
game.move.select(Moves.TOXIC_THREAD);
await game.phaseInterceptor.to(TurnEndPhase);
@ -124,7 +123,7 @@ describe("Abilities - Disguise", () => {
const maxHp = mimikyu.getMaxHp();
const disguiseDamage = toDmgValue(maxHp / 8);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
@ -149,7 +148,7 @@ describe("Abilities - Disguise", () => {
const mimikyu = game.scene.getParty()[1]!;
expect(mimikyu.formIndex).toBe(bustedForm);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.doKillOpponents();
await game.toNextWave();
@ -169,7 +168,7 @@ describe("Abilities - Disguise", () => {
expect(mimikyu.formIndex).toBe(bustedForm);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.doKillOpponents();
await game.toNextWave();
@ -189,11 +188,11 @@ describe("Abilities - Disguise", () => {
expect(mimikyu1.formIndex).toBe(bustedForm);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.killPokemon(mimikyu1);
game.doSelectPartyPokemon(1);
await game.toNextTurn();
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.doKillOpponents();
game.onNextPrompt("CheckSwitchPhase", Mode.CONFIRM, () => { // TODO: Make tests run in set mode instead of switch mode
game.setMode(Mode.MESSAGE);

View File

@ -1,12 +1,11 @@
import { Species } from "#app/enums/species.js";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { Species } from "#app/enums/species";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import GameManager from "#test/utils/gameManager";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
describe("Abilities - Dry Skin", () => {
let phaserGame: Phaser.Game;
@ -43,13 +42,13 @@ describe("Abilities - Dry Skin", () => {
// first turn
let previousEnemyHp = enemy.hp;
game.doAttack(getMovePosition(game.scene, 0, Moves.SUNNY_DAY));
game.move.select(Moves.SUNNY_DAY);
await game.phaseInterceptor.to(TurnEndPhase);
expect(enemy.hp).toBeLessThan(previousEnemyHp);
// second turn
previousEnemyHp = enemy.hp;
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
expect(enemy.hp).toBeLessThan(previousEnemyHp);
});
@ -66,13 +65,13 @@ describe("Abilities - Dry Skin", () => {
// first turn
let previousEnemyHp = enemy.hp;
game.doAttack(getMovePosition(game.scene, 0, Moves.RAIN_DANCE));
game.move.select(Moves.RAIN_DANCE);
await game.phaseInterceptor.to(TurnEndPhase);
expect(enemy.hp).toBeGreaterThan(previousEnemyHp);
// second turn
previousEnemyHp = enemy.hp;
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
expect(enemy.hp).toBeGreaterThan(previousEnemyHp);
});
@ -87,7 +86,7 @@ describe("Abilities - Dry Skin", () => {
enemy.hp = initialHP;
// first turn
game.doAttack(getMovePosition(game.scene, 0, Moves.FLAMETHROWER));
game.move.select(Moves.FLAMETHROWER);
await game.phaseInterceptor.to(TurnEndPhase);
const fireDamageTakenWithDrySkin = initialHP - enemy.hp;
@ -96,7 +95,7 @@ describe("Abilities - Dry Skin", () => {
game.override.enemyAbility(Abilities.NONE);
// second turn
game.doAttack(getMovePosition(game.scene, 0, Moves.FLAMETHROWER));
game.move.select(Moves.FLAMETHROWER);
await game.phaseInterceptor.to(TurnEndPhase);
const fireDamageTakenWithoutDrySkin = initialHP - enemy.hp;
@ -113,7 +112,7 @@ describe("Abilities - Dry Skin", () => {
enemy.hp = 1;
game.doAttack(getMovePosition(game.scene, 0, Moves.WATER_GUN));
game.move.select(Moves.WATER_GUN);
await game.phaseInterceptor.to(TurnEndPhase);
expect(enemy.hp).toBeGreaterThan(1);
});
@ -129,7 +128,7 @@ describe("Abilities - Dry Skin", () => {
enemy.hp = 1;
game.override.enemyMoveset([Moves.PROTECT, Moves.PROTECT, Moves.PROTECT, Moves.PROTECT]);
game.doAttack(getMovePosition(game.scene, 0, Moves.WATER_GUN));
game.move.select(Moves.WATER_GUN);
await game.phaseInterceptor.to(TurnEndPhase);
expect(enemy.hp).toBe(1);
});
@ -145,14 +144,14 @@ describe("Abilities - Dry Skin", () => {
enemy.hp = 1;
// first turn
game.doAttack(getMovePosition(game.scene, 0, Moves.WATER_SHURIKEN));
game.move.select(Moves.WATER_SHURIKEN);
await game.phaseInterceptor.to(TurnEndPhase);
const healthGainedFromWaterShuriken = enemy.hp - 1;
enemy.hp = 1;
// second turn
game.doAttack(getMovePosition(game.scene, 0, Moves.WATER_GUN));
game.move.select(Moves.WATER_GUN);
await game.phaseInterceptor.to(TurnEndPhase);
const healthGainedFromWaterGun = enemy.hp - 1;

View File

@ -1,16 +1,15 @@
import { Species } from "#app/enums/species.js";
import GameManager from "#test/utils/gameManager";
import { BattlerIndex } from "#app/battle";
import { StatusEffect } from "#app/data/status-effect";
import { BattlerTagType } from "#app/enums/battler-tag-type";
import { Species } from "#app/enums/species";
import { MovePhase } from "#app/phases/move-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import GameManager from "#test/utils/gameManager";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { StatusEffect } from "#app/data/status-effect.js";
import { BattlerTagType } from "#app/enums/battler-tag-type.js";
import { BattlerIndex } from "#app/battle.js";
import { MovePhase } from "#app/phases/move-phase.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
describe("Abilities - Flash Fire", () => {
let phaserGame: Phaser.Game;
@ -44,7 +43,7 @@ describe("Abilities - Flash Fire", () => {
const blissey = game.scene.getPlayerPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
expect(blissey.hp).toBe(blissey.getMaxHp());
}, 20000);
@ -55,7 +54,7 @@ describe("Abilities - Flash Fire", () => {
const blissey = game.scene.getPlayerPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.PROTECT));
game.move.select(Moves.PROTECT);
await game.phaseInterceptor.to(TurnEndPhase);
expect(blissey!.getTag(BattlerTagType.FIRE_BOOST)).toBeUndefined();
}, 20000);
@ -66,7 +65,7 @@ describe("Abilities - Flash Fire", () => {
const blissey = game.scene.getPlayerPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.move.forceHit();
await game.phaseInterceptor.to(MovePhase, false);
await game.move.forceHit();
@ -82,7 +81,7 @@ describe("Abilities - Flash Fire", () => {
const blissey = game.scene.getPlayerPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
expect(blissey!.getTag(BattlerTagType.FIRE_BOOST)).toBeDefined();
@ -93,7 +92,7 @@ describe("Abilities - Flash Fire", () => {
await game.startBattle([Species.BLISSEY, Species.CHANSEY]);
// ensure use baton pass after enemy moved
game.doAttack(getMovePosition(game.scene, 0, Moves.BATON_PASS));
game.move.select(Moves.BATON_PASS);
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
game.doSelectPartyPokemon(1);
@ -113,7 +112,7 @@ describe("Abilities - Flash Fire", () => {
blissey.hp = initialHP;
// first turn
game.doAttack(getMovePosition(game.scene, 0, Moves.EMBER));
game.move.select(Moves.EMBER);
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
await game.phaseInterceptor.to(TurnEndPhase);
const originalDmg = initialHP - blissey.hp;
@ -122,7 +121,7 @@ describe("Abilities - Flash Fire", () => {
blissey.hp = initialHP;
// second turn
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
const flashFireDmg = initialHP - blissey.hp;

View File

@ -1,19 +1,18 @@
import { BattlerTagType } from "#app/enums/battler-tag-type.js";
import { BattleStat } from "#app/data/battle-stat";
import { BattlerTagType } from "#app/enums/battler-tag-type";
import { StatusEffect } from "#app/enums/status-effect";
import Pokemon from "#app/field/pokemon";
import { BerryPhase } from "#app/phases/berry-phase";
import { MoveEndPhase } from "#app/phases/move-end-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { TurnStartPhase } from "#app/phases/turn-start-phase";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { SPLASH_ONLY } from "../utils/testUtils";
import { BattleStat } from "#app/data/battle-stat.js";
import { StatusEffect } from "#app/enums/status-effect.js";
import Pokemon from "#app/field/pokemon.js";
import { BerryPhase } from "#app/phases/berry-phase.js";
import { MoveEndPhase } from "#app/phases/move-end-phase.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
import { TurnStartPhase } from "#app/phases/turn-start-phase.js";
describe("Abilities - Gulp Missile", () => {
let phaserGame: Phaser.Game;
@ -58,9 +57,9 @@ describe("Abilities - Gulp Missile", () => {
await game.startBattle([Species.CRAMORANT]);
const cramorant = game.scene.getPlayerPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.DIVE));
game.move.select(Moves.DIVE);
await game.toNextTurn();
game.doAttack(getMovePosition(game.scene, 0, Moves.DIVE));
game.move.select(Moves.DIVE);
await game.phaseInterceptor.to(MoveEndPhase);
expect(cramorant.getHpRatio()).toBeGreaterThanOrEqual(.5);
@ -75,7 +74,7 @@ describe("Abilities - Gulp Missile", () => {
vi.spyOn(cramorant, "getHpRatio").mockReturnValue(.49);
expect(cramorant.getHpRatio()).toBe(.49);
game.doAttack(getMovePosition(game.scene, 0, Moves.SURF));
game.move.select(Moves.SURF);
await game.phaseInterceptor.to(MoveEndPhase);
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_PIKACHU)).toBeDefined();
@ -86,7 +85,7 @@ describe("Abilities - Gulp Missile", () => {
await game.startBattle([Species.CRAMORANT, Species.MAGIKARP]);
const cramorant = game.scene.getPlayerPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.SURF));
game.move.select(Moves.SURF);
await game.toNextTurn();
game.doSwitchPokemon(1);
@ -101,7 +100,7 @@ describe("Abilities - Gulp Missile", () => {
await game.startBattle([Species.CRAMORANT]);
const cramorant = game.scene.getPlayerPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.DIVE));
game.move.select(Moves.DIVE);
await game.phaseInterceptor.to(MoveEndPhase);
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_ARROKUDA)).toBeDefined();
@ -115,7 +114,7 @@ describe("Abilities - Gulp Missile", () => {
const enemy = game.scene.getEnemyPokemon()!;
vi.spyOn(enemy, "damageAndUpdate");
game.doAttack(getMovePosition(game.scene, 0, Moves.SURF));
game.move.select(Moves.SURF);
await game.phaseInterceptor.to(TurnEndPhase);
expect(enemy.damageAndUpdate).toHaveReturnedWith(getEffectDamage(enemy));
@ -128,7 +127,7 @@ describe("Abilities - Gulp Missile", () => {
const cramorant = game.scene.getPlayerPokemon()!;
vi.spyOn(cramorant, "getHpRatio").mockReturnValue(.55);
game.doAttack(getMovePosition(game.scene, 0, Moves.SURF));
game.move.select(Moves.SURF);
await game.phaseInterceptor.to(MoveEndPhase);
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_ARROKUDA)).toBeDefined();
@ -150,7 +149,7 @@ describe("Abilities - Gulp Missile", () => {
vi.spyOn(enemy, "damageAndUpdate");
vi.spyOn(cramorant, "getHpRatio").mockReturnValue(.55);
game.doAttack(getMovePosition(game.scene, 0, Moves.SURF));
game.move.select(Moves.SURF);
await game.phaseInterceptor.to(MoveEndPhase);
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_ARROKUDA)).toBeDefined();
@ -174,7 +173,7 @@ describe("Abilities - Gulp Missile", () => {
vi.spyOn(enemy, "damageAndUpdate");
vi.spyOn(cramorant, "getHpRatio").mockReturnValue(.45);
game.doAttack(getMovePosition(game.scene, 0, Moves.SURF));
game.move.select(Moves.SURF);
await game.phaseInterceptor.to(MoveEndPhase);
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_PIKACHU)).toBeDefined();
@ -194,7 +193,7 @@ describe("Abilities - Gulp Missile", () => {
const cramorant = game.scene.getPlayerPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.DIVE));
game.move.select(Moves.DIVE);
await game.phaseInterceptor.to(BerryPhase, false);
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_ARROKUDA)).toBeDefined();
@ -210,7 +209,7 @@ describe("Abilities - Gulp Missile", () => {
vi.spyOn(cramorant, "getHpRatio").mockReturnValue(.55);
game.doAttack(getMovePosition(game.scene, 0, Moves.SURF));
game.move.select(Moves.SURF);
await game.phaseInterceptor.to(MoveEndPhase);
const enemyHpPreEffect = enemy.hp;
@ -232,7 +231,7 @@ describe("Abilities - Gulp Missile", () => {
const cramorant = game.scene.getPlayerPokemon()!;
vi.spyOn(cramorant, "getHpRatio").mockReturnValue(.55);
game.doAttack(getMovePosition(game.scene, 0, Moves.SURF));
game.move.select(Moves.SURF);
await game.phaseInterceptor.to(MoveEndPhase);
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_ARROKUDA)).toBeDefined();
@ -252,7 +251,7 @@ describe("Abilities - Gulp Missile", () => {
const cramorant = game.scene.getPlayerPokemon()!;
vi.spyOn(cramorant, "getHpRatio").mockReturnValue(.55);
game.doAttack(getMovePosition(game.scene, 0, Moves.SURF));
game.move.select(Moves.SURF);
await game.phaseInterceptor.to(MoveEndPhase);
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_ARROKUDA)).toBeDefined();
@ -269,7 +268,7 @@ describe("Abilities - Gulp Missile", () => {
game.override.enemyAbility(Abilities.TRACE);
await game.startBattle([Species.CRAMORANT]);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(TurnStartPhase);
expect(game.scene.getEnemyPokemon()?.hasAbility(Abilities.GULP_MISSILE)).toBe(false);

View File

@ -1,14 +1,13 @@
import { Species } from "#app/enums/species.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { Species } from "#app/enums/species";
import { StatusEffect } from "#app/enums/status-effect";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { toDmgValue } from "#app/utils";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import GameManager from "#test/utils/gameManager";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import { StatusEffect } from "#app/enums/status-effect.js";
import { toDmgValue } from "#app/utils";
describe("Abilities - Heatproof", () => {
let phaserGame: Phaser.Game;
@ -46,14 +45,14 @@ describe("Abilities - Heatproof", () => {
const initialHP = 1000;
enemy.hp = initialHP;
game.doAttack(getMovePosition(game.scene, 0, Moves.FLAMETHROWER));
game.move.select(Moves.FLAMETHROWER);
await game.phaseInterceptor.to(TurnEndPhase);
const heatproofDamage = initialHP - enemy.hp;
enemy.hp = initialHP;
game.override.enemyAbility(Abilities.BALL_FETCH);
game.doAttack(getMovePosition(game.scene, 0, Moves.FLAMETHROWER));
game.move.select(Moves.FLAMETHROWER);
await game.phaseInterceptor.to(TurnEndPhase);
const regularDamage = initialHP - enemy.hp;
@ -69,7 +68,7 @@ describe("Abilities - Heatproof", () => {
const enemy = game.scene.getEnemyPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.toNextTurn();
// Normal burn damage is /16

View File

@ -1,15 +1,14 @@
import { allMoves } from "#app/data/move.js";
import { Abilities } from "#app/enums/abilities.js";
import { Stat } from "#app/enums/stat.js";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { allMoves } from "#app/data/move";
import { Abilities } from "#app/enums/abilities";
import { Stat } from "#app/enums/stat";
import { DamagePhase } from "#app/phases/damage-phase";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import { DamagePhase } from "#app/phases/damage-phase.js";
import { MoveEffectPhase } from "#app/phases/move-effect-phase.js";
describe("Abilities - Hustle", () => {
let phaserGame: Phaser.Game;
@ -44,7 +43,7 @@ describe("Abilities - Hustle", () => {
vi.spyOn(pikachu, "getBattleStat");
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
game.move.select(Moves.TACKLE);
await game.move.forceHit();
await game.phaseInterceptor.to(DamagePhase);
@ -57,7 +56,7 @@ describe("Abilities - Hustle", () => {
vi.spyOn(pikachu, "getAccuracyMultiplier");
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
game.move.select(Moves.TACKLE);
await game.phaseInterceptor.to(MoveEffectPhase);
expect(pikachu.getAccuracyMultiplier).toHaveReturnedWith(0.8);
@ -71,7 +70,7 @@ describe("Abilities - Hustle", () => {
vi.spyOn(pikachu, "getBattleStat");
vi.spyOn(pikachu, "getAccuracyMultiplier");
game.doAttack(getMovePosition(game.scene, 0, Moves.GIGA_DRAIN));
game.move.select(Moves.GIGA_DRAIN);
await game.phaseInterceptor.to(DamagePhase);
expect(pikachu.getBattleStat).toHaveReturnedWith(spatk);
@ -89,7 +88,7 @@ describe("Abilities - Hustle", () => {
vi.spyOn(pikachu, "getAccuracyMultiplier");
vi.spyOn(allMoves[Moves.FISSURE], "calculateBattleAccuracy");
game.doAttack(getMovePosition(game.scene, 0, Moves.FISSURE));
game.move.select(Moves.FISSURE);
await game.phaseInterceptor.to(DamagePhase);
expect(enemyPokemon.turnData.damageTaken).toBe(enemyPokemon.getMaxHp());

View File

@ -3,7 +3,6 @@ import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
@ -40,16 +39,16 @@ describe("Abilities - Hyper Cutter", () => {
const enemy = game.scene.getEnemyPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.OCTOLOCK));
game.move.select(Moves.OCTOLOCK);
await game.toNextTurn();
game.doAttack(getMovePosition(game.scene, 0, Moves.DEFOG));
game.move.select(Moves.DEFOG);
await game.toNextTurn();
game.doAttack(getMovePosition(game.scene, 0, Moves.NOBLE_ROAR));
game.move.select(Moves.NOBLE_ROAR);
await game.toNextTurn();
game.doAttack(getMovePosition(game.scene, 0, Moves.SAND_ATTACK));
game.move.select(Moves.SAND_ATTACK);
await game.toNextTurn();
game.override.moveset([Moves.STRING_SHOT]);
game.doAttack(getMovePosition(game.scene, 0, Moves.STRING_SHOT));
game.move.select(Moves.STRING_SHOT);
await game.toNextTurn();
expect(enemy.summonData.battleStats[BattleStat.ATK]).toEqual(0);

View File

@ -1,16 +1,15 @@
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
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";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { TurnInitPhase } from "#app/phases/turn-init-phase";
import { Abilities } from "#enums/abilities";
import { BattlerTagType } from "#enums/battler-tag-type";
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, expect, it } from "vitest";
import { MoveEffectPhase } from "#app/phases/move-effect-phase.js";
import { MoveEndPhase } from "#app/phases/move-end-phase.js";
import { QuietFormChangePhase } from "#app/phases/quiet-form-change-phase.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
import { TurnInitPhase } from "#app/phases/turn-init-phase.js";
describe("Abilities - Ice Face", () => {
let phaserGame: Phaser.Game;
@ -39,7 +38,7 @@ describe("Abilities - Ice Face", () => {
it("takes no damage from physical move and transforms to Noice", async () => {
await game.startBattle([Species.HITMONLEE]);
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
game.move.select(Moves.TACKLE);
await game.phaseInterceptor.to(MoveEndPhase);
@ -55,7 +54,7 @@ describe("Abilities - Ice Face", () => {
game.override.enemyLevel(1);
await game.startBattle([Species.HITMONLEE]);
game.doAttack(getMovePosition(game.scene, 0, Moves.SURGING_STRIKES));
game.move.select(Moves.SURGING_STRIKES);
const eiscue = game.scene.getEnemyPokemon()!;
expect(eiscue.getTag(BattlerTagType.ICE_FACE)).toBeDefined();
@ -81,7 +80,7 @@ describe("Abilities - Ice Face", () => {
it("takes damage from special moves", async () => {
await game.startBattle([Species.MAGIKARP]);
game.doAttack(getMovePosition(game.scene, 0, Moves.ICE_BEAM));
game.move.select(Moves.ICE_BEAM);
await game.phaseInterceptor.to(MoveEndPhase);
@ -95,7 +94,7 @@ describe("Abilities - Ice Face", () => {
it("takes effects from status moves", async () => {
await game.startBattle([Species.MAGIKARP]);
game.doAttack(getMovePosition(game.scene, 0, Moves.TOXIC_THREAD));
game.move.select(Moves.TOXIC_THREAD);
await game.phaseInterceptor.to(MoveEndPhase);
@ -111,7 +110,7 @@ describe("Abilities - Ice Face", () => {
await game.startBattle([Species.MAGIKARP]);
game.doAttack(getMovePosition(game.scene, 0, Moves.QUICK_ATTACK));
game.move.select(Moves.QUICK_ATTACK);
await game.phaseInterceptor.to(MoveEndPhase);
@ -133,7 +132,7 @@ describe("Abilities - Ice Face", () => {
await game.startBattle([Species.EISCUE, Species.NINJASK]);
game.doAttack(getMovePosition(game.scene, 0, Moves.SNOWSCAPE));
game.move.select(Moves.SNOWSCAPE);
await game.phaseInterceptor.to(TurnEndPhase);
let eiscue = game.scene.getPlayerPokemon()!;
@ -160,7 +159,7 @@ describe("Abilities - Ice Face", () => {
await game.startBattle([Species.EISCUE]);
game.doAttack(getMovePosition(game.scene, 0, Moves.HAIL));
game.move.select(Moves.HAIL);
const eiscue = game.scene.getPlayerPokemon()!;
await game.phaseInterceptor.to(QuietFormChangePhase);
@ -179,7 +178,7 @@ describe("Abilities - Ice Face", () => {
await game.startBattle([Species.EISCUE, Species.MAGIKARP]);
game.doAttack(getMovePosition(game.scene, 0, Moves.ICE_BEAM));
game.move.select(Moves.ICE_BEAM);
await game.phaseInterceptor.to(TurnEndPhase);
let eiscue = game.scene.getPlayerPokemon()!;
@ -213,7 +212,7 @@ describe("Abilities - Ice Face", () => {
expect(eiscue.formIndex).toBe(noiceForm);
expect(eiscue.getTag(BattlerTagType.ICE_FACE)).toBeUndefined();
game.doAttack(getMovePosition(game.scene, 0, Moves.ICE_BEAM));
game.move.select(Moves.ICE_BEAM);
await game.doKillOpponents();
await game.phaseInterceptor.to(TurnEndPhase);
game.doSelectModifier();
@ -228,7 +227,7 @@ describe("Abilities - Ice Face", () => {
await game.startBattle([Species.MAGIKARP]);
game.doAttack(getMovePosition(game.scene, 0, Moves.GASTRO_ACID));
game.move.select(Moves.GASTRO_ACID);
await game.phaseInterceptor.to(TurnEndPhase);
@ -244,7 +243,7 @@ describe("Abilities - Ice Face", () => {
await game.startBattle([Species.MAGIKARP]);
game.doAttack(getMovePosition(game.scene, 0, Moves.SKILL_SWAP));
game.move.select(Moves.SKILL_SWAP);
await game.phaseInterceptor.to(TurnEndPhase);
@ -260,7 +259,7 @@ describe("Abilities - Ice Face", () => {
await game.startBattle([Species.MAGIKARP]);
game.doAttack(getMovePosition(game.scene, 0, Moves.SIMPLE_BEAM));
game.move.select(Moves.SIMPLE_BEAM);
await game.phaseInterceptor.to(TurnInitPhase);

View File

@ -1,22 +1,21 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import Phaser from "phaser";
import GameManager from "#test/utils/gameManager";
import { Mode } from "#app/ui/ui";
import { BattleStat } from "#app/data/battle-stat";
import { generateStarter, getMovePosition } from "#test/utils/gameManagerUtils";
import { Command } from "#app/ui/command-ui-handler";
import { Status, StatusEffect } from "#app/data/status-effect";
import { GameModes, getGameMode } from "#app/game-mode";
import { CommandPhase } from "#app/phases/command-phase";
import { DamagePhase } from "#app/phases/damage-phase";
import { EncounterPhase } from "#app/phases/encounter-phase";
import { EnemyCommandPhase } from "#app/phases/enemy-command-phase";
import { SelectStarterPhase } from "#app/phases/select-starter-phase";
import { TurnInitPhase } from "#app/phases/turn-init-phase";
import { Mode } from "#app/ui/ui";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import { generateStarter } from "#test/utils/gameManagerUtils";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import { CommandPhase } from "#app/phases/command-phase.js";
import { DamagePhase } from "#app/phases/damage-phase.js";
import { EncounterPhase } from "#app/phases/encounter-phase.js";
import { EnemyCommandPhase } from "#app/phases/enemy-command-phase.js";
import { SelectStarterPhase } from "#app/phases/select-starter-phase.js";
import { TurnInitPhase } from "#app/phases/turn-init-phase.js";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Abilities - Intimidate", () => {
let phaserGame: Phaser.Game;
@ -217,13 +216,7 @@ describe("Abilities - Intimidate", () => {
let battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
expect(battleStatsPokemon[BattleStat.ATK]).toBe(-1);
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
});
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => {
const movePosition = getMovePosition(game.scene, 0, Moves.AERIAL_ACE);
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false);
});
game.move.select(Moves.AERIAL_ACE);
await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(DamagePhase);
await game.killPokemon(game.scene.currentBattle.enemyParty[0]);
expect(game.scene.currentBattle.enemyParty[0].isFainted()).toBe(true);
@ -243,13 +236,7 @@ describe("Abilities - Intimidate", () => {
let battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
expect(battleStatsPokemon[BattleStat.ATK]).toBe(-1);
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
});
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => {
const movePosition = getMovePosition(game.scene, 0, Moves.AERIAL_ACE);
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false);
});
game.move.select(Moves.AERIAL_ACE);
console.log("===to new turn===");
await game.toNextTurn();
battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
@ -268,13 +255,7 @@ describe("Abilities - Intimidate", () => {
let battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
expect(battleStatsPokemon[BattleStat.ATK]).toBe(-1);
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
});
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => {
const movePosition = getMovePosition(game.scene, 0, Moves.AERIAL_ACE);
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false);
});
game.move.select(Moves.AERIAL_ACE);
console.log("===to new turn===");
await game.toNextTurn();
battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
@ -282,13 +263,7 @@ describe("Abilities - Intimidate", () => {
battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
expect(battleStatsOpponent[BattleStat.ATK]).toBe(0);
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
});
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => {
const movePosition = getMovePosition(game.scene, 0, Moves.AERIAL_ACE);
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false);
});
game.move.select(Moves.AERIAL_ACE);
console.log("===to new turn===");
await game.toNextTurn();
battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
@ -307,13 +282,7 @@ describe("Abilities - Intimidate", () => {
let battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
expect(battleStatsPokemon[BattleStat.ATK]).toBe(-1);
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
});
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => {
const movePosition = getMovePosition(game.scene, 0, Moves.AERIAL_ACE);
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false);
});
game.move.select(Moves.AERIAL_ACE);
console.log("===to new turn===");
await game.toNextTurn();
battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
@ -321,13 +290,7 @@ describe("Abilities - Intimidate", () => {
battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
expect(battleStatsOpponent[BattleStat.ATK]).toBe(-1);
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
});
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => {
const movePosition = getMovePosition(game.scene, 0, Moves.AERIAL_ACE);
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false);
});
game.move.select(Moves.AERIAL_ACE);
console.log("===to new turn===");
await game.toNextTurn();
battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;

View File

@ -1,10 +1,10 @@
import { BattleStat } from "#app/data/battle-stat";
import GameManager from "#test/utils/gameManager";
import { CommandPhase } from "#app/phases/command-phase";
import { Abilities } from "#enums/abilities";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { CommandPhase } from "#app/phases/command-phase.js";
describe("Abilities - Intrepid Sword", () => {

View File

@ -1,18 +1,17 @@
import { allMoves } from "#app/data/move.js";
import { Type } from "#app/data/type.js";
import { Weather, WeatherType } from "#app/data/weather.js";
import { PlayerPokemon } from "#app/field/pokemon.js";
import { allMoves } from "#app/data/move";
import { Type } from "#app/data/type";
import { Weather, WeatherType } from "#app/data/weather";
import { PlayerPokemon } from "#app/field/pokemon";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { Abilities } from "#enums/abilities";
import { BattlerTagType } from "#enums/battler-tag-type";
import { Biome } from "#enums/biome";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
const TIMEOUT = 20 * 1000;
@ -49,7 +48,7 @@ describe("Abilities - Libero", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
expect(leadPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
testPokemonTypeMatchesDefaultMoveType(leadPokemon, Moves.SPLASH);
@ -67,12 +66,12 @@ describe("Abilities - Libero", () => {
let leadPokemon = game.scene.getPlayerPokemon()!;
expect(leadPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
testPokemonTypeMatchesDefaultMoveType(leadPokemon, Moves.SPLASH);
game.doAttack(getMovePosition(game.scene, 0, Moves.AGILITY));
game.move.select(Moves.AGILITY);
await game.phaseInterceptor.to(TurnEndPhase);
expect(leadPokemon.summonData.abilitiesApplied.filter((a) => a === Abilities.LIBERO)).toHaveLength(1);
@ -89,7 +88,7 @@ describe("Abilities - Libero", () => {
leadPokemon = game.scene.getPlayerPokemon()!;
expect(leadPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
testPokemonTypeMatchesDefaultMoveType(leadPokemon, Moves.SPLASH);
@ -108,7 +107,7 @@ describe("Abilities - Libero", () => {
expect(leadPokemon).not.toBe(undefined);
game.scene.arena.weather = new Weather(WeatherType.SUNNY);
game.doAttack(getMovePosition(game.scene, 0, Moves.WEATHER_BALL));
game.move.select(Moves.WEATHER_BALL);
await game.phaseInterceptor.to(TurnEndPhase);
expect(leadPokemon.summonData.abilitiesApplied).toContain(Abilities.LIBERO);
@ -131,7 +130,7 @@ describe("Abilities - Libero", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
expect(leadPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
game.move.select(Moves.TACKLE);
await game.phaseInterceptor.to(TurnEndPhase);
expect(leadPokemon.summonData.abilitiesApplied).toContain(Abilities.LIBERO);
@ -154,7 +153,7 @@ describe("Abilities - Libero", () => {
expect(leadPokemon).not.toBe(undefined);
game.scene.arena.biomeType = Biome.MOUNTAIN;
game.doAttack(getMovePosition(game.scene, 0, Moves.NATURE_POWER));
game.move.select(Moves.NATURE_POWER);
await game.phaseInterceptor.to(TurnEndPhase);
testPokemonTypeMatchesDefaultMoveType(leadPokemon, Moves.AIR_SLASH);
@ -172,7 +171,7 @@ describe("Abilities - Libero", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
expect(leadPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.DIG));
game.move.select(Moves.DIG);
await game.phaseInterceptor.to(TurnEndPhase);
testPokemonTypeMatchesDefaultMoveType(leadPokemon, Moves.DIG);
@ -191,7 +190,7 @@ describe("Abilities - Libero", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
expect(leadPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
game.move.select(Moves.TACKLE);
await game.move.forceMiss();
await game.phaseInterceptor.to(TurnEndPhase);
@ -213,7 +212,7 @@ describe("Abilities - Libero", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
expect(leadPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
game.move.select(Moves.TACKLE);
await game.phaseInterceptor.to(TurnEndPhase);
testPokemonTypeMatchesDefaultMoveType(leadPokemon, Moves.TACKLE);
@ -232,7 +231,7 @@ describe("Abilities - Libero", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
expect(leadPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
game.move.select(Moves.TACKLE);
await game.phaseInterceptor.to(TurnEndPhase);
testPokemonTypeMatchesDefaultMoveType(leadPokemon, Moves.TACKLE);
@ -251,7 +250,7 @@ describe("Abilities - Libero", () => {
expect(leadPokemon).not.toBe(undefined);
leadPokemon.summonData.types = [allMoves[Moves.SPLASH].defaultType];
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
expect(leadPokemon.summonData.abilitiesApplied).not.toContain(Abilities.LIBERO);
@ -271,7 +270,7 @@ describe("Abilities - Libero", () => {
vi.spyOn(leadPokemon, "isTerastallized").mockReturnValue(true);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
expect(leadPokemon.summonData.abilitiesApplied).not.toContain(Abilities.LIBERO);
@ -289,7 +288,7 @@ describe("Abilities - Libero", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
expect(leadPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.STRUGGLE));
game.move.select(Moves.STRUGGLE);
await game.phaseInterceptor.to(TurnEndPhase);
expect(leadPokemon.summonData.abilitiesApplied).not.toContain(Abilities.LIBERO);
@ -307,7 +306,7 @@ describe("Abilities - Libero", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
expect(leadPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.BURN_UP));
game.move.select(Moves.BURN_UP);
await game.phaseInterceptor.to(TurnEndPhase);
expect(leadPokemon.summonData.abilitiesApplied).not.toContain(Abilities.LIBERO);
@ -326,7 +325,7 @@ describe("Abilities - Libero", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
expect(leadPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.TRICK_OR_TREAT));
game.move.select(Moves.TRICK_OR_TREAT);
await game.phaseInterceptor.to(TurnEndPhase);
testPokemonTypeMatchesDefaultMoveType(leadPokemon, Moves.TRICK_OR_TREAT);
@ -344,7 +343,7 @@ describe("Abilities - Libero", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
expect(leadPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.CURSE));
game.move.select(Moves.CURSE);
await game.phaseInterceptor.to(TurnEndPhase);
testPokemonTypeMatchesDefaultMoveType(leadPokemon, Moves.CURSE);

View File

@ -1,17 +1,16 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import Phaser from "phaser";
import GameManager from "#test/utils/gameManager";
import { Species } from "#enums/species";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
import { Moves } from "#enums/moves";
import { ArenaTagType } from "#enums/arena-tag-type";
import { ArenaTagSide, getArenaTag } from "#app/data/arena-tag";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities";
import { WeatherType } from "#app/data/weather.js";
import { StatusEffect, getStatusEffectCatchRateMultiplier } from "#app/data/status-effect";
import { WeatherType } from "#app/data/weather";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { Abilities } from "#enums/abilities";
import { ArenaTagType } from "#enums/arena-tag-type";
import { BattlerTagType } from "#enums/battler-tag-type";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
const TIMEOUT = 20 * 1000; // 20 sec timeout
@ -58,7 +57,7 @@ describe("Abilities - Magic Guard", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!;
expect(enemyPokemon).toBeDefined();
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
@ -82,7 +81,7 @@ describe("Abilities - Magic Guard", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
@ -106,7 +105,7 @@ describe("Abilities - Magic Guard", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
@ -126,7 +125,7 @@ describe("Abilities - Magic Guard", () => {
await game.startBattle([Species.MAGIKARP]);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
const enemyPokemon = game.scene.getEnemyPokemon()!;
@ -150,7 +149,7 @@ describe("Abilities - Magic Guard", () => {
await game.startBattle([Species.MAGIKARP]);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
const enemyPokemon = game.scene.getEnemyPokemon()!;
@ -180,7 +179,7 @@ describe("Abilities - Magic Guard", () => {
await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
const enemyPokemon = game.scene.getEnemyPokemon()!;
@ -206,7 +205,7 @@ describe("Abilities - Magic Guard", () => {
await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
const enemyPokemon = game.scene.getEnemyPokemon()!;
@ -233,7 +232,7 @@ describe("Abilities - Magic Guard", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.CURSE));
game.move.select(Moves.CURSE);
const enemyPokemon = game.scene.getEnemyPokemon()!;
@ -257,7 +256,7 @@ describe("Abilities - Magic Guard", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.HIGH_JUMP_KICK));
game.move.select(Moves.HIGH_JUMP_KICK);
await game.move.forceMiss();
await game.phaseInterceptor.to(TurnEndPhase);
@ -276,7 +275,7 @@ describe("Abilities - Magic Guard", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.TAKE_DOWN));
game.move.select(Moves.TAKE_DOWN);
await game.phaseInterceptor.to(TurnEndPhase);
@ -294,7 +293,7 @@ describe("Abilities - Magic Guard", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.STRUGGLE));
game.move.select(Moves.STRUGGLE);
await game.phaseInterceptor.to(TurnEndPhase);
@ -313,7 +312,7 @@ describe("Abilities - Magic Guard", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.STEEL_BEAM));
game.move.select(Moves.STEEL_BEAM);
await game.phaseInterceptor.to(TurnEndPhase);
@ -329,7 +328,7 @@ describe("Abilities - Magic Guard", () => {
it("Magic Guard does not prevent self-damage from confusion", async () => {
await game.startBattle([Species.MAGIKARP]);
game.doAttack(getMovePosition(game.scene, 0, Moves.CHARM));
game.move.select(Moves.CHARM);
await game.phaseInterceptor.to(TurnEndPhase);
});
@ -341,7 +340,7 @@ describe("Abilities - Magic Guard", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.BELLY_DRUM));
game.move.select(Moves.BELLY_DRUM);
await game.phaseInterceptor.to(TurnEndPhase);
@ -364,7 +363,7 @@ describe("Abilities - Magic Guard", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
@ -390,7 +389,7 @@ describe("Abilities - Magic Guard", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!;
enemyPokemon.hp = 1;
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
game.move.select(Moves.TACKLE);
await game.phaseInterceptor.to(TurnEndPhase);
/**
@ -414,7 +413,7 @@ describe("Abilities - Magic Guard", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
game.move.select(Moves.TACKLE);
await game.phaseInterceptor.to(TurnEndPhase);
/**
@ -438,7 +437,7 @@ describe("Abilities - Magic Guard", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.ABSORB));
game.move.select(Moves.ABSORB);
await game.phaseInterceptor.to(TurnEndPhase);
/**
@ -458,7 +457,7 @@ describe("Abilities - Magic Guard", () => {
await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
/**

View File

@ -1,17 +1,13 @@
import { BattleStat } from "#app/data/battle-stat";
import { Stat } from "#app/data/pokemon-stat";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { Command } from "#app/ui/command-ui-handler";
import { Mode } from "#app/ui/ui";
import { EnemyCommandPhase } from "#app/phases/enemy-command-phase";
import { VictoryPhase } from "#app/phases/victory-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, expect, it } from "vitest";
import { CommandPhase } from "#app/phases/command-phase.js";
import { EnemyCommandPhase } from "#app/phases/enemy-command-phase.js";
import { VictoryPhase } from "#app/phases/victory-phase.js";
describe("Abilities - Moxie", () => {
@ -50,13 +46,7 @@ describe("Abilities - Moxie", () => {
let battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
expect(battleStatsPokemon[Stat.ATK]).toBe(0);
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
});
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => {
const movePosition = getMovePosition(game.scene, 0, moveToUse);
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false);
});
game.move.select(moveToUse);
await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(VictoryPhase);
battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
expect(battleStatsPokemon[BattleStat.ATK]).toBe(1);

View File

@ -1,11 +1,10 @@
import { MovePhase } from "#app/phases/move-phase.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities";
import { BattleStat } from "#app/data/battle-stat";
import { MovePhase } from "#app/phases/move-phase";
import { TurnEndPhase } from "#app/phases/turn-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, expect, it } from "vitest";
@ -42,14 +41,14 @@ describe("Abilities - Mycelium Might", () => {
* https://www.smogon.com/forums/threads/scarlet-violet-battle-mechanics-research.3709545/page-24
**/
it("If a Pokemon with Mycelium Might uses a status move, it will always move last but the status move will ignore protective abilities", async() => {
it("will move last in its priority bracket and ignore protective abilities", async () => {
await game.startBattle([Species.REGIELEKI]);
const leadIndex = game.scene.getPlayerPokemon()!.getBattlerIndex();
const enemyPokemon = game.scene.getEnemyPokemon();
const enemyIndex = enemyPokemon?.getBattlerIndex();
game.doAttack(getMovePosition(game.scene, 0, Moves.BABY_DOLL_EYES));
game.move.select(Moves.BABY_DOLL_EYES);
await game.phaseInterceptor.to(MovePhase, false);
// The opponent Pokemon (without Mycelium Might) goes first despite having lower speed than the player Pokemon.
@ -64,7 +63,7 @@ describe("Abilities - Mycelium Might", () => {
expect(enemyPokemon?.summonData.battleStats[BattleStat.ATK]).toBe(-1);
}, 20000);
it("Pokemon with Mycelium Might will go first if a status move that is in a higher priority bracket than the opponent's move is used", async() => {
it("will still go first if a status move that is in a higher priority bracket than the opponent's move is used", async () => {
game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]);
await game.startBattle([Species.REGIELEKI]);
@ -72,7 +71,7 @@ describe("Abilities - Mycelium Might", () => {
const enemyPokemon = game.scene.getEnemyPokemon();
const enemyIndex = enemyPokemon?.getBattlerIndex();
game.doAttack(getMovePosition(game.scene, 0, Moves.BABY_DOLL_EYES));
game.move.select(Moves.BABY_DOLL_EYES);
await game.phaseInterceptor.to(MovePhase, false);
// The player Pokemon (with M.M.) goes first because its move is still within a higher priority bracket than its opponent.
@ -86,13 +85,13 @@ describe("Abilities - Mycelium Might", () => {
expect(enemyPokemon?.summonData.battleStats[BattleStat.ATK]).toBe(-1);
}, 20000);
it("Order is established normally if the Pokemon uses a non-status move", async() => {
it("will not affect non-status moves", async () => {
await game.startBattle([Species.REGIELEKI]);
const leadIndex = game.scene.getPlayerPokemon()!.getBattlerIndex();
const enemyIndex = game.scene.getEnemyPokemon()!.getBattlerIndex();
game.doAttack(getMovePosition(game.scene, 0, Moves.QUICK_ATTACK));
game.move.select(Moves.QUICK_ATTACK);
await game.phaseInterceptor.to(MovePhase, false);
// The player Pokemon (with M.M.) goes first because it has a higher speed and did not use a status move.

View File

@ -1,22 +1,21 @@
import { BattleStat } from "#app/data/battle-stat.js";
import { StatusEffect } from "#app/data/status-effect.js";
import { Type } from "#app/data/type.js";
import { BattlerTagType } from "#app/enums/battler-tag-type.js";
import { BattleStat } from "#app/data/battle-stat";
import { StatusEffect } from "#app/data/status-effect";
import { Type } from "#app/data/type";
import { BattlerTagType } from "#app/enums/battler-tag-type";
import { BerryPhase } from "#app/phases/berry-phase";
import { CommandPhase } from "#app/phases/command-phase";
import { DamagePhase } from "#app/phases/damage-phase";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import { MoveEndPhase } from "#app/phases/move-end-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { toDmgValue } from "#app/utils";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import { BerryPhase } from "#app/phases/berry-phase.js";
import { CommandPhase } from "#app/phases/command-phase.js";
import { DamagePhase } from "#app/phases/damage-phase.js";
import { MoveEffectPhase } from "#app/phases/move-effect-phase.js";
import { MoveEndPhase } from "#app/phases/move-end-phase.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
import { toDmgValue } from "#app/utils";
const TIMEOUT = 20 * 1000;
@ -61,7 +60,7 @@ describe("Abilities - Parental Bond", () => {
let enemyStartingHp = enemyPokemon.hp;
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
game.move.select(Moves.TACKLE);
await game.phaseInterceptor.to(MoveEffectPhase, false);
@ -92,7 +91,7 @@ describe("Abilities - Parental Bond", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!;
expect(enemyPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.POWER_UP_PUNCH));
game.move.select(Moves.POWER_UP_PUNCH);
await game.phaseInterceptor.to(BerryPhase, false);
@ -114,7 +113,7 @@ describe("Abilities - Parental Bond", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!;
expect(enemyPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.BABY_DOLL_EYES));
game.move.select(Moves.BABY_DOLL_EYES);
await game.phaseInterceptor.to(BerryPhase, false);
expect(enemyPokemon.summonData.battleStats[BattleStat.ATK]).toBe(-1);
@ -134,7 +133,7 @@ describe("Abilities - Parental Bond", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!;
expect(enemyPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.DOUBLE_HIT));
game.move.select(Moves.DOUBLE_HIT);
await game.move.forceHit();
await game.phaseInterceptor.to(BerryPhase, false);
@ -156,7 +155,7 @@ describe("Abilities - Parental Bond", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!;
expect(enemyPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.SELF_DESTRUCT));
game.move.select(Moves.SELF_DESTRUCT);
await game.phaseInterceptor.to(DamagePhase, false);
@ -177,7 +176,7 @@ describe("Abilities - Parental Bond", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!;
expect(enemyPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.ROLLOUT));
game.move.select(Moves.ROLLOUT);
await game.move.forceHit();
await game.phaseInterceptor.to(DamagePhase, false);
@ -201,7 +200,7 @@ describe("Abilities - Parental Bond", () => {
const enemyStartingHp = enemyPokemon.hp;
game.doAttack(getMovePosition(game.scene, 0, Moves.DRAGON_RAGE));
game.move.select(Moves.DRAGON_RAGE);
await game.phaseInterceptor.to(BerryPhase, false);
expect(enemyPokemon.hp).toBe(enemyStartingHp - 80);
@ -225,7 +224,7 @@ describe("Abilities - Parental Bond", () => {
const playerStartingHp = leadPokemon.hp;
const enemyStartingHp = enemyPokemon.hp;
game.doAttack(getMovePosition(game.scene, 0, Moves.COUNTER));
game.move.select(Moves.COUNTER);
await game.phaseInterceptor.to(DamagePhase);
const playerDamage = playerStartingHp - leadPokemon.hp;
@ -252,10 +251,10 @@ describe("Abilities - Parental Bond", () => {
expect(enemyPokemon.length).toBe(2);
enemyPokemon.forEach(p => expect(p).not.toBe(undefined));
game.doAttack(getMovePosition(game.scene, 0, Moves.EARTHQUAKE));
game.move.select(Moves.EARTHQUAKE);
await game.phaseInterceptor.to(CommandPhase);
game.doAttack(getMovePosition(game.scene, 1, Moves.EARTHQUAKE));
game.move.select(Moves.EARTHQUAKE, 1);
await game.phaseInterceptor.to(BerryPhase, false);
playerPokemon.forEach(p => expect(p.turnData.hitCount).toBe(1));
@ -275,7 +274,7 @@ describe("Abilities - Parental Bond", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!;
expect(enemyPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.EARTHQUAKE));
game.move.select(Moves.EARTHQUAKE);
await game.phaseInterceptor.to(DamagePhase, false);
expect(leadPokemon.turnData.hitCount).toBe(2);
@ -295,7 +294,7 @@ describe("Abilities - Parental Bond", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!;
expect(enemyPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.MIND_BLOWN));
game.move.select(Moves.MIND_BLOWN);
await game.phaseInterceptor.to(DamagePhase, false);
@ -321,7 +320,7 @@ describe("Abilities - Parental Bond", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!;
expect(enemyPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.BURN_UP));
game.move.select(Moves.BURN_UP);
await game.phaseInterceptor.to(DamagePhase);
@ -349,7 +348,7 @@ describe("Abilities - Parental Bond", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!;
expect(enemyPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
game.move.select(Moves.TACKLE);
await game.phaseInterceptor.to(DamagePhase);
@ -373,7 +372,7 @@ describe("Abilities - Parental Bond", () => {
const enemyStartingHp = enemyPokemon.hp;
game.doAttack(getMovePosition(game.scene, 0, Moves.SUPER_FANG));
game.move.select(Moves.SUPER_FANG);
await game.move.forceHit();
await game.phaseInterceptor.to(DamagePhase);
@ -402,7 +401,7 @@ describe("Abilities - Parental Bond", () => {
const enemyStartingHp = enemyPokemon.hp;
game.doAttack(getMovePosition(game.scene, 0, Moves.SEISMIC_TOSS));
game.move.select(Moves.SEISMIC_TOSS);
await game.move.forceHit();
await game.phaseInterceptor.to(DamagePhase);
@ -428,7 +427,7 @@ describe("Abilities - Parental Bond", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!;
expect(enemyPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.HYPER_BEAM));
game.move.select(Moves.HYPER_BEAM);
await game.move.forceHit();
await game.phaseInterceptor.to(DamagePhase);
@ -456,7 +455,7 @@ describe("Abilities - Parental Bond", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!;
expect(enemyPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.ANCHOR_SHOT));
game.move.select(Moves.ANCHOR_SHOT);
await game.move.forceHit();
await game.phaseInterceptor.to(DamagePhase);
@ -486,7 +485,7 @@ describe("Abilities - Parental Bond", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!;
expect(enemyPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.SMACK_DOWN));
game.move.select(Moves.SMACK_DOWN);
await game.move.forceHit();
await game.phaseInterceptor.to(DamagePhase);
@ -513,7 +512,7 @@ describe("Abilities - Parental Bond", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!;
expect(enemyPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.U_TURN));
game.move.select(Moves.U_TURN);
await game.move.forceHit();
await game.phaseInterceptor.to(MoveEffectPhase);
@ -537,7 +536,7 @@ describe("Abilities - Parental Bond", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!;
expect(enemyPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.WAKE_UP_SLAP));
game.move.select(Moves.WAKE_UP_SLAP);
await game.move.forceHit();
await game.phaseInterceptor.to(DamagePhase);
@ -565,7 +564,7 @@ describe("Abilities - Parental Bond", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!;
expect(enemyPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
game.move.select(Moves.TACKLE);
await game.phaseInterceptor.to(BerryPhase, false);
@ -587,7 +586,7 @@ describe("Abilities - Parental Bond", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!;
expect(enemyPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.WATER_GUN));
game.move.select(Moves.WATER_GUN);
await game.phaseInterceptor.to(BerryPhase, false);
@ -614,10 +613,10 @@ describe("Abilities - Parental Bond", () => {
const enemyStartingHp = enemyPokemon.map(p => p.hp);
game.doAttack(getMovePosition(game.scene, 0, Moves.EARTHQUAKE));
game.move.select(Moves.EARTHQUAKE);
await game.phaseInterceptor.to(CommandPhase);
game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH));
game.move.select(Moves.SPLASH, 1);
await game.phaseInterceptor.to(MoveEffectPhase, false);

View File

@ -1,15 +1,14 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import Phaser from "phaser";
import GameManager from "#test/utils/gameManager";
import { Species } from "#enums/species";
import { BattlerIndex } from "#app/battle";
import { StatusEffect } from "#app/data/status-effect";
import { Abilities } from "#app/enums/abilities";
import { CommandPhase } from "#app/phases/command-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { Moves } from "#enums/moves";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { StatusEffect } from "#app/data/status-effect.js";
import { allAbilities } from "#app/data/ability.js";
import { Abilities } from "#app/enums/abilities.js";
import { BattlerIndex } from "#app/battle.js";
import { CommandPhase } from "#app/phases/command-phase.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { SPLASH_ONLY } from "../utils/testUtils";
describe("Abilities - Pastel Veil", () => {
let phaserGame: Phaser.Game;
@ -27,50 +26,49 @@ describe("Abilities - Pastel Veil", () => {
beforeEach(() => {
game = new GameManager(phaserGame);
game.override.battleType("double");
game.override.moveset([Moves.SPLASH]);
game.override.enemyAbility(Abilities.BALL_FETCH);
game.override.enemySpecies(Species.MAGIKARP);
game.override.enemyMoveset([Moves.TOXIC_THREAD, Moves.TOXIC_THREAD, Moves.TOXIC_THREAD, Moves.TOXIC_THREAD]);
game.override
.battleType("double")
.moveset([Moves.TOXIC_THREAD, Moves.SPLASH])
.enemyAbility(Abilities.BALL_FETCH)
.enemySpecies(Species.SUNKERN)
.enemyMoveset(SPLASH_ONLY);
});
it("prevents the user and its allies from being afflicted by poison", async () => {
await game.startBattle([Species.GALAR_PONYTA, Species.MAGIKARP]);
const ponyta = game.scene.getPlayerField()[0];
vi.spyOn(ponyta, "getAbility").mockReturnValue(allAbilities[Abilities.PASTEL_VEIL]);
await game.startBattle([Species.MAGIKARP, Species.GALAR_PONYTA]);
const ponyta = game.scene.getPlayerField()[1];
const magikarp = game.scene.getPlayerField()[0];
ponyta.abilityIndex = 1;
expect(ponyta.hasAbility(Abilities.PASTEL_VEIL)).toBe(true);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH));
game.move.select(Moves.SPLASH);
game.move.select(Moves.TOXIC_THREAD, 1, BattlerIndex.PLAYER);
await game.phaseInterceptor.to(TurnEndPhase);
expect(game.scene.getPlayerField().every(p => p.status?.effect)).toBe(false);
expect(magikarp.status?.effect).toBeUndefined();
});
it("it heals the poisoned status condition of allies if user is sent out into battle", async () => {
await game.startBattle([Species.MAGIKARP, Species.MAGIKARP, Species.GALAR_PONYTA]);
const ponyta = game.scene.getParty().find(p => p.species.speciesId === Species.GALAR_PONYTA)!;
vi.spyOn(ponyta, "getAbility").mockReturnValue(allAbilities[Abilities.PASTEL_VEIL]);
await game.startBattle([Species.MAGIKARP, Species.FEEBAS, Species.GALAR_PONYTA]);
const ponyta = game.scene.getParty()[2];
const magikarp = game.scene.getPlayerField()[0];
ponyta.abilityIndex = 1;
expect(ponyta.hasAbility(Abilities.PASTEL_VEIL)).toBe(true);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH));
game.move.select(Moves.SPLASH);
game.move.select(Moves.TOXIC_THREAD, 1, BattlerIndex.PLAYER);
await game.phaseInterceptor.to(TurnEndPhase);
expect(game.scene.getPlayerField().some(p => p.status?.effect === StatusEffect.POISON)).toBe(true);
const poisonedMon = game.scene.getPlayerField().find(p => p.status?.effect === StatusEffect.POISON);
expect(magikarp.status?.effect).toBe(StatusEffect.POISON);
await game.phaseInterceptor.to(CommandPhase);
game.doAttack(getMovePosition(game.scene, (poisonedMon!.getBattlerIndex() as BattlerIndex.PLAYER | BattlerIndex.PLAYER_2), Moves.SPLASH));
game.move.select(Moves.SPLASH);
game.doSwitchPokemon(2);
await game.phaseInterceptor.to(TurnEndPhase);
expect(game.scene.getPlayerField().every(p => p.status?.effect)).toBe(false);
expect(magikarp.status?.effect).toBeUndefined();
});
});

View File

@ -1,11 +1,10 @@
import { Status, StatusEffect } from "#app/data/status-effect.js";
import { QuietFormChangePhase } from "#app/phases/quiet-form-change-phase.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
import { Status, StatusEffect } from "#app/data/status-effect";
import { QuietFormChangePhase } from "#app/phases/quiet-form-change-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
const TIMEOUT = 20 * 1000;
@ -53,7 +52,7 @@ describe("Abilities - POWER CONSTRUCT", () => {
zygarde!.status = new Status(StatusEffect.FAINT);
expect(zygarde!.isFainted()).toBe(true);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.doKillOpponents();
await game.phaseInterceptor.to(TurnEndPhase);
game.doSelectModifier();

View File

@ -1,14 +1,13 @@
import { allMoves } from "#app/data/move.js";
import { Abilities } from "#app/enums/abilities.js";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { allMoves } from "#app/data/move";
import { Abilities } from "#app/enums/abilities";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import { MoveEffectPhase } from "#app/phases/move-effect-phase.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
describe("Abilities - Power Spot", () => {
let phaserGame: Phaser.Game;
@ -42,8 +41,8 @@ describe("Abilities - Power Spot", () => {
vi.spyOn(moveToCheck, "calculateBattlePower");
await game.startBattle([Species.REGIELEKI, Species.STONJOURNER]);
game.doAttack(getMovePosition(game.scene, 0, Moves.DAZZLING_GLEAM));
game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH));
game.move.select(Moves.DAZZLING_GLEAM);
game.move.select(Moves.SPLASH, 1);
await game.phaseInterceptor.to(MoveEffectPhase);
expect(moveToCheck.calculateBattlePower).toHaveReturnedWith(basePower * powerSpotMultiplier);
@ -56,8 +55,8 @@ describe("Abilities - Power Spot", () => {
vi.spyOn(moveToCheck, "calculateBattlePower");
await game.startBattle([Species.REGIELEKI, Species.STONJOURNER]);
game.doAttack(getMovePosition(game.scene, 0, Moves.BREAKING_SWIPE));
game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH));
game.move.select(Moves.BREAKING_SWIPE);
game.move.select(Moves.SPLASH, 1);
await game.phaseInterceptor.to(MoveEffectPhase);
expect(moveToCheck.calculateBattlePower).toHaveReturnedWith(basePower * powerSpotMultiplier);
@ -70,8 +69,8 @@ describe("Abilities - Power Spot", () => {
vi.spyOn(moveToCheck, "calculateBattlePower");
await game.startBattle([Species.STONJOURNER, Species.REGIELEKI]);
game.doAttack(getMovePosition(game.scene, 0, Moves.BREAKING_SWIPE));
game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH));
game.move.select(Moves.BREAKING_SWIPE);
game.move.select(Moves.SPLASH, 1);
await game.phaseInterceptor.to(TurnEndPhase);
expect(moveToCheck.calculateBattlePower).toHaveReturnedWith(basePower);

View File

@ -1,18 +1,17 @@
import { allMoves } from "#app/data/move.js";
import { Type } from "#app/data/type.js";
import { Weather, WeatherType } from "#app/data/weather.js";
import { PlayerPokemon } from "#app/field/pokemon.js";
import { allMoves } from "#app/data/move";
import { Type } from "#app/data/type";
import { Weather, WeatherType } from "#app/data/weather";
import { PlayerPokemon } from "#app/field/pokemon";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { Abilities } from "#enums/abilities";
import { BattlerTagType } from "#enums/battler-tag-type";
import { Biome } from "#enums/biome";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
const TIMEOUT = 20 * 1000;
@ -49,7 +48,7 @@ describe("Abilities - Protean", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
expect(leadPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
testPokemonTypeMatchesDefaultMoveType(leadPokemon, Moves.SPLASH);
@ -67,12 +66,12 @@ describe("Abilities - Protean", () => {
let leadPokemon = game.scene.getPlayerPokemon()!;
expect(leadPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
testPokemonTypeMatchesDefaultMoveType(leadPokemon, Moves.SPLASH);
game.doAttack(getMovePosition(game.scene, 0, Moves.AGILITY));
game.move.select(Moves.AGILITY);
await game.phaseInterceptor.to(TurnEndPhase);
expect(leadPokemon.summonData.abilitiesApplied.filter((a) => a === Abilities.PROTEAN)).toHaveLength(1);
@ -89,7 +88,7 @@ describe("Abilities - Protean", () => {
leadPokemon = game.scene.getPlayerPokemon()!;
expect(leadPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
testPokemonTypeMatchesDefaultMoveType(leadPokemon, Moves.SPLASH);
@ -108,7 +107,7 @@ describe("Abilities - Protean", () => {
expect(leadPokemon).not.toBe(undefined);
game.scene.arena.weather = new Weather(WeatherType.SUNNY);
game.doAttack(getMovePosition(game.scene, 0, Moves.WEATHER_BALL));
game.move.select(Moves.WEATHER_BALL);
await game.phaseInterceptor.to(TurnEndPhase);
expect(leadPokemon.summonData.abilitiesApplied).toContain(Abilities.PROTEAN);
@ -131,7 +130,7 @@ describe("Abilities - Protean", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
expect(leadPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
game.move.select(Moves.TACKLE);
await game.phaseInterceptor.to(TurnEndPhase);
expect(leadPokemon.summonData.abilitiesApplied).toContain(Abilities.PROTEAN);
@ -154,7 +153,7 @@ describe("Abilities - Protean", () => {
expect(leadPokemon).not.toBe(undefined);
game.scene.arena.biomeType = Biome.MOUNTAIN;
game.doAttack(getMovePosition(game.scene, 0, Moves.NATURE_POWER));
game.move.select(Moves.NATURE_POWER);
await game.phaseInterceptor.to(TurnEndPhase);
testPokemonTypeMatchesDefaultMoveType(leadPokemon, Moves.AIR_SLASH);
@ -172,7 +171,7 @@ describe("Abilities - Protean", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
expect(leadPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.DIG));
game.move.select(Moves.DIG);
await game.phaseInterceptor.to(TurnEndPhase);
testPokemonTypeMatchesDefaultMoveType(leadPokemon, Moves.DIG);
@ -191,7 +190,7 @@ describe("Abilities - Protean", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
expect(leadPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
game.move.select(Moves.TACKLE);
await game.move.forceMiss();
await game.phaseInterceptor.to(TurnEndPhase);
@ -213,7 +212,7 @@ describe("Abilities - Protean", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
expect(leadPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
game.move.select(Moves.TACKLE);
await game.phaseInterceptor.to(TurnEndPhase);
testPokemonTypeMatchesDefaultMoveType(leadPokemon, Moves.TACKLE);
@ -232,7 +231,7 @@ describe("Abilities - Protean", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
expect(leadPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
game.move.select(Moves.TACKLE);
await game.phaseInterceptor.to(TurnEndPhase);
testPokemonTypeMatchesDefaultMoveType(leadPokemon, Moves.TACKLE);
@ -251,7 +250,7 @@ describe("Abilities - Protean", () => {
expect(leadPokemon).not.toBe(undefined);
leadPokemon.summonData.types = [allMoves[Moves.SPLASH].defaultType];
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
expect(leadPokemon.summonData.abilitiesApplied).not.toContain(Abilities.PROTEAN);
@ -271,7 +270,7 @@ describe("Abilities - Protean", () => {
vi.spyOn(leadPokemon, "isTerastallized").mockReturnValue(true);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
expect(leadPokemon.summonData.abilitiesApplied).not.toContain(Abilities.PROTEAN);
@ -289,7 +288,7 @@ describe("Abilities - Protean", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
expect(leadPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.STRUGGLE));
game.move.select(Moves.STRUGGLE);
await game.phaseInterceptor.to(TurnEndPhase);
expect(leadPokemon.summonData.abilitiesApplied).not.toContain(Abilities.PROTEAN);
@ -307,7 +306,7 @@ describe("Abilities - Protean", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
expect(leadPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.BURN_UP));
game.move.select(Moves.BURN_UP);
await game.phaseInterceptor.to(TurnEndPhase);
expect(leadPokemon.summonData.abilitiesApplied).not.toContain(Abilities.PROTEAN);
@ -326,7 +325,7 @@ describe("Abilities - Protean", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
expect(leadPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.TRICK_OR_TREAT));
game.move.select(Moves.TRICK_OR_TREAT);
await game.phaseInterceptor.to(TurnEndPhase);
testPokemonTypeMatchesDefaultMoveType(leadPokemon, Moves.TRICK_OR_TREAT);
@ -344,7 +343,7 @@ describe("Abilities - Protean", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
expect(leadPokemon).not.toBe(undefined);
game.doAttack(getMovePosition(game.scene, 0, Moves.CURSE));
game.move.select(Moves.CURSE);
await game.phaseInterceptor.to(TurnEndPhase);
testPokemonTypeMatchesDefaultMoveType(leadPokemon, Moves.CURSE);

View File

@ -1,12 +1,11 @@
import { allAbilities, BypassSpeedChanceAbAttr } from "#app/data/ability";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { FaintPhase } from "#app/phases/faint-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, expect, test, vi } from "vitest";
import { FaintPhase } from "#app/phases/faint-phase.js";
describe("Abilities - Quick Draw", () => {
let phaserGame: Phaser.Game;
@ -47,7 +46,7 @@ describe("Abilities - Quick Draw", () => {
pokemon.hp = 1;
enemy.hp = 1;
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
game.move.select(Moves.TACKLE);
await game.phaseInterceptor.to(FaintPhase, false);
expect(pokemon.isFainted()).toBe(false);
@ -67,7 +66,7 @@ describe("Abilities - Quick Draw", () => {
pokemon.hp = 1;
enemy.hp = 1;
game.doAttack(getMovePosition(game.scene, 0, Moves.TAIL_WHIP));
game.move.select(Moves.TAIL_WHIP);
await game.phaseInterceptor.to(FaintPhase, false);
expect(pokemon.isFainted()).toBe(true);
@ -87,7 +86,7 @@ describe("Abilities - Quick Draw", () => {
pokemon.hp = 1;
enemy.hp = 1;
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
game.move.select(Moves.TACKLE);
await game.phaseInterceptor.to(FaintPhase, false);
expect(pokemon.isFainted()).toBe(true);

View File

@ -1,11 +1,10 @@
import GameManager from "#test/utils/gameManager";
import { WeatherType } from "#app/enums/weather-type";
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, expect, it } from "vitest";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { WeatherType } from "#app/enums/weather-type.js";
describe("Abilities - Sand Spit", () => {
@ -39,7 +38,7 @@ describe("Abilities - Sand Spit", () => {
game.override.enemyMoveset(Array(4).fill(Moves.TACKLE));
await game.startBattle();
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.toNextTurn();
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SANDSTORM);
@ -49,7 +48,7 @@ describe("Abilities - Sand Spit", () => {
game.override.enemyMoveset(Array(4).fill(Moves.GROWL));
await game.startBattle();
game.doAttack(getMovePosition(game.scene, 0, Moves.COIL));
game.move.select(Moves.COIL);
await game.toNextTurn();
expect(game.scene.arena.weather?.weatherType).not.toBe(WeatherType.SANDSTORM);

View File

@ -1,16 +1,15 @@
import { BattleStatMultiplierAbAttr, allAbilities } from "#app/data/ability.js";
import { BattleStat } from "#app/data/battle-stat.js";
import { WeatherType } from "#app/data/weather.js";
import { BattleStatMultiplierAbAttr, allAbilities } from "#app/data/ability";
import { BattleStat } from "#app/data/battle-stat";
import { WeatherType } from "#app/data/weather";
import { CommandPhase } from "#app/phases/command-phase";
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, expect, test, vi } from "vitest";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { CommandPhase } from "#app/phases/command-phase.js";
import { MoveEffectPhase } from "#app/phases/move-effect-phase.js";
import { MoveEndPhase } from "#app/phases/move-end-phase.js";
const TIMEOUT = 20 * 1000;
@ -64,11 +63,11 @@ describe("Abilities - Sand Veil", () => {
expect(leadPokemon[0].hasAbility(Abilities.SAND_VEIL)).toBe(true);
expect(leadPokemon[1].hasAbility(Abilities.SAND_VEIL)).toBe(false);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(CommandPhase);
game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH));
game.move.select(Moves.SPLASH, 1);
await game.phaseInterceptor.to(MoveEffectPhase, false);

View File

@ -1,15 +1,14 @@
import { BattleStat } from "#app/data/battle-stat.js";
import { TerrainType } from "#app/data/terrain.js";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { BattleStat } from "#app/data/battle-stat";
import { TerrainType } from "#app/data/terrain";
import { MoveEndPhase } from "#app/phases/move-end-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { Abilities } from "#enums/abilities";
import { BattlerTagType } from "#enums/battler-tag-type";
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, expect, it } from "vitest";
import { MoveEndPhase } from "#app/phases/move-end-phase.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
// See also: TypeImmunityAbAttr
describe("Abilities - Sap Sipper", () => {
@ -45,7 +44,7 @@ describe("Abilities - Sap Sipper", () => {
const startingOppHp = game.scene.currentBattle.enemyParty[0].hp;
game.doAttack(getMovePosition(game.scene, 0, moveToUse));
game.move.select(moveToUse);
await game.phaseInterceptor.to(TurnEndPhase);
@ -64,7 +63,7 @@ describe("Abilities - Sap Sipper", () => {
await game.startBattle();
game.doAttack(getMovePosition(game.scene, 0, moveToUse));
game.move.select(moveToUse);
await game.phaseInterceptor.to(TurnEndPhase);
@ -83,7 +82,7 @@ describe("Abilities - Sap Sipper", () => {
await game.startBattle();
game.doAttack(getMovePosition(game.scene, 0, moveToUse));
game.move.select(moveToUse);
await game.phaseInterceptor.to(TurnEndPhase);
@ -105,7 +104,7 @@ describe("Abilities - Sap Sipper", () => {
const startingOppHp = game.scene.currentBattle.enemyParty[0].hp;
game.doAttack(getMovePosition(game.scene, 0, moveToUse));
game.move.select(moveToUse);
await game.phaseInterceptor.to(TurnEndPhase);
@ -125,7 +124,7 @@ describe("Abilities - Sap Sipper", () => {
await game.startBattle();
game.doAttack(getMovePosition(game.scene, 0, moveToUse));
game.move.select(moveToUse);
await game.phaseInterceptor.to(MoveEndPhase);
@ -152,7 +151,7 @@ describe("Abilities - Sap Sipper", () => {
const startingOppHp = game.scene.currentBattle.enemyParty[0].hp;
game.doAttack(getMovePosition(game.scene, 0, moveToUse));
game.move.select(moveToUse);
await game.phaseInterceptor.to(TurnEndPhase);

View File

@ -1,11 +1,10 @@
import { Status, StatusEffect } from "#app/data/status-effect.js";
import { QuietFormChangePhase } from "#app/phases/quiet-form-change-phase.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
import { Status, StatusEffect } from "#app/data/status-effect";
import { QuietFormChangePhase } from "#app/phases/quiet-form-change-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
const TIMEOUT = 20 * 1000;
@ -53,7 +52,7 @@ describe("Abilities - SCHOOLING", () => {
wishiwashi.status = new Status(StatusEffect.FAINT);
expect(wishiwashi.isFainted()).toBe(true);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.doKillOpponents();
await game.phaseInterceptor.to(TurnEndPhase);
game.doSelectModifier();

View File

@ -1,13 +1,12 @@
import { ArenaTagType } from "#app/enums/arena-tag-type.js";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { ArenaTagType } from "#app/enums/arena-tag-type";
import { PostSummonPhase } from "#app/phases/post-summon-phase";
import { TurnEndPhase } from "#app/phases/turn-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, expect, it } from "vitest";
import { PostSummonPhase } from "#app/phases/post-summon-phase.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
describe("Abilities - Screen Cleaner", () => {
let phaserGame: Phaser.Game;
@ -36,7 +35,7 @@ describe("Abilities - Screen Cleaner", () => {
await game.startBattle([Species.MAGIKARP, Species.MAGIKARP]);
game.doAttack(getMovePosition(game.scene, 0, Moves.HAIL));
game.move.select(Moves.HAIL);
await game.phaseInterceptor.to(TurnEndPhase);
expect(game.scene.arena.getTag(ArenaTagType.AURORA_VEIL)).toBeDefined();
@ -53,7 +52,7 @@ describe("Abilities - Screen Cleaner", () => {
await game.startBattle([Species.MAGIKARP, Species.MAGIKARP]);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
expect(game.scene.arena.getTag(ArenaTagType.LIGHT_SCREEN)).toBeDefined();
@ -70,7 +69,7 @@ describe("Abilities - Screen Cleaner", () => {
await game.startBattle([Species.MAGIKARP, Species.MAGIKARP]);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
expect(game.scene.arena.getTag(ArenaTagType.REFLECT)).toBeDefined();

View File

@ -1,18 +1,14 @@
import { BattlerIndex } from "#app/battle";
import { applyAbAttrs, MoveEffectChanceMultiplierAbAttr } from "#app/data/ability";
import { Stat } from "#app/data/pokemon-stat";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { Command } from "#app/ui/command-ui-handler";
import { Mode } from "#app/ui/ui";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import * as Utils from "#app/utils";
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, expect, it } from "vitest";
import { BattlerIndex } from "#app/battle.js";
import { CommandPhase } from "#app/phases/command-phase.js";
import { MoveEffectPhase } from "#app/phases/move-effect-phase.js";
describe("Abilities - Serene Grace", () => {
@ -49,13 +45,7 @@ describe("Abilities - Serene Grace", () => {
game.scene.getEnemyParty()[0].stats[Stat.SPDEF] = 10000;
expect(game.scene.getParty()[0].formIndex).toBe(0);
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
});
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => {
const movePosition = getMovePosition(game.scene, 0, moveToUse);
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false);
});
game.move.select(moveToUse);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to(MoveEffectPhase, false);
@ -82,13 +72,7 @@ describe("Abilities - Serene Grace", () => {
game.scene.getEnemyParty()[0].stats[Stat.SPDEF] = 10000;
expect(game.scene.getParty()[0].formIndex).toBe(0);
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
});
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => {
const movePosition = getMovePosition(game.scene, 0, moveToUse);
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false);
});
game.move.select(moveToUse);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to(MoveEffectPhase, false);

View File

@ -1,18 +1,14 @@
import { BattlerIndex } from "#app/battle";
import { applyAbAttrs, applyPostDefendAbAttrs, applyPreAttackAbAttrs, MoveEffectChanceMultiplierAbAttr, MovePowerBoostAbAttr, PostDefendTypeChangeAbAttr } from "#app/data/ability";
import { Stat } from "#app/data/pokemon-stat";
import { CommandPhase } from "#app/phases/command-phase.js";
import { MoveEffectPhase } from "#app/phases/move-effect-phase.js";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { Command } from "#app/ui/command-ui-handler";
import { Mode } from "#app/ui/ui";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import * as Utils from "#app/utils";
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, expect, it } from "vitest";
import { BattlerIndex } from "#app/battle.js";
describe("Abilities - Sheer Force", () => {
@ -50,13 +46,7 @@ describe("Abilities - Sheer Force", () => {
game.scene.getEnemyParty()[0].stats[Stat.SPDEF] = 10000;
expect(game.scene.getParty()[0].formIndex).toBe(0);
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
});
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => {
const movePosition = getMovePosition(game.scene, 0, moveToUse);
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false);
});
game.move.select(moveToUse);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to(MoveEffectPhase, false);
@ -89,13 +79,7 @@ describe("Abilities - Sheer Force", () => {
game.scene.getEnemyParty()[0].stats[Stat.DEF] = 10000;
expect(game.scene.getParty()[0].formIndex).toBe(0);
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
});
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => {
const movePosition = getMovePosition(game.scene, 0, moveToUse);
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false);
});
game.move.select(moveToUse);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to(MoveEffectPhase, false);
@ -128,13 +112,7 @@ describe("Abilities - Sheer Force", () => {
game.scene.getEnemyParty()[0].stats[Stat.DEF] = 10000;
expect(game.scene.getParty()[0].formIndex).toBe(0);
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
});
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => {
const movePosition = getMovePosition(game.scene, 0, moveToUse);
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false);
});
game.move.select(moveToUse);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to(MoveEffectPhase, false);
@ -169,13 +147,7 @@ describe("Abilities - Sheer Force", () => {
game.scene.getEnemyParty()[0].stats[Stat.DEF] = 10000;
expect(game.scene.getParty()[0].formIndex).toBe(0);
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
});
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => {
const movePosition = getMovePosition(game.scene, 0, moveToUse);
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false);
});
game.move.select(moveToUse);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to(MoveEffectPhase, false);

View File

@ -1,18 +1,14 @@
import { BattlerIndex } from "#app/battle";
import { applyAbAttrs, applyPreDefendAbAttrs, IgnoreMoveEffectsAbAttr, MoveEffectChanceMultiplierAbAttr } from "#app/data/ability";
import { Stat } from "#app/data/pokemon-stat";
import { CommandPhase } from "#app/phases/command-phase.js";
import { MoveEffectPhase } from "#app/phases/move-effect-phase.js";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { Command } from "#app/ui/command-ui-handler";
import { Mode } from "#app/ui/ui";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import * as Utils from "#app/utils";
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, expect, it } from "vitest";
import { BattlerIndex } from "#app/battle.js";
describe("Abilities - Shield Dust", () => {
@ -50,13 +46,7 @@ describe("Abilities - Shield Dust", () => {
game.scene.getEnemyParty()[0].stats[Stat.SPDEF] = 10000;
expect(game.scene.getParty()[0].formIndex).toBe(0);
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
});
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => {
const movePosition = getMovePosition(game.scene, 0, moveToUse);
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false);
});
game.move.select(moveToUse);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to(MoveEffectPhase, false);

View File

@ -1,11 +1,10 @@
import { Status, StatusEffect } from "#app/data/status-effect.js";
import { QuietFormChangePhase } from "#app/phases/quiet-form-change-phase.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
import { Status, StatusEffect } from "#app/data/status-effect";
import { QuietFormChangePhase } from "#app/phases/quiet-form-change-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
const TIMEOUT = 20 * 1000;
@ -53,7 +52,7 @@ describe("Abilities - SHIELDS DOWN", () => {
minior.status = new Status(StatusEffect.FAINT);
expect(minior.isFainted()).toBe(true);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.doKillOpponents();
await game.phaseInterceptor.to(TurnEndPhase);
game.doSelectModifier();

View File

@ -1,11 +1,10 @@
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { MovePhase } from "#app/phases/move-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, expect, it } from "vitest";
import { MovePhase } from "#app/phases/move-phase.js";
describe("Abilities - Stall", () => {
@ -44,7 +43,7 @@ describe("Abilities - Stall", () => {
const leadIndex = game.scene.getPlayerPokemon()!.getBattlerIndex();
const enemyIndex = game.scene.getEnemyPokemon()!.getBattlerIndex();
game.doAttack(getMovePosition(game.scene, 0, Moves.QUICK_ATTACK));
game.move.select(Moves.QUICK_ATTACK);
await game.phaseInterceptor.to(MovePhase, false);
// The player Pokemon (without Stall) goes first despite having lower speed than the opponent.
@ -62,7 +61,7 @@ describe("Abilities - Stall", () => {
const leadIndex = game.scene.getPlayerPokemon()!.getBattlerIndex();
const enemyIndex = game.scene.getEnemyPokemon()!.getBattlerIndex();
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
game.move.select(Moves.TACKLE);
await game.phaseInterceptor.to(MovePhase, false);
// The opponent Pokemon (with Stall) goes first because its move is still within a higher priority bracket than its opponent.
@ -81,7 +80,7 @@ describe("Abilities - Stall", () => {
const leadIndex = game.scene.getPlayerPokemon()!.getBattlerIndex();
const enemyIndex = game.scene.getEnemyPokemon()!.getBattlerIndex();
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
game.move.select(Moves.TACKLE);
await game.phaseInterceptor.to(MovePhase, false);
// The opponent Pokemon (with Stall) goes first because it has a higher speed.

View File

@ -1,15 +1,13 @@
import { allAbilities } from "#app/data/ability.js";
import { allMoves } from "#app/data/move.js";
import { Abilities } from "#app/enums/abilities.js";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { allAbilities } from "#app/data/ability";
import { allMoves } from "#app/data/move";
import { Abilities } from "#app/enums/abilities";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import { MoveEffectPhase } from "#app/phases/move-effect-phase.js";
import { SelectTargetPhase } from "#app/phases/select-target-phase.js";
describe("Abilities - Steely Spirit", () => {
let phaserGame: Phaser.Game;
@ -47,10 +45,8 @@ describe("Abilities - Steely Spirit", () => {
expect(boostSource.hasAbility(Abilities.STEELY_SPIRIT)).toBe(true);
game.doAttack(getMovePosition(game.scene, 0, moveToCheck));
await game.phaseInterceptor.to(SelectTargetPhase, false);
game.doSelectTarget(enemyToCheck.getBattlerIndex());
game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH));
game.move.select(moveToCheck, 0, enemyToCheck.getBattlerIndex());
game.move.select(Moves.SPLASH, 1);
await game.phaseInterceptor.to(MoveEffectPhase);
expect(allMoves[moveToCheck].calculateBattlePower).toHaveReturnedWith(ironHeadPower * steelySpiritMultiplier);
@ -66,12 +62,8 @@ describe("Abilities - Steely Spirit", () => {
expect(game.scene.getPlayerField().every(p => p.hasAbility(Abilities.STEELY_SPIRIT))).toBe(true);
game.doAttack(getMovePosition(game.scene, 0, moveToCheck));
await game.phaseInterceptor.to(SelectTargetPhase, false);
game.doSelectTarget(enemyToCheck.getBattlerIndex());
game.doAttack(getMovePosition(game.scene, 1, moveToCheck));
await game.phaseInterceptor.to(SelectTargetPhase, false);
game.doSelectTarget(enemyToCheck.getBattlerIndex());
game.move.select(moveToCheck, 0, enemyToCheck.getBattlerIndex());
game.move.select(moveToCheck, 1, enemyToCheck.getBattlerIndex());
await game.phaseInterceptor.to(MoveEffectPhase);
expect(allMoves[moveToCheck].calculateBattlePower).toHaveReturnedWith(ironHeadPower * Math.pow(steelySpiritMultiplier, 2));
@ -90,10 +82,8 @@ describe("Abilities - Steely Spirit", () => {
expect(boostSource.hasAbility(Abilities.STEELY_SPIRIT)).toBe(false);
expect(boostSource.summonData.abilitySuppressed).toBe(true);
game.doAttack(getMovePosition(game.scene, 0, moveToCheck));
await game.phaseInterceptor.to(SelectTargetPhase, false);
game.doSelectTarget(enemyToCheck.getBattlerIndex());
game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH));
game.move.select(moveToCheck, 0, enemyToCheck.getBattlerIndex());
game.move.select(Moves.SPLASH, 1);
await game.phaseInterceptor.to(MoveEffectPhase);
expect(allMoves[moveToCheck].calculateBattlePower).toHaveReturnedWith(ironHeadPower);

View File

@ -1,13 +1,12 @@
import { EnemyPokemon } from "#app/field/pokemon.js";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { EnemyPokemon } from "#app/field/pokemon";
import { DamagePhase } from "#app/phases/damage-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, expect, test } from "vitest";
import { DamagePhase } from "#app/phases/damage-phase.js";
import { MoveEndPhase } from "#app/phases/move-end-phase.js";
const TIMEOUT = 20 * 1000;
@ -42,7 +41,7 @@ describe("Abilities - Sturdy", () => {
"Sturdy activates when user is at full HP",
async () => {
await game.startBattle();
game.doAttack(getMovePosition(game.scene, 0, Moves.CLOSE_COMBAT));
game.move.select(Moves.CLOSE_COMBAT);
await game.phaseInterceptor.to(MoveEndPhase);
expect(game.scene.getEnemyParty()[0].hp).toBe(1);
},
@ -57,7 +56,7 @@ describe("Abilities - Sturdy", () => {
const enemyPokemon: EnemyPokemon = game.scene.getEnemyParty()[0];
enemyPokemon.hp = enemyPokemon.getMaxHp() - 1;
game.doAttack(getMovePosition(game.scene, 0, Moves.CLOSE_COMBAT));
game.move.select(Moves.CLOSE_COMBAT);
await game.phaseInterceptor.to(DamagePhase);
expect(enemyPokemon.hp).toBe(0);
@ -70,7 +69,7 @@ describe("Abilities - Sturdy", () => {
"Sturdy pokemon should be immune to OHKO moves",
async () => {
await game.startBattle();
game.doAttack(getMovePosition(game.scene, 0, Moves.FISSURE));
game.move.select(Moves.FISSURE);
await game.phaseInterceptor.to(MoveEndPhase);
const enemyPokemon: EnemyPokemon = game.scene.getEnemyParty()[0];
@ -85,7 +84,7 @@ describe("Abilities - Sturdy", () => {
game.override.ability(Abilities.MOLD_BREAKER);
await game.startBattle();
game.doAttack(getMovePosition(game.scene, 0, Moves.CLOSE_COMBAT));
game.move.select(Moves.CLOSE_COMBAT);
await game.phaseInterceptor.to(DamagePhase);
const enemyPokemon: EnemyPokemon = game.scene.getEnemyParty()[0];

View File

@ -1,16 +1,14 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import Phaser from "phaser";
import GameManager from "#test/utils/gameManager";
import { Species } from "#enums/species";
import { BattlerIndex } from "#app/battle";
import { Abilities } from "#app/enums/abilities";
import { BattlerTagType } from "#app/enums/battler-tag-type";
import { CommandPhase } from "#app/phases/command-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { Moves } from "#enums/moves";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { BattlerTagType } from "#app/enums/battler-tag-type.js";
import { Abilities } from "#app/enums/abilities.js";
import { BattlerIndex } from "#app/battle.js";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import { CommandPhase } from "#app/phases/command-phase.js";
import { MovePhase } from "#app/phases/move-phase.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Abilities - Sweet Veil", () => {
let phaserGame: Phaser.Game;
@ -29,7 +27,7 @@ describe("Abilities - Sweet Veil", () => {
beforeEach(() => {
game = new GameManager(phaserGame);
game.override.battleType("double");
game.override.moveset([Moves.SPLASH, Moves.REST]);
game.override.moveset([Moves.SPLASH, Moves.REST, Moves.YAWN]);
game.override.enemySpecies(Species.MAGIKARP);
game.override.enemyAbility(Abilities.BALL_FETCH);
game.override.enemyMoveset([Moves.POWDER, Moves.POWDER, Moves.POWDER, Moves.POWDER]);
@ -38,8 +36,8 @@ describe("Abilities - Sweet Veil", () => {
it("prevents the user and its allies from falling asleep", async () => {
await game.startBattle([Species.SWIRLIX, Species.MAGIKARP]);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH));
game.move.select(Moves.SPLASH);
game.move.select(Moves.SPLASH, 1);
await game.phaseInterceptor.to(TurnEndPhase);
@ -50,8 +48,8 @@ describe("Abilities - Sweet Veil", () => {
game.override.enemyMoveset(SPLASH_ONLY);
await game.startBattle([Species.SWIRLIX, Species.MAGIKARP]);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.doAttack(getMovePosition(game.scene, 1, Moves.REST));
game.move.select(Moves.SPLASH);
game.move.select(Moves.REST, 1);
await game.phaseInterceptor.to(TurnEndPhase);
@ -62,8 +60,8 @@ describe("Abilities - Sweet Veil", () => {
game.override.enemyMoveset([Moves.YAWN, Moves.YAWN, Moves.YAWN, Moves.YAWN]);
await game.startBattle([Species.SWIRLIX, Species.MAGIKARP]);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH));
game.move.select(Moves.SPLASH);
game.move.select(Moves.SPLASH, 1);
await game.phaseInterceptor.to(TurnEndPhase);
@ -74,28 +72,19 @@ describe("Abilities - Sweet Veil", () => {
game.override.enemySpecies(Species.PIKACHU);
game.override.enemyLevel(5);
game.override.startingLevel(5);
game.override.enemyMoveset([Moves.YAWN, Moves.YAWN, Moves.YAWN, Moves.YAWN]);
game.override.enemyMoveset(SPLASH_ONLY);
await game.startBattle([Species.SHUCKLE, Species.SHUCKLE, Species.SWIRLIX]);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH));
game.move.select(Moves.SPLASH);
game.move.select(Moves.YAWN, 1, BattlerIndex.PLAYER);
// First pokemon move
await game.move.forceHit();
// Second pokemon move
await game.phaseInterceptor.to(MovePhase, false);
await game.move.forceHit();
await game.phaseInterceptor.to("BerryPhase");
expect(game.scene.getPlayerField().some(p => !!p.getTag(BattlerTagType.DROWSY))).toBe(true);
await game.phaseInterceptor.to(TurnEndPhase);
const drowsyMon = game.scene.getPlayerField().find(p => !!p.getTag(BattlerTagType.DROWSY))!;
await game.phaseInterceptor.to(CommandPhase);
game.doAttack(getMovePosition(game.scene, (drowsyMon.getBattlerIndex() as BattlerIndex.PLAYER | BattlerIndex.PLAYER_2), Moves.SPLASH));
game.move.select(Moves.SPLASH);
game.doSwitchPokemon(2);
expect(game.scene.getPlayerField().every(p => p.status?.effect)).toBe(false);

View File

@ -1,11 +1,10 @@
import { TurnEndPhase } from "#app/phases/turn-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, expect, test } from "vitest";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
const TIMEOUT = 20 * 1000;
@ -80,7 +79,7 @@ async function testUnseenFistHitResult(game: GameManager, attackMove: Moves, pro
const enemyStartingHp = enemyPokemon.hp;
game.doAttack(getMovePosition(game.scene, 0, attackMove));
game.move.select(attackMove);
await game.phaseInterceptor.to(TurnEndPhase, false);
if (shouldSucceed) {

View File

@ -1,11 +1,10 @@
import { BattleStat } from "#app/data/battle-stat.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { BattleStat } from "#app/data/battle-stat";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { Abilities } from "#enums/abilities";
import { BattlerTagType } from "#enums/battler-tag-type";
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, expect, it } from "vitest";
@ -42,7 +41,7 @@ describe("Abilities - Volt Absorb", () => {
await game.startBattle();
game.doAttack(getMovePosition(game.scene, 0, moveToUse));
game.move.select(moveToUse);
await game.phaseInterceptor.to(TurnEndPhase);

View File

@ -1,13 +1,12 @@
import { BattlerTagType } from "#app/enums/battler-tag-type.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { BattlerTagType } from "#app/enums/battler-tag-type";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils";
describe("Abilities - Wind Power", () => {
let phaserGame: Phaser.Game;
@ -38,7 +37,7 @@ describe("Abilities - Wind Power", () => {
expect(shiftry.getTag(BattlerTagType.CHARGED)).toBeUndefined();
game.doAttack(getMovePosition(game.scene, 0, Moves.PETAL_BLIZZARD));
game.move.select(Moves.PETAL_BLIZZARD);
await game.phaseInterceptor.to(TurnEndPhase);
expect(shiftry.getTag(BattlerTagType.CHARGED)).toBeDefined();
@ -53,7 +52,7 @@ describe("Abilities - Wind Power", () => {
expect(shiftry.getTag(BattlerTagType.CHARGED)).toBeUndefined();
game.doAttack(getMovePosition(game.scene, 0, Moves.TAILWIND));
game.move.select(Moves.TAILWIND);
await game.phaseInterceptor.to(TurnEndPhase);
expect(shiftry.getTag(BattlerTagType.CHARGED)).toBeDefined();
@ -70,7 +69,7 @@ describe("Abilities - Wind Power", () => {
expect(shiftry.getTag(BattlerTagType.CHARGED)).toBeUndefined();
expect(magikarp.getTag(BattlerTagType.CHARGED)).toBeUndefined();
game.doAttack(getMovePosition(game.scene, 0, Moves.TAILWIND));
game.move.select(Moves.TAILWIND);
await game.phaseInterceptor.to(TurnEndPhase);
@ -86,7 +85,7 @@ describe("Abilities - Wind Power", () => {
expect(shiftry.getTag(BattlerTagType.CHARGED)).toBeUndefined();
game.doAttack(getMovePosition(game.scene, 0, Moves.SANDSTORM));
game.move.select(Moves.SANDSTORM);
await game.phaseInterceptor.to(TurnEndPhase);

View File

@ -1,13 +1,12 @@
import { BattleStat } from "#app/data/battle-stat.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { BattleStat } from "#app/data/battle-stat";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils";
describe("Abilities - Wind Rider", () => {
let phaserGame: Phaser.Game;
@ -38,7 +37,7 @@ describe("Abilities - Wind Rider", () => {
expect(shiftry.summonData.battleStats[BattleStat.ATK]).toBe(0);
game.doAttack(getMovePosition(game.scene, 0, Moves.PETAL_BLIZZARD));
game.move.select(Moves.PETAL_BLIZZARD);
await game.phaseInterceptor.to(TurnEndPhase);
@ -55,7 +54,7 @@ describe("Abilities - Wind Rider", () => {
expect(shiftry.summonData.battleStats[BattleStat.ATK]).toBe(0);
game.doAttack(getMovePosition(game.scene, 0, Moves.TAILWIND));
game.move.select(Moves.TAILWIND);
await game.phaseInterceptor.to(TurnEndPhase);
@ -73,7 +72,7 @@ describe("Abilities - Wind Rider", () => {
expect(shiftry.summonData.battleStats[BattleStat.ATK]).toBe(0);
expect(magikarp.summonData.battleStats[BattleStat.ATK]).toBe(0);
game.doAttack(getMovePosition(game.scene, 0, Moves.TAILWIND));
game.move.select(Moves.TAILWIND);
await game.phaseInterceptor.to(TurnEndPhase);
@ -91,7 +90,7 @@ describe("Abilities - Wind Rider", () => {
expect(shiftry.summonData.battleStats[BattleStat.ATK]).toBe(0);
expect(magikarp.summonData.battleStats[BattleStat.ATK]).toBe(0);
game.doAttack(getMovePosition(game.scene, 0, Moves.TAILWIND));
game.move.select(Moves.TAILWIND);
await game.phaseInterceptor.to(TurnEndPhase);
@ -108,7 +107,7 @@ describe("Abilities - Wind Rider", () => {
expect(shiftry.summonData.battleStats[BattleStat.ATK]).toBe(0);
expect(shiftry.isFullHp()).toBe(true);
game.doAttack(getMovePosition(game.scene, 0, Moves.SANDSTORM));
game.move.select(Moves.SANDSTORM);
await game.phaseInterceptor.to(TurnEndPhase);

View File

@ -1,14 +1,13 @@
import { allAbilities } from "#app/data/ability.js";
import { allMoves } from "#app/data/move.js";
import { MoveEffectPhase } from "#app/phases/move-effect-phase.js";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { allAbilities } from "#app/data/ability";
import { allMoves } from "#app/data/move";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils";
describe("Abilities - Wonder Skin", () => {
let phaserGame: Phaser.Game;
@ -40,7 +39,7 @@ describe("Abilities - Wonder Skin", () => {
vi.spyOn(moveToCheck, "calculateBattleAccuracy");
await game.startBattle([Species.PIKACHU]);
game.doAttack(getMovePosition(game.scene, 0, Moves.CHARM));
game.move.select(Moves.CHARM);
await game.phaseInterceptor.to(MoveEffectPhase);
expect(moveToCheck.calculateBattleAccuracy).toHaveReturnedWith(50);
@ -52,7 +51,7 @@ describe("Abilities - Wonder Skin", () => {
vi.spyOn(moveToCheck, "calculateBattleAccuracy");
await game.startBattle([Species.PIKACHU]);
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
game.move.select(Moves.TACKLE);
await game.phaseInterceptor.to(MoveEffectPhase);
expect(moveToCheck.calculateBattleAccuracy).toHaveReturnedWith(100);
@ -68,7 +67,7 @@ describe("Abilities - Wonder Skin", () => {
vi.spyOn(moveToCheck, "calculateBattleAccuracy");
await game.startBattle([Species.PIKACHU]);
game.doAttack(getMovePosition(game.scene, 0, Moves.CHARM));
game.move.select(Moves.CHARM);
await game.phaseInterceptor.to(MoveEffectPhase);
expect(moveToCheck.calculateBattleAccuracy).toHaveReturnedWith(100);

View File

@ -1,26 +1,23 @@
import { BattlerIndex } from "#app/battle";
import { Stat } from "#app/data/pokemon-stat";
import { Status, StatusEffect } from "#app/data/status-effect.js";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { Command } from "#app/ui/command-ui-handler";
import { Status, StatusEffect } from "#app/data/status-effect";
import { DamagePhase } from "#app/phases/damage-phase";
import { EnemyCommandPhase } from "#app/phases/enemy-command-phase";
import { MessagePhase } from "#app/phases/message-phase";
import { PostSummonPhase } from "#app/phases/post-summon-phase";
import { QuietFormChangePhase } from "#app/phases/quiet-form-change-phase";
import { SwitchPhase } from "#app/phases/switch-phase";
import { SwitchSummonPhase } from "#app/phases/switch-summon-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { TurnInitPhase } from "#app/phases/turn-init-phase";
import { TurnStartPhase } from "#app/phases/turn-start-phase";
import { Mode } from "#app/ui/ui";
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, expect, test } from "vitest";
import { BattlerIndex } from "#app/battle.js";
import { CommandPhase } from "#app/phases/command-phase.js";
import { DamagePhase } from "#app/phases/damage-phase.js";
import { EnemyCommandPhase } from "#app/phases/enemy-command-phase.js";
import { MessagePhase } from "#app/phases/message-phase.js";
import { PostSummonPhase } from "#app/phases/post-summon-phase.js";
import { QuietFormChangePhase } from "#app/phases/quiet-form-change-phase.js";
import { SwitchPhase } from "#app/phases/switch-phase.js";
import { SwitchSummonPhase } from "#app/phases/switch-summon-phase.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
import { TurnInitPhase } from "#app/phases/turn-init-phase.js";
import { TurnStartPhase } from "#app/phases/turn-start-phase.js";
const TIMEOUT = 20 * 1000;
@ -59,13 +56,7 @@ describe("Abilities - ZEN MODE", () => {
game.scene.getParty()[0].hp = 100;
expect(game.scene.getParty()[0].formIndex).toBe(0);
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
});
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => {
const movePosition = getMovePosition(game.scene, 0, moveToUse);
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false);
});
game.move.select(moveToUse);
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
await game.phaseInterceptor.to(DamagePhase, false);
@ -88,13 +79,7 @@ describe("Abilities - ZEN MODE", () => {
game.scene.getParty()[0].hp = 100;
expect(game.scene.getParty()[0].formIndex).toBe(0);
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
});
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => {
const movePosition = getMovePosition(game.scene, 0, moveToUse);
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false);
});
game.move.select(moveToUse);
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
await game.phaseInterceptor.to(QuietFormChangePhase);
@ -114,13 +99,7 @@ describe("Abilities - ZEN MODE", () => {
game.scene.getParty()[0].hp = 100;
expect(game.scene.getParty()[0].formIndex).toBe(0);
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
});
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => {
const movePosition = getMovePosition(game.scene, 0, moveToUse);
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false);
});
game.move.select(moveToUse);
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
await game.phaseInterceptor.to(DamagePhase, false);
@ -169,7 +148,7 @@ describe("Abilities - ZEN MODE", () => {
darmanitan.status = new Status(StatusEffect.FAINT);
expect(darmanitan.isFainted()).toBe(true);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.doKillOpponents();
await game.phaseInterceptor.to(TurnEndPhase);
game.doSelectModifier();

View File

@ -1,11 +1,10 @@
import { Status, StatusEffect } from "#app/data/status-effect.js";
import { QuietFormChangePhase } from "#app/phases/quiet-form-change-phase.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
import { Status, StatusEffect } from "#app/data/status-effect";
import { QuietFormChangePhase } from "#app/phases/quiet-form-change-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { SPLASH_ONLY } from "../utils/testUtils";
@ -52,7 +51,7 @@ describe("Abilities - ZERO TO HERO", () => {
palafin2.status = new Status(StatusEffect.FAINT);
expect(palafin2.isFainted()).toBe(true);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.doKillOpponents();
await game.phaseInterceptor.to(TurnEndPhase);
game.doSelectModifier();
@ -80,7 +79,7 @@ describe("Abilities - ZERO TO HERO", () => {
const palafin = game.scene.getPlayerPokemon()!;
expect(palafin.formIndex).toBe(baseForm);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.killPokemon(palafin);
game.doSelectPartyPokemon(1);
await game.toNextTurn();
@ -97,7 +96,7 @@ describe("Abilities - ZERO TO HERO", () => {
const palafin = game.scene.getPlayerPokemon()!;
expect(palafin.formIndex).toBe(heroForm);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.killPokemon(palafin);
game.doSelectPartyPokemon(1);
await game.toNextTurn();

View File

@ -1,4 +1,4 @@
import * as battleScene from "#app/battle-scene.js";
import * as battleScene from "#app/battle-scene";
import { describe, expect, it, vi } from "vitest";
import { initLoggedInUser, loggedInUser, updateUserInfo } from "../account";
import * as utils from "../utils";

View File

@ -1,7 +1,7 @@
import { TurnHeldItemTransferModifier } from "#app/modifier/modifier.js";
import { TurnHeldItemTransferModifier } from "#app/modifier/modifier";
import { Achv, AchvTier, DamageAchv, HealAchv, LevelAchv, ModifierAchv, MoneyAchv, RibbonAchv, achvs } from "#app/system/achv";
import { IntegerHolder, NumberHolder } from "#app/utils";
import GameManager from "#test/utils/gameManager";
import { IntegerHolder, NumberHolder } from "#app/utils.js";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import BattleScene from "../../battle-scene";

View File

@ -6,7 +6,6 @@ import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { SPLASH_ONLY } from "../utils/testUtils";
@ -45,14 +44,14 @@ describe("Arena - Gravity", () => {
// Setup Gravity on first turn
await game.startBattle([Species.PIKACHU]);
game.doAttack(getMovePosition(game.scene, 0, Moves.GRAVITY));
game.move.select(Moves.GRAVITY);
await game.phaseInterceptor.to(TurnEndPhase);
expect(game.scene.arena.getTag(ArenaTagType.GRAVITY)).toBeDefined();
// Use non-OHKO move on second turn
await game.toNextTurn();
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
game.move.select(Moves.TACKLE);
await game.phaseInterceptor.to(MoveEffectPhase);
expect(moveToCheck.calculateBattleAccuracy).toHaveReturnedWith(100 * 1.67);
@ -69,14 +68,14 @@ describe("Arena - Gravity", () => {
// Setup Gravity on first turn
await game.startBattle([Species.PIKACHU]);
game.doAttack(getMovePosition(game.scene, 0, Moves.GRAVITY));
game.move.select(Moves.GRAVITY);
await game.phaseInterceptor.to(TurnEndPhase);
expect(game.scene.arena.getTag(ArenaTagType.GRAVITY)).toBeDefined();
// Use OHKO move on second turn
await game.toNextTurn();
game.doAttack(getMovePosition(game.scene, 0, Moves.FISSURE));
game.move.select(Moves.FISSURE);
await game.phaseInterceptor.to(MoveEffectPhase);
expect(moveToCheck.calculateBattleAccuracy).toHaveReturnedWith(30);
@ -96,21 +95,21 @@ describe("Arena - Gravity", () => {
vi.spyOn(pidgeot, "getAttackTypeEffectiveness");
// Try earthquake on 1st turn (fails!);
game.doAttack(getMovePosition(game.scene, 0, Moves.EARTHQUAKE));
game.move.select(Moves.EARTHQUAKE);
await game.phaseInterceptor.to(TurnEndPhase);
expect(pidgeot.getAttackTypeEffectiveness).toHaveReturnedWith(0);
// Setup Gravity on 2nd turn
await game.toNextTurn();
game.doAttack(getMovePosition(game.scene, 0, Moves.GRAVITY));
game.move.select(Moves.GRAVITY);
await game.phaseInterceptor.to(TurnEndPhase);
expect(game.scene.arena.getTag(ArenaTagType.GRAVITY)).toBeDefined();
// Use ground move on 3rd turn
await game.toNextTurn();
game.doAttack(getMovePosition(game.scene, 0, Moves.EARTHQUAKE));
game.move.select(Moves.EARTHQUAKE);
await game.phaseInterceptor.to(TurnEndPhase);
expect(pidgeot.getAttackTypeEffectiveness).toHaveReturnedWith(1);
@ -129,14 +128,14 @@ describe("Arena - Gravity", () => {
vi.spyOn(pidgeot, "getAttackTypeEffectiveness");
// Setup Gravity on 1st turn
game.doAttack(getMovePosition(game.scene, 0, Moves.GRAVITY));
game.move.select(Moves.GRAVITY);
await game.phaseInterceptor.to(TurnEndPhase);
expect(game.scene.arena.getTag(ArenaTagType.GRAVITY)).toBeDefined();
// Use electric move on 2nd turn
await game.toNextTurn();
game.doAttack(getMovePosition(game.scene, 0, Moves.THUNDERBOLT));
game.move.select(Moves.THUNDERBOLT);
await game.phaseInterceptor.to(TurnEndPhase);
expect(pidgeot.getAttackTypeEffectiveness).toHaveReturnedWith(2);

View File

@ -1,11 +1,10 @@
import { allMoves } from "#app/data/move.js";
import { WeatherType } from "#app/data/weather.js";
import { Abilities } from "#app/enums/abilities.js";
import { MoveEffectPhase } from "#app/phases/move-effect-phase.js";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { allMoves } from "#app/data/move";
import { WeatherType } from "#app/data/weather";
import { Abilities } from "#app/enums/abilities";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
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, expect, it, vi } from "vitest";
@ -41,7 +40,7 @@ describe("Weather - Fog", () => {
vi.spyOn(moveToCheck, "calculateBattleAccuracy");
await game.startBattle([Species.MAGIKARP]);
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
game.move.select(Moves.TACKLE);
await game.phaseInterceptor.to(MoveEffectPhase);
expect(moveToCheck.calculateBattleAccuracy).toHaveReturnedWith(100 * 0.9);

View File

@ -1,12 +1,11 @@
import { allMoves } from "#app/data/move.js";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { allMoves } from "#app/data/move";
import { TurnStartPhase } from "#app/phases/turn-start-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, expect, it } from "vitest";
import { TurnStartPhase } from "#app/phases/turn-start-phase.js";
describe("Weather - Strong Winds", () => {
let phaserGame: Phaser.Game;
@ -38,7 +37,7 @@ describe("Weather - Strong Winds", () => {
const pikachu = game.scene.getPlayerPokemon()!;
const enemy = game.scene.getEnemyPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.THUNDERBOLT));
game.move.select(Moves.THUNDERBOLT);
await game.phaseInterceptor.to(TurnStartPhase);
expect(enemy.getAttackTypeEffectiveness(allMoves[Moves.THUNDERBOLT].type, pikachu)).toBe(0.5);
@ -49,7 +48,7 @@ describe("Weather - Strong Winds", () => {
const pikachu = game.scene.getPlayerPokemon()!;
const enemy = game.scene.getEnemyPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.THUNDERBOLT));
game.move.select(Moves.THUNDERBOLT);
await game.phaseInterceptor.to(TurnStartPhase);
expect(enemy.getAttackTypeEffectiveness(allMoves[Moves.THUNDERBOLT].type, pikachu)).toBe(1);
@ -60,7 +59,7 @@ describe("Weather - Strong Winds", () => {
const pikachu = game.scene.getPlayerPokemon()!;
const enemy = game.scene.getEnemyPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.ICE_BEAM));
game.move.select(Moves.ICE_BEAM);
await game.phaseInterceptor.to(TurnStartPhase);
expect(enemy.getAttackTypeEffectiveness(allMoves[Moves.ICE_BEAM].type, pikachu)).toBe(1);
@ -71,7 +70,7 @@ describe("Weather - Strong Winds", () => {
const pikachu = game.scene.getPlayerPokemon()!;
const enemy = game.scene.getEnemyPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.ROCK_SLIDE));
game.move.select(Moves.ROCK_SLIDE);
await game.phaseInterceptor.to(TurnStartPhase);
expect(enemy.getAttackTypeEffectiveness(allMoves[Moves.ROCK_SLIDE].type, pikachu)).toBe(1);

View File

@ -1,4 +1,4 @@
import { LoadingScene } from "#app/loading-scene.js";
import { LoadingScene } from "#app/loading-scene";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import GameManager from "./utils/gameManager";

View File

@ -1,4 +1,4 @@
import { BattleStat, getBattleStatLevelChangeDescription, getBattleStatName } from "#app/data/battle-stat.js";
import { BattleStat, getBattleStatLevelChangeDescription, getBattleStatName } from "#app/data/battle-stat";
import { describe, expect, it } from "vitest";
import { arrayOfRange, mockI18next } from "./utils/testUtils";

View File

@ -1,19 +1,13 @@
import { Stat } from "#app/data/pokemon-stat";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { Command } from "#app/ui/command-ui-handler";
import TargetSelectUiHandler from "#app/ui/target-select-ui-handler";
import { Mode } from "#app/ui/ui";
import { EnemyCommandPhase } from "#app/phases/enemy-command-phase";
import { SelectTargetPhase } from "#app/phases/select-target-phase";
import { TurnStartPhase } from "#app/phases/turn-start-phase";
import { Abilities } from "#enums/abilities";
import { Button } from "#enums/buttons";
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, expect, it } from "vitest";
import { CommandPhase } from "#app/phases/command-phase.js";
import { EnemyCommandPhase } from "#app/phases/enemy-command-phase.js";
import { SelectTargetPhase } from "#app/phases/select-target-phase.js";
import { TurnStartPhase } from "#app/phases/turn-start-phase.js";
describe("Battle order", () => {
@ -46,13 +40,7 @@ describe("Battle order", () => {
game.scene.getParty()[0].stats[Stat.SPD] = 50;
game.scene.currentBattle.enemyParty[0].stats[Stat.SPD] = 150;
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
});
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => {
const movePosition = getMovePosition(game.scene, 0, Moves.TACKLE);
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false);
});
game.move.select(Moves.TACKLE);
await game.phaseInterceptor.run(EnemyCommandPhase);
const phase = game.scene.getCurrentPhase() as TurnStartPhase;
const order = phase.getOrder();
@ -67,13 +55,7 @@ describe("Battle order", () => {
game.scene.getParty()[0].stats[Stat.SPD] = 150;
game.scene.currentBattle.enemyParty[0].stats[Stat.SPD] = 50;
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
});
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => {
const movePosition = getMovePosition(game.scene, 0, Moves.TACKLE);
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false);
});
game.move.select(Moves.TACKLE);
await game.phaseInterceptor.run(EnemyCommandPhase);
const phase = game.scene.getCurrentPhase() as TurnStartPhase;
const order = phase.getOrder();
@ -92,28 +74,8 @@ describe("Battle order", () => {
game.scene.currentBattle.enemyParty[0].stats[Stat.SPD] = 150;
game.scene.currentBattle.enemyParty[1].stats[Stat.SPD] = 150;
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
});
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => {
const movePosition = getMovePosition(game.scene, 0, Moves.TACKLE);
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false);
});
game.onNextPrompt("SelectTargetPhase", Mode.TARGET_SELECT, () => {
const handler = game.scene.ui.getHandler() as TargetSelectUiHandler;
handler.processInput(Button.ACTION);
});
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
});
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => {
const movePosition = getMovePosition(game.scene, 0, Moves.TACKLE);
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false);
});
game.onNextPrompt("SelectTargetPhase", Mode.TARGET_SELECT, () => {
const handler = game.scene.ui.getHandler() as TargetSelectUiHandler;
handler.processInput(Button.ACTION);
});
game.move.select(Moves.TACKLE);
game.move.select(Moves.TACKLE, 1);
await game.phaseInterceptor.runFrom(SelectTargetPhase).to(TurnStartPhase, false);
const phase = game.scene.getCurrentPhase() as TurnStartPhase;
const order = phase.getOrder();
@ -134,28 +96,8 @@ describe("Battle order", () => {
game.scene.currentBattle.enemyParty[0].stats[Stat.SPD] = 100;
game.scene.currentBattle.enemyParty[1].stats[Stat.SPD] = 150;
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
});
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => {
const movePosition = getMovePosition(game.scene, 0, Moves.TACKLE);
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false);
});
game.onNextPrompt("SelectTargetPhase", Mode.TARGET_SELECT, () => {
const handler = game.scene.ui.getHandler() as TargetSelectUiHandler;
handler.processInput(Button.ACTION);
});
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
});
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => {
const movePosition = getMovePosition(game.scene, 0, Moves.TACKLE);
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false);
});
game.onNextPrompt("SelectTargetPhase", Mode.TARGET_SELECT, () => {
const handler = game.scene.ui.getHandler() as TargetSelectUiHandler;
handler.processInput(Button.ACTION);
});
game.move.select(Moves.TACKLE);
game.move.select(Moves.TACKLE, 1);
await game.phaseInterceptor.runFrom(SelectTargetPhase).to(TurnStartPhase, false);
const phase = game.scene.getCurrentPhase() as TurnStartPhase;
const order = phase.getOrder();
@ -175,28 +117,8 @@ describe("Battle order", () => {
game.scene.currentBattle.enemyParty[0].stats[Stat.SPD] = 100;
game.scene.currentBattle.enemyParty[1].stats[Stat.SPD] = 150;
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
});
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => {
const movePosition = getMovePosition(game.scene, 0, Moves.TACKLE);
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false);
});
game.onNextPrompt("SelectTargetPhase", Mode.TARGET_SELECT, () => {
const handler = game.scene.ui.getHandler() as TargetSelectUiHandler;
handler.processInput(Button.ACTION);
});
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
});
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => {
const movePosition = getMovePosition(game.scene, 0, Moves.TACKLE);
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false);
});
game.onNextPrompt("SelectTargetPhase", Mode.TARGET_SELECT, () => {
const handler = game.scene.ui.getHandler() as TargetSelectUiHandler;
handler.processInput(Button.ACTION);
});
game.move.select(Moves.TACKLE);
game.move.select(Moves.TACKLE, 1);
await game.phaseInterceptor.runFrom(SelectTargetPhase).to(TurnStartPhase, false);
const phase = game.scene.getCurrentPhase() as TurnStartPhase;
const order = phase.getOrder();

View File

@ -1,10 +1,23 @@
import { allSpecies } from "#app/data/pokemon-species";
import { TempBattleStat } from "#app/data/temp-battle-stat.js";
import { GameModes } from "#app/game-mode";
import { getGameMode } from "#app/game-mode.js";
import { TempBattleStat } from "#app/data/temp-battle-stat";
import { GameModes, getGameMode } from "#app/game-mode";
import { BattleEndPhase } from "#app/phases/battle-end-phase";
import { CommandPhase } from "#app/phases/command-phase";
import { DamagePhase } from "#app/phases/damage-phase";
import { EncounterPhase } from "#app/phases/encounter-phase";
import { EnemyCommandPhase } from "#app/phases/enemy-command-phase";
import { LoginPhase } from "#app/phases/login-phase";
import { NextEncounterPhase } from "#app/phases/next-encounter-phase";
import { SelectGenderPhase } from "#app/phases/select-gender-phase";
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
import { SelectStarterPhase } from "#app/phases/select-starter-phase";
import { SummonPhase } from "#app/phases/summon-phase";
import { SwitchPhase } from "#app/phases/switch-phase";
import { TitlePhase } from "#app/phases/title-phase";
import { TurnInitPhase } from "#app/phases/turn-init-phase";
import { VictoryPhase } from "#app/phases/victory-phase";
import GameManager from "#app/test/utils/gameManager";
import { generateStarter, getMovePosition, } from "#app/test/utils/gameManagerUtils";
import { Command } from "#app/ui/command-ui-handler";
import { generateStarter } from "#app/test/utils/gameManagerUtils";
import { Mode } from "#app/ui/ui";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
@ -13,21 +26,6 @@ import { Species } from "#enums/species";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { SPLASH_ONLY } from "../utils/testUtils";
import { BattleEndPhase } from "#app/phases/battle-end-phase.js";
import { CommandPhase } from "#app/phases/command-phase.js";
import { DamagePhase } from "#app/phases/damage-phase.js";
import { EncounterPhase } from "#app/phases/encounter-phase.js";
import { EnemyCommandPhase } from "#app/phases/enemy-command-phase.js";
import { LoginPhase } from "#app/phases/login-phase.js";
import { NextEncounterPhase } from "#app/phases/next-encounter-phase.js";
import { SelectGenderPhase } from "#app/phases/select-gender-phase.js";
import { SelectModifierPhase } from "#app/phases/select-modifier-phase.js";
import { SelectStarterPhase } from "#app/phases/select-starter-phase.js";
import { SummonPhase } from "#app/phases/summon-phase.js";
import { SwitchPhase } from "#app/phases/switch-phase.js";
import { TitlePhase } from "#app/phases/title-phase.js";
import { TurnInitPhase } from "#app/phases/turn-init-phase.js";
import { VictoryPhase } from "#app/phases/victory-phase.js";
describe("Test Battle Phase", () => {
let phaserGame: Phaser.Game;
@ -104,13 +102,7 @@ describe("Test Battle Phase", () => {
game.override.enemyAbility(Abilities.HYDRATION);
game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]);
await game.startBattle();
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
});
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => {
const movePosition = getMovePosition(game.scene, 0, Moves.TACKLE);
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false);
});
game.move.select(Moves.TACKLE);
await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(SelectModifierPhase, false);
}, 20000);
@ -124,13 +116,7 @@ describe("Test Battle Phase", () => {
game.override.enemyMoveset([Moves.TAIL_WHIP, Moves.TAIL_WHIP, Moves.TAIL_WHIP, Moves.TAIL_WHIP]);
game.override.battleType("single");
await game.startBattle();
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
});
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => {
const movePosition = getMovePosition(game.scene, 0, Moves.TACKLE);
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false);
});
game.move.select(Moves.TACKLE);
await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(TurnInitPhase, false);
}, 20000);
@ -279,13 +265,7 @@ describe("Test Battle Phase", () => {
Species.CHARIZARD,
]);
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
});
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => {
const movePosition = getMovePosition(game.scene, 0, moveToUse);
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false);
});
game.move.select(moveToUse);
await game.phaseInterceptor.to(DamagePhase, false);
await game.killPokemon(game.scene.currentBattle.enemyParty[0]);
expect(game.scene.currentBattle.enemyParty[0].isFainted()).toBe(true);
@ -305,7 +285,7 @@ describe("Test Battle Phase", () => {
game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]);
await game.startBattle();
const turn = game.scene.currentBattle.turn;
game.doAttack(0);
game.move.select(moveToUse);
await game.toNextTurn();
expect(game.scene.currentBattle.turn).toBeGreaterThan(turn);
}, 20000);
@ -323,7 +303,7 @@ describe("Test Battle Phase", () => {
game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]);
await game.startBattle();
const waveIndex = game.scene.currentBattle.waveIndex;
game.doAttack(0);
game.move.select(moveToUse);
await game.doKillOpponents();
await game.toNextWave();
expect(game.scene.currentBattle.waveIndex).toBeGreaterThan(waveIndex);
@ -343,7 +323,7 @@ describe("Test Battle Phase", () => {
await game.startBattle();
game.scene.getPlayerPokemon()!.hp = 1;
game.doAttack(getMovePosition(game.scene, 0, moveToUse));
game.move.select(moveToUse);
await game.phaseInterceptor.to(BattleEndPhase);
game.doRevivePokemon(0); // pretend max revive was picked

View File

@ -1,14 +1,13 @@
import { DamagePhase } from "#app/phases/damage-phase.js";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { toDmgValue } from "#app/utils";
import { Abilities } from "#enums/abilities";
import { ArenaTagType } from "#enums/arena-tag-type";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { ArenaTagType } from "#enums/arena-tag-type";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import { toDmgValue } from "#app/utils";
describe("Round Down and Minimun 1 test in Damage Calculation", () => {
let phaserGame: Phaser.Game;
@ -41,7 +40,7 @@ describe("Round Down and Minimun 1 test in Damage Calculation", () => {
const shedinja = game.scene.getPlayerPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.JUMP_KICK));
game.move.select(Moves.JUMP_KICK);
await game.phaseInterceptor.to(DamagePhase);

View File

@ -1,13 +1,12 @@
import GameManager from "#test/utils/gameManager";
import { getMovePosition, } from "#test/utils/gameManagerUtils";
import { Status, StatusEffect } from "#app/data/status-effect";
import { BattleEndPhase } from "#app/phases/battle-end-phase";
import { TurnInitPhase } from "#app/phases/turn-init-phase";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import { Status, StatusEffect } from "#app/data/status-effect.js";
import { BattleEndPhase } from "#app/phases/battle-end-phase.js";
import { TurnInitPhase } from "#app/phases/turn-init-phase.js";
describe("Double Battles", () => {
let phaserGame: Phaser.Game;
@ -37,8 +36,8 @@ describe("Double Battles", () => {
Species.SQUIRTLE,
]);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH));
game.move.select(Moves.SPLASH);
game.move.select(Moves.SPLASH, 1);
for (const pokemon of game.scene.getPlayerField()) {
pokemon.hp = 0;

View File

@ -1,13 +1,14 @@
import GameManager from "#test/utils/gameManager";
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, expect, it } from "vitest";
describe("Error Handling", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
const moveToUse = Moves.SPLASH;
beforeAll(() => {
phaserGame = new Phaser.Game({
@ -21,7 +22,6 @@ describe("Error Handling", () => {
beforeEach(() => {
game = new GameManager(phaserGame);
const moveToUse = Moves.SPLASH;
game.override
.battleType("single")
.startingWave(3);
@ -37,7 +37,7 @@ describe("Error Handling", () => {
it.skip("to next turn", async () => {
await game.startBattle();
const turn = game.scene.currentBattle.turn;
game.doAttack(0);
game.move.select(moveToUse);
await game.toNextTurn();
expect(game.scene.currentBattle.turn).toBeGreaterThan(turn);
}, 20000);

View File

@ -1,9 +1,9 @@
import { CommandPhase } from "#app/phases/command-phase.js";
import GameManager from "#test/utils/gameManager";
import { CommandPhase } from "#app/phases/command-phase";
import { Mode } from "#app/ui/ui";
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, expect, it } from "vitest";

View File

@ -1,10 +1,10 @@
import BattleScene from "#app/battle-scene";
import { BattleStat } from "#app/data/battle-stat";
import { BattlerTag, BattlerTagLapseType, OctolockTag, TrappedTag } from "#app/data/battler-tags";
import { BattlerTagType } from "#app/enums/battler-tag-type";
import Pokemon from "#app/field/pokemon";
import { StatChangePhase } from "#app/phases/stat-change-phase";
import { describe, expect, it, vi } from "vitest";
import Pokemon from "#app/field/pokemon.js";
import BattleScene from "#app/battle-scene.js";
import { BattlerTag, BattlerTagLapseType, OctolockTag, TrappedTag } from "#app/data/battler-tags.js";
import { BattleStat } from "#app/data/battle-stat.js";
import { BattlerTagType } from "#app/enums/battler-tag-type.js";
import { StatChangePhase } from "#app/phases/stat-change-phase.js";
vi.mock("#app/battle-scene.js");

View File

@ -1,10 +1,10 @@
import BattleScene from "#app/battle-scene";
import { BattleStat } from "#app/data/battle-stat";
import { StockpilingTag } from "#app/data/battler-tags";
import Pokemon, { PokemonSummonData } from "#app/field/pokemon";
import * as messages from "#app/messages";
import { StatChangePhase } from "#app/phases/stat-change-phase";
import { beforeEach, describe, expect, it, vi } from "vitest";
import Pokemon, { PokemonSummonData } from "#app/field/pokemon.js";
import BattleScene from "#app/battle-scene.js";
import { StockpilingTag } from "#app/data/battler-tags.js";
import { BattleStat } from "#app/data/battle-stat.js";
import * as messages from "#app/messages.js";
import { StatChangePhase } from "#app/phases/stat-change-phase.js";
beforeEach(() => {
vi.spyOn(messages, "getPokemonNameWithAffix").mockImplementation(() => "");

View File

@ -1,14 +1,14 @@
import { Egg, getLegendaryGachaSpeciesForTimestamp } from "#app/data/egg";
import { EggSourceType } from "#app/enums/egg-source-types";
import { EggTier } from "#app/enums/egg-type";
import { VariantTier } from "#app/enums/variant-tiers";
import EggData from "#app/system/egg-data";
import * as Utils from "#app/utils";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import BattleScene from "../../battle-scene";
import { Egg, getLegendaryGachaSpeciesForTimestamp } from "#app/data/egg.js";
import { Species } from "#enums/species";
import Phaser from "phaser";
import { EggSourceType } from "#app/enums/egg-source-types.js";
import { EggTier } from "#app/enums/egg-type.js";
import { VariantTier } from "#app/enums/variant-tiers.js";
import GameManager from "#test/utils/gameManager";
import EggData from "#app/system/egg-data.js";
import * as Utils from "#app/utils.js";
describe("Egg Generation Tests", () => {
let phaserGame: Phaser.Game;

View File

@ -1,6 +1,6 @@
import { pokemonEvolutions, SpeciesFormEvolution, SpeciesWildEvolutionDelay } from "#app/data/pokemon-evolutions.js";
import { Abilities } from "#app/enums/abilities.js";
import { Species } from "#app/enums/species.js";
import { pokemonEvolutions, SpeciesFormEvolution, SpeciesWildEvolutionDelay } from "#app/data/pokemon-evolutions";
import { Abilities } from "#app/enums/abilities";
import { Species } from "#app/enums/species";
import GameManager from "#test/utils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";

View File

@ -1,8 +1,8 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import Phaser from "phaser";
import GameManager from "#test/utils/gameManager";
import { Species } from "#enums/species";
import * as Utils from "#app/utils";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
describe("Evolution tests", () => {
let phaserGame: Phaser.Game;

View File

@ -1,4 +1,4 @@
import { Species } from "#app/enums/species.js";
import { Species } from "#app/enums/species";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import GameManager from "../utils/gameManager";

View File

@ -1,8 +1,8 @@
import { Biome } from "#app/enums/biome.js";
import { Species } from "#app/enums/species.js";
import { Biome } from "#app/enums/biome";
import { Species } from "#app/enums/species";
import { GameModes } from "#app/game-mode";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import GameManager from "./utils/gameManager";
import { GameModes } from "#app/game-mode";
const FinalWave = {
Classic: 200,

View File

@ -1,7 +1,7 @@
import { GameMode, GameModes, getGameMode } from "#app/game-mode.js";
import { GameMode, GameModes, getGameMode } from "#app/game-mode";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import GameManager from "./utils/gameManager";
import * as Utils from "../utils";
import GameManager from "./utils/gameManager";
describe("game-mode", () => {
let phaserGame: Phaser.Game;
let game: GameManager;

View File

@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
import { initStatsKeys } from "#app/ui/game-stats-ui-handler";
import { describe, expect, it } from "vitest";
async function importModule() {
try {

View File

@ -1,9 +1,9 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import Phaser from "phaser";
import GameManager from "#test/utils/gameManager";
import pad_xbox360 from "#app/configs/inputs/pad_xbox360";
import cfg_keyboard_qwerty from "#app/configs/inputs/cfg_keyboard_qwerty";
import pad_xbox360 from "#app/configs/inputs/pad_xbox360";
import GameManager from "#test/utils/gameManager";
import InputsHandler from "#test/utils/inputsHandler";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Inputs", () => {

View File

@ -1,8 +1,8 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import Phaser from "phaser";
import { Abilities } from "#app/enums/abilities";
import { Species } from "#app/enums/species";
import GameManager from "#test/utils/gameManager";
import { Species } from "#app/enums/species.js";
import { Abilities } from "#app/enums/abilities.js";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Internals", () => {
let phaserGame: Phaser.Game;

View File

@ -2,9 +2,9 @@ import { Stat } from "#app/data/pokemon-stat";
import { EvolutionStatBoosterModifier } from "#app/modifier/modifier";
import { modifierTypes } from "#app/modifier/modifier-type";
import i18next from "#app/plugins/i18n";
import GameManager from "#test/utils/gameManager";
import * as Utils from "#app/utils";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import Phase from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";

View File

@ -1,7 +1,7 @@
import { Abilities } from "#app/enums/abilities.js";
import { PokemonExpBoosterModifier } from "#app/modifier/modifier.js";
import GameManager from "#test/utils/gameManager";
import { Abilities } from "#app/enums/abilities";
import { PokemonExpBoosterModifier } from "#app/modifier/modifier";
import * as Utils from "#app/utils";
import GameManager from "#test/utils/gameManager";
import Phase from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";

View File

@ -1,16 +1,14 @@
import { BattlerIndex } from "#app/battle.js";
import { allMoves } from "#app/data/move.js";
import { Abilities } from "#app/enums/abilities.js";
import { BerryType } from "#app/enums/berry-type.js";
import { Moves } from "#app/enums/moves.js";
import { Species } from "#app/enums/species.js";
import { BattlerIndex } from "#app/battle";
import { allMoves } from "#app/data/move";
import { Abilities } from "#app/enums/abilities";
import { BerryType } from "#app/enums/berry-type";
import { Moves } from "#app/enums/moves";
import { Species } from "#app/enums/species";
import { MoveEndPhase } from "#app/phases/move-end-phase";
import GameManager from "#test/utils/gameManager";
import Phase from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { CommandPhase } from "#app/phases/command-phase.js";
import { MoveEndPhase } from "#app/phases/move-end-phase.js";
import { SelectTargetPhase } from "#app/phases/select-target-phase.js";
import { SPLASH_ONLY } from "../utils/testUtils";
const TIMEOUT = 20 * 1000; // 20 seconds
@ -35,12 +33,12 @@ describe("Items - Grip Claw", () => {
.battleType("double")
.moveset([Moves.POPULATION_BOMB, Moves.SPLASH])
.startingHeldItems([
{ name: "GRIP_CLAW", count: 5 },
{ name: "GRIP_CLAW", count: 5 }, // TODO: Find a way to mock the steal chance of grip claw
{ name: "MULTI_LENS", count: 3 },
])
.enemySpecies(Species.SNORLAX)
.ability(Abilities.KLUTZ)
.enemyMoveset([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH])
.enemyMoveset(SPLASH_ONLY)
.enemyHeldItems([
{ name: "BERRY", type: BerryType.SITRUS, count: 2 },
{ name: "BERRY", type: BerryType.LUM, count: 2 },
@ -54,19 +52,14 @@ describe("Items - Grip Claw", () => {
it(
"should only steal items from the attack target",
async () => {
await game.startBattle([Species.PANSEAR, Species.ROWLET, Species.PANPOUR, Species.PANSAGE, Species.CHARMANDER, Species.SQUIRTLE]);
await game.startBattle([Species.PANSEAR, Species.ROWLET]);
const enemyPokemon = game.scene.getEnemyField();
const enemyHeldItemCt = enemyPokemon.map(p => p.getHeldItems.length);
game.doAttack(getMovePosition(game.scene, 0, Moves.POPULATION_BOMB));
await game.phaseInterceptor.to(SelectTargetPhase, false);
game.doSelectTarget(BattlerIndex.ENEMY);
await game.phaseInterceptor.to(CommandPhase, false);
game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH));
game.move.select(Moves.POPULATION_BOMB, 0, BattlerIndex.ENEMY);
game.move.select(Moves.SPLASH, 1);
await game.phaseInterceptor.to(MoveEndPhase, false);

View File

@ -1,11 +1,11 @@
import { BattlerIndex } from "#app/battle";
import { CritBoosterModifier } from "#app/modifier/modifier";
import { modifierTypes } from "#app/modifier/modifier-type";
import { MoveEffectPhase } from "#app/phases/move-effect-phase.js";
import GameManager from "#test/utils/gameManager";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import * as Utils from "#app/utils";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import Phase from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
@ -41,7 +41,7 @@ describe("Items - Leek", () => {
Species.FARFETCHD
]);
game.doAttack(0);
game.move.select(Moves.POUND);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);

View File

@ -1,12 +1,11 @@
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { DamagePhase } from "#app/phases/damage-phase";
import { TurnEndPhase } from "#app/phases/turn-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, expect, it } from "vitest";
import { DamagePhase } from "#app/phases/damage-phase.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
describe("Items - Leftovers", () => {
@ -46,7 +45,7 @@ describe("Items - Leftovers", () => {
// We should have full hp
expect(leadPokemon.isFullHp()).toBe(true);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
// We should have less hp after the attack
await game.phaseInterceptor.to(DamagePhase, false);

View File

@ -2,9 +2,9 @@ import { Stat } from "#app/data/pokemon-stat";
import { SpeciesStatBoosterModifier } from "#app/modifier/modifier";
import { modifierTypes } from "#app/modifier/modifier-type";
import i18next from "#app/plugins/i18n";
import GameManager from "#test/utils/gameManager";
import * as Utils from "#app/utils";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import Phase from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";

View File

@ -1,11 +1,10 @@
import { Abilities } from "#app/enums/abilities";
import { Moves } from "#app/enums/moves";
import { ModifierTypeOption, modifierTypes } from "#app/modifier/modifier-type";
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
import GameManager from "#test/utils/gameManager";
import Phase from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { Abilities } from "#app/enums/abilities.js";
import { Moves } from "#app/enums/moves.js";
import { getMovePosition } from "../utils/gameManagerUtils";
import { ModifierTypeOption, modifierTypes } from "#app/modifier/modifier-type.js";
import { SelectModifierPhase } from "#app/phases/select-modifier-phase.js";
describe("Items - Lock Capsule", () => {
let phaserGame: Phaser.Game;
@ -35,7 +34,7 @@ describe("Items - Lock Capsule", () => {
it("doesn't set the cost of common tier items to 0", async () => {
await game.startBattle();
game.doAttack(getMovePosition(game.scene, 0, Moves.SURF));
game.move.select(Moves.SURF);
await game.phaseInterceptor.to(SelectModifierPhase, false);
const rewards = game.scene.getCurrentPhase() as SelectModifierPhase;

View File

@ -2,9 +2,9 @@ import { Stat } from "#app/data/pokemon-stat";
import { SpeciesStatBoosterModifier } from "#app/modifier/modifier";
import { modifierTypes } from "#app/modifier/modifier-type";
import i18next from "#app/plugins/i18n";
import GameManager from "#test/utils/gameManager";
import * as Utils from "#app/utils";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import Phase from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";

View File

@ -2,9 +2,9 @@ import { Stat } from "#app/data/pokemon-stat";
import { SpeciesStatBoosterModifier } from "#app/modifier/modifier";
import { modifierTypes } from "#app/modifier/modifier-type";
import i18next from "#app/plugins/i18n";
import GameManager from "#test/utils/gameManager";
import * as Utils from "#app/utils";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import Phase from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";

View File

@ -1,11 +1,11 @@
import { BattlerIndex } from "#app/battle";
import { CritBoosterModifier } from "#app/modifier/modifier";
import { modifierTypes } from "#app/modifier/modifier-type";
import { MoveEffectPhase } from "#app/phases/move-effect-phase.js";
import GameManager from "#test/utils/gameManager";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import * as Utils from "#app/utils";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import Phase from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
@ -41,7 +41,7 @@ describe("Items - Scope Lens", () => {
Species.GASTLY
]);
game.doAttack(0);
game.move.select(Moves.POUND);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);

View File

@ -2,9 +2,9 @@ import { Stat } from "#app/data/pokemon-stat";
import { SpeciesStatBoosterModifier } from "#app/modifier/modifier";
import { modifierTypes } from "#app/modifier/modifier-type";
import i18next from "#app/plugins/i18n";
import GameManager from "#test/utils/gameManager";
import * as Utils from "#app/utils";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import Phase from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";

View File

@ -1,18 +1,14 @@
import { StatusEffect } from "#app/data/status-effect";
import { EnemyCommandPhase } from "#app/phases/enemy-command-phase";
import { MessagePhase } from "#app/phases/message-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import i18next, { initI18n } from "#app/plugins/i18n";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { Command } from "#app/ui/command-ui-handler";
import { Mode } from "#app/ui/ui";
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, expect, it } from "vitest";
import { CommandPhase } from "#app/phases/command-phase.js";
import { EnemyCommandPhase } from "#app/phases/enemy-command-phase.js";
import { MessagePhase } from "#app/phases/message-phase.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
describe("Items - Toxic orb", () => {
@ -55,15 +51,7 @@ describe("Items - Toxic orb", () => {
]);
expect(game.scene.modifiers[0].type.id).toBe("TOXIC_ORB");
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
// Select Attack
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
});
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => {
// Select Move Growth
const movePosition = getMovePosition(game.scene, 0, moveToUse);
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false);
});
game.move.select(moveToUse);
// will run the 13 phase from enemyCommandPhase to TurnEndPhase
await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(TurnEndPhase);

View File

@ -1,26 +1,25 @@
import { beforeAll, describe, expect, it } from "vitest";
import { getBattleStatName, getBattleStatLevelChangeDescription } from "#app/data/battle-stat.js";
import { BattleStat} from "#app/data/battle-stat.js";
import { pokemonInfo as enPokemonInfo } from "#app/locales/en/pokemon-info.js";
import { battle as enBattleStat } from "#app/locales/en/battle.js";
import { pokemonInfo as dePokemonInfo } from "#app/locales/de/pokemon-info.js";
import { battle as deBattleStat } from "#app/locales/de/battle.js";
import { pokemonInfo as esPokemonInfo } from "#app/locales/es/pokemon-info.js";
import { battle as esBattleStat } from "#app/locales/es/battle.js";
import { pokemonInfo as frPokemonInfo } from "#app/locales/fr/pokemon-info.js";
import { battle as frBattleStat } from "#app/locales/fr/battle.js";
import { pokemonInfo as itPokemonInfo } from "#app/locales/it/pokemon-info.js";
import { battle as itBattleStat } from "#app/locales/it/battle.js";
import { pokemonInfo as koPokemonInfo } from "#app/locales/ko/pokemon-info.js";
import { battle as koBattleStat } from "#app/locales/ko/battle.js";
import { pokemonInfo as ptBrPokemonInfo } from "#app/locales/pt_BR/pokemon-info.js";
import { battle as ptBrBattleStat } from "#app/locales/pt_BR/battle.js";
import { pokemonInfo as zhCnPokemonInfo } from "#app/locales/zh_CN/pokemon-info.js";
import { battle as zhCnBattleStat } from "#app/locales/zh_CN/battle.js";
import { pokemonInfo as zhTwPokemonInfo } from "#app/locales/zh_TW/pokemon-info.js";
import { battle as zhTwBattleStat } from "#app/locales/zh_TW/battle.js";
import { BattleStat, getBattleStatLevelChangeDescription, getBattleStatName } from "#app/data/battle-stat";
import { battle as deBattleStat } from "#app/locales/de/battle";
import { pokemonInfo as dePokemonInfo } from "#app/locales/de/pokemon-info";
import { battle as enBattleStat } from "#app/locales/en/battle";
import { pokemonInfo as enPokemonInfo } from "#app/locales/en/pokemon-info";
import { battle as esBattleStat } from "#app/locales/es/battle";
import { pokemonInfo as esPokemonInfo } from "#app/locales/es/pokemon-info";
import { battle as frBattleStat } from "#app/locales/fr/battle";
import { pokemonInfo as frPokemonInfo } from "#app/locales/fr/pokemon-info";
import { battle as itBattleStat } from "#app/locales/it/battle";
import { pokemonInfo as itPokemonInfo } from "#app/locales/it/pokemon-info";
import { battle as koBattleStat } from "#app/locales/ko/battle";
import { pokemonInfo as koPokemonInfo } from "#app/locales/ko/pokemon-info";
import { battle as ptBrBattleStat } from "#app/locales/pt_BR/battle";
import { pokemonInfo as ptBrPokemonInfo } from "#app/locales/pt_BR/pokemon-info";
import { battle as zhCnBattleStat } from "#app/locales/zh_CN/battle";
import { pokemonInfo as zhCnPokemonInfo } from "#app/locales/zh_CN/pokemon-info";
import { battle as zhTwBattleStat } from "#app/locales/zh_TW/battle";
import { pokemonInfo as zhTwPokemonInfo } from "#app/locales/zh_TW/pokemon-info";
import i18next, { initI18n } from "#app/plugins/i18n";
import { KoreanPostpositionProcessor } from "i18next-korean-postposition-processor";
import { beforeAll, describe, expect, it } from "vitest";
interface BattleStatTestUnit {
stat: BattleStat,

View File

@ -1,9 +1,9 @@
import { afterEach, beforeAll, describe, expect, it } from "vitest";
import Phaser from "phaser";
import GameManager from "#test/utils/gameManager";
import { Species } from "#enums/species";
import i18next from "i18next";
import { initI18n } from "#app/plugins/i18n";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import i18next from "i18next";
import Phaser from "phaser";
import { afterEach, beforeAll, describe, expect, it } from "vitest";
describe("Lokalization - french", () => {
let phaserGame: Phaser.Game;

View File

@ -1,7 +1,7 @@
import { beforeAll, describe, afterEach, expect, it, vi } from "vitest";
import { StatusEffect, getStatusEffectActivationText, getStatusEffectDescriptor, getStatusEffectHealText, getStatusEffectObtainText, getStatusEffectOverlapText } from "#app/data/status-effect";
import i18next from "i18next";
import { mockI18next } from "#test/utils/testUtils";
import i18next from "i18next";
import { afterEach, beforeAll, describe, expect, it, vi } from "vitest";
const pokemonName = "PKM";
const sourceText = "SOURCE";

View File

@ -1,11 +1,11 @@
import { TerrainType, getTerrainName } from "#app/data/terrain";
import { getTerrainBlockMessage, getTerrainClearMessage, getTerrainStartMessage } from "#app/data/weather";
import GameManager from "#test/utils/gameManager";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import { mockI18next } from "#test/utils/testUtils";
import i18next from "i18next";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { mockI18next } from "#test/utils/testUtils";
describe("terrain", () => {
let phaserGame: Phaser.Game;

View File

@ -1,16 +1,15 @@
import { allMoves } from "#app/data/move.js";
import { BattlerTagType } from "#app/enums/battler-tag-type.js";
import { allMoves } from "#app/data/move";
import { BattlerTagType } from "#app/enums/battler-tag-type";
import { BerryPhase } from "#app/phases/berry-phase";
import { CommandPhase } from "#app/phases/command-phase";
import { MoveEndPhase } from "#app/phases/move-end-phase";
import { TurnEndPhase } from "#app/phases/turn-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, expect, test, vi } from "vitest";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { BerryPhase } from "#app/phases/berry-phase.js";
import { CommandPhase } from "#app/phases/command-phase.js";
import { MoveEndPhase } from "#app/phases/move-end-phase.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
const TIMEOUT = 20 * 1000;
@ -50,7 +49,7 @@ describe("Moves - Astonish", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.ASTONISH));
game.move.select(Moves.ASTONISH);
await game.phaseInterceptor.to(MoveEndPhase, false);
@ -63,7 +62,7 @@ describe("Moves - Astonish", () => {
await game.phaseInterceptor.to(CommandPhase, false);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(BerryPhase, false);

View File

@ -1,15 +1,14 @@
import { ArenaTagSide } from "#app/data/arena-tag.js";
import Move, { allMoves } from "#app/data/move.js";
import { WeatherType } from "#app/data/weather.js";
import { Abilities } from "#app/enums/abilities.js";
import { ArenaTagType } from "#app/enums/arena-tag-type.js";
import Pokemon from "#app/field/pokemon.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { NumberHolder } from "#app/utils.js";
import { ArenaTagSide } from "#app/data/arena-tag";
import Move, { allMoves } from "#app/data/move";
import { WeatherType } from "#app/data/weather";
import { Abilities } from "#app/enums/abilities";
import { ArenaTagType } from "#app/enums/arena-tag-type";
import Pokemon from "#app/field/pokemon";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { NumberHolder } from "#app/utils";
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, expect, it } from "vitest";
@ -46,7 +45,7 @@ describe("Moves - Aurora Veil", () => {
const moveToUse = Moves.TACKLE;
await game.startBattle([Species.SHUCKLE]);
game.doAttack(getMovePosition(game.scene, 0, moveToUse));
game.move.select(moveToUse);
await game.phaseInterceptor.to(TurnEndPhase);
const mockedDmg = getMockedMoveDamage(game.scene.getEnemyPokemon()!, game.scene.getPlayerPokemon()!, allMoves[moveToUse]);
@ -60,8 +59,8 @@ describe("Moves - Aurora Veil", () => {
const moveToUse = Moves.ROCK_SLIDE;
await game.startBattle([Species.SHUCKLE, Species.SHUCKLE]);
game.doAttack(getMovePosition(game.scene, 0, moveToUse));
game.doAttack(getMovePosition(game.scene, 1, moveToUse));
game.move.select(moveToUse);
game.move.select(moveToUse, 1);
await game.phaseInterceptor.to(TurnEndPhase);
const mockedDmg = getMockedMoveDamage(game.scene.getEnemyPokemon()!, game.scene.getPlayerPokemon()!, allMoves[moveToUse]);
@ -73,7 +72,7 @@ describe("Moves - Aurora Veil", () => {
const moveToUse = Moves.ABSORB;
await game.startBattle([Species.SHUCKLE]);
game.doAttack(getMovePosition(game.scene, 0, moveToUse));
game.move.select(moveToUse);
await game.phaseInterceptor.to(TurnEndPhase);
@ -88,8 +87,8 @@ describe("Moves - Aurora Veil", () => {
const moveToUse = Moves.DAZZLING_GLEAM;
await game.startBattle([Species.SHUCKLE, Species.SHUCKLE]);
game.doAttack(getMovePosition(game.scene, 0, moveToUse));
game.doAttack(getMovePosition(game.scene, 1, moveToUse));
game.move.select(moveToUse);
game.move.select(moveToUse, 1);
await game.phaseInterceptor.to(TurnEndPhase);
const mockedDmg = getMockedMoveDamage(game.scene.getEnemyPokemon()!, game.scene.getPlayerPokemon()!, allMoves[moveToUse]);

View File

@ -1,13 +1,12 @@
import { BattleStat } from "#app/data/battle-stat.js";
import { BattleStat } from "#app/data/battle-stat";
import { PostSummonPhase } from "#app/phases/post-summon-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { SPLASH_ONLY } from "../utils/testUtils";
import { PostSummonPhase } from "#app/phases/post-summon-phase.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
describe("Moves - Baton Pass", () => {
@ -44,12 +43,12 @@ describe("Moves - Baton Pass", () => {
]);
// round 1 - buff
game.doAttack(getMovePosition(game.scene, 0, Moves.NASTY_PLOT));
game.move.select(Moves.NASTY_PLOT);
await game.toNextTurn();
expect(game.scene.getPlayerPokemon()!.summonData.battleStats[BattleStat.SPATK]).toEqual(2);
// round 2 - baton pass
game.doAttack(getMovePosition(game.scene, 0, Moves.BATON_PASS));
game.move.select(Moves.BATON_PASS);
game.doSelectPartyPokemon(1);
await game.phaseInterceptor.to(TurnEndPhase);
@ -70,13 +69,13 @@ describe("Moves - Baton Pass", () => {
]);
// round 1 - ai buffs
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.toNextTurn();
// round 2 - baton pass
game.scene.getEnemyPokemon()!.hp = 100;
game.override.enemyMoveset(new Array(4).fill(Moves.BATON_PASS));
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(PostSummonPhase, false);
// assert

View File

@ -1,15 +1,14 @@
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import GameManager from "#test/utils/gameManager";
import { Species } from "#enums/species";
import { BattlerTagType } from "#app/enums/battler-tag-type";
import { StatusEffect } from "#app/enums/status-effect";
import { BerryPhase } from "#app/phases/berry-phase";
import { MovePhase } from "#app/phases/move-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { BattlerTagType } from "#app/enums/battler-tag-type.js";
import { StatusEffect } from "#app/enums/status-effect.js";
import { BerryPhase } from "#app/phases/berry-phase.js";
import { MovePhase } from "#app/phases/move-phase.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
const TIMEOUT = 20 * 1000;
@ -48,7 +47,7 @@ describe("Moves - Beak Blast", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
const enemyPokemon = game.scene.getEnemyPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.BEAK_BLAST));
game.move.select(Moves.BEAK_BLAST);
await game.phaseInterceptor.to(MovePhase, false);
expect(leadPokemon.getTag(BattlerTagType.BEAK_BLAST_CHARGING)).toBeDefined();
@ -68,7 +67,7 @@ describe("Moves - Beak Blast", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
const enemyPokemon = game.scene.getEnemyPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.BEAK_BLAST));
game.move.select(Moves.BEAK_BLAST);
await game.phaseInterceptor.to(MovePhase, false);
expect(leadPokemon.getTag(BattlerTagType.BEAK_BLAST_CHARGING)).toBeDefined();
@ -88,7 +87,7 @@ describe("Moves - Beak Blast", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
const enemyPokemon = game.scene.getEnemyPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.BEAK_BLAST));
game.move.select(Moves.BEAK_BLAST);
await game.phaseInterceptor.to(MovePhase, false);
expect(leadPokemon.getTag(BattlerTagType.BEAK_BLAST_CHARGING)).toBeDefined();
@ -107,7 +106,7 @@ describe("Moves - Beak Blast", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.BEAK_BLAST));
game.move.select(Moves.BEAK_BLAST);
await game.phaseInterceptor.to(BerryPhase, false);
expect(leadPokemon.turnData.hitCount).toBe(2);
@ -124,7 +123,7 @@ describe("Moves - Beak Blast", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
const enemyPokemon = game.scene.getEnemyPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.BEAK_BLAST));
game.move.select(Moves.BEAK_BLAST);
await game.phaseInterceptor.to(MovePhase, false);
expect(leadPokemon.getTag(BattlerTagType.BEAK_BLAST_CHARGING)).toBeDefined();

View File

@ -1,12 +1,11 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import Phaser from "phaser";
import { Abilities } from "#app/enums/abilities";
import { Moves } from "#app/enums/moves";
import { Species } from "#app/enums/species";
import { StatusEffect } from "#app/enums/status-effect";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import GameManager from "#test/utils/gameManager";
import { Species } from "#app/enums/species.js";
import { Moves } from "#app/enums/moves.js";
import { Abilities } from "#app/enums/abilities.js";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { StatusEffect } from "#app/enums/status-effect.js";
import { MoveEffectPhase } from "#app/phases/move-effect-phase.js";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
const TIMEOUT = 20 * 1000; // 20 sec timeout
@ -46,7 +45,7 @@ describe("Moves - Beat Up", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!;
let enemyStartingHp = enemyPokemon.hp;
game.doAttack(getMovePosition(game.scene, 0, Moves.BEAT_UP));
game.move.select(Moves.BEAT_UP);
await game.phaseInterceptor.to(MoveEffectPhase);
@ -70,7 +69,7 @@ describe("Moves - Beat Up", () => {
game.scene.getParty()[1].trySetStatus(StatusEffect.BURN);
game.doAttack(getMovePosition(game.scene, 0, Moves.BEAT_UP));
game.move.select(Moves.BEAT_UP);
await game.phaseInterceptor.to(MoveEffectPhase);
@ -88,7 +87,7 @@ describe("Moves - Beat Up", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!;
let enemyStartingHp = enemyPokemon.hp;
game.doAttack(getMovePosition(game.scene, 0, Moves.BEAT_UP));
game.move.select(Moves.BEAT_UP);
await game.phaseInterceptor.to(MoveEffectPhase);

View File

@ -1,12 +1,11 @@
import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
import Phaser from "phaser";
import GameManager from "#test/utils/gameManager";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { BattleStat } from "#app/data/battle-stat";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { toDmgValue } from "#app/utils";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import { BattleStat } from "#app/data/battle-stat";
import { toDmgValue } from "#app/utils";
import GameManager from "#test/utils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
const TIMEOUT = 20 * 1000;
// RATIO : HP Cost of Move
@ -47,7 +46,7 @@ describe("Moves - BELLY DRUM", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
const hpLost = toDmgValue(leadPokemon.getMaxHp() / RATIO);
game.doAttack(getMovePosition(game.scene, 0, Moves.BELLY_DRUM));
game.move.select(Moves.BELLY_DRUM);
await game.phaseInterceptor.to(TurnEndPhase);
expect(leadPokemon.hp).toBe(leadPokemon.getMaxHp() - hpLost);
@ -66,7 +65,7 @@ describe("Moves - BELLY DRUM", () => {
leadPokemon.summonData.battleStats[BattleStat.ATK] = -3;
leadPokemon.summonData.battleStats[BattleStat.SPATK] = 6;
game.doAttack(getMovePosition(game.scene, 0, Moves.BELLY_DRUM));
game.move.select(Moves.BELLY_DRUM);
await game.phaseInterceptor.to(TurnEndPhase);
expect(leadPokemon.hp).toBe(leadPokemon.getMaxHp() - hpLost);
@ -83,7 +82,7 @@ describe("Moves - BELLY DRUM", () => {
leadPokemon.summonData.battleStats[BattleStat.ATK] = 6;
game.doAttack(getMovePosition(game.scene, 0, Moves.BELLY_DRUM));
game.move.select(Moves.BELLY_DRUM);
await game.phaseInterceptor.to(TurnEndPhase);
expect(leadPokemon.hp).toBe(leadPokemon.getMaxHp());
@ -99,7 +98,7 @@ describe("Moves - BELLY DRUM", () => {
const hpLost = toDmgValue(leadPokemon.getMaxHp() / RATIO);
leadPokemon.hp = hpLost - PREDAMAGE;
game.doAttack(getMovePosition(game.scene, 0, Moves.BELLY_DRUM));
game.move.select(Moves.BELLY_DRUM);
await game.phaseInterceptor.to(TurnEndPhase);
expect(leadPokemon.hp).toBe(hpLost - PREDAMAGE);

View File

@ -2,14 +2,13 @@ import { ArenaTagSide, ArenaTrapTag } from "#app/data/arena-tag";
import { allMoves } from "#app/data/move";
import { Abilities } from "#app/enums/abilities";
import { ArenaTagType } from "#app/enums/arena-tag-type";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
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, expect, test, vi } from "vitest";
import { MoveEffectPhase } from "#app/phases/move-effect-phase.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
const TIMEOUT = 20 * 1000;
@ -50,7 +49,7 @@ describe("Moves - Ceaseless Edge", () => {
const enemyStartingHp = enemyPokemon.hp;
game.doAttack(getMovePosition(game.scene, 0, Moves.CEASELESS_EDGE));
game.move.select(Moves.CEASELESS_EDGE);
await game.phaseInterceptor.to(MoveEffectPhase, false);
// Spikes should not have any layers before move effect is applied
@ -75,7 +74,7 @@ describe("Moves - Ceaseless Edge", () => {
const enemyStartingHp = enemyPokemon.hp;
game.doAttack(getMovePosition(game.scene, 0, Moves.CEASELESS_EDGE));
game.move.select(Moves.CEASELESS_EDGE);
await game.phaseInterceptor.to(MoveEffectPhase, false);
// Spikes should not have any layers before move effect is applied
@ -98,7 +97,7 @@ describe("Moves - Ceaseless Edge", () => {
await game.startBattle([Species.ILLUMISE]);
game.doAttack(getMovePosition(game.scene, 0, Moves.CEASELESS_EDGE));
game.move.select(Moves.CEASELESS_EDGE);
await game.phaseInterceptor.to(MoveEffectPhase, false);
// Spikes should not have any layers before move effect is applied
const tagBefore = game.scene.arena.getTagOnSide(ArenaTagType.SPIKES, ArenaTagSide.ENEMY) as ArenaTrapTag;
@ -112,7 +111,7 @@ describe("Moves - Ceaseless Edge", () => {
const hpBeforeSpikes = game.scene.currentBattle.enemyParty[1].hp;
// Check HP of pokemon that WILL BE switched in (index 1)
game.forceOpponentToSwitch();
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase, false);
expect(game.scene.currentBattle.enemyParty[0].hp).toBeLessThan(hpBeforeSpikes);
}, TIMEOUT

View File

@ -1,13 +1,12 @@
import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
import Phaser from "phaser";
import GameManager from "#test/utils/gameManager";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { BattleStat } from "#app/data/battle-stat";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { toDmgValue } from "#app/utils";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import { BattleStat } from "#app/data/battle-stat";
import GameManager from "#test/utils/gameManager";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import { toDmgValue } from "#app/utils";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
const TIMEOUT = 20 * 1000;
/** HP Cost of Move */
@ -48,7 +47,7 @@ describe("Moves - CLANGOROUS_SOUL", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
const hpLost = toDmgValue(leadPokemon.getMaxHp() / RATIO);
game.doAttack(getMovePosition(game.scene, 0, Moves.CLANGOROUS_SOUL));
game.move.select(Moves.CLANGOROUS_SOUL);
await game.phaseInterceptor.to(TurnEndPhase);
expect(leadPokemon.hp).toBe(leadPokemon.getMaxHp() - hpLost);
@ -73,7 +72,7 @@ describe("Moves - CLANGOROUS_SOUL", () => {
leadPokemon.summonData.battleStats[BattleStat.SPATK] = 6;
leadPokemon.summonData.battleStats[BattleStat.SPDEF] = 4;
game.doAttack(getMovePosition(game.scene, 0, Moves.CLANGOROUS_SOUL));
game.move.select(Moves.CLANGOROUS_SOUL);
await game.phaseInterceptor.to(TurnEndPhase);
expect(leadPokemon.hp).toBe(leadPokemon.getMaxHp() - hpLost);
@ -97,7 +96,7 @@ describe("Moves - CLANGOROUS_SOUL", () => {
leadPokemon.summonData.battleStats[BattleStat.SPDEF] = 6;
leadPokemon.summonData.battleStats[BattleStat.SPD] = 6;
game.doAttack(getMovePosition(game.scene, 0, Moves.CLANGOROUS_SOUL));
game.move.select(Moves.CLANGOROUS_SOUL);
await game.phaseInterceptor.to(TurnEndPhase);
expect(leadPokemon.hp).toBe(leadPokemon.getMaxHp());
@ -117,7 +116,7 @@ describe("Moves - CLANGOROUS_SOUL", () => {
const hpLost = toDmgValue(leadPokemon.getMaxHp() / RATIO);
leadPokemon.hp = hpLost - PREDAMAGE;
game.doAttack(getMovePosition(game.scene, 0, Moves.CLANGOROUS_SOUL));
game.move.select(Moves.CLANGOROUS_SOUL);
await game.phaseInterceptor.to(TurnEndPhase);
expect(leadPokemon.hp).toBe(hpLost - PREDAMAGE);

View File

@ -1,14 +1,13 @@
import { BattleStat } from "#app/data/battle-stat";
import { BattlerTagType } from "#app/enums/battler-tag-type";
import { BerryPhase } from "#app/phases/berry-phase";
import { CommandPhase } from "#app/phases/command-phase";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
import GameManager from "../utils/gameManager";
import { Species } from "#enums/species";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { getMovePosition } from "../utils/gameManagerUtils";
import { BattleStat } from "#app/data/battle-stat.js";
import { BattlerTagType } from "#app/enums/battler-tag-type.js";
import { BerryPhase } from "#app/phases/berry-phase.js";
import { CommandPhase } from "#app/phases/command-phase.js";
const TIMEOUT = 20 * 1000;
@ -48,11 +47,11 @@ describe("Moves - Crafty Shield", () => {
const leadPokemon = game.scene.getPlayerField();
game.doAttack(getMovePosition(game.scene, 0, Moves.CRAFTY_SHIELD));
game.move.select(Moves.CRAFTY_SHIELD);
await game.phaseInterceptor.to(CommandPhase);
game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH));
game.move.select(Moves.SPLASH, 1);
await game.phaseInterceptor.to(BerryPhase, false);
@ -69,11 +68,11 @@ describe("Moves - Crafty Shield", () => {
const leadPokemon = game.scene.getPlayerField();
game.doAttack(getMovePosition(game.scene, 0, Moves.CRAFTY_SHIELD));
game.move.select(Moves.CRAFTY_SHIELD);
await game.phaseInterceptor.to(CommandPhase);
game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH));
game.move.select(Moves.SPLASH, 1);
await game.phaseInterceptor.to(BerryPhase, false);
@ -91,11 +90,11 @@ describe("Moves - Crafty Shield", () => {
const leadPokemon = game.scene.getPlayerField();
game.doAttack(getMovePosition(game.scene, 0, Moves.CRAFTY_SHIELD));
game.move.select(Moves.CRAFTY_SHIELD);
await game.phaseInterceptor.to(CommandPhase);
game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH));
game.move.select(Moves.SPLASH, 1);
await game.phaseInterceptor.to(BerryPhase, false);
@ -110,11 +109,11 @@ describe("Moves - Crafty Shield", () => {
const leadPokemon = game.scene.getPlayerField();
game.doAttack(getMovePosition(game.scene, 0, Moves.CRAFTY_SHIELD));
game.move.select(Moves.CRAFTY_SHIELD);
await game.phaseInterceptor.to(CommandPhase);
game.doAttack(getMovePosition(game.scene, 1, Moves.SWORDS_DANCE));
game.move.select(Moves.SWORDS_DANCE, 1);
await game.phaseInterceptor.to(BerryPhase, false);

View File

@ -1,10 +1,9 @@
import { BattleStat } from "#app/data/battle-stat.js";
import { Abilities } from "#app/enums/abilities.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { BattleStat } from "#app/data/battle-stat";
import { Abilities } from "#app/enums/abilities";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
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, expect, it, vi } from "vitest";
@ -42,7 +41,7 @@ describe("Moves - Double Team", () => {
vi.spyOn(enemy, "getAccuracyMultiplier");
expect(ally.summonData.battleStats[BattleStat.EVA]).toBe(0);
game.doAttack(getMovePosition(game.scene, 0, Moves.DOUBLE_TEAM));
game.move.select(Moves.DOUBLE_TEAM);
await game.phaseInterceptor.to(TurnEndPhase);
await game.toNextTurn();

View File

@ -1,17 +1,16 @@
import { BattleStat } from "#app/data/battle-stat";
import { Type } from "#app/data/type";
import { Species } from "#app/enums/species.js";
import { Species } from "#app/enums/species";
import { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon";
import { modifierTypes } from "#app/modifier/modifier-type";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { Abilities } from "#enums/abilities";
import { BattlerTagType } from "#enums/battler-tag-type";
import { Moves } from "#enums/moves";
import GameManager from "#test/utils/gameManager";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils";
describe("Moves - Dragon Rage", () => {
let phaserGame: Phaser.Game;
@ -62,7 +61,7 @@ describe("Moves - Dragon Rage", () => {
game.override.disableCrits();
vi.spyOn(enemyPokemon, "getTypes").mockReturnValue([Type.DRAGON]);
game.doAttack(getMovePosition(game.scene, 0, Moves.DRAGON_RAGE));
game.move.select(Moves.DRAGON_RAGE);
await game.phaseInterceptor.to(TurnEndPhase);
const damageDealt = enemyPokemon.getMaxHp() - enemyPokemon.hp;
@ -73,7 +72,7 @@ describe("Moves - Dragon Rage", () => {
game.override.disableCrits();
vi.spyOn(enemyPokemon, "getTypes").mockReturnValue([Type.STEEL]);
game.doAttack(getMovePosition(game.scene, 0, Moves.DRAGON_RAGE));
game.move.select(Moves.DRAGON_RAGE);
await game.phaseInterceptor.to(TurnEndPhase);
const damageDealt = enemyPokemon.getMaxHp() - enemyPokemon.hp;
@ -84,7 +83,7 @@ describe("Moves - Dragon Rage", () => {
game.override.disableCrits();
partyPokemon.summonData.battleStats[BattleStat.SPATK] = 2;
game.doAttack(getMovePosition(game.scene, 0, Moves.DRAGON_RAGE));
game.move.select(Moves.DRAGON_RAGE);
await game.phaseInterceptor.to(TurnEndPhase);
const damageDealt = enemyPokemon.getMaxHp() - enemyPokemon.hp;
@ -95,7 +94,7 @@ describe("Moves - Dragon Rage", () => {
game.override.disableCrits();
vi.spyOn(partyPokemon, "getTypes").mockReturnValue([Type.DRAGON]);
game.doAttack(getMovePosition(game.scene, 0, Moves.DRAGON_RAGE));
game.move.select(Moves.DRAGON_RAGE);
await game.phaseInterceptor.to(TurnEndPhase);
const damageDealt = enemyPokemon.getMaxHp() - enemyPokemon.hp;
@ -105,7 +104,7 @@ describe("Moves - Dragon Rage", () => {
it("ignores criticals", async () => {
partyPokemon.addTag(BattlerTagType.ALWAYS_CRIT, 99);
game.doAttack(getMovePosition(game.scene, 0, Moves.DRAGON_RAGE));
game.move.select(Moves.DRAGON_RAGE);
await game.phaseInterceptor.to(TurnEndPhase);
const damageDealt = enemyPokemon.getMaxHp() - enemyPokemon.hp;
@ -116,7 +115,7 @@ describe("Moves - Dragon Rage", () => {
game.override.disableCrits();
game.override.enemyAbility(Abilities.ICE_SCALES);
game.doAttack(getMovePosition(game.scene, 0, Moves.DRAGON_RAGE));
game.move.select(Moves.DRAGON_RAGE);
await game.phaseInterceptor.to(TurnEndPhase);
const damageDealt = enemyPokemon.getMaxHp() - enemyPokemon.hp;
@ -127,7 +126,7 @@ describe("Moves - Dragon Rage", () => {
game.override.disableCrits();
game.scene.addModifier(modifierTypes.MULTI_LENS().newModifier(partyPokemon), false);
game.doAttack(getMovePosition(game.scene, 0, Moves.DRAGON_RAGE));
game.move.select(Moves.DRAGON_RAGE);
await game.phaseInterceptor.to(TurnEndPhase);
const damageDealt = enemyPokemon.getMaxHp() - enemyPokemon.hp;

View File

@ -1,16 +1,15 @@
import { allMoves } from "#app/data/move.js";
import { SPLASH_ONLY } from "../utils/testUtils";
import { BattlerIndex } from "#app/battle";
import { allMoves } from "#app/data/move";
import { BattleEndPhase } from "#app/phases/battle-end-phase";
import { BerryPhase } from "#app/phases/berry-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest";
import GameManager from "../utils/gameManager";
import { getMovePosition } from "../utils/gameManagerUtils";
import { BattlerIndex } from "#app/battle.js";
import { BattleEndPhase } from "#app/phases/battle-end-phase.js";
import { BerryPhase } from "#app/phases/berry-phase.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
import { SPLASH_ONLY } from "../utils/testUtils";
const TIMEOUT = 20 * 1000;
@ -46,9 +45,8 @@ describe("Moves - Dragon Tail", () => {
await game.startBattle([Species.DRATINI]);
const enemyPokemon = game.scene.getEnemyPokemon()!;
expect(enemyPokemon).toBeDefined();
game.doAttack(getMovePosition(game.scene, 0, Moves.DRAGON_TAIL));
game.move.select(Moves.DRAGON_TAIL);
await game.phaseInterceptor.to(BerryPhase);
@ -68,12 +66,9 @@ describe("Moves - Dragon Tail", () => {
await game.startBattle([Species.DRATINI]);
const leadPokemon = game.scene.getPlayerPokemon()!;
expect(leadPokemon).toBeDefined();
const enemyPokemon = game.scene.getEnemyPokemon()!;
expect(enemyPokemon).toBeDefined();
game.doAttack(getMovePosition(game.scene, 0, Moves.DRAGON_TAIL));
game.move.select(Moves.DRAGON_TAIL);
await game.phaseInterceptor.to(BerryPhase);
@ -93,19 +88,12 @@ describe("Moves - Dragon Tail", () => {
await game.startBattle([Species.DRATINI, Species.DRATINI, Species.WAILORD, Species.WAILORD]);
const leadPokemon = game.scene.getParty()[0]!;
const secPokemon = game.scene.getParty()[1]!;
expect(leadPokemon).toBeDefined();
expect(secPokemon).toBeDefined();
const enemyLeadPokemon = game.scene.currentBattle.enemyParty[0]!;
const enemySecPokemon = game.scene.currentBattle.enemyParty[1]!;
expect(enemyLeadPokemon).toBeDefined();
expect(enemySecPokemon).toBeDefined();
const enemyLeadPokemon = game.scene.getEnemyParty()[0]!;
const enemySecPokemon = game.scene.getEnemyParty()[1]!;
game.doAttack(getMovePosition(game.scene, 0, Moves.DRAGON_TAIL));
game.doSelectTarget(BattlerIndex.ENEMY);
game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH));
game.move.select(Moves.DRAGON_TAIL, 0, BattlerIndex.ENEMY);
game.move.select(Moves.SPLASH, 1);
await game.phaseInterceptor.to(TurnEndPhase);
@ -117,10 +105,8 @@ describe("Moves - Dragon Tail", () => {
expect(leadPokemon.hp).toBeLessThan(leadPokemon.getMaxHp());
// second turn
game.doAttack(getMovePosition(game.scene, 0, Moves.FLAMETHROWER));
game.doSelectTarget(BattlerIndex.ENEMY_2);
game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH));
game.move.select(Moves.FLAMETHROWER, 0, BattlerIndex.ENEMY_2);
game.move.select(Moves.SPLASH, 1);
await game.phaseInterceptor.to(BerryPhase);
expect(enemySecPokemon.hp).toBeLessThan(enemySecPokemon.getMaxHp());
@ -137,20 +123,13 @@ describe("Moves - Dragon Tail", () => {
const leadPokemon = game.scene.getParty()[0]!;
const secPokemon = game.scene.getParty()[1]!;
expect(leadPokemon).toBeDefined();
expect(secPokemon).toBeDefined();
const enemyLeadPokemon = game.scene.currentBattle.enemyParty[0]!;
const enemySecPokemon = game.scene.currentBattle.enemyParty[1]!;
expect(enemyLeadPokemon).toBeDefined();
expect(enemySecPokemon).toBeDefined();
game.doAttack(getMovePosition(game.scene, 0, Moves.DRAGON_TAIL));
game.doSelectTarget(BattlerIndex.ENEMY);
const enemyLeadPokemon = game.scene.getEnemyParty()[0]!;
const enemySecPokemon = game.scene.getEnemyParty()[1]!;
game.move.select(Moves.DRAGON_TAIL, 0, BattlerIndex.ENEMY);
// target the same pokemon, second move should be redirected after first flees
game.doAttack(getMovePosition(game.scene, 0, Moves.DRAGON_TAIL));
game.doSelectTarget(BattlerIndex.ENEMY);
game.move.select(Moves.DRAGON_TAIL, 1, BattlerIndex.ENEMY);
await game.phaseInterceptor.to(BerryPhase);

View File

@ -1,14 +1,12 @@
import { BattlerIndex } from "#app/battle";
import { allMoves } from "#app/data/move";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { DamagePhase } from "#app/phases/damage-phase";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
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, expect, it, vi } from "vitest";
import { DamagePhase } from "#app/phases/damage-phase.js";
import { MoveEffectPhase } from "#app/phases/move-effect-phase.js";
import { TurnStartPhase } from "#app/phases/turn-start-phase.js";
describe("Moves - Dynamax Cannon", () => {
let phaserGame: Phaser.Game;
@ -49,7 +47,7 @@ describe("Moves - Dynamax Cannon", () => {
Species.ETERNATUS,
]);
game.doAttack(getMovePosition(game.scene, 0, dynamaxCannon.id));
game.move.select(dynamaxCannon.id);
await game.phaseInterceptor.to(MoveEffectPhase, false);
expect((game.scene.getCurrentPhase() as MoveEffectPhase).move.moveId).toBe(dynamaxCannon.id);
@ -63,7 +61,7 @@ describe("Moves - Dynamax Cannon", () => {
Species.ETERNATUS,
]);
game.doAttack(getMovePosition(game.scene, 0, dynamaxCannon.id));
game.move.select(dynamaxCannon.id);
await game.phaseInterceptor.to(MoveEffectPhase, false);
expect((game.scene.getCurrentPhase() as MoveEffectPhase).move.moveId).toBe(dynamaxCannon.id);
@ -77,7 +75,7 @@ describe("Moves - Dynamax Cannon", () => {
Species.ETERNATUS,
]);
game.doAttack(getMovePosition(game.scene, 0, dynamaxCannon.id));
game.move.select(dynamaxCannon.id);
await game.phaseInterceptor.to(MoveEffectPhase, false);
const phase = game.scene.getCurrentPhase() as MoveEffectPhase;
@ -94,7 +92,7 @@ describe("Moves - Dynamax Cannon", () => {
Species.ETERNATUS,
]);
game.doAttack(getMovePosition(game.scene, 0, dynamaxCannon.id));
game.move.select(dynamaxCannon.id);
await game.phaseInterceptor.to(MoveEffectPhase, false);
const phase = game.scene.getCurrentPhase() as MoveEffectPhase;
@ -111,7 +109,7 @@ describe("Moves - Dynamax Cannon", () => {
Species.ETERNATUS,
]);
game.doAttack(getMovePosition(game.scene, 0, dynamaxCannon.id));
game.move.select(dynamaxCannon.id);
await game.phaseInterceptor.to(MoveEffectPhase, false);
const phase = game.scene.getCurrentPhase() as MoveEffectPhase;
@ -128,7 +126,7 @@ describe("Moves - Dynamax Cannon", () => {
Species.ETERNATUS,
]);
game.doAttack(getMovePosition(game.scene, 0, dynamaxCannon.id));
game.move.select(dynamaxCannon.id);
await game.phaseInterceptor.to(MoveEffectPhase, false);
const phase = game.scene.getCurrentPhase() as MoveEffectPhase;
@ -145,7 +143,7 @@ describe("Moves - Dynamax Cannon", () => {
Species.ETERNATUS,
]);
game.doAttack(getMovePosition(game.scene, 0, dynamaxCannon.id));
game.move.select(dynamaxCannon.id);
await game.phaseInterceptor.to(MoveEffectPhase, false);
const phase = game.scene.getCurrentPhase() as MoveEffectPhase;
@ -162,11 +160,8 @@ describe("Moves - Dynamax Cannon", () => {
Species.ETERNATUS,
]);
game.doAttack(getMovePosition(game.scene, 0, dynamaxCannon.id));
await game.phaseInterceptor.to(TurnStartPhase, false);
// Force user to act before enemy
vi.spyOn((game.scene.getCurrentPhase() as TurnStartPhase), "getOrder").mockReturnValue([ BattlerIndex.PLAYER, BattlerIndex. ENEMY]);
game.move.select(dynamaxCannon.id);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to(MoveEffectPhase, false);
expect((game.scene.getCurrentPhase() as MoveEffectPhase).move.moveId).toBe(dynamaxCannon.id);

View File

@ -1,13 +1,12 @@
import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
import Phaser from "phaser";
import GameManager from "#test/utils/gameManager";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { BattleStat } from "#app/data/battle-stat";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { toDmgValue } from "#app/utils";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import { BattleStat } from "#app/data/battle-stat";
import GameManager from "#test/utils/gameManager";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import { toDmgValue } from "#app/utils";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
const TIMEOUT = 20 * 1000;
/** HP Cost of Move */
@ -48,7 +47,7 @@ describe("Moves - FILLET AWAY", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
const hpLost = toDmgValue(leadPokemon.getMaxHp() / RATIO);
game.doAttack(getMovePosition(game.scene, 0, Moves.FILLET_AWAY));
game.move.select(Moves.FILLET_AWAY);
await game.phaseInterceptor.to(TurnEndPhase);
expect(leadPokemon.hp).toBe(leadPokemon.getMaxHp() - hpLost);
@ -69,7 +68,7 @@ describe("Moves - FILLET AWAY", () => {
leadPokemon.summonData.battleStats[BattleStat.ATK] = 6;
leadPokemon.summonData.battleStats[BattleStat.SPATK] = 3;
game.doAttack(getMovePosition(game.scene, 0, Moves.FILLET_AWAY));
game.move.select(Moves.FILLET_AWAY);
await game.phaseInterceptor.to(TurnEndPhase);
expect(leadPokemon.hp).toBe(leadPokemon.getMaxHp() - hpLost);
@ -89,7 +88,7 @@ describe("Moves - FILLET AWAY", () => {
leadPokemon.summonData.battleStats[BattleStat.SPATK] = 6;
leadPokemon.summonData.battleStats[BattleStat.SPD] = 6;
game.doAttack(getMovePosition(game.scene, 0, Moves.FILLET_AWAY));
game.move.select(Moves.FILLET_AWAY);
await game.phaseInterceptor.to(TurnEndPhase);
expect(leadPokemon.hp).toBe(leadPokemon.getMaxHp());
@ -107,7 +106,7 @@ describe("Moves - FILLET AWAY", () => {
const hpLost = toDmgValue(leadPokemon.getMaxHp() / RATIO);
leadPokemon.hp = hpLost - PREDAMAGE;
game.doAttack(getMovePosition(game.scene, 0, Moves.FILLET_AWAY));
game.move.select(Moves.FILLET_AWAY);
await game.phaseInterceptor.to(TurnEndPhase);
expect(leadPokemon.hp).toBe(hpLost - PREDAMAGE);

View File

@ -1,15 +1,14 @@
import { BattleStat } from "#app/data/battle-stat";
import { Species } from "#app/enums/species.js";
import { Species } from "#app/enums/species";
import { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { DamagePhase } from "#app/phases/damage-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import GameManager from "#test/utils/gameManager";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils";
import { DamagePhase } from "#app/phases/damage-phase.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
describe("Moves - Fissure", () => {
let phaserGame: Phaser.Game;
@ -57,7 +56,7 @@ describe("Moves - Fissure", () => {
game.override.ability(Abilities.NO_GUARD);
game.override.enemyAbility(Abilities.FUR_COAT);
game.doAttack(getMovePosition(game.scene, 0, Moves.FISSURE));
game.move.select(Moves.FISSURE);
await game.phaseInterceptor.to(DamagePhase, true);
expect(enemyPokemon.isFainted()).toBe(true);
@ -68,7 +67,7 @@ describe("Moves - Fissure", () => {
enemyPokemon.summonData.battleStats[BattleStat.ACC] = -6;
game.doAttack(getMovePosition(game.scene, 0, Moves.FISSURE));
game.move.select(Moves.FISSURE);
// wait for TurnEndPhase instead of DamagePhase as fissure might not actually inflict damage
await game.phaseInterceptor.to(TurnEndPhase);
@ -81,7 +80,7 @@ describe("Moves - Fissure", () => {
enemyPokemon.summonData.battleStats[BattleStat.EVA] = 6;
game.doAttack(getMovePosition(game.scene, 0, Moves.FISSURE));
game.move.select(Moves.FISSURE);
// wait for TurnEndPhase instead of DamagePhase as fissure might not actually inflict damage
await game.phaseInterceptor.to(TurnEndPhase);

Some files were not shown because too many files have changed in this diff Show More