apply game.override.startingHeldItems

This commit is contained in:
Felix Staud 2024-07-25 16:43:48 -07:00
parent 05a3142c13
commit 4338f7b927
16 changed files with 98 additions and 112 deletions

View File

@ -339,7 +339,7 @@ describe("Abilities - Parental Bond", () => {
"Moves boosted by this ability and Multi-Lens should strike 4 times",
async () => {
game.override.moveset([Moves.TACKLE]);
vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "MULTI_LENS", count: 1}]);
game.override.startingHeldItems([{name: "MULTI_LENS", count: 1}]);
await game.startBattle([Species.CHARIZARD]);
@ -361,7 +361,7 @@ describe("Abilities - Parental Bond", () => {
"Super Fang boosted by this ability and Multi-Lens should strike twice",
async () => {
game.override.moveset([Moves.SUPER_FANG]);
vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "MULTI_LENS", count: 1}]);
game.override.startingHeldItems([{name: "MULTI_LENS", count: 1}]);
await game.startBattle([Species.CHARIZARD]);
@ -392,7 +392,7 @@ describe("Abilities - Parental Bond", () => {
"Seismic Toss boosted by this ability and Multi-Lens should strike twice",
async () => {
game.override.moveset([Moves.SEISMIC_TOSS]);
vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "MULTI_LENS", count: 1}]);
game.override.startingHeldItems([{name: "MULTI_LENS", count: 1}]);
await game.startBattle([Species.CHARIZARD]);
@ -615,7 +615,7 @@ describe("Abilities - Parental Bond", () => {
async () => {
game.override.battleType("double");
game.override.moveset([Moves.EARTHQUAKE, Moves.SPLASH]);
vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "MULTI_LENS", count: 1}]);
game.override.startingHeldItems([{name: "MULTI_LENS", count: 1}]);
await game.startBattle([Species.CHARIZARD, Species.PIDGEOT]);

View File

@ -1,20 +1,19 @@
import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest";
import Phaser from "phaser";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import {Abilities} from "#enums/abilities";
import {applyAbAttrs ,applyPreAttackAbAttrs,applyPostDefendAbAttrs, MoveEffectChanceMultiplierAbAttr, MovePowerBoostAbAttr, PostDefendTypeChangeAbAttr} from "#app/data/ability";
import {Species} from "#enums/species";
import { applyAbAttrs, applyPostDefendAbAttrs, applyPreAttackAbAttrs, MoveEffectChanceMultiplierAbAttr, MovePowerBoostAbAttr, PostDefendTypeChangeAbAttr } from "#app/data/ability";
import { Stat } from "#app/data/pokemon-stat";
import {
CommandPhase,
MoveEffectPhase,
} from "#app/phases";
import {Mode} from "#app/ui/ui";
import {Stat} from "#app/data/pokemon-stat";
import {Moves} from "#enums/moves";
import {getMovePosition} from "#app/test/utils/gameManagerUtils";
import {Command} from "#app/ui/command-ui-handler";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Command } from "#app/ui/command-ui-handler";
import { Mode } from "#app/ui/ui";
import * as Utils from "#app/utils";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Abilities - Sheer Force", () => {
@ -161,7 +160,7 @@ describe("Abilities - Sheer Force", () => {
it("Sheer Force Disabling Specific Abilities", async() => {
const moveToUse = Moves.CRUSH_CLAW;
game.override.enemyAbility(Abilities.COLOR_CHANGE);
vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "KINGS_ROCK", count: 1}]);
game.override.startingHeldItems([{name: "KINGS_ROCK", count: 1}]);
game.override.ability(Abilities.SHEER_FORCE);
await game.startBattle([
Species.PIDGEOT

View File

@ -1,13 +1,12 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import Phase from "phaser";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { Stat } from "#app/data/pokemon-stat";
import { EvolutionStatBoosterModifier } from "#app/modifier/modifier";
import { modifierTypes } from "#app/modifier/modifier-type";
import * as Utils from "#app/utils";
import i18next from "#app/plugins/i18n";
import GameManager from "#app/test/utils/gameManager";
import * as Utils from "#app/utils";
import { Species } from "#enums/species";
import Phase from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
describe("Items - Eviolite", () => {
let phaserGame: Phaser.Game;
@ -30,7 +29,7 @@ describe("Items - Eviolite", () => {
});
it("EVIOLITE activates in battle correctly", async() => {
vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{ name: "EVIOLITE" }]);
game.override.startingHeldItems([{ name: "EVIOLITE" }]);
const consoleSpy = vi.spyOn(console, "log");
await game.startBattle([
Species.PICHU

View File

@ -1,10 +1,9 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import Phase from "phaser";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { Abilities } from "#app/enums/abilities.js";
import { PokemonExpBoosterModifier } from "#app/modifier/modifier.js";
import GameManager from "#app/test/utils/gameManager";
import * as Utils from "#app/utils";
import Phase from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("EXP Modifier Items", () => {
let phaserGame: Phaser.Game;
@ -29,7 +28,7 @@ describe("EXP Modifier Items", () => {
});
it("EXP booster items stack additively", async() => {
vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "LUCKY_EGG"}, {name: "GOLDEN_EGG"}]);
game.override.startingHeldItems([{name: "LUCKY_EGG"}, {name: "GOLDEN_EGG"}]);
await game.startBattle();
const partyMember = game.scene.getPlayerPokemon();

View File

@ -32,7 +32,7 @@ describe("Items - Grip Claw", () => {
game.override.battleType("double");
game.override.moveset([ Moves.POPULATION_BOMB, Moves.SPLASH ]);
vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "GRIP_CLAW", count: 5}, {name: "MULTI_LENS", count: 3}]);
game.override.startingHeldItems([{name: "GRIP_CLAW", count: 5}, {name: "MULTI_LENS", count: 3}]);
game.override.enemySpecies(Species.SNORLAX);
game.override.ability(Abilities.KLUTZ);
game.override.enemyMoveset([ Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH ]);

View File

@ -1,14 +1,13 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import Phase from "phaser";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { Species } from "#enums/species";
import { Moves } from "#enums/moves";
import { BattlerIndex } from "#app/battle";
import { CritBoosterModifier } from "#app/modifier/modifier";
import { modifierTypes } from "#app/modifier/modifier-type";
import * as Utils from "#app/utils";
import { MoveEffectPhase, TurnStartPhase } from "#app/phases";
import { BattlerIndex } from "#app/battle";
import GameManager from "#app/test/utils/gameManager";
import * as Utils from "#app/utils";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import Phase from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
describe("Items - Leek", () => {
let phaserGame: Phaser.Game;
@ -35,7 +34,7 @@ describe("Items - Leek", () => {
});
it("LEEK activates in battle correctly", async() => {
vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{ name: "LEEK" }]);
game.override.startingHeldItems([{ name: "LEEK" }]);
game.override.moveset([ Moves.POUND ]);
const consoleSpy = vi.spyOn(console, "log");
await game.startBattle([

View File

@ -1,12 +1,11 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import Phaser from "phaser";
import GameManager from "#app/test/utils/gameManager";
import overrides from "#app/overrides";
import { DamagePhase, TurnEndPhase } from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Items - Leftovers", () => {
@ -32,7 +31,7 @@ describe("Items - Leftovers", () => {
game.override.enemySpecies(Species.SHUCKLE);
game.override.enemyAbility(Abilities.UNNERVE);
game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]);
vi.spyOn(overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "LEFTOVERS", count: 1}]);
game.override.startingHeldItems([{name: "LEFTOVERS", count: 1}]);
});
it("leftovers works", async() => {

View File

@ -1,13 +1,12 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import Phase from "phaser";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { Species } from "#enums/species";
import { Stat } from "#app/data/pokemon-stat";
import { SpeciesStatBoosterModifier } from "#app/modifier/modifier";
import { modifierTypes } from "#app/modifier/modifier-type";
import * as Utils from "#app/utils";
import i18next from "#app/plugins/i18n";
import GameManager from "#app/test/utils/gameManager";
import * as Utils from "#app/utils";
import { Species } from "#enums/species";
import Phase from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
describe("Items - Light Ball", () => {
let phaserGame: Phaser.Game;
@ -30,7 +29,7 @@ describe("Items - Light Ball", () => {
});
it("LIGHT_BALL activates in battle correctly", async() => {
vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{ name: "SPECIES_STAT_BOOSTER", type: "LIGHT_BALL" }]);
game.override.startingHeldItems([{ name: "SPECIES_STAT_BOOSTER", type: "LIGHT_BALL" }]);
const consoleSpy = vi.spyOn(console, "log");
await game.startBattle([
Species.PIKACHU

View File

@ -1,13 +1,12 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import Phase from "phaser";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { Species } from "#enums/species";
import { Stat } from "#app/data/pokemon-stat";
import { SpeciesStatBoosterModifier } from "#app/modifier/modifier";
import { modifierTypes } from "#app/modifier/modifier-type";
import * as Utils from "#app/utils";
import i18next from "#app/plugins/i18n";
import GameManager from "#app/test/utils/gameManager";
import * as Utils from "#app/utils";
import { Species } from "#enums/species";
import Phase from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
describe("Items - Metal Powder", () => {
let phaserGame: Phaser.Game;
@ -30,7 +29,7 @@ describe("Items - Metal Powder", () => {
});
it("METAL_POWDER activates in battle correctly", async() => {
vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{ name: "SPECIES_STAT_BOOSTER", type: "METAL_POWDER" }]);
game.override.startingHeldItems([{ name: "SPECIES_STAT_BOOSTER", type: "METAL_POWDER" }]);
const consoleSpy = vi.spyOn(console, "log");
await game.startBattle([
Species.DITTO

View File

@ -1,13 +1,12 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import Phase from "phaser";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { Species } from "#enums/species";
import { Stat } from "#app/data/pokemon-stat";
import { SpeciesStatBoosterModifier } from "#app/modifier/modifier";
import { modifierTypes } from "#app/modifier/modifier-type";
import * as Utils from "#app/utils";
import i18next from "#app/plugins/i18n";
import GameManager from "#app/test/utils/gameManager";
import * as Utils from "#app/utils";
import { Species } from "#enums/species";
import Phase from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
describe("Items - Quick Powder", () => {
let phaserGame: Phaser.Game;
@ -30,7 +29,7 @@ describe("Items - Quick Powder", () => {
});
it("QUICK_POWDER activates in battle correctly", async() => {
vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{ name: "SPECIES_STAT_BOOSTER", type: "QUICK_POWDER" }]);
game.override.startingHeldItems([{ name: "SPECIES_STAT_BOOSTER", type: "QUICK_POWDER" }]);
const consoleSpy = vi.spyOn(console, "log");
await game.startBattle([
Species.DITTO

View File

@ -1,14 +1,13 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import Phase from "phaser";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { Species } from "#enums/species";
import { Moves } from "#enums/moves";
import { BattlerIndex } from "#app/battle";
import { CritBoosterModifier } from "#app/modifier/modifier";
import { modifierTypes } from "#app/modifier/modifier-type";
import * as Utils from "#app/utils";
import { MoveEffectPhase, TurnStartPhase } from "#app/phases";
import { BattlerIndex } from "#app/battle";
import GameManager from "#app/test/utils/gameManager";
import * as Utils from "#app/utils";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import Phase from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
describe("Items - Scope Lens", () => {
let phaserGame: Phaser.Game;
@ -35,7 +34,7 @@ describe("Items - Scope Lens", () => {
}, 20000);
it("SCOPE_LENS activates in battle correctly", async() => {
vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{ name: "SCOPE_LENS" }]);
game.override.startingHeldItems([{ name: "SCOPE_LENS" }]);
game.override.moveset([ Moves.POUND ]);
const consoleSpy = vi.spyOn(console, "log");
await game.startBattle([

View File

@ -1,13 +1,12 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import Phase from "phaser";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { Species } from "#enums/species";
import { Stat } from "#app/data/pokemon-stat";
import { SpeciesStatBoosterModifier } from "#app/modifier/modifier";
import { modifierTypes } from "#app/modifier/modifier-type";
import * as Utils from "#app/utils";
import i18next from "#app/plugins/i18n";
import GameManager from "#app/test/utils/gameManager";
import * as Utils from "#app/utils";
import { Species } from "#enums/species";
import Phase from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
describe("Items - Thick Club", () => {
let phaserGame: Phaser.Game;
@ -30,7 +29,7 @@ describe("Items - Thick Club", () => {
});
it("THICK_CLUB activates in battle correctly", async() => {
vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{ name: "SPECIES_STAT_BOOSTER", type: "THICK_CLUB" }]);
game.override.startingHeldItems([{ name: "SPECIES_STAT_BOOSTER", type: "THICK_CLUB" }]);
const consoleSpy = vi.spyOn(console, "log");
await game.startBattle([
Species.CUBONE

View File

@ -1,21 +1,20 @@
import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest";
import Phaser from "phaser";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { StatusEffect } from "#app/data/status-effect";
import {
CommandPhase,
EnemyCommandPhase,
MessagePhase,
TurnEndPhase,
} from "#app/phases";
import {Mode} from "#app/ui/ui";
import {getMovePosition} from "#app/test/utils/gameManagerUtils";
import {Command} from "#app/ui/command-ui-handler";
import {StatusEffect} from "#app/data/status-effect";
import i18next, { initI18n } from "#app/plugins/i18n";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Command } from "#app/ui/command-ui-handler";
import { Mode } from "#app/ui/ui";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import i18next, { initI18n } from "#app/plugins/i18n";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Items - Toxic orb", () => {
@ -43,7 +42,7 @@ describe("Items - Toxic orb", () => {
game.override.startingLevel(2000);
game.override.moveset([moveToUse]);
game.override.enemyMoveset([oppMoveToUse, oppMoveToUse, oppMoveToUse, oppMoveToUse]);
vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{
game.override.startingHeldItems([{
name: "TOXIC_ORB",
}]);
});

View File

@ -1,18 +1,17 @@
import {afterEach, beforeAll, beforeEach, describe, expect, test, vi} from "vitest";
import Phaser from "phaser";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { ArenaTagSide, ArenaTrapTag } from "#app/data/arena-tag";
import { allMoves } from "#app/data/move";
import { Abilities } from "#app/enums/abilities";
import { ArenaTagType } from "#app/enums/arena-tag-type";
import {
MoveEffectPhase,
TurnEndPhase
} from "#app/phases";
import {getMovePosition} from "#app/test/utils/gameManagerUtils";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import { ArenaTagType } from "#app/enums/arena-tag-type";
import { allMoves } from "#app/data/move";
import { ArenaTagSide, ArenaTrapTag } from "#app/data/arena-tag";
import { Abilities } from "#app/enums/abilities";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest";
const TIMEOUT = 20 * 1000;
@ -75,7 +74,7 @@ describe("Moves - Ceaseless Edge", () => {
test(
"move should hit twice with multi lens and apply two layers of spikes",
async () => {
vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "MULTI_LENS"}]);
game.override.startingHeldItems([{name: "MULTI_LENS"}]);
await game.startBattle([ Species.ILLUMISE ]);
const leadPokemon = game.scene.getPlayerPokemon();
@ -104,7 +103,7 @@ describe("Moves - Ceaseless Edge", () => {
test(
"trainer - move should hit twice, apply two layers of spikes, force switch opponent - opponent takes damage",
async () => {
vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "MULTI_LENS"}]);
game.override.startingHeldItems([{name: "MULTI_LENS"}]);
game.override.startingWave(5);
await game.startBattle([ Species.ILLUMISE ]);

View File

@ -1,13 +1,12 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import Phaser from "phaser";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { allMoves } from "#app/data/move.js";
import { Abilities } from "#app/enums/abilities.js";
import { DamagePhase, TurnEndPhase } from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import { Abilities } from "#app/enums/abilities.js";
import { allMoves } from "#app/data/move.js";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
describe("Moves - Glaive Rush", () => {
@ -66,7 +65,7 @@ describe("Moves - Glaive Rush", () => {
}, 20000);
it("interacts properly with multi-lens", async() => {
vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "MULTI_LENS", count: 2}]);
game.override.startingHeldItems([{name: "MULTI_LENS", count: 2}]);
game.override.enemyMoveset(Array(4).fill(Moves.AVALANCHE));
await game.startBattle();
const player = game.scene.getPlayerPokemon();

View File

@ -1,8 +1,7 @@
import { BerryType } from "#app/enums/berry-type";
import { Button } from "#app/enums/buttons";
import { Moves } from "#app/enums/moves";
import { Species } from "#app/enums/species";
import { Button } from "#app/enums/buttons";
import Overrides from "#app/overrides";
import {
BattleEndPhase,
SelectModifierPhase
@ -13,7 +12,7 @@ import PartyUiHandler, { PartyUiMode } from "#app/ui/party-ui-handler";
import { Mode } from "#app/ui/ui";
import Phaser from "phaser";
import BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { getMovePosition } from "../utils/gameManagerUtils";
@ -36,7 +35,7 @@ describe("UI - Transfer Items", () => {
game.override.battleType("single");
game.override.startingLevel(100);
game.override.startingWave(1);
vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([
game.override.startingHeldItems([
{ name: "BERRY", count: 1, type: BerryType.SITRUS },
{ name: "BERRY", count: 2, type: BerryType.APICOT },
{ name: "BERRY", count: 2, type: BerryType.LUM },