Compare commits

..

No commits in common. "af56eee1cf23383164a2ac390afb94ba01bdde4d" and "7e81b5021442543903e45b952b02b7b41b0d9877" have entirely different histories.

131 changed files with 2317 additions and 538 deletions

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -3565,9 +3565,6 @@ export class VariableAccuracyAttr extends MoveAttr {
} }
} }
/**
* Attribute used for Thunder and Hurricane that sets accuracy to 50 in sun and never miss in rain
*/
export class ThunderAccuracyAttr extends VariableAccuracyAttr { export class ThunderAccuracyAttr extends VariableAccuracyAttr {
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
if (!user.scene.arena.weather?.isEffectSuppressed(user.scene)) { if (!user.scene.arena.weather?.isEffectSuppressed(user.scene)) {
@ -3575,6 +3572,7 @@ export class ThunderAccuracyAttr extends VariableAccuracyAttr {
const weatherType = user.scene.arena.weather?.weatherType || WeatherType.NONE; const weatherType = user.scene.arena.weather?.weatherType || WeatherType.NONE;
switch (weatherType) { switch (weatherType) {
case WeatherType.SUNNY: case WeatherType.SUNNY:
case WeatherType.SANDSTORM:
case WeatherType.HARSH_SUN: case WeatherType.HARSH_SUN:
accuracy.value = 50; accuracy.value = 50;
return true; return true;
@ -3589,28 +3587,6 @@ export class ThunderAccuracyAttr extends VariableAccuracyAttr {
} }
} }
/**
* Attribute used for Bleakwind Storm, Wildbolt Storm, and Sandsear Storm that sets accuracy to never
* miss in rain
* Springtide Storm does NOT have this property
*/
export class StormAccuracyAttr extends VariableAccuracyAttr {
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
if (!user.scene.arena.weather?.isEffectSuppressed(user.scene)) {
const accuracy = args[0] as Utils.NumberHolder;
const weatherType = user.scene.arena.weather?.weatherType || WeatherType.NONE;
switch (weatherType) {
case WeatherType.RAIN:
case WeatherType.HEAVY_RAIN:
accuracy.value = -1;
return true;
}
}
return false;
}
}
/** /**
* Attribute used for moves which never miss * Attribute used for moves which never miss
* against Pokemon with the {@linkcode BattlerTagType.MINIMIZED} * against Pokemon with the {@linkcode BattlerTagType.MINIMIZED}
@ -8420,17 +8396,17 @@ export function initMoves() {
.attr(AddArenaTrapTagHitAttr, ArenaTagType.SPIKES) .attr(AddArenaTrapTagHitAttr, ArenaTagType.SPIKES)
.slicingMove(), .slicingMove(),
new AttackMove(Moves.BLEAKWIND_STORM, Type.FLYING, MoveCategory.SPECIAL, 100, 80, 10, 30, 0, 8) new AttackMove(Moves.BLEAKWIND_STORM, Type.FLYING, MoveCategory.SPECIAL, 100, 80, 10, 30, 0, 8)
.attr(StormAccuracyAttr) .attr(ThunderAccuracyAttr)
.attr(StatChangeAttr, BattleStat.SPD, -1) .attr(StatChangeAttr, BattleStat.SPD, -1)
.windMove() .windMove()
.target(MoveTarget.ALL_NEAR_ENEMIES), .target(MoveTarget.ALL_NEAR_ENEMIES),
new AttackMove(Moves.WILDBOLT_STORM, Type.ELECTRIC, MoveCategory.SPECIAL, 100, 80, 10, 20, 0, 8) new AttackMove(Moves.WILDBOLT_STORM, Type.ELECTRIC, MoveCategory.SPECIAL, 100, 80, 10, 20, 0, 8)
.attr(StormAccuracyAttr) .attr(ThunderAccuracyAttr)
.attr(StatusEffectAttr, StatusEffect.PARALYSIS) .attr(StatusEffectAttr, StatusEffect.PARALYSIS)
.windMove() .windMove()
.target(MoveTarget.ALL_NEAR_ENEMIES), .target(MoveTarget.ALL_NEAR_ENEMIES),
new AttackMove(Moves.SANDSEAR_STORM, Type.GROUND, MoveCategory.SPECIAL, 100, 80, 10, 20, 0, 8) new AttackMove(Moves.SANDSEAR_STORM, Type.GROUND, MoveCategory.SPECIAL, 100, 80, 10, 20, 0, 8)
.attr(StormAccuracyAttr) .attr(ThunderAccuracyAttr)
.attr(StatusEffectAttr, StatusEffect.BURN) .attr(StatusEffectAttr, StatusEffect.BURN)
.windMove() .windMove()
.target(MoveTarget.ALL_NEAR_ENEMIES), .target(MoveTarget.ALL_NEAR_ENEMIES),

View File

@ -61,7 +61,7 @@ export const battle: SimpleTranslationEntries = {
"hpIsFull": "Les PV de {{pokemonName}}\nsont au maximum !", "hpIsFull": "Les PV de {{pokemonName}}\nsont au maximum !",
"skipItemQuestion": "Êtes-vous sûr·e de ne pas vouloir prendre dobjet ?", "skipItemQuestion": "Êtes-vous sûr·e de ne pas vouloir prendre dobjet ?",
"eggHatching": "Hein ?", "eggHatching": "Hein ?",
"ivScannerUseQuestion": "Utiliser le Scanner dIV\nsur {{pokemonName}} ?", "ivScannerUseQuestion": "Utiliser le Scanner dIV sur {{pokemonName}} ?",
"wildPokemonWithAffix": "{{pokemonName}} sauvage", "wildPokemonWithAffix": "{{pokemonName}} sauvage",
"foePokemonWithAffix": "{{pokemonName}} ennemi", "foePokemonWithAffix": "{{pokemonName}} ennemi",
"useMove": "{{pokemonNameWithAffix}} utilise\n{{moveName}} !", "useMove": "{{pokemonNameWithAffix}} utilise\n{{moveName}} !",
@ -74,21 +74,21 @@ export const battle: SimpleTranslationEntries = {
"statsAnd": "et", "statsAnd": "et",
"stats": "Les stats", "stats": "Les stats",
"statRose_one": "{{stats}} de {{pokemonNameWithAffix}}\naugmente !", "statRose_one": "{{stats}} de {{pokemonNameWithAffix}}\naugmente !",
"statRose_other": "{{stats}}\nde {{pokemonNameWithAffix}} augmentent !", "statRose_other": "{{stats}} de {{pokemonNameWithAffix}}\naugmentent !",
"statSharplyRose_one": "{{stats}} de {{pokemonNameWithAffix}}\naugmente beaucoup !", "statSharplyRose_one": "{{stats}} de {{pokemonNameWithAffix}}\naugmente beaucoup !",
"statSharplyRose_other": "{{stats}}\nde {{pokemonNameWithAffix}} augmentent beaucoup !", "statSharplyRose_other": "{{stats}} de {{pokemonNameWithAffix}}\naugmentent beaucoup !",
"statRoseDrastically_one": "{{stats}} de {{pokemonNameWithAffix}}\naugmente énormément !", "statRoseDrastically_one": "{{stats}} de {{pokemonNameWithAffix}}\naugmente énormément !",
"statRoseDrastically_other": "{{stats}}\nde {{pokemonNameWithAffix}} augmentent énormément !", "statRoseDrastically_other": "{{stats}} de {{pokemonNameWithAffix}}\naugmentent énormément !",
"statWontGoAnyHigher_one": "{{stats}} de {{pokemonNameWithAffix}}\nne peut plus augmenter !", "statWontGoAnyHigher_one": "{{stats}} de {{pokemonNameWithAffix}}\nne peut plus augmenter !",
"statWontGoAnyHigher_other": "{{stats}}\nde {{pokemonNameWithAffix}} ne peuvent plus augmenter !", "statWontGoAnyHigher_other": "{{stats}} de {{pokemonNameWithAffix}}\nne peuvent plus augmenter !",
"statFell_one": "{{stats}} de {{pokemonNameWithAffix}}\nbaisse !", "statFell_one": "{{stats}} de {{pokemonNameWithAffix}}\nbaisse !",
"statFell_other": "{{stats}}\nde {{pokemonNameWithAffix}} baissent !", "statFell_other": "{{stats}} de {{pokemonNameWithAffix}}\nbaissent !",
"statHarshlyFell_one": "{{stats}} de {{pokemonNameWithAffix}}\nbaisse beaucoup !", "statHarshlyFell_one": "{{stats}} de {{pokemonNameWithAffix}}\nbaisse beaucoup !",
"statHarshlyFell_other": "{{stats}}\nde {{pokemonNameWithAffix}} baissent beaucoup !", "statHarshlyFell_other": "{{stats}} de {{pokemonNameWithAffix}}\nbaissent beaucoup !",
"statSeverelyFell_one": "{{stats}} de {{pokemonNameWithAffix}}\nbaisse énormément !", "statSeverelyFell_one": "{{stats}} de {{pokemonNameWithAffix}}\nbaisse énormément !",
"statSeverelyFell_other": "{{stats}}\nde {{pokemonNameWithAffix}} baissent énormément !", "statSeverelyFell_other": "{{stats}} de {{pokemonNameWithAffix}}\nbaissent énormément !",
"statWontGoAnyLower_one": "{{stats}} de {{pokemonNameWithAffix}}\nne peut plus baisser !", "statWontGoAnyLower_one": "{{stats}} de {{pokemonNameWithAffix}}\nne peut plus baisser !",
"statWontGoAnyLower_other": "{{stats}}\nde {{pokemonNameWithAffix}} ne peuvent plus baisser !", "statWontGoAnyLower_other": "{{stats}} de {{pokemonNameWithAffix}}\nne peuvent plus baisser !",
"transformedIntoType": "{{pokemonName}} transformed\ninto the {{type}} type!", "transformedIntoType": "{{pokemonName}} transformed\ninto the {{type}} type!",
"ppReduced": "Les PP de la capacité {{moveName}}\nde {{targetName}} baissent de {{reduction}} !", "ppReduced": "Les PP de la capacité {{moveName}}\nde {{targetName}} baissent de {{reduction}} !",
"retryBattle": "Voulez-vous réessayer depuis le début du combat ?", "retryBattle": "Voulez-vous réessayer depuis le début du combat ?",

View File

@ -7,7 +7,7 @@ import { SimpleTranslationEntries } from "#app/interfaces/locales";
*/ */
export const starterSelectUiHandler: SimpleTranslationEntries = { export const starterSelectUiHandler: SimpleTranslationEntries = {
"confirmStartTeam": "Commencer avec ces Pokémon ?", "confirmStartTeam": "Commencer avec ces Pokémon ?",
"confirmExit": "Êtes-vous sûr·e de vouloir quitter ?", "confirmExit": "Do you want to exit?",
"invalidParty": "Cette équipe de départ est invalide !", "invalidParty": "Cette équipe de départ est invalide !",
"gen1": "1G", "gen1": "1G",
"gen2": "2G", "gen2": "2G",

View File

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

View File

@ -1,13 +1,13 @@
import { allMoves } from "#app/data/move.js"; import { allMoves } from "#app/data/move.js";
import { MoveEffectPhase } from "#app/phases"; import { MoveEffectPhase } from "#app/phases";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils"; import { SPLASH_ONLY } from "../utils/testUtils";
describe("Abilities - Aura Break", () => { describe("Abilities - Aura Break", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;

View File

@ -1,13 +1,13 @@
import { allMoves } from "#app/data/move.js"; import { allMoves } from "#app/data/move.js";
import { Abilities } from "#app/enums/abilities.js"; import { Abilities } from "#app/enums/abilities.js";
import { MoveEffectPhase, TurnEndPhase } from "#app/phases.js"; import { MoveEffectPhase, TurnEndPhase } from "#app/phases.js";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils"; import { SPLASH_ONLY } from "../utils/testUtils";
describe("Abilities - Battery", () => { describe("Abilities - Battery", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;

View File

@ -5,9 +5,9 @@ import { Species } from "#app/enums/species.js";
import { CommandPhase, MessagePhase } from "#app/phases.js"; import { CommandPhase, MessagePhase } from "#app/phases.js";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
import GameManager from "#test/utils/gameManager"; import GameManager from "../utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "../utils/gameManagerUtils";
import { SPLASH_ONLY } from "#test/utils/testUtils"; import { SPLASH_ONLY } from "../utils/testUtils";
const TIMEOUT = 20 * 1000; const TIMEOUT = 20 * 1000;
@ -42,6 +42,8 @@ describe("Abilities - COSTAR", () => {
await game.startBattle([Species.MAGIKARP, Species.MAGIKARP, Species.FLAMIGO]); await game.startBattle([Species.MAGIKARP, Species.MAGIKARP, Species.FLAMIGO]);
let [leftPokemon, rightPokemon] = game.scene.getPlayerField(); let [leftPokemon, rightPokemon] = game.scene.getPlayerField();
expect(leftPokemon).toBeDefined();
expect(rightPokemon).toBeDefined();
game.doAttack(getMovePosition(game.scene, 0, Moves.NASTY_PLOT)); game.doAttack(getMovePosition(game.scene, 0, Moves.NASTY_PLOT));
await game.phaseInterceptor.to(CommandPhase); await game.phaseInterceptor.to(CommandPhase);
@ -71,6 +73,8 @@ describe("Abilities - COSTAR", () => {
await game.startBattle([Species.MAGIKARP, Species.MAGIKARP, Species.FLAMIGO]); await game.startBattle([Species.MAGIKARP, Species.MAGIKARP, Species.FLAMIGO]);
let [leftPokemon, rightPokemon] = game.scene.getPlayerField(); let [leftPokemon, rightPokemon] = game.scene.getPlayerField();
expect(leftPokemon).toBeDefined();
expect(rightPokemon).toBeDefined();
expect(leftPokemon.summonData.battleStats[BattleStat.ATK]).toBe(-2); expect(leftPokemon.summonData.battleStats[BattleStat.ATK]).toBe(-2);
expect(leftPokemon.summonData.battleStats[BattleStat.ATK]).toBe(-2); expect(leftPokemon.summonData.battleStats[BattleStat.ATK]).toBe(-2);

View File

@ -1,12 +1,12 @@
import { Species } from "#app/enums/species.js"; import { Species } from "#app/enums/species.js";
import { TurnEndPhase } from "#app/phases"; import { TurnEndPhase } from "#app/phases";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils"; import { SPLASH_ONLY } from "../utils/testUtils";
describe("Abilities - Dry Skin", () => { describe("Abilities - Dry Skin", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -83,6 +83,7 @@ describe("Abilities - Dry Skin", () => {
await game.startBattle(); await game.startBattle();
const enemy = game.scene.getEnemyPokemon(); const enemy = game.scene.getEnemyPokemon();
expect(enemy).toBeDefined();
const initialHP = 1000; const initialHP = 1000;
enemy.hp = initialHP; enemy.hp = initialHP;

View File

@ -2,13 +2,13 @@ import { allMoves } from "#app/data/move.js";
import { Abilities } from "#app/enums/abilities.js"; import { Abilities } from "#app/enums/abilities.js";
import { Stat } from "#app/enums/stat.js"; import { Stat } from "#app/enums/stat.js";
import { DamagePhase, MoveEffectPhase } from "#app/phases.js"; import { DamagePhase, MoveEffectPhase } from "#app/phases.js";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils"; import { SPLASH_ONLY } from "../utils/testUtils";
describe("Abilities - Hustle", () => { describe("Abilities - Hustle", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;

View File

@ -1,7 +1,12 @@
import { QuietFormChangePhase } from "#app/form-change-phase"; import { QuietFormChangePhase } from "#app/form-change-phase";
import { MoveEffectPhase, MoveEndPhase, TurnEndPhase, TurnInitPhase } from "#app/phases"; import {
import GameManager from "#test/utils/gameManager"; MoveEffectPhase,
import { getMovePosition } from "#test/utils/gameManagerUtils"; MoveEndPhase,
TurnEndPhase,
TurnInitPhase,
} from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { BattlerTagType } from "#enums/battler-tag-type"; import { BattlerTagType } from "#enums/battler-tag-type";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";

View File

@ -1,9 +1,10 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import Phaser from "phaser"; import Phaser from "phaser";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { Mode } from "#app/ui/ui"; import { Mode } from "#app/ui/ui";
import { BattleStat } from "#app/data/battle-stat"; import { BattleStat } from "#app/data/battle-stat";
import { generateStarter, getMovePosition } from "#test/utils/gameManagerUtils"; import { generateStarter, getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Command } from "#app/ui/command-ui-handler"; import { Command } from "#app/ui/command-ui-handler";
import { Status, StatusEffect } from "#app/data/status-effect"; import { Status, StatusEffect } from "#app/data/status-effect";
import { GameModes, getGameMode } from "#app/game-mode"; import { GameModes, getGameMode } from "#app/game-mode";
@ -11,7 +12,6 @@ import { CommandPhase, DamagePhase, EncounterPhase, EnemyCommandPhase, SelectSta
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { SPLASH_ONLY } from "#test/utils/testUtils";
describe("Abilities - Intimidate", () => { describe("Abilities - Intimidate", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -35,7 +35,7 @@ describe("Abilities - Intimidate", () => {
game.override.enemyPassiveAbility(Abilities.HYDRATION); game.override.enemyPassiveAbility(Abilities.HYDRATION);
game.override.ability(Abilities.INTIMIDATE); game.override.ability(Abilities.INTIMIDATE);
game.override.startingWave(3); game.override.startingWave(3);
game.override.enemyMoveset(SPLASH_ONLY); game.override.enemyMoveset([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]);
}); });
it("single - wild with switch", async () => { it("single - wild with switch", async () => {
@ -294,7 +294,7 @@ describe("Abilities - Intimidate", () => {
it("single - trainer should only trigger once whatever turn we are", async () => { it("single - trainer should only trigger once whatever turn we are", async () => {
game.override.moveset([Moves.SPLASH]); game.override.moveset([Moves.SPLASH]);
game.override.enemyMoveset(SPLASH_ONLY); game.override.enemyMoveset([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]);
game.override.startingWave(5); game.override.startingWave(5);
await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]); await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]);
let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats; let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
@ -334,6 +334,7 @@ describe("Abilities - Intimidate", () => {
it("double - wild vs only 1 on player side", async () => { it("double - wild vs only 1 on player side", async () => {
game.override.battleType("double"); game.override.battleType("double");
game.override.startingWave(3); game.override.startingWave(3);
vi.spyOn(Overrides, "OPP_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{ name: "COIN_CASE" }]);
await game.runToSummon([Species.MIGHTYENA]); await game.runToSummon([Species.MIGHTYENA]);
await game.phaseInterceptor.to(CommandPhase, false); await game.phaseInterceptor.to(CommandPhase, false);
const battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats; const battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;

View File

@ -1,6 +1,8 @@
import { BattleStat } from "#app/data/battle-stat"; import { BattleStat } from "#app/data/battle-stat";
import { CommandPhase } from "#app/phases"; import {
import GameManager from "#test/utils/gameManager"; CommandPhase,
} from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";

View File

@ -10,9 +10,9 @@ import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest";
import GameManager from "#test/utils/gameManager"; import GameManager from "../utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "../utils/gameManagerUtils";
import { SPLASH_ONLY } from "#test/utils/testUtils"; import { SPLASH_ONLY } from "../utils/testUtils";
const TIMEOUT = 20 * 1000; const TIMEOUT = 20 * 1000;

View File

@ -1,17 +1,17 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import Phaser from "phaser"; import Phaser from "phaser";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import overrides from "#app/overrides";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { TurnEndPhase, MoveEffectPhase } from "#app/phases"; import { TurnEndPhase, MoveEffectPhase } from "#app/phases";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { ArenaTagType } from "#enums/arena-tag-type"; import { ArenaTagType } from "#enums/arena-tag-type";
import { ArenaTagSide, getArenaTag } from "#app/data/arena-tag"; import { ArenaTagSide, getArenaTag } from "#app/data/arena-tag";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { WeatherType } from "#app/data/weather.js"; import { WeatherType } from "#app/data/weather.js";
import { StatusEffect, getStatusEffectCatchRateMultiplier } from "#app/data/status-effect"; import { StatusEffect, getStatusEffectCatchRateMultiplier } from "#app/data/status-effect";
import { BattlerTagType } from "#enums/battler-tag-type"; import { BattlerTagType } from "#enums/battler-tag-type";
import { SPLASH_ONLY } from "#test/utils/testUtils";
const TIMEOUT = 20 * 1000; // 20 sec timeout const TIMEOUT = 20 * 1000; // 20 sec timeout
@ -33,15 +33,16 @@ describe("Abilities - Magic Guard", () => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
/** Player Pokemon overrides */ /** Player Pokemon overrides */
game.override.ability(Abilities.MAGIC_GUARD); vi.spyOn(overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.MAGIC_GUARD);
game.override.moveset([Moves.SPLASH]); vi.spyOn(overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.UNNERVE);
game.override.startingLevel(100); vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]);
vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100);
/** Enemy Pokemon overrides */ /** Enemy Pokemon overrides */
game.override.enemySpecies(Species.SNORLAX); vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX);
game.override.enemyAbility(Abilities.INSOMNIA); vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA);
game.override.enemyMoveset(SPLASH_ONLY); vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]);
game.override.enemyLevel(100); vi.spyOn(overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100);
}); });
//Bulbapedia Reference: https://bulbapedia.bulbagarden.net/wiki/Magic_Guard_(Ability) //Bulbapedia Reference: https://bulbapedia.bulbagarden.net/wiki/Magic_Guard_(Ability)
@ -49,13 +50,15 @@ describe("Abilities - Magic Guard", () => {
it( it(
"ability should prevent damage caused by weather", "ability should prevent damage caused by weather",
async () => { async () => {
game.override.weather(WeatherType.SANDSTORM); vi.spyOn(overrides, "WEATHER_OVERRIDE", "get").mockReturnValue(WeatherType.SANDSTORM);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon(); const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
const enemyPokemon = game.scene.getEnemyPokemon(); const enemyPokemon = game.scene.getEnemyPokemon();
expect(enemyPokemon).toBeDefined();
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH)); game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
@ -75,11 +78,15 @@ describe("Abilities - Magic Guard", () => {
"ability should prevent damage caused by status effects but other non-damage effects still apply", "ability should prevent damage caused by status effects but other non-damage effects still apply",
async () => { async () => {
//Toxic keeps track of the turn counters -> important that Magic Guard keeps track of post-Toxic turns //Toxic keeps track of the turn counters -> important that Magic Guard keeps track of post-Toxic turns
game.override.statusEffect(StatusEffect.POISON); vi.spyOn(overrides, "STATUS_OVERRIDE", "get").mockReturnValue(StatusEffect.POISON);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon(); const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
const enemyPokemon = game.scene.getEnemyPokemon();
expect(enemyPokemon).toBeDefined();
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH)); game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
@ -98,12 +105,16 @@ describe("Abilities - Magic Guard", () => {
it( it(
"ability effect should not persist when the ability is replaced", "ability effect should not persist when the ability is replaced",
async () => { async () => {
game.override.enemyMoveset([Moves.WORRY_SEED,Moves.WORRY_SEED,Moves.WORRY_SEED,Moves.WORRY_SEED]); vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.WORRY_SEED,Moves.WORRY_SEED,Moves.WORRY_SEED,Moves.WORRY_SEED]);
game.override.statusEffect(StatusEffect.POISON); vi.spyOn(overrides, "STATUS_OVERRIDE", "get").mockReturnValue(StatusEffect.POISON);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon(); const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
const enemyPokemon = game.scene.getEnemyPokemon();
expect(enemyPokemon).toBeDefined();
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH)); game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
@ -120,14 +131,18 @@ describe("Abilities - Magic Guard", () => {
it("Magic Guard prevents damage caused by burn but other non-damaging effects are still applied", it("Magic Guard prevents damage caused by burn but other non-damaging effects are still applied",
async () => { async () => {
game.override.enemyStatusEffect(StatusEffect.BURN); vi.spyOn(overrides, "OPP_STATUS_OVERRIDE", "get").mockReturnValue(StatusEffect.BURN);
game.override.enemyAbility(Abilities.MAGIC_GUARD); vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.MAGIC_GUARD);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon();
expect (leadPokemon).toBeDefined();
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH)); game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
const enemyPokemon = game.scene.getEnemyPokemon(); const enemyPokemon = game.scene.getEnemyPokemon();
expect(enemyPokemon).toBeDefined();
await game.phaseInterceptor.to(TurnEndPhase); await game.phaseInterceptor.to(TurnEndPhase);
@ -144,14 +159,18 @@ describe("Abilities - Magic Guard", () => {
it("Magic Guard prevents damage caused by toxic but other non-damaging effects are still applied", it("Magic Guard prevents damage caused by toxic but other non-damaging effects are still applied",
async () => { async () => {
game.override.enemyStatusEffect(StatusEffect.TOXIC); vi.spyOn(overrides, "OPP_STATUS_OVERRIDE", "get").mockReturnValue(StatusEffect.TOXIC);
game.override.enemyAbility(Abilities.MAGIC_GUARD); vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.MAGIC_GUARD);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon();
expect (leadPokemon).toBeDefined();
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH)); game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
const enemyPokemon = game.scene.getEnemyPokemon(); const enemyPokemon = game.scene.getEnemyPokemon();
expect(enemyPokemon).toBeDefined();
const toxicStartCounter = enemyPokemon.status.turnCount; const toxicStartCounter = enemyPokemon.status.turnCount;
//should be 0 //should be 0
@ -178,10 +197,12 @@ describe("Abilities - Magic Guard", () => {
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon(); const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH)); game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
const enemyPokemon = game.scene.getEnemyPokemon(); const enemyPokemon = game.scene.getEnemyPokemon();
expect(enemyPokemon).toBeDefined();
await game.phaseInterceptor.to(TurnEndPhase); await game.phaseInterceptor.to(TurnEndPhase);
@ -204,10 +225,12 @@ describe("Abilities - Magic Guard", () => {
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon(); const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH)); game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
const enemyPokemon = game.scene.getEnemyPokemon(); const enemyPokemon = game.scene.getEnemyPokemon();
expect(enemyPokemon).toBeDefined();
await game.phaseInterceptor.to(TurnEndPhase); await game.phaseInterceptor.to(TurnEndPhase);
@ -227,14 +250,16 @@ describe("Abilities - Magic Guard", () => {
it("Magic Guard prevents against damage from volatile status effects", it("Magic Guard prevents against damage from volatile status effects",
async () => { async () => {
await game.startBattle([Species.DUSKULL]); await game.startBattle([Species.DUSKULL]);
game.override.moveset([Moves.CURSE]); vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.CURSE]);
game.override.enemyAbility(Abilities.MAGIC_GUARD); vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.MAGIC_GUARD);
const leadPokemon = game.scene.getPlayerPokemon(); const leadPokemon = game.scene.getPlayerPokemon();
expect (leadPokemon).toBeDefined();
game.doAttack(getMovePosition(game.scene, 0, Moves.CURSE)); game.doAttack(getMovePosition(game.scene, 0, Moves.CURSE));
const enemyPokemon = game.scene.getEnemyPokemon(); const enemyPokemon = game.scene.getEnemyPokemon();
expect(enemyPokemon).toBeDefined();
await game.phaseInterceptor.to(TurnEndPhase); await game.phaseInterceptor.to(TurnEndPhase);
@ -251,10 +276,11 @@ describe("Abilities - Magic Guard", () => {
); );
it("Magic Guard prevents crash damage", async () => { it("Magic Guard prevents crash damage", async () => {
game.override.moveset([Moves.HIGH_JUMP_KICK]); vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.HIGH_JUMP_KICK]);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon(); const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
game.doAttack(getMovePosition(game.scene, 0, Moves.HIGH_JUMP_KICK)); game.doAttack(getMovePosition(game.scene, 0, Moves.HIGH_JUMP_KICK));
await game.phaseInterceptor.to(MoveEffectPhase, false); await game.phaseInterceptor.to(MoveEffectPhase, false);
@ -271,10 +297,11 @@ describe("Abilities - Magic Guard", () => {
); );
it("Magic Guard prevents damage from recoil", async () => { it("Magic Guard prevents damage from recoil", async () => {
game.override.moveset([Moves.TAKE_DOWN]); vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TAKE_DOWN]);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon(); const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
game.doAttack(getMovePosition(game.scene, 0, Moves.TAKE_DOWN)); game.doAttack(getMovePosition(game.scene, 0, Moves.TAKE_DOWN));
@ -289,10 +316,11 @@ describe("Abilities - Magic Guard", () => {
); );
it("Magic Guard does not prevent damage from Struggle's recoil", async () => { it("Magic Guard does not prevent damage from Struggle's recoil", async () => {
game.override.moveset([Moves.STRUGGLE]); vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.STRUGGLE]);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon(); const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
game.doAttack(getMovePosition(game.scene, 0, Moves.STRUGGLE)); game.doAttack(getMovePosition(game.scene, 0, Moves.STRUGGLE));
@ -308,10 +336,11 @@ describe("Abilities - Magic Guard", () => {
//This tests different move attributes than the recoil tests above //This tests different move attributes than the recoil tests above
it("Magic Guard prevents self-damage from attacking moves", async () => { it("Magic Guard prevents self-damage from attacking moves", async () => {
game.override.moveset([Moves.STEEL_BEAM]); vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.STEEL_BEAM]);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon(); const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
game.doAttack(getMovePosition(game.scene, 0, Moves.STEEL_BEAM)); game.doAttack(getMovePosition(game.scene, 0, Moves.STEEL_BEAM));
@ -336,10 +365,11 @@ describe("Abilities - Magic Guard", () => {
*/ */
it("Magic Guard does not prevent self-damage from non-attacking moves", async () => { it("Magic Guard does not prevent self-damage from non-attacking moves", async () => {
game.override.moveset([Moves.BELLY_DRUM]); vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.BELLY_DRUM]);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon(); const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
game.doAttack(getMovePosition(game.scene, 0, Moves.BELLY_DRUM)); game.doAttack(getMovePosition(game.scene, 0, Moves.BELLY_DRUM));
@ -355,14 +385,15 @@ describe("Abilities - Magic Guard", () => {
it("Magic Guard prevents damage from abilities with PostTurnHurtIfSleepingAbAttr", async() => { it("Magic Guard prevents damage from abilities with PostTurnHurtIfSleepingAbAttr", async() => {
//Tests the ability Bad Dreams //Tests the ability Bad Dreams
game.override.statusEffect(StatusEffect.SLEEP); vi.spyOn(overrides, "STATUS_OVERRIDE", "get").mockReturnValue(StatusEffect.SLEEP);
//enemy pokemon is given Spore just in case player pokemon somehow awakens during test //enemy pokemon is given Spore just in case player pokemon somehow awakens during test
game.override.enemyMoveset([Moves.SPORE, Moves.SPORE, Moves.SPORE, Moves.SPORE]); vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPORE, Moves.SPORE, Moves.SPORE, Moves.SPORE]);
game.override.enemyAbility(Abilities.BAD_DREAMS); vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BAD_DREAMS);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon(); const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH)); game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
@ -380,14 +411,16 @@ describe("Abilities - Magic Guard", () => {
it("Magic Guard prevents damage from abilities with PostFaintContactDamageAbAttr", async() => { it("Magic Guard prevents damage from abilities with PostFaintContactDamageAbAttr", async() => {
//Tests the abilities Innards Out/Aftermath //Tests the abilities Innards Out/Aftermath
game.override.moveset([Moves.TACKLE]); vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]);
game.override.enemyAbility(Abilities.AFTERMATH); vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.AFTERMATH);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon(); const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
const enemyPokemon = game.scene.getEnemyPokemon(); const enemyPokemon = game.scene.getEnemyPokemon();
expect(enemyPokemon).toBeDefined();
enemyPokemon.hp = 1; enemyPokemon.hp = 1;
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE)); game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
@ -405,14 +438,16 @@ describe("Abilities - Magic Guard", () => {
it("Magic Guard prevents damage from abilities with PostDefendContactDamageAbAttr", async() => { it("Magic Guard prevents damage from abilities with PostDefendContactDamageAbAttr", async() => {
//Tests the abilities Iron Barbs/Rough Skin //Tests the abilities Iron Barbs/Rough Skin
game.override.moveset([Moves.TACKLE]); vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]);
game.override.enemyAbility(Abilities.IRON_BARBS); vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.IRON_BARBS);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon(); const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
const enemyPokemon = game.scene.getEnemyPokemon(); const enemyPokemon = game.scene.getEnemyPokemon();
expect(enemyPokemon).toBeDefined();
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE)); game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
await game.phaseInterceptor.to(TurnEndPhase); await game.phaseInterceptor.to(TurnEndPhase);
@ -429,14 +464,16 @@ describe("Abilities - Magic Guard", () => {
it("Magic Guard prevents damage from abilities with ReverseDrainAbAttr", async() => { it("Magic Guard prevents damage from abilities with ReverseDrainAbAttr", async() => {
//Tests the ability Liquid Ooze //Tests the ability Liquid Ooze
game.override.moveset([Moves.ABSORB]); vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.ABSORB]);
game.override.enemyAbility(Abilities.LIQUID_OOZE); vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.LIQUID_OOZE);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon(); const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
const enemyPokemon = game.scene.getEnemyPokemon(); const enemyPokemon = game.scene.getEnemyPokemon();
expect(enemyPokemon).toBeDefined();
game.doAttack(getMovePosition(game.scene, 0, Moves.ABSORB)); game.doAttack(getMovePosition(game.scene, 0, Moves.ABSORB));
await game.phaseInterceptor.to(TurnEndPhase); await game.phaseInterceptor.to(TurnEndPhase);
@ -453,11 +490,12 @@ describe("Abilities - Magic Guard", () => {
it("Magic Guard prevents HP loss from abilities with PostWeatherLapseDamageAbAttr", async() => { it("Magic Guard prevents HP loss from abilities with PostWeatherLapseDamageAbAttr", async() => {
//Tests the abilities Solar Power/Dry Skin //Tests the abilities Solar Power/Dry Skin
game.override.passiveAbility(Abilities.SOLAR_POWER); vi.spyOn(overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.SOLAR_POWER);
game.override.weather(WeatherType.SUNNY); vi.spyOn(overrides, "WEATHER_OVERRIDE", "get").mockReturnValue(WeatherType.SUNNY);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon(); const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH)); game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
await game.phaseInterceptor.to(TurnEndPhase); await game.phaseInterceptor.to(TurnEndPhase);

View File

@ -1,8 +1,12 @@
import { BattleStat } from "#app/data/battle-stat"; import { BattleStat } from "#app/data/battle-stat";
import { Stat } from "#app/data/pokemon-stat"; import { Stat } from "#app/data/pokemon-stat";
import { CommandPhase, EnemyCommandPhase, VictoryPhase } from "#app/phases"; import {
import GameManager from "#test/utils/gameManager"; CommandPhase,
import { getMovePosition } from "#test/utils/gameManagerUtils"; EnemyCommandPhase,
VictoryPhase
} from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Command } from "#app/ui/command-ui-handler"; import { Command } from "#app/ui/command-ui-handler";
import { Mode } from "#app/ui/ui"; import { Mode } from "#app/ui/ui";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";

View File

@ -8,9 +8,9 @@ import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest";
import GameManager from "#test/utils/gameManager"; import GameManager from "../utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "../utils/gameManagerUtils";
import { SPLASH_ONLY } from "#test/utils/testUtils"; import { SPLASH_ONLY } from "../utils/testUtils";
const TIMEOUT = 20 * 1000; const TIMEOUT = 20 * 1000;

View File

@ -1,10 +1,14 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import Phaser from "phaser"; import Phaser from "phaser";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import overrides from "#app/overrides";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { CommandPhase, TurnEndPhase } from "#app/phases"; import {
CommandPhase,
TurnEndPhase,
} from "#app/phases";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { StatusEffect } from "#app/data/status-effect.js"; import { StatusEffect } from "#app/data/status-effect.js";
import { allAbilities } from "#app/data/ability.js"; import { allAbilities } from "#app/data/ability.js";
import { Abilities } from "#app/enums/abilities.js"; import { Abilities } from "#app/enums/abilities.js";
@ -26,11 +30,11 @@ describe("Abilities - Pastel Veil", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleType("double"); vi.spyOn(overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double");
game.override.moveset([Moves.SPLASH]); vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]);
game.override.enemyAbility(Abilities.BALL_FETCH); vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH);
game.override.enemySpecies(Species.MAGIKARP); vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP);
game.override.enemyMoveset([Moves.TOXIC_THREAD, Moves.TOXIC_THREAD, Moves.TOXIC_THREAD, Moves.TOXIC_THREAD]); vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TOXIC_THREAD, Moves.TOXIC_THREAD, Moves.TOXIC_THREAD, Moves.TOXIC_THREAD]);
}); });
it("prevents the user and its allies from being afflicted by poison", async () => { it("prevents the user and its allies from being afflicted by poison", async () => {

View File

@ -1,13 +1,13 @@
import { allMoves } from "#app/data/move.js"; import { allMoves } from "#app/data/move.js";
import { Abilities } from "#app/enums/abilities.js"; import { Abilities } from "#app/enums/abilities.js";
import { MoveEffectPhase, TurnEndPhase } from "#app/phases.js"; import { MoveEffectPhase, TurnEndPhase } from "#app/phases.js";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils"; import { SPLASH_ONLY } from "../utils/testUtils";
describe("Abilities - Power Spot", () => { describe("Abilities - Power Spot", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;

View File

@ -10,9 +10,9 @@ import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest";
import GameManager from "#test/utils/gameManager"; import GameManager from "../utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "../utils/gameManagerUtils";
import { SPLASH_ONLY } from "#test/utils/testUtils"; import { SPLASH_ONLY } from "../utils/testUtils";
const TIMEOUT = 20 * 1000; const TIMEOUT = 20 * 1000;

View File

@ -1,7 +1,7 @@
import { allAbilities, BypassSpeedChanceAbAttr } from "#app/data/ability"; import { allAbilities, BypassSpeedChanceAbAttr } from "#app/data/ability";
import { FaintPhase } from "#app/phases"; import { FaintPhase } from "#app/phases";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";

View File

@ -1,10 +1,10 @@
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "../utils/gameManagerUtils";
import { WeatherType } from "#app/enums/weather-type.js"; import { WeatherType } from "#app/enums/weather-type.js";

View File

@ -7,8 +7,8 @@ import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest";
import GameManager from "#test/utils/gameManager"; import GameManager from "../utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "../utils/gameManagerUtils";
const TIMEOUT = 20 * 1000; const TIMEOUT = 20 * 1000;
@ -45,6 +45,10 @@ describe("Abilities - Sand Veil", () => {
await game.startBattle([Species.SNORLAX, Species.BLISSEY]); await game.startBattle([Species.SNORLAX, Species.BLISSEY]);
const leadPokemon = game.scene.getPlayerField(); const leadPokemon = game.scene.getPlayerField();
leadPokemon.forEach(p => expect(p).toBeDefined());
const enemyPokemon = game.scene.getEnemyField();
enemyPokemon.forEach(p => expect(p).toBeDefined());
vi.spyOn(leadPokemon[0], "getAbility").mockReturnValue(allAbilities[Abilities.SAND_VEIL]); vi.spyOn(leadPokemon[0], "getAbility").mockReturnValue(allAbilities[Abilities.SAND_VEIL]);

View File

@ -1,8 +1,10 @@
import { BattleStat } from "#app/data/battle-stat.js"; import { BattleStat } from "#app/data/battle-stat.js";
import { TerrainType } from "#app/data/terrain.js"; import { TerrainType } from "#app/data/terrain.js";
import { MoveEndPhase, TurnEndPhase } from "#app/phases"; import {
import GameManager from "#test/utils/gameManager"; MoveEndPhase, TurnEndPhase,
import { getMovePosition } from "#test/utils/gameManagerUtils"; } from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { BattlerTagType } from "#enums/battler-tag-type"; import { BattlerTagType } from "#enums/battler-tag-type";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";

View File

@ -1,7 +1,7 @@
import { ArenaTagType } from "#app/enums/arena-tag-type.js"; import { ArenaTagType } from "#app/enums/arena-tag-type.js";
import { PostSummonPhase, TurnEndPhase, } from "#app/phases"; import { PostSummonPhase, TurnEndPhase, } from "#app/phases";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";

View File

@ -1,8 +1,11 @@
import { applyAbAttrs, MoveEffectChanceMultiplierAbAttr } from "#app/data/ability"; import { applyAbAttrs, MoveEffectChanceMultiplierAbAttr } from "#app/data/ability";
import { Stat } from "#app/data/pokemon-stat"; import { Stat } from "#app/data/pokemon-stat";
import { CommandPhase, MoveEffectPhase } from "#app/phases"; import {
import GameManager from "#test/utils/gameManager"; CommandPhase,
import { getMovePosition } from "#test/utils/gameManagerUtils"; MoveEffectPhase,
} from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Command } from "#app/ui/command-ui-handler"; import { Command } from "#app/ui/command-ui-handler";
import { Mode } from "#app/ui/ui"; import { Mode } from "#app/ui/ui";
import * as Utils from "#app/utils"; import * as Utils from "#app/utils";

View File

@ -1,8 +1,11 @@
import { applyAbAttrs, applyPostDefendAbAttrs, applyPreAttackAbAttrs, MoveEffectChanceMultiplierAbAttr, MovePowerBoostAbAttr, PostDefendTypeChangeAbAttr } from "#app/data/ability"; import { applyAbAttrs, applyPostDefendAbAttrs, applyPreAttackAbAttrs, MoveEffectChanceMultiplierAbAttr, MovePowerBoostAbAttr, PostDefendTypeChangeAbAttr } from "#app/data/ability";
import { Stat } from "#app/data/pokemon-stat"; import { Stat } from "#app/data/pokemon-stat";
import { CommandPhase, MoveEffectPhase } from "#app/phases"; import {
import GameManager from "#test/utils/gameManager"; CommandPhase,
import { getMovePosition } from "#test/utils/gameManagerUtils"; MoveEffectPhase,
} from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Command } from "#app/ui/command-ui-handler"; import { Command } from "#app/ui/command-ui-handler";
import { Mode } from "#app/ui/ui"; import { Mode } from "#app/ui/ui";
import * as Utils from "#app/utils"; import * as Utils from "#app/utils";

View File

@ -1,8 +1,11 @@
import { applyAbAttrs, applyPreDefendAbAttrs, IgnoreMoveEffectsAbAttr, MoveEffectChanceMultiplierAbAttr } from "#app/data/ability"; import { applyAbAttrs, applyPreDefendAbAttrs, IgnoreMoveEffectsAbAttr, MoveEffectChanceMultiplierAbAttr } from "#app/data/ability";
import { Stat } from "#app/data/pokemon-stat"; import { Stat } from "#app/data/pokemon-stat";
import { CommandPhase, MoveEffectPhase } from "#app/phases"; import {
import GameManager from "#test/utils/gameManager"; CommandPhase,
import { getMovePosition } from "#test/utils/gameManagerUtils"; MoveEffectPhase,
} from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Command } from "#app/ui/command-ui-handler"; import { Command } from "#app/ui/command-ui-handler";
import { Mode } from "#app/ui/ui"; import { Mode } from "#app/ui/ui";
import * as Utils from "#app/utils"; import * as Utils from "#app/utils";

View File

@ -2,13 +2,13 @@ import { allAbilities } from "#app/data/ability.js";
import { allMoves } from "#app/data/move.js"; import { allMoves } from "#app/data/move.js";
import { Abilities } from "#app/enums/abilities.js"; import { Abilities } from "#app/enums/abilities.js";
import { MoveEffectPhase, SelectTargetPhase } from "#app/phases.js"; import { MoveEffectPhase, SelectTargetPhase } from "#app/phases.js";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils"; import { SPLASH_ONLY } from "../utils/testUtils";
describe("Abilities - Steely Spirit", () => { describe("Abilities - Steely Spirit", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;

View File

@ -1,7 +1,10 @@
import { EnemyPokemon } from "#app/field/pokemon.js"; import { EnemyPokemon } from "#app/field/pokemon.js";
import { DamagePhase, MoveEndPhase } from "#app/phases"; import {
import GameManager from "#test/utils/gameManager"; DamagePhase,
import { getMovePosition } from "#test/utils/gameManagerUtils"; MoveEndPhase,
} from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";

View File

@ -1,14 +1,19 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import Phaser from "phaser"; import Phaser from "phaser";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import overrides from "#app/overrides";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { CommandPhase, MoveEffectPhase, MovePhase, TurnEndPhase } from "#app/phases"; import {
CommandPhase,
MoveEffectPhase,
MovePhase,
TurnEndPhase,
} from "#app/phases";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { BattlerTagType } from "#app/enums/battler-tag-type.js"; import { BattlerTagType } from "#app/enums/battler-tag-type.js";
import { Abilities } from "#app/enums/abilities.js"; import { Abilities } from "#app/enums/abilities.js";
import { BattlerIndex } from "#app/battle.js"; import { BattlerIndex } from "#app/battle.js";
import { SPLASH_ONLY } from "#test/utils/testUtils";
describe("Abilities - Sweet Veil", () => { describe("Abilities - Sweet Veil", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -26,11 +31,11 @@ describe("Abilities - Sweet Veil", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleType("double"); vi.spyOn(overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double");
game.override.moveset([Moves.SPLASH, Moves.REST]); vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.REST]);
game.override.enemySpecies(Species.MAGIKARP); vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP);
game.override.enemyAbility(Abilities.BALL_FETCH); vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH);
game.override.enemyMoveset([Moves.POWDER, Moves.POWDER, Moves.POWDER, Moves.POWDER]); vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.POWDER, Moves.POWDER, Moves.POWDER, Moves.POWDER]);
}); });
it("prevents the user and its allies from falling asleep", async () => { it("prevents the user and its allies from falling asleep", async () => {
@ -45,7 +50,7 @@ describe("Abilities - Sweet Veil", () => {
}); });
it("causes Rest to fail when used by the user or its allies", async () => { it("causes Rest to fail when used by the user or its allies", async () => {
game.override.enemyMoveset(SPLASH_ONLY); vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]);
await game.startBattle([Species.SWIRLIX, Species.MAGIKARP]); await game.startBattle([Species.SWIRLIX, Species.MAGIKARP]);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH)); game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
@ -57,7 +62,7 @@ describe("Abilities - Sweet Veil", () => {
}); });
it("causes Yawn to fail if used on the user or its allies", async () => { it("causes Yawn to fail if used on the user or its allies", async () => {
game.override.enemyMoveset([Moves.YAWN, Moves.YAWN, Moves.YAWN, Moves.YAWN]); vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.YAWN, Moves.YAWN, Moves.YAWN, Moves.YAWN]);
await game.startBattle([Species.SWIRLIX, Species.MAGIKARP]); await game.startBattle([Species.SWIRLIX, Species.MAGIKARP]);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH)); game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
@ -69,10 +74,10 @@ describe("Abilities - Sweet Veil", () => {
}); });
it("prevents the user and its allies already drowsy due to Yawn from falling asleep.", async () => { it("prevents the user and its allies already drowsy due to Yawn from falling asleep.", async () => {
game.override.enemySpecies(Species.PIKACHU); vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.PIKACHU);
game.override.enemyLevel(5); vi.spyOn(overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(5);
game.override.startingLevel(5); vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(5);
game.override.enemyMoveset([Moves.YAWN, Moves.YAWN, Moves.YAWN, Moves.YAWN]); vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.YAWN, Moves.YAWN, Moves.YAWN, Moves.YAWN]);
await game.startBattle([Species.SHUCKLE, Species.SHUCKLE, Species.SWIRLIX]); await game.startBattle([Species.SHUCKLE, Species.SHUCKLE, Species.SWIRLIX]);

View File

@ -4,8 +4,8 @@ import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
import GameManager from "#test/utils/gameManager"; import GameManager from "../utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "../utils/gameManagerUtils";
const TIMEOUT = 20 * 1000; const TIMEOUT = 20 * 1000;

View File

@ -1,7 +1,9 @@
import { BattleStat } from "#app/data/battle-stat.js"; import { BattleStat } from "#app/data/battle-stat.js";
import { TurnEndPhase } from "#app/phases"; import {
import GameManager from "#test/utils/gameManager"; TurnEndPhase,
import { getMovePosition } from "#test/utils/gameManagerUtils"; } from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { BattlerTagType } from "#enums/battler-tag-type"; import { BattlerTagType } from "#enums/battler-tag-type";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";

View File

@ -1,13 +1,15 @@
import { BattlerTagType } from "#app/enums/battler-tag-type.js"; import { BattlerTagType } from "#app/enums/battler-tag-type.js";
import { TurnEndPhase } from "#app/phases"; import {
import GameManager from "#test/utils/gameManager"; TurnEndPhase,
import { getMovePosition } from "#test/utils/gameManagerUtils"; } from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils"; import { SPLASH_ONLY } from "../utils/testUtils";
describe("Abilities - Wind Power", () => { describe("Abilities - Wind Power", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;

View File

@ -1,13 +1,15 @@
import { BattleStat } from "#app/data/battle-stat.js"; import { BattleStat } from "#app/data/battle-stat.js";
import { TurnEndPhase } from "#app/phases"; import {
import GameManager from "#test/utils/gameManager"; TurnEndPhase,
import { getMovePosition } from "#test/utils/gameManagerUtils"; } from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils"; import { SPLASH_ONLY } from "../utils/testUtils";
describe("Abilities - Wind Rider", () => { describe("Abilities - Wind Rider", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;

View File

@ -1,14 +1,14 @@
import { allAbilities } from "#app/data/ability.js"; import { allAbilities } from "#app/data/ability.js";
import { allMoves } from "#app/data/move.js"; import { allMoves } from "#app/data/move.js";
import { MoveEffectPhase } from "#app/phases"; import { MoveEffectPhase } from "#app/phases";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils"; import { SPLASH_ONLY } from "../utils/testUtils";
describe("Abilities - Wonder Skin", () => { describe("Abilities - Wonder Skin", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;

View File

@ -1,9 +1,20 @@
import { Stat } from "#app/data/pokemon-stat"; import { Stat } from "#app/data/pokemon-stat";
import { Status, StatusEffect } from "#app/data/status-effect.js"; import { Status, StatusEffect } from "#app/data/status-effect.js";
import { QuietFormChangePhase } from "#app/form-change-phase"; import { QuietFormChangePhase } from "#app/form-change-phase";
import { CommandPhase, DamagePhase, EnemyCommandPhase, MessagePhase, PostSummonPhase, SwitchPhase, SwitchSummonPhase, TurnEndPhase, TurnInitPhase, TurnStartPhase } from "#app/phases"; import {
import GameManager from "#test/utils/gameManager"; CommandPhase,
import { getMovePosition } from "#test/utils/gameManagerUtils"; DamagePhase,
EnemyCommandPhase,
MessagePhase,
PostSummonPhase,
SwitchPhase,
SwitchSummonPhase,
TurnEndPhase,
TurnInitPhase,
TurnStartPhase,
} from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Command } from "#app/ui/command-ui-handler"; import { Command } from "#app/ui/command-ui-handler";
import { Mode } from "#app/ui/ui"; import { Mode } from "#app/ui/ui";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";

View File

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

View File

@ -1,9 +1,12 @@
import { allMoves } from "#app/data/move.js"; import { allMoves } from "#app/data/move.js";
import { Abilities } from "#app/enums/abilities.js"; import { Abilities } from "#app/enums/abilities.js";
import { ArenaTagType } from "#app/enums/arena-tag-type.js"; import { ArenaTagType } from "#app/enums/arena-tag-type.js";
import { MoveEffectPhase, TurnEndPhase } from "#app/phases"; import {
import GameManager from "#test/utils/gameManager"; MoveEffectPhase,
import { getMovePosition } from "#test/utils/gameManagerUtils"; TurnEndPhase,
} from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";

View File

@ -1,9 +1,11 @@
import { allMoves } from "#app/data/move.js"; import { allMoves } from "#app/data/move.js";
import { WeatherType } from "#app/data/weather.js"; import { WeatherType } from "#app/data/weather.js";
import { Abilities } from "#app/enums/abilities.js"; import { Abilities } from "#app/enums/abilities.js";
import { MoveEffectPhase } from "#app/phases"; import {
import GameManager from "#test/utils/gameManager"; MoveEffectPhase,
import { getMovePosition } from "#test/utils/gameManagerUtils"; } from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";

View File

@ -1,7 +1,9 @@
import { allMoves } from "#app/data/move.js"; import { allMoves } from "#app/data/move.js";
import { TurnStartPhase } from "#app/phases"; import {
import GameManager from "#test/utils/gameManager"; TurnStartPhase,
import { getMovePosition } from "#test/utils/gameManagerUtils"; } from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";

View File

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

View File

@ -1,7 +1,10 @@
import { Stat } from "#app/data/pokemon-stat"; import { Stat } from "#app/data/pokemon-stat";
import { CommandPhase, EnemyCommandPhase, SelectTargetPhase, TurnStartPhase } from "#app/phases"; import {
import GameManager from "#test/utils/gameManager"; CommandPhase, EnemyCommandPhase, SelectTargetPhase,
import { getMovePosition } from "#test/utils/gameManagerUtils"; TurnStartPhase
} from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Command } from "#app/ui/command-ui-handler"; import { Command } from "#app/ui/command-ui-handler";
import TargetSelectUiHandler from "#app/ui/target-select-ui-handler"; import TargetSelectUiHandler from "#app/ui/target-select-ui-handler";
import { Mode } from "#app/ui/ui"; import { Mode } from "#app/ui/ui";

View File

@ -1,9 +1,20 @@
import { allSpecies } from "#app/data/pokemon-species"; import { allSpecies } from "#app/data/pokemon-species";
import { GameModes } from "#app/game-mode"; import { GameModes } from "#app/game-mode";
import { getGameMode } from "#app/game-mode.js"; import { getGameMode } from "#app/game-mode.js";
import { CommandPhase, DamagePhase, EncounterPhase, EnemyCommandPhase, LoginPhase, SelectGenderPhase, SelectModifierPhase, SelectStarterPhase, SummonPhase, TitlePhase, TurnInitPhase, VictoryPhase } from "#app/phases"; import {
import GameManager from "#test/utils/gameManager"; CommandPhase, DamagePhase,
import { generateStarter, getMovePosition, } from "#test/utils/gameManagerUtils"; EncounterPhase,
EnemyCommandPhase,
LoginPhase,
SelectGenderPhase,
SelectModifierPhase,
SelectStarterPhase,
SummonPhase,
TitlePhase,
TurnInitPhase, VictoryPhase,
} from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { generateStarter, getMovePosition, } from "#app/test/utils/gameManagerUtils";
import { Command } from "#app/ui/command-ui-handler"; import { Command } from "#app/ui/command-ui-handler";
import { Mode } from "#app/ui/ui"; import { Mode } from "#app/ui/ui";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";

View File

@ -1,11 +1,14 @@
import { BattleEndPhase, TurnInitPhase } from "#app/phases"; import {
import GameManager from "#test/utils/gameManager"; BattleEndPhase,
import { getMovePosition, } from "#test/utils/gameManagerUtils"; TurnInitPhase,
} from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition, } from "#app/test/utils/gameManagerUtils";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils"; import { SPLASH_ONLY } from "../utils/testUtils";
import { Status, StatusEffect } from "#app/data/status-effect.js"; import { Status, StatusEffect } from "#app/data/status-effect.js";
describe("Test Battle Phase", () => { describe("Test Battle Phase", () => {
@ -40,6 +43,8 @@ describe("Test Battle Phase", () => {
game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH)); game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH));
for (const pokemon of game.scene.getPlayerField()) { for (const pokemon of game.scene.getPlayerField()) {
expect(pokemon).toBeDefined();
pokemon.hp = 0; pokemon.hp = 0;
pokemon.status = new Status(StatusEffect.FAINT); pokemon.status = new Status(StatusEffect.FAINT);
expect(pokemon.isFainted()).toBe(true); expect(pokemon.isFainted()).toBe(true);

View File

@ -1,4 +1,4 @@
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";

View File

@ -1,5 +1,7 @@
import { CommandPhase } from "#app/phases"; import {
import GameManager from "#test/utils/gameManager"; CommandPhase,
} from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { Mode } from "#app/ui/ui"; import { Mode } from "#app/ui/ui";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";

View File

@ -1,4 +1,4 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest";
import BattleScene from "../../battle-scene"; import BattleScene from "../../battle-scene";
import { Egg, getLegendaryGachaSpeciesForTimestamp } from "#app/data/egg.js"; import { Egg, getLegendaryGachaSpeciesForTimestamp } from "#app/data/egg.js";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
@ -6,7 +6,7 @@ import Phaser from "phaser";
import { EggSourceType } from "#app/enums/egg-source-types.js"; import { EggSourceType } from "#app/enums/egg-source-types.js";
import { EggTier } from "#app/enums/egg-type.js"; import { EggTier } from "#app/enums/egg-type.js";
import { VariantTier } from "#app/enums/variant-tiers.js"; import { VariantTier } from "#app/enums/variant-tiers.js";
import GameManager from "#test/utils/gameManager"; import GameManager from "../utils/gameManager";
import EggData from "#app/system/egg-data.js"; import EggData from "#app/system/egg-data.js";
import * as Utils from "#app/utils.js"; import * as Utils from "#app/utils.js";

View File

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

View File

@ -1,6 +1,6 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import Phaser from "phaser"; import Phaser from "phaser";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import * as Utils from "#app/utils"; import * as Utils from "#app/utils";

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@ import { Stat } from "#app/data/pokemon-stat";
import { EvolutionStatBoosterModifier } from "#app/modifier/modifier"; import { EvolutionStatBoosterModifier } from "#app/modifier/modifier";
import { modifierTypes } from "#app/modifier/modifier-type"; import { modifierTypes } from "#app/modifier/modifier-type";
import i18next from "#app/plugins/i18n"; import i18next from "#app/plugins/i18n";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import * as Utils from "#app/utils"; import * as Utils from "#app/utils";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phase from "phaser"; import Phase from "phaser";

View File

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

View File

@ -5,10 +5,10 @@ import { BerryType } from "#app/enums/berry-type.js";
import { Moves } from "#app/enums/moves.js"; import { Moves } from "#app/enums/moves.js";
import { Species } from "#app/enums/species.js"; import { Species } from "#app/enums/species.js";
import { CommandPhase, MoveEndPhase, SelectTargetPhase } from "#app/phases.js"; import { CommandPhase, MoveEndPhase, SelectTargetPhase } from "#app/phases.js";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import Phase from "phaser"; import Phase from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "../utils/gameManagerUtils";
const TIMEOUT = 20 * 1000; // 20 seconds const TIMEOUT = 20 * 1000; // 20 seconds
@ -54,7 +54,11 @@ describe("Items - Grip Claw", () => {
async () => { async () => {
await game.startBattle([Species.PANSEAR, Species.ROWLET, Species.PANPOUR, Species.PANSAGE, Species.CHARMANDER, Species.SQUIRTLE]); await game.startBattle([Species.PANSEAR, Species.ROWLET, Species.PANPOUR, Species.PANSAGE, Species.CHARMANDER, Species.SQUIRTLE]);
const playerPokemon = game.scene.getPlayerField();
playerPokemon.forEach(p => expect(p).toBeDefined());
const enemyPokemon = game.scene.getEnemyField(); const enemyPokemon = game.scene.getEnemyField();
enemyPokemon.forEach(p => expect(p).toBeDefined());
const enemyHeldItemCt = enemyPokemon.map(p => p.getHeldItems.length); const enemyHeldItemCt = enemyPokemon.map(p => p.getHeldItems.length);

View File

@ -2,7 +2,7 @@ import { BattlerIndex } from "#app/battle";
import { CritBoosterModifier } from "#app/modifier/modifier"; import { CritBoosterModifier } from "#app/modifier/modifier";
import { modifierTypes } from "#app/modifier/modifier-type"; import { modifierTypes } from "#app/modifier/modifier-type";
import { MoveEffectPhase, TurnStartPhase } from "#app/phases"; import { MoveEffectPhase, TurnStartPhase } from "#app/phases";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import * as Utils from "#app/utils"; import * as Utils from "#app/utils";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";

View File

@ -1,6 +1,6 @@
import { DamagePhase, TurnEndPhase } from "#app/phases"; import { DamagePhase, TurnEndPhase } from "#app/phases";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
@ -41,6 +41,10 @@ describe("Items - Leftovers", () => {
expect(game.scene.modifiers[0].type.id).toBe("LEFTOVERS"); expect(game.scene.modifiers[0].type.id).toBe("LEFTOVERS");
const leadPokemon = game.scene.getPlayerPokemon(); const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
const enemyPokemon = game.scene.getEnemyPokemon();
expect(enemyPokemon).toBeDefined();
// We should have full hp // We should have full hp
expect(leadPokemon.isFullHp()).toBe(true); expect(leadPokemon.isFullHp()).toBe(true);

View File

@ -2,7 +2,7 @@ import { Stat } from "#app/data/pokemon-stat";
import { SpeciesStatBoosterModifier } from "#app/modifier/modifier"; import { SpeciesStatBoosterModifier } from "#app/modifier/modifier";
import { modifierTypes } from "#app/modifier/modifier-type"; import { modifierTypes } from "#app/modifier/modifier-type";
import i18next from "#app/plugins/i18n"; import i18next from "#app/plugins/i18n";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import * as Utils from "#app/utils"; import * as Utils from "#app/utils";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phase from "phaser"; import Phase from "phaser";

View File

@ -2,7 +2,7 @@ import { Stat } from "#app/data/pokemon-stat";
import { SpeciesStatBoosterModifier } from "#app/modifier/modifier"; import { SpeciesStatBoosterModifier } from "#app/modifier/modifier";
import { modifierTypes } from "#app/modifier/modifier-type"; import { modifierTypes } from "#app/modifier/modifier-type";
import i18next from "#app/plugins/i18n"; import i18next from "#app/plugins/i18n";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import * as Utils from "#app/utils"; import * as Utils from "#app/utils";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phase from "phaser"; import Phase from "phaser";

View File

@ -2,7 +2,7 @@ import { Stat } from "#app/data/pokemon-stat";
import { SpeciesStatBoosterModifier } from "#app/modifier/modifier"; import { SpeciesStatBoosterModifier } from "#app/modifier/modifier";
import { modifierTypes } from "#app/modifier/modifier-type"; import { modifierTypes } from "#app/modifier/modifier-type";
import i18next from "#app/plugins/i18n"; import i18next from "#app/plugins/i18n";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import * as Utils from "#app/utils"; import * as Utils from "#app/utils";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phase from "phaser"; import Phase from "phaser";

View File

@ -2,7 +2,7 @@ import { BattlerIndex } from "#app/battle";
import { CritBoosterModifier } from "#app/modifier/modifier"; import { CritBoosterModifier } from "#app/modifier/modifier";
import { modifierTypes } from "#app/modifier/modifier-type"; import { modifierTypes } from "#app/modifier/modifier-type";
import { MoveEffectPhase, TurnStartPhase } from "#app/phases"; import { MoveEffectPhase, TurnStartPhase } from "#app/phases";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import * as Utils from "#app/utils"; import * as Utils from "#app/utils";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";

View File

@ -2,7 +2,7 @@ import { Stat } from "#app/data/pokemon-stat";
import { SpeciesStatBoosterModifier } from "#app/modifier/modifier"; import { SpeciesStatBoosterModifier } from "#app/modifier/modifier";
import { modifierTypes } from "#app/modifier/modifier-type"; import { modifierTypes } from "#app/modifier/modifier-type";
import i18next from "#app/plugins/i18n"; import i18next from "#app/plugins/i18n";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import * as Utils from "#app/utils"; import * as Utils from "#app/utils";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phase from "phaser"; import Phase from "phaser";

View File

@ -1,8 +1,13 @@
import { StatusEffect } from "#app/data/status-effect"; import { StatusEffect } from "#app/data/status-effect";
import { CommandPhase, EnemyCommandPhase, MessagePhase, TurnEndPhase } from "#app/phases"; import {
CommandPhase,
EnemyCommandPhase,
MessagePhase,
TurnEndPhase,
} from "#app/phases";
import i18next, { initI18n } from "#app/plugins/i18n"; import i18next, { initI18n } from "#app/plugins/i18n";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Command } from "#app/ui/command-ui-handler"; import { Command } from "#app/ui/command-ui-handler";
import { Mode } from "#app/ui/ui"; import { Mode } from "#app/ui/ui";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";

View File

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

View File

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

View File

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

View File

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

View File

@ -6,8 +6,8 @@ import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest";
import GameManager from "#test/utils/gameManager"; import GameManager from "../utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "../utils/gameManagerUtils";
const TIMEOUT = 20 * 1000; const TIMEOUT = 20 * 1000;
@ -44,8 +44,10 @@ describe("Moves - Astonish", () => {
await game.startBattle([Species.MEOWSCARADA]); await game.startBattle([Species.MEOWSCARADA]);
const leadPokemon = game.scene.getPlayerPokemon(); const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
const enemyPokemon = game.scene.getEnemyPokemon(); const enemyPokemon = game.scene.getEnemyPokemon();
expect(enemyPokemon).toBeDefined();
game.doAttack(getMovePosition(game.scene, 0, Moves.ASTONISH)); game.doAttack(getMovePosition(game.scene, 0, Moves.ASTONISH));

View File

@ -4,9 +4,11 @@ import { WeatherType } from "#app/data/weather.js";
import { Abilities } from "#app/enums/abilities.js"; import { Abilities } from "#app/enums/abilities.js";
import { ArenaTagType } from "#app/enums/arena-tag-type.js"; import { ArenaTagType } from "#app/enums/arena-tag-type.js";
import Pokemon from "#app/field/pokemon.js"; import Pokemon from "#app/field/pokemon.js";
import { TurnEndPhase } from "#app/phases"; import {
import GameManager from "#test/utils/gameManager"; TurnEndPhase,
import { getMovePosition } from "#test/utils/gameManagerUtils"; } from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { NumberHolder } from "#app/utils.js"; import { NumberHolder } from "#app/utils.js";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";

View File

@ -1,10 +1,11 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import Phaser from "phaser"; import Phaser from "phaser";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { Species } from "#app/enums/species.js"; import { Species } from "#app/enums/species.js";
import { Moves } from "#app/enums/moves.js"; import { Moves } from "#app/enums/moves.js";
import { Abilities } from "#app/enums/abilities.js"; import { Abilities } from "#app/enums/abilities.js";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "../utils/gameManagerUtils";
import { MoveEffectPhase } from "#app/phases.js"; import { MoveEffectPhase } from "#app/phases.js";
import { StatusEffect } from "#app/enums/status-effect.js"; import { StatusEffect } from "#app/enums/status-effect.js";
@ -26,15 +27,15 @@ describe("Moves - Beat Up", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleType("single"); vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single");
game.override.enemySpecies(Species.SNORLAX); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX);
game.override.enemyLevel(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100);
game.override.enemyMoveset(Array(4).fill(Moves.SPLASH)); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(Array(4).fill(Moves.SPLASH));
game.override.enemyAbility(Abilities.INSOMNIA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA);
game.override.startingLevel(100); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100);
game.override.moveset([Moves.BEAT_UP]); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.BEAT_UP]);
}); });
it( it(
@ -81,7 +82,7 @@ describe("Moves - Beat Up", () => {
it( it(
"should hit twice for each player Pokemon if the user has Multi-Lens", "should hit twice for each player Pokemon if the user has Multi-Lens",
async () => { async () => {
game.override.startingHeldItems([{name: "MULTI_LENS", count: 1}]); vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "MULTI_LENS", count: 1}]);
await game.startBattle([Species.MAGIKARP, Species.BULBASAUR, Species.CHARMANDER, Species.SQUIRTLE, Species.PIKACHU, Species.EEVEE]); await game.startBattle([Species.MAGIKARP, Species.BULBASAUR, Species.CHARMANDER, Species.SQUIRTLE, Species.PIKACHU, Species.EEVEE]);
const playerPokemon = game.scene.getPlayerPokemon(); const playerPokemon = game.scene.getPlayerPokemon();

View File

@ -1,8 +1,11 @@
import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; import {afterEach, beforeAll, beforeEach, describe, expect, test, vi} from "vitest";
import Phaser from "phaser"; import Phaser from "phaser";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import { TurnEndPhase } from "#app/phases"; import overrides from "#app/overrides";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import {
TurnEndPhase,
} from "#app/phases";
import {getMovePosition} from "#app/test/utils/gameManagerUtils";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { BattleStat } from "#app/data/battle-stat"; import { BattleStat } from "#app/data/battle-stat";
@ -29,10 +32,10 @@ describe("Moves - BELLY DRUM", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.starterSpecies(Species.MAGIKARP); vi.spyOn(overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP);
game.override.enemySpecies(Species.SNORLAX); vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX);
game.override.startingLevel(100); vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100);
game.override.enemyLevel(100); vi.spyOn(overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100);
game.override.moveset([Moves.BELLY_DRUM]); game.override.moveset([Moves.BELLY_DRUM]);
game.override.enemyMoveset([Moves.SPLASH]); game.override.enemyMoveset([Moves.SPLASH]);
}); });
@ -44,6 +47,7 @@ describe("Moves - BELLY DRUM", () => {
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon(); const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
const hpLost = Math.floor(leadPokemon.getMaxHp() / RATIO); const hpLost = Math.floor(leadPokemon.getMaxHp() / RATIO);
game.doAttack(getMovePosition(game.scene, 0, Moves.BELLY_DRUM)); game.doAttack(getMovePosition(game.scene, 0, Moves.BELLY_DRUM));
@ -59,6 +63,7 @@ describe("Moves - BELLY DRUM", () => {
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon(); const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
const hpLost = Math.floor(leadPokemon.getMaxHp() / RATIO); const hpLost = Math.floor(leadPokemon.getMaxHp() / RATIO);
// Here - BattleStat.ATK -> -3 and BattleStat.SPATK -> 6 // Here - BattleStat.ATK -> -3 and BattleStat.SPATK -> 6
@ -79,6 +84,7 @@ describe("Moves - BELLY DRUM", () => {
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon(); const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
leadPokemon.summonData.battleStats[BattleStat.ATK] = 6; leadPokemon.summonData.battleStats[BattleStat.ATK] = 6;
@ -95,6 +101,7 @@ describe("Moves - BELLY DRUM", () => {
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon(); const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
const hpLost = Math.floor(leadPokemon.getMaxHp() / RATIO); const hpLost = Math.floor(leadPokemon.getMaxHp() / RATIO);
leadPokemon.hp = hpLost - PREDAMAGE; leadPokemon.hp = hpLost - PREDAMAGE;

View File

@ -2,9 +2,12 @@ import { ArenaTagSide, ArenaTrapTag } from "#app/data/arena-tag";
import { allMoves } from "#app/data/move"; import { allMoves } from "#app/data/move";
import { Abilities } from "#app/enums/abilities"; import { Abilities } from "#app/enums/abilities";
import { ArenaTagType } from "#app/enums/arena-tag-type"; import { ArenaTagType } from "#app/enums/arena-tag-type";
import { MoveEffectPhase, TurnEndPhase } from "#app/phases"; import {
import GameManager from "#test/utils/gameManager"; MoveEffectPhase,
import { getMovePosition } from "#test/utils/gameManagerUtils"; TurnEndPhase
} from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";
@ -45,7 +48,11 @@ describe("Moves - Ceaseless Edge", () => {
async () => { async () => {
await game.startBattle([ Species.ILLUMISE ]); await game.startBattle([ Species.ILLUMISE ]);
const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
const enemyPokemon = game.scene.getEnemyPokemon(); const enemyPokemon = game.scene.getEnemyPokemon();
expect(enemyPokemon).toBeDefined();
const enemyStartingHp = enemyPokemon.hp; const enemyStartingHp = enemyPokemon.hp;
@ -70,7 +77,11 @@ describe("Moves - Ceaseless Edge", () => {
game.override.startingHeldItems([{name: "MULTI_LENS"}]); game.override.startingHeldItems([{name: "MULTI_LENS"}]);
await game.startBattle([ Species.ILLUMISE ]); await game.startBattle([ Species.ILLUMISE ]);
const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
const enemyPokemon = game.scene.getEnemyPokemon(); const enemyPokemon = game.scene.getEnemyPokemon();
expect(enemyPokemon).toBeDefined();
const enemyStartingHp = enemyPokemon.hp; const enemyStartingHp = enemyPokemon.hp;
@ -97,6 +108,12 @@ describe("Moves - Ceaseless Edge", () => {
await game.startBattle([ Species.ILLUMISE ]); await game.startBattle([ Species.ILLUMISE ]);
const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
const enemyPokemon = game.scene.getEnemyPokemon();
expect(enemyPokemon).toBeDefined();
game.doAttack(getMovePosition(game.scene, 0, Moves.CEASELESS_EDGE)); game.doAttack(getMovePosition(game.scene, 0, Moves.CEASELESS_EDGE));
await game.phaseInterceptor.to(MoveEffectPhase, false); await game.phaseInterceptor.to(MoveEffectPhase, false);
// Spikes should not have any layers before move effect is applied // Spikes should not have any layers before move effect is applied

View File

@ -1,17 +1,19 @@
import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; import {afterEach, beforeAll, beforeEach, describe, expect, test, vi} from "vitest";
import Phaser from "phaser"; import Phaser from "phaser";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import { TurnEndPhase } from "#app/phases"; import overrides from "#app/overrides";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import {
TurnEndPhase,
} from "#app/phases";
import {getMovePosition} from "#app/test/utils/gameManagerUtils";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { BattleStat } from "#app/data/battle-stat"; import { BattleStat } from "#app/data/battle-stat";
import { SPLASH_ONLY } from "#test/utils/testUtils";
const TIMEOUT = 20 * 1000; const TIMEOUT = 20 * 1000;
/** HP Cost of Move */ // RATIO : HP Cost of Move
const RATIO = 3; const RATIO = 3;
/** Amount of extra HP lost */ // PREDAMAGE : Amount of extra HP lost
const PREDAMAGE = 15; const PREDAMAGE = 15;
describe("Moves - CLANGOROUS_SOUL", () => { describe("Moves - CLANGOROUS_SOUL", () => {
@ -30,12 +32,12 @@ describe("Moves - CLANGOROUS_SOUL", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.starterSpecies(Species.MAGIKARP); vi.spyOn(overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP);
game.override.enemySpecies(Species.SNORLAX); vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX);
game.override.startingLevel(100); vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100);
game.override.enemyLevel(100); vi.spyOn(overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100);
game.override.moveset([Moves.CLANGOROUS_SOUL]); game.override.moveset([Moves.CLANGOROUS_SOUL]);
game.override.enemyMoveset(SPLASH_ONLY); game.override.enemyMoveset([Moves.SPLASH]);
}); });
//Bulbapedia Reference: https://bulbapedia.bulbagarden.net/wiki/Clangorous_Soul_(move) //Bulbapedia Reference: https://bulbapedia.bulbagarden.net/wiki/Clangorous_Soul_(move)
@ -45,6 +47,7 @@ describe("Moves - CLANGOROUS_SOUL", () => {
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon(); const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
const hpLost = Math.floor(leadPokemon.getMaxHp() / RATIO); const hpLost = Math.floor(leadPokemon.getMaxHp() / RATIO);
game.doAttack(getMovePosition(game.scene, 0, Moves.CLANGOROUS_SOUL)); game.doAttack(getMovePosition(game.scene, 0, Moves.CLANGOROUS_SOUL));
@ -64,6 +67,7 @@ describe("Moves - CLANGOROUS_SOUL", () => {
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon(); const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
const hpLost = Math.floor(leadPokemon.getMaxHp() / RATIO); const hpLost = Math.floor(leadPokemon.getMaxHp() / RATIO);
//Here - BattleStat.SPD -> 0 and BattleStat.SPDEF -> 4 //Here - BattleStat.SPD -> 0 and BattleStat.SPDEF -> 4
@ -89,6 +93,7 @@ describe("Moves - CLANGOROUS_SOUL", () => {
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon(); const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
leadPokemon.summonData.battleStats[BattleStat.ATK] = 6; leadPokemon.summonData.battleStats[BattleStat.ATK] = 6;
leadPokemon.summonData.battleStats[BattleStat.DEF] = 6; leadPokemon.summonData.battleStats[BattleStat.DEF] = 6;
@ -113,6 +118,7 @@ describe("Moves - CLANGOROUS_SOUL", () => {
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon(); const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
const hpLost = Math.floor(leadPokemon.getMaxHp() / RATIO); const hpLost = Math.floor(leadPokemon.getMaxHp() / RATIO);
leadPokemon.hp = hpLost - PREDAMAGE; leadPokemon.hp = hpLost - PREDAMAGE;

View File

@ -1,8 +1,10 @@
import { BattleStat } from "#app/data/battle-stat.js"; import { BattleStat } from "#app/data/battle-stat.js";
import { Abilities } from "#app/enums/abilities.js"; import { Abilities } from "#app/enums/abilities.js";
import { TurnEndPhase } from "#app/phases"; import {
import GameManager from "#test/utils/gameManager"; TurnEndPhase,
import { getMovePosition } from "#test/utils/gameManagerUtils"; } from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";

View File

@ -4,14 +4,14 @@ import { Species } from "#app/enums/species.js";
import { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon"; import { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon";
import { modifierTypes } from "#app/modifier/modifier-type"; import { modifierTypes } from "#app/modifier/modifier-type";
import { TurnEndPhase } from "#app/phases"; import { TurnEndPhase } from "#app/phases";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { BattlerTagType } from "#enums/battler-tag-type"; import { BattlerTagType } from "#enums/battler-tag-type";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils"; import { SPLASH_ONLY } from "../utils/testUtils";
describe("Moves - Dragon Rage", () => { describe("Moves - Dragon Rage", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;

View File

@ -1,8 +1,8 @@
import { BattlerIndex } from "#app/battle"; import { BattlerIndex } from "#app/battle";
import { allMoves } from "#app/data/move"; import { allMoves } from "#app/data/move";
import { DamagePhase, MoveEffectPhase, TurnStartPhase } from "#app/phases"; import { DamagePhase, MoveEffectPhase, TurnStartPhase } from "#app/phases";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";

View File

@ -1,17 +1,19 @@
import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; import {afterEach, beforeAll, beforeEach, describe, expect, test, vi} from "vitest";
import Phaser from "phaser"; import Phaser from "phaser";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import { TurnEndPhase } from "#app/phases"; import overrides from "#app/overrides";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import {
TurnEndPhase,
} from "#app/phases";
import {getMovePosition} from "#app/test/utils/gameManagerUtils";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { BattleStat } from "#app/data/battle-stat"; import { BattleStat } from "#app/data/battle-stat";
import { SPLASH_ONLY } from "#test/utils/testUtils";
const TIMEOUT = 20 * 1000; const TIMEOUT = 20 * 1000;
/** HP Cost of Move */ // RATIO : HP Cost of Move
const RATIO = 2; const RATIO = 2;
/** Amount of extra HP lost */ // PREDAMAGE : Amount of extra HP lost
const PREDAMAGE = 15; const PREDAMAGE = 15;
describe("Moves - FILLET AWAY", () => { describe("Moves - FILLET AWAY", () => {
@ -30,12 +32,12 @@ describe("Moves - FILLET AWAY", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.starterSpecies(Species.MAGIKARP); vi.spyOn(overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP);
game.override.enemySpecies(Species.SNORLAX); vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX);
game.override.startingLevel(100); vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100);
game.override.enemyLevel(100); vi.spyOn(overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100);
game.override.moveset([Moves.FILLET_AWAY]); game.override.moveset([Moves.FILLET_AWAY]);
game.override.enemyMoveset(SPLASH_ONLY); game.override.enemyMoveset([Moves.SPLASH]);
}); });
//Bulbapedia Reference: https://bulbapedia.bulbagarden.net/wiki/fillet_away_(move) //Bulbapedia Reference: https://bulbapedia.bulbagarden.net/wiki/fillet_away_(move)
@ -45,6 +47,7 @@ describe("Moves - FILLET AWAY", () => {
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon(); const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
const hpLost = Math.floor(leadPokemon.getMaxHp() / RATIO); const hpLost = Math.floor(leadPokemon.getMaxHp() / RATIO);
game.doAttack(getMovePosition(game.scene, 0, Moves.FILLET_AWAY)); game.doAttack(getMovePosition(game.scene, 0, Moves.FILLET_AWAY));
@ -62,6 +65,7 @@ describe("Moves - FILLET AWAY", () => {
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon(); const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
const hpLost = Math.floor(leadPokemon.getMaxHp() / RATIO); const hpLost = Math.floor(leadPokemon.getMaxHp() / RATIO);
//Here - BattleStat.SPD -> 0 and BattleStat.SPATK -> 3 //Here - BattleStat.SPD -> 0 and BattleStat.SPATK -> 3
@ -83,6 +87,7 @@ describe("Moves - FILLET AWAY", () => {
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon(); const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
leadPokemon.summonData.battleStats[BattleStat.ATK] = 6; leadPokemon.summonData.battleStats[BattleStat.ATK] = 6;
leadPokemon.summonData.battleStats[BattleStat.SPATK] = 6; leadPokemon.summonData.battleStats[BattleStat.SPATK] = 6;
@ -103,6 +108,7 @@ describe("Moves - FILLET AWAY", () => {
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon(); const leadPokemon = game.scene.getPlayerPokemon();
expect(leadPokemon).toBeDefined();
const hpLost = Math.floor(leadPokemon.getMaxHp() / RATIO); const hpLost = Math.floor(leadPokemon.getMaxHp() / RATIO);
leadPokemon.hp = hpLost - PREDAMAGE; leadPokemon.hp = hpLost - PREDAMAGE;

View File

@ -2,13 +2,13 @@ import { BattleStat } from "#app/data/battle-stat";
import { Species } from "#app/enums/species.js"; import { Species } from "#app/enums/species.js";
import { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon"; import { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon";
import { DamagePhase, TurnEndPhase } from "#app/phases"; import { DamagePhase, TurnEndPhase } from "#app/phases";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils"; import { SPLASH_ONLY } from "../utils/testUtils";
describe("Moves - Fissure", () => { describe("Moves - Fissure", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;

View File

@ -1,10 +1,14 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import Phaser from "phaser"; import Phaser from "phaser";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { SelectTargetPhase, TurnEndPhase } from "#app/phases"; import {
SelectTargetPhase,
TurnEndPhase,
} from "#app/phases";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#app/enums/abilities.js"; import { Abilities } from "#app/enums/abilities.js";
import { allAbilities } from "#app/data/ability.js"; import { allAbilities } from "#app/data/ability.js";
import Pokemon from "#app/field/pokemon.js"; import Pokemon from "#app/field/pokemon.js";
@ -36,14 +40,14 @@ describe("Moves - Flame Burst", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleType("double"); vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double");
game.override.moveset([Moves.FLAME_BURST, Moves.SPLASH]); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.FLAME_BURST, Moves.SPLASH]);
game.override.disableCrits(); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true);
game.override.ability(Abilities.UNNERVE); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.UNNERVE);
game.override.startingWave(4); vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(4);
game.override.enemySpecies(Species.SHUCKLE); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SHUCKLE);
game.override.enemyAbility(Abilities.BALL_FETCH); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH);
game.override.enemyMoveset(new Array(4).fill(Moves.SPLASH)); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(new Array(4).fill(Moves.SPLASH));
}); });
it("inflicts damage to the target's ally equal to 1/16 of its max HP", async () => { it("inflicts damage to the target's ally equal to 1/16 of its max HP", async () => {
@ -61,7 +65,7 @@ describe("Moves - Flame Burst", () => {
}); });
it("does not inflict damage to the target's ally if the target was not affected by Flame Burst", async () => { it("does not inflict damage to the target's ally if the target was not affected by Flame Burst", async () => {
game.override.enemyAbility(Abilities.FLASH_FIRE); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.FLASH_FIRE);
await game.startBattle([Species.PIKACHU, Species.PIKACHU]); await game.startBattle([Species.PIKACHU, Species.PIKACHU]);
const [ leftEnemy, rightEnemy ] = game.scene.getEnemyField(); const [ leftEnemy, rightEnemy ] = game.scene.getEnemyField();

View File

@ -2,15 +2,17 @@ import { BattleStat } from "#app/data/battle-stat.js";
import { SemiInvulnerableTag } from "#app/data/battler-tags.js"; import { SemiInvulnerableTag } from "#app/data/battler-tags.js";
import { Type } from "#app/data/type.js"; import { Type } from "#app/data/type.js";
import { Biome } from "#app/enums/biome.js"; import { Biome } from "#app/enums/biome.js";
import { TurnEndPhase } from "#app/phases"; import {
import GameManager from "#test/utils/gameManager"; TurnEndPhase,
import { getMovePosition } from "#test/utils/gameManagerUtils"; } from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils"; import { SPLASH_ONLY } from "../utils/testUtils";
describe("Moves - Flower Shield", () => { describe("Moves - Flower Shield", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;

View File

@ -1,9 +1,13 @@
import { BattlerIndex } from "#app/battle.js"; import { BattlerIndex } from "#app/battle.js";
import { Stat } from "#app/data/pokemon-stat"; import { Stat } from "#app/data/pokemon-stat";
import { Abilities } from "#app/enums/abilities.js"; import { Abilities } from "#app/enums/abilities.js";
import { CommandPhase, SelectTargetPhase, TurnEndPhase } from "#app/phases"; import {
import GameManager from "#test/utils/gameManager"; CommandPhase,
import { getMovePosition } from "#test/utils/gameManagerUtils"; SelectTargetPhase,
TurnEndPhase,
} from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";

View File

@ -1,7 +1,8 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import Phaser from "phaser"; import Phaser from "phaser";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import overrides from "#app/overrides";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
@ -24,16 +25,16 @@ describe("Moves - Fusion Bolt", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.moveset([ fusionBolt ]); vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ fusionBolt ]);
game.override.startingLevel(1); vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(1);
game.override.enemySpecies(Species.RESHIRAM); vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RESHIRAM);
game.override.enemyAbility(Abilities.ROUGH_SKIN); vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ROUGH_SKIN);
game.override.enemyMoveset([ Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH ]); vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH ]);
game.override.battleType("single"); vi.spyOn(overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single");
game.override.startingWave(97); vi.spyOn(overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(97);
game.override.disableCrits(); vi.spyOn(overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true);
}); });
it("should not make contact", async() => { it("should not make contact", async() => {

View File

@ -1,8 +1,9 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import Phaser from "phaser"; import Phaser from "phaser";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import overrides from "#app/overrides";
import { TurnStartPhase } from "#app/phases"; import { TurnStartPhase } from "#app/phases";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { StatusEffect } from "#app/data/status-effect"; import { StatusEffect } from "#app/data/status-effect";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
@ -25,15 +26,15 @@ describe("Moves - Fusion Flare", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.moveset([ fusionFlare ]); vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ fusionFlare ]);
game.override.startingLevel(1); vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(1);
game.override.enemySpecies(Species.RESHIRAM); vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RESHIRAM);
game.override.enemyMoveset([ Moves.REST, Moves.REST, Moves.REST, Moves.REST ]); vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.REST, Moves.REST, Moves.REST, Moves.REST ]);
game.override.battleType("single"); vi.spyOn(overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single");
game.override.startingWave(97); vi.spyOn(overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(97);
game.override.disableCrits(); vi.spyOn(overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true);
}); });
it("should thaw freeze status condition", async() => { it("should thaw freeze status condition", async() => {

View File

@ -1,8 +1,9 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import Phaser from "phaser"; import Phaser from "phaser";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import overrides from "#app/overrides";
import { MoveEffectPhase, MovePhase, MoveEndPhase, TurnStartPhase, DamagePhase } from "#app/phases"; import { MoveEffectPhase, MovePhase, MoveEndPhase, TurnStartPhase, DamagePhase } from "#app/phases";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Stat } from "#app/data/pokemon-stat"; import { Stat } from "#app/data/pokemon-stat";
import { allMoves } from "#app/data/move"; import { allMoves } from "#app/data/move";
import { BattlerIndex } from "#app/battle"; import { BattlerIndex } from "#app/battle";
@ -28,15 +29,15 @@ describe("Moves - Fusion Flare and Fusion Bolt", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.moveset([ fusionFlare.id, fusionBolt.id ]); vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ fusionFlare.id, fusionBolt.id ]);
game.override.startingLevel(1); vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(1);
game.override.enemySpecies(Species.RESHIRAM); vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RESHIRAM);
game.override.enemyMoveset([ Moves.REST, Moves.REST, Moves.REST, Moves.REST ]); vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.REST, Moves.REST, Moves.REST, Moves.REST ]);
game.override.battleType("double"); vi.spyOn(overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double");
game.override.startingWave(97); vi.spyOn(overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(97);
game.override.disableCrits(); vi.spyOn(overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true);
vi.spyOn(fusionFlare, "calculateBattlePower"); vi.spyOn(fusionFlare, "calculateBattlePower");
vi.spyOn(fusionBolt, "calculateBattlePower"); vi.spyOn(fusionBolt, "calculateBattlePower");
@ -132,7 +133,7 @@ describe("Moves - Fusion Flare and Fusion Bolt", () => {
}, 20000); }, 20000);
it("FUSION_FLARE should not double power of subsequent FUSION_BOLT if a move succeeded in between", async() => { it("FUSION_FLARE should not double power of subsequent FUSION_BOLT if a move succeeded in between", async() => {
game.override.enemyMoveset([ Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH ]); vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH ]);
await game.startBattle([ await game.startBattle([
Species.ZEKROM, Species.ZEKROM,
Species.ZEKROM Species.ZEKROM
@ -193,7 +194,7 @@ describe("Moves - Fusion Flare and Fusion Bolt", () => {
}, 20000); }, 20000);
it("FUSION_FLARE and FUSION_BOLT alternating throughout turn should double power of subsequent moves", async() => { it("FUSION_FLARE and FUSION_BOLT alternating throughout turn should double power of subsequent moves", async() => {
game.override.enemyMoveset([ fusionFlare.id, fusionFlare.id, fusionFlare.id, fusionFlare.id ]); vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ fusionFlare.id, fusionFlare.id, fusionFlare.id, fusionFlare.id ]);
await game.startBattle([ await game.startBattle([
Species.ZEKROM, Species.ZEKROM,
Species.ZEKROM Species.ZEKROM
@ -257,7 +258,7 @@ describe("Moves - Fusion Flare and Fusion Bolt", () => {
}, 20000); }, 20000);
it("FUSION_FLARE and FUSION_BOLT alternating throughout turn should double power of subsequent moves if moves are aimed at allies", async() => { it("FUSION_FLARE and FUSION_BOLT alternating throughout turn should double power of subsequent moves if moves are aimed at allies", async() => {
game.override.enemyMoveset([ fusionFlare.id, fusionFlare.id, fusionFlare.id, fusionFlare.id ]); vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ fusionFlare.id, fusionFlare.id, fusionFlare.id, fusionFlare.id ]);
await game.startBattle([ await game.startBattle([
Species.ZEKROM, Species.ZEKROM,
Species.ZEKROM Species.ZEKROM

View File

@ -1,13 +1,15 @@
import { BattlerIndex } from "#app/battle.js"; import { BattlerIndex } from "#app/battle.js";
import { Stat } from "#app/data/pokemon-stat.js"; import { Stat } from "#app/data/pokemon-stat.js";
import { Abilities } from "#app/enums/abilities.js"; import { Abilities } from "#app/enums/abilities.js";
import { Moves } from "#app/enums/moves.js"; import {
Moves
} from "#app/enums/moves.js";
import { Species } from "#app/enums/species.js"; import { Species } from "#app/enums/species.js";
import { MoveResult } from "#app/field/pokemon.js"; import { MoveResult } from "#app/field/pokemon.js";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import GameManager from "#test/utils/gameManager"; import GameManager from "../utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "../utils/gameManagerUtils";
import { SPLASH_ONLY } from "#test/utils/testUtils"; import { SPLASH_ONLY } from "../utils/testUtils";
const TIMEOUT = 20 * 1000; const TIMEOUT = 20 * 1000;

View File

@ -1,8 +1,8 @@
import { allMoves } from "#app/data/move.js"; import { allMoves } from "#app/data/move.js";
import { Abilities } from "#app/enums/abilities.js"; import { Abilities } from "#app/enums/abilities.js";
import { DamagePhase, TurnEndPhase } from "#app/phases"; import { DamagePhase, TurnEndPhase } from "#app/phases";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";

View File

@ -1,8 +1,12 @@
import { BattleStat } from "#app/data/battle-stat"; import { BattleStat } from "#app/data/battle-stat";
import { Stat } from "#app/data/pokemon-stat"; import { Stat } from "#app/data/pokemon-stat";
import { CommandPhase, EnemyCommandPhase, TurnInitPhase } from "#app/phases"; import {
import GameManager from "#test/utils/gameManager"; CommandPhase,
import { getMovePosition } from "#test/utils/gameManagerUtils"; EnemyCommandPhase,
TurnInitPhase,
} from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Command } from "#app/ui/command-ui-handler"; import { Command } from "#app/ui/command-ui-handler";
import { Mode } from "#app/ui/ui"; import { Mode } from "#app/ui/ui";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";

View File

@ -1,13 +1,15 @@
import { allMoves } from "#app/data/move.js"; import { allMoves } from "#app/data/move.js";
import { MoveEffectPhase } from "#app/phases"; import {
import GameManager from "#test/utils/gameManager"; MoveEffectPhase
import { getMovePosition } from "#test/utils/gameManagerUtils"; } from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils"; import { SPLASH_ONLY } from "../utils/testUtils";
describe("Moves - Hard Press", () => { describe("Moves - Hard Press", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;

View File

@ -4,10 +4,10 @@ import { BattlerTagType } from "#app/enums/battler-tag-type.js";
import { Moves } from "#app/enums/moves.js"; import { Moves } from "#app/enums/moves.js";
import { Species } from "#app/enums/species.js"; import { Species } from "#app/enums/species.js";
import { BerryPhase, TurnEndPhase } from "#app/phases.js"; import { BerryPhase, TurnEndPhase } from "#app/phases.js";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "../utils/gameManagerUtils";
const TIMEOUT = 20 * 1000; // 20 sec timeout for all tests const TIMEOUT = 20 * 1000; // 20 sec timeout for all tests

View File

@ -3,9 +3,11 @@ import Move, { allMoves } from "#app/data/move.js";
import { Abilities } from "#app/enums/abilities.js"; import { Abilities } from "#app/enums/abilities.js";
import { ArenaTagType } from "#app/enums/arena-tag-type.js"; import { ArenaTagType } from "#app/enums/arena-tag-type.js";
import Pokemon from "#app/field/pokemon.js"; import Pokemon from "#app/field/pokemon.js";
import { TurnEndPhase } from "#app/phases"; import {
import GameManager from "#test/utils/gameManager"; TurnEndPhase,
import { getMovePosition } from "#test/utils/gameManagerUtils"; } from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { NumberHolder } from "#app/utils.js"; import { NumberHolder } from "#app/utils.js";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";

View File

@ -1,5 +1,5 @@
import { CommandPhase, TurnEndPhase } from "#app/phases.js"; import { CommandPhase, TurnEndPhase } from "#app/phases.js";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";

View File

@ -1,13 +1,17 @@
import { BattleStat } from "#app/data/battle-stat.js"; import { BattleStat } from "#app/data/battle-stat.js";
import { MoveEffectPhase, MoveEndPhase, StatChangePhase } from "#app/phases"; import {
import GameManager from "#test/utils/gameManager"; MoveEffectPhase,
import { getMovePosition } from "#test/utils/gameManagerUtils"; MoveEndPhase,
StatChangePhase,
} from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils"; import { SPLASH_ONLY } from "../utils/testUtils";
const TIMEOUT = 20 * 1000; const TIMEOUT = 20 * 1000;

View File

@ -2,12 +2,12 @@ import { getMoveTargets } from "#app/data/move.js";
import { Abilities } from "#app/enums/abilities.js"; import { Abilities } from "#app/enums/abilities.js";
import { Species } from "#app/enums/species.js"; import { Species } from "#app/enums/species.js";
import { TurnEndPhase } from "#app/phases.js"; import { TurnEndPhase } from "#app/phases.js";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "../utils/gameManagerUtils";
import { SPLASH_ONLY } from "#test/utils/testUtils"; import { SPLASH_ONLY } from "../utils/testUtils";
const TIMEOUT = 20 * 1000; const TIMEOUT = 20 * 1000;
@ -73,6 +73,7 @@ async function checkTargetMultiplier(game: GameManager, attackMove: Moves, killA
await game.startBattle(); await game.startBattle();
const playerPokemonRepr = game.scene.getPlayerField(); const playerPokemonRepr = game.scene.getPlayerField();
expect(playerPokemonRepr).not.toBeUndefined();
killAllyAndEnemy(game, killAlly, killSecondEnemy); killAllyAndEnemy(game, killAlly, killSecondEnemy);

View File

@ -1,14 +1,14 @@
import { BattleStat } from "#app/data/battle-stat"; import { BattleStat } from "#app/data/battle-stat";
import { TrappedTag } from "#app/data/battler-tags.js"; import { TrappedTag } from "#app/data/battler-tags.js";
import { CommandPhase, MoveEndPhase, TurnInitPhase } from "#app/phases"; import { CommandPhase, MoveEndPhase, TurnInitPhase } from "#app/phases";
import GameManager from "#test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { SPLASH_ONLY } from "#test/utils/testUtils"; import { SPLASH_ONLY } from "../utils/testUtils";
describe("Moves - Octolock", () => { describe("Moves - Octolock", () => {
describe("integration tests", () => { describe("integration tests", () => {

View File

@ -1,8 +1,10 @@
import { Status, StatusEffect } from "#app/data/status-effect.js"; import { Status, StatusEffect } from "#app/data/status-effect.js";
import { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon.js"; import { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon.js";
import { MoveEndPhase } from "#app/phases"; import {
import GameManager from "#test/utils/gameManager"; MoveEndPhase,
import { getMovePosition } from "#test/utils/gameManagerUtils"; } from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";

View File

@ -1,7 +1,11 @@
import { BattlerIndex } from "#app/battle.js"; import { BattlerIndex } from "#app/battle.js";
import { CommandPhase, SelectTargetPhase, TurnEndPhase } from "#app/phases"; import {
import GameManager from "#test/utils/gameManager"; CommandPhase,
import { getMovePosition } from "#test/utils/gameManagerUtils"; SelectTargetPhase,
TurnEndPhase,
} from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";

View File

@ -3,9 +3,11 @@ import Move, { allMoves } from "#app/data/move.js";
import { Abilities } from "#app/enums/abilities.js"; import { Abilities } from "#app/enums/abilities.js";
import { ArenaTagType } from "#app/enums/arena-tag-type.js"; import { ArenaTagType } from "#app/enums/arena-tag-type.js";
import Pokemon from "#app/field/pokemon.js"; import Pokemon from "#app/field/pokemon.js";
import { TurnEndPhase } from "#app/phases"; import {
import GameManager from "#test/utils/gameManager"; TurnEndPhase,
import { getMovePosition } from "#test/utils/gameManagerUtils"; } from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { NumberHolder } from "#app/utils.js"; import { NumberHolder } from "#app/utils.js";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";

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