diff --git a/test/battle/battle.test.ts b/test/battle/battle.test.ts index ff658a4a0b1..75c84e82da4 100644 --- a/test/battle/battle.test.ts +++ b/test/battle/battle.test.ts @@ -1,5 +1,4 @@ import { allSpecies } from "#app/data/data-lists"; -import { Stat } from "#enums/stat"; import { getGameMode } from "#app/game-mode"; import { GameModes } from "#enums/game-modes"; import { BattleEndPhase } from "#app/phases/battle-end-phase"; @@ -25,6 +24,7 @@ import { SpeciesId } from "#enums/species-id"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { BiomeId } from "#enums/biome-id"; +import { TrainerItemId } from "#enums/trainer-item-id"; describe("Test Battle Phase", () => { let phaserGame: Phaser.Game; @@ -312,7 +312,7 @@ describe("Test Battle Phase", () => { .startingLevel(100) .moveset([moveToUse]) .enemyMoveset(MoveId.SPLASH) - .startingHeldItems([{ name: "TEMP_STAT_STAGE_BOOSTER", type: Stat.ACC }]); + .startingTrainerItems([{ entry: TrainerItemId.X_ACCURACY }]); await game.classicMode.startBattle(); game.scene.getPlayerPokemon()!.hp = 1; diff --git a/test/battle/damage_calculation.test.ts b/test/battle/damage_calculation.test.ts index 19cdf6b9237..d78cdfceae8 100644 --- a/test/battle/damage_calculation.test.ts +++ b/test/battle/damage_calculation.test.ts @@ -1,10 +1,9 @@ import { allMoves } from "#app/data/data-lists"; -import type { EnemyPersistentModifier } from "#app/modifier/modifier"; -import { modifierTypes } from "#app/data/data-lists"; import { AbilityId } from "#enums/ability-id"; import { ArenaTagType } from "#enums/arena-tag-type"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; +import { TrainerItemId } from "#enums/trainer-item-id"; import GameManager from "#test/testUtils/gameManager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; @@ -72,9 +71,7 @@ describe("Battle Mechanics - Damage Calculation", () => { await game.classicMode.startBattle([SpeciesId.SHUCKLE]); - const dmg_redux_modifier = modifierTypes.ENEMY_DAMAGE_REDUCTION().newModifier() as EnemyPersistentModifier; - dmg_redux_modifier.stackCount = 1000; - await game.scene.addEnemyModifier(modifierTypes.ENEMY_DAMAGE_REDUCTION().newModifier() as EnemyPersistentModifier); + game.scene.enemyTrainerItems.add(TrainerItemId.ENEMY_DAMAGE_REDUCTION, 1000); const aggron = game.scene.getEnemyPokemon()!; diff --git a/test/daily_mode.test.ts b/test/daily_mode.test.ts index 5933bf236cd..2bb413a2a01 100644 --- a/test/daily_mode.test.ts +++ b/test/daily_mode.test.ts @@ -1,12 +1,12 @@ import { BiomeId } from "#enums/biome-id"; import { MoveId } from "#enums/move-id"; -import { MapModifier } from "#app/modifier/modifier"; import { pokerogueApi } from "#app/plugins/api/pokerogue-api"; import RewardSelectUiHandler from "#app/ui/reward-select-ui-handler"; import { SpeciesId } from "#enums/species-id"; import { UiMode } from "#enums/ui-mode"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import GameManager from "#test/testUtils/gameManager"; +import { TrainerItemId } from "#enums/trainer-item-id"; //const TIMEOUT = 20 * 1000; @@ -38,7 +38,7 @@ describe("Daily Mode", () => { expect(pkm.level).toBe(20); expect(pkm.moveset.length).toBeGreaterThan(0); }); - expect(game.scene.getModifiers(MapModifier).length).toBeGreaterThan(0); + expect(game.scene.trainerItems.getStack(TrainerItemId.MAP)).toBe(1); }); }); diff --git a/test/final_boss.test.ts b/test/final_boss.test.ts index 071f83285e7..44c7dbae461 100644 --- a/test/final_boss.test.ts +++ b/test/final_boss.test.ts @@ -1,5 +1,4 @@ import { GameModes } from "#enums/game-modes"; -import { TurnHeldItemTransferModifier } from "#app/modifier/modifier"; import { AbilityId } from "#enums/ability-id"; import { BiomeId } from "#enums/biome-id"; import { MoveId } from "#enums/move-id"; @@ -7,6 +6,7 @@ import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; import GameManager from "#test/testUtils/gameManager"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; +import { HeldItemId } from "#enums/held-item-id"; const FinalWave = { Classic: 200, @@ -93,9 +93,7 @@ describe("Final Boss", () => { expect(eternatus.formIndex).toBe(1); expect(eternatus.bossSegments).toBe(5); expect(eternatus.bossSegmentIndex).toBe(4); - const miniBlackHole = eternatus.getHeldItems().find(m => m instanceof TurnHeldItemTransferModifier); - expect(miniBlackHole).toBeDefined(); - expect(miniBlackHole?.stackCount).toBe(1); + expect(eternatus.heldItemManager.getStack(HeldItemId.MINI_BLACK_HOLE)).toBe(1); }); it("should change form on status damage down to last boss fragment", async () => { @@ -136,8 +134,6 @@ describe("Final Boss", () => { expect(eternatus.formIndex).toBe(1); expect(eternatus.bossSegments).toBe(5); expect(eternatus.bossSegmentIndex).toBe(4); - const miniBlackHole = eternatus.getHeldItems().find(m => m instanceof TurnHeldItemTransferModifier); - expect(miniBlackHole).toBeDefined(); - expect(miniBlackHole?.stackCount).toBe(1); + expect(eternatus.heldItemManager.getStack(HeldItemId.MINI_BLACK_HOLE)).toBe(1); }); }); diff --git a/test/items/multi_lens.test.ts b/test/items/multi_lens.test.ts index 5d4732a8bcd..7337922a8f1 100644 --- a/test/items/multi_lens.test.ts +++ b/test/items/multi_lens.test.ts @@ -6,6 +6,7 @@ import { SpeciesId } from "#enums/species-id"; import GameManager from "#test/testUtils/gameManager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; +import { HeldItemId } from "#enums/held-item-id"; describe("Items - Multi Lens", () => { let phaserGame: Phaser.Game; @@ -26,7 +27,7 @@ describe("Items - Multi Lens", () => { game.override .moveset([MoveId.TACKLE, MoveId.TRAILBLAZE, MoveId.TACHYON_CUTTER, MoveId.FUTURE_SIGHT]) .ability(AbilityId.BALL_FETCH) - .startingHeldItems([{ name: "MULTI_LENS" }]) + .startingHeldItems([{ entry: HeldItemId.MULTI_LENS }]) .battleStyle("single") .criticalHits(false) .enemySpecies(SpeciesId.SNORLAX) @@ -42,7 +43,7 @@ describe("Items - Multi Lens", () => { ])( "$stackCount count: should deal {$firstHitDamage}x damage on the first hit, then hit $stackCount times for 0.25x", async ({ stackCount, firstHitDamage }) => { - game.override.startingHeldItems([{ name: "MULTI_LENS", count: stackCount }]); + game.override.startingHeldItems([{ entry: HeldItemId.MULTI_LENS, count: stackCount }]); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); @@ -116,7 +117,7 @@ describe("Items - Multi Lens", () => { }); it("should enhance fixed-damage moves while also applying damage reduction", async () => { - game.override.startingHeldItems([{ name: "MULTI_LENS", count: 1 }]).moveset(MoveId.SEISMIC_TOSS); + game.override.startingHeldItems([{ entry: HeldItemId.MULTI_LENS }]).moveset(MoveId.SEISMIC_TOSS); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); @@ -137,7 +138,7 @@ describe("Items - Multi Lens", () => { it("should result in correct damage for hp% attacks with 1 lens", async () => { game.override - .startingHeldItems([{ name: "MULTI_LENS", count: 1 }]) + .startingHeldItems([{ entry: HeldItemId.MULTI_LENS }]) .moveset(MoveId.SUPER_FANG) .ability(AbilityId.COMPOUND_EYES) .enemyLevel(1000) @@ -155,7 +156,7 @@ describe("Items - Multi Lens", () => { it("should result in correct damage for hp% attacks with 2 lenses", async () => { game.override - .startingHeldItems([{ name: "MULTI_LENS", count: 2 }]) + .startingHeldItems([{ entry: HeldItemId.MULTI_LENS, count: 2 }]) .moveset(MoveId.SUPER_FANG) .ability(AbilityId.COMPOUND_EYES) .enemyMoveset(MoveId.SPLASH) @@ -174,7 +175,7 @@ describe("Items - Multi Lens", () => { it("should result in correct damage for hp% attacks with 2 lenses + Parental Bond", async () => { game.override - .startingHeldItems([{ name: "MULTI_LENS", count: 2 }]) + .startingHeldItems([{ entry: HeldItemId.MULTI_LENS, count: 2 }]) .moveset(MoveId.SUPER_FANG) .ability(AbilityId.PARENTAL_BOND) .passiveAbility(AbilityId.COMPOUND_EYES) diff --git a/test/items/reviver_seed.test.ts b/test/items/reviver_seed.test.ts index d977189789c..4ac47ae320b 100644 --- a/test/items/reviver_seed.test.ts +++ b/test/items/reviver_seed.test.ts @@ -1,5 +1,5 @@ import { BattlerIndex } from "#enums/battler-index"; -import { allMoves } from "#app/data/data-lists"; +import { allHeldItems, allMoves } from "#app/data/data-lists"; import { BattlerTagType } from "#app/enums/battler-tag-type"; import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; @@ -8,6 +8,7 @@ import GameManager from "#test/testUtils/gameManager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { HeldItemId } from "#enums/held-item-id"; +import type { InstantReviveHeldItem } from "#app/items/held-items/instant-revive"; describe("Items - Reviver Seed", () => { let phaserGame: Phaser.Game; @@ -54,7 +55,7 @@ describe("Items - Reviver Seed", () => { const player = game.scene.getPlayerPokemon()!; player.damageAndUpdate(player.hp - 1); - const reviverSeed = player.getHeldItems()[0] as PokemonInstantReviveModifier; + const reviverSeed = allHeldItems[HeldItemId.REVIVER_SEED] as InstantReviveHeldItem; vi.spyOn(reviverSeed, "apply"); game.move.select(MoveId.TACKLE); @@ -70,7 +71,7 @@ describe("Items - Reviver Seed", () => { player.damageAndUpdate(player.hp - 1); player.addTag(BattlerTagType.CONFUSED, 3); - const reviverSeed = player.getHeldItems()[0] as PokemonInstantReviveModifier; + const reviverSeed = allHeldItems[HeldItemId.REVIVER_SEED] as InstantReviveHeldItem; vi.spyOn(reviverSeed, "apply"); vi.spyOn(player, "randBattleSeedInt").mockReturnValue(0); // Force confusion self-hit @@ -122,8 +123,8 @@ describe("Items - Reviver Seed", () => { const player = game.scene.getPlayerPokemon()!; player.damageAndUpdate(player.hp - 1); - const playerSeed = player.getHeldItems()[0] as PokemonInstantReviveModifier; - vi.spyOn(playerSeed, "apply"); + const reviverSeed = allHeldItems[HeldItemId.REVIVER_SEED] as InstantReviveHeldItem; + vi.spyOn(reviverSeed, "apply"); game.move.select(move); await game.phaseInterceptor.to("TurnEndPhase"); diff --git a/test/items/temp_stat_stage_booster.test.ts b/test/items/temp_stat_stage_booster.test.ts index 1a3f3723a0b..cae4fcbece7 100644 --- a/test/items/temp_stat_stage_booster.test.ts +++ b/test/items/temp_stat_stage_booster.test.ts @@ -10,6 +10,7 @@ import { UiMode } from "#enums/ui-mode"; import { Button } from "#app/enums/buttons"; import type RewardSelectUiHandler from "#app/ui/reward-select-ui-handler"; import { ShopCursorTarget } from "#app/enums/shop-cursor-target"; +import { TrainerItemId } from "#enums/trainer-item-id"; describe("Items - Temporary Stat Stage Boosters", () => { let phaserGame: Phaser.Game; @@ -34,7 +35,7 @@ describe("Items - Temporary Stat Stage Boosters", () => { .enemyMoveset(MoveId.SPLASH) .enemyAbility(AbilityId.BALL_FETCH) .moveset([MoveId.TACKLE, MoveId.SPLASH, MoveId.HONE_CLAWS, MoveId.BELLY_DRUM]) - .startingModifier([{ name: "TEMP_STAT_STAGE_BOOSTER", type: Stat.ATK }]); + .startingTrainerItems([{ entry: TrainerItemId.X_ATTACK }]); }); it("should provide a x1.3 stat stage multiplier", async () => { @@ -52,7 +53,7 @@ describe("Items - Temporary Stat Stage Boosters", () => { }); it("should increase existing ACC stat stage by 1 for X_ACCURACY only", async () => { - game.override.startingModifier([{ name: "TEMP_STAT_STAGE_BOOSTER", type: Stat.ACC }]).ability(AbilityId.SIMPLE); + game.override.startingTrainerItems([{ entry: TrainerItemId.X_ACCURACY }]).ability(AbilityId.SIMPLE); await game.classicMode.startBattle([SpeciesId.PIKACHU]); @@ -94,10 +95,7 @@ describe("Items - Temporary Stat Stage Boosters", () => { }); it("should not increase past maximum stat stage multiplier", async () => { - game.override.startingModifier([ - { name: "TEMP_STAT_STAGE_BOOSTER", type: Stat.ACC }, - { name: "TEMP_STAT_STAGE_BOOSTER", type: Stat.ATK }, - ]); + game.override.startingTrainerItems([{ entry: TrainerItemId.X_ATTACK }, { entry: TrainerItemId.X_ACCURACY }]); await game.classicMode.startBattle([SpeciesId.PIKACHU]); @@ -128,10 +126,7 @@ describe("Items - Temporary Stat Stage Boosters", () => { await game.phaseInterceptor.to("BattleEndPhase"); - const modifier = game.scene.findModifier( - m => m instanceof TempStatStageBoosterModifier, - ) as TempStatStageBoosterModifier; - expect(modifier.getBattleCount()).toBe(4); + expect(game.scene.trainerItems.getStack(TrainerItemId.X_ATTACK)).toBe(4); // Forced X_ATTACK to spawn in the first slot with override game.onNextPrompt( @@ -151,14 +146,7 @@ describe("Items - Temporary Stat Stage Boosters", () => { await game.phaseInterceptor.to("TurnInitPhase"); // Making sure only one booster is in the modifier list even after picking up another - let count = 0; - for (const m of game.scene.modifiers) { - if (m instanceof TempStatStageBoosterModifier) { - count++; - const modifierInstance = m as TempStatStageBoosterModifier; - expect(modifierInstance.getBattleCount()).toBe(modifierInstance.getMaxBattles()); - } - } - expect(count).toBe(1); + + expect(game.scene.trainerItems.getStack(TrainerItemId.X_ATTACK)).toBe(5); }); }); diff --git a/test/items/thick_club.test.ts b/test/items/thick_club.test.ts index bc019ee99f8..18910f6b5f5 100644 --- a/test/items/thick_club.test.ts +++ b/test/items/thick_club.test.ts @@ -1,5 +1,4 @@ import { Stat } from "#enums/stat"; -import { SpeciesStatBoosterModifier } from "#app/modifier/modifier"; import { modifierTypes } from "#app/data/data-lists"; import i18next from "#app/plugins/i18n"; import { NumberHolder, randInt } from "#app/utils/common"; @@ -7,6 +6,7 @@ import { SpeciesId } from "#enums/species-id"; import GameManager from "#test/testUtils/gameManager"; import Phase from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; +import { HeldItemId } from "#enums/held-item-id"; describe("Items - Thick Club", () => { let phaserGame: Phaser.Game; @@ -29,7 +29,7 @@ describe("Items - Thick Club", () => { }); it("THICK_CLUB activates in battle correctly", async () => { - game.override.startingHeldItems([{ name: "RARE_SPECIES_STAT_BOOSTER", type: "THICK_CLUB" }]); + game.override.startingHeldItems([{ entry: HeldItemId.THICK_CLUB }]); const consoleSpy = vi.spyOn(console, "log"); await game.classicMode.startBattle([SpeciesId.CUBONE]); diff --git a/test/moves/beak_blast.test.ts b/test/moves/beak_blast.test.ts index 2cb9f9bdd6f..621dd9f21dd 100644 --- a/test/moves/beak_blast.test.ts +++ b/test/moves/beak_blast.test.ts @@ -4,6 +4,7 @@ import { BerryPhase } from "#app/phases/berry-phase"; import { MovePhase } from "#app/phases/move-phase"; import { TurnEndPhase } from "#app/phases/turn-end-phase"; import { AbilityId } from "#enums/ability-id"; +import { HeldItemId } from "#enums/held-item-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import GameManager from "#test/testUtils/gameManager"; @@ -87,7 +88,7 @@ describe("Moves - Beak Blast", () => { }); it("should only hit twice with Multi-Lens", async () => { - game.override.startingHeldItems([{ name: "MULTI_LENS", count: 1 }]); + game.override.startingHeldItems([{ entry: HeldItemId.MULTI_LENS }]); await game.classicMode.startBattle([SpeciesId.BLASTOISE]); diff --git a/test/moves/ceaseless_edge.test.ts b/test/moves/ceaseless_edge.test.ts index 1dec98fe3a8..3a12b65f4e0 100644 --- a/test/moves/ceaseless_edge.test.ts +++ b/test/moves/ceaseless_edge.test.ts @@ -10,6 +10,7 @@ import { SpeciesId } from "#enums/species-id"; import GameManager from "#test/testUtils/gameManager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; +import { HeldItemId } from "#enums/held-item-id"; describe("Moves - Ceaseless Edge", () => { let phaserGame: Phaser.Game; @@ -61,7 +62,7 @@ describe("Moves - Ceaseless Edge", () => { }); test("move should hit twice with multi lens and apply two layers of spikes", async () => { - game.override.startingHeldItems([{ name: "MULTI_LENS" }]); + game.override.startingHeldItems([{ entry: HeldItemId.MULTI_LENS }]); await game.classicMode.startBattle([SpeciesId.ILLUMISE]); const enemyPokemon = game.scene.getEnemyPokemon()!; @@ -83,7 +84,7 @@ describe("Moves - Ceaseless Edge", () => { }); test("trainer - move should hit twice, apply two layers of spikes, force switch opponent - opponent takes damage", async () => { - game.override.startingHeldItems([{ name: "MULTI_LENS" }]).startingWave(25); + game.override.startingHeldItems([{ entry: HeldItemId.MULTI_LENS }]).startingWave(25); await game.classicMode.startBattle([SpeciesId.ILLUMISE]); diff --git a/test/moves/destiny_bond.test.ts b/test/moves/destiny_bond.test.ts index a78d46b464b..184b4be67b8 100644 --- a/test/moves/destiny_bond.test.ts +++ b/test/moves/destiny_bond.test.ts @@ -10,7 +10,7 @@ import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { BattlerIndex } from "#enums/battler-index"; import { StatusEffect } from "#enums/status-effect"; -import { PokemonInstantReviveModifier } from "#app/modifier/modifier"; +import { HeldItemId } from "#enums/held-item-id"; describe("Moves - Destiny Bond", () => { let phaserGame: Phaser.Game; @@ -232,7 +232,7 @@ describe("Moves - Destiny Bond", () => { it("should not allow the opponent to revive via Reviver Seed", async () => { const moveToUse = MoveId.TACKLE; - game.override.moveset(moveToUse).startingHeldItems([{ name: "REVIVER_SEED" }]); + game.override.moveset(moveToUse).startingHeldItems([{ entry: HeldItemId.REVIVER_SEED }]); await game.classicMode.startBattle(defaultParty); const enemyPokemon = game.scene.getEnemyPokemon(); @@ -246,9 +246,6 @@ describe("Moves - Destiny Bond", () => { expect(playerPokemon?.isFainted()).toBe(true); // Check that the Tackle user's Reviver Seed did not activate - const revSeeds = game.scene - .getModifiers(PokemonInstantReviveModifier) - .filter(m => m.pokemonId === playerPokemon?.id); - expect(revSeeds.length).toBe(1); + expect(playerPokemon?.heldItemManager.getStack(HeldItemId.REVIVER_SEED)).toBe(1); }); }); diff --git a/test/moves/dragon_tail.test.ts b/test/moves/dragon_tail.test.ts index 8c456f27853..2404b517e77 100644 --- a/test/moves/dragon_tail.test.ts +++ b/test/moves/dragon_tail.test.ts @@ -10,6 +10,7 @@ import { SpeciesId } from "#enums/species-id"; import GameManager from "#test/testUtils/gameManager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; +import { HeldItemId } from "#enums/held-item-id"; describe("Moves - Dragon Tail", () => { let phaserGame: Phaser.Game; @@ -162,7 +163,7 @@ describe("Moves - Dragon Tail", () => { it("should not cause a softlock when activating an opponent trainer's reviver seed", async () => { game.override .startingWave(5) - .enemyHeldItems([{ name: "REVIVER_SEED" }]) + .enemyHeldItems([{ entry: HeldItemId.REVIVER_SEED }]) .startingLevel(1000); // To make sure Dragon Tail KO's the opponent await game.classicMode.startBattle([SpeciesId.DRATINI]); @@ -179,7 +180,7 @@ describe("Moves - Dragon Tail", () => { it("should not cause a softlock when activating a player's reviver seed", async () => { game.override - .startingHeldItems([{ name: "REVIVER_SEED" }]) + .startingHeldItems([{ entry: HeldItemId.REVIVER_SEED }]) .enemyMoveset(MoveId.DRAGON_TAIL) .enemyLevel(1000); // To make sure Dragon Tail KO's the player await game.classicMode.startBattle([SpeciesId.DRATINI, SpeciesId.BULBASAUR]); diff --git a/test/moves/fell_stinger.test.ts b/test/moves/fell_stinger.test.ts index 0737db9105f..6b3e0e090cb 100644 --- a/test/moves/fell_stinger.test.ts +++ b/test/moves/fell_stinger.test.ts @@ -8,6 +8,7 @@ import { Stat } from "#enums/stat"; import { StatusEffect } from "#app/enums/status-effect"; import { WeatherType } from "#app/enums/weather-type"; import { allMoves } from "#app/data/data-lists"; +import { HeldItemId } from "#enums/held-item-id"; describe("Moves - Fell Stinger", () => { let phaserGame: Phaser.Game; @@ -88,7 +89,7 @@ describe("Moves - Fell Stinger", () => { }); it("should not grant stat boost if enemy is saved by Reviver Seed", async () => { - game.override.enemyAbility(AbilityId.BALL_FETCH).enemyHeldItems([{ name: "REVIVER_SEED" }]); + game.override.enemyAbility(AbilityId.BALL_FETCH).enemyHeldItems([{ entry: HeldItemId.REVIVER_SEED }]); await game.classicMode.startBattle([SpeciesId.LEAVANNY]); const leadPokemon = game.scene.getPlayerPokemon()!; diff --git a/test/moves/fusion_flare_bolt.test.ts b/test/moves/fusion_flare_bolt.test.ts index d7af700d39b..f65dddc1fc5 100644 --- a/test/moves/fusion_flare_bolt.test.ts +++ b/test/moves/fusion_flare_bolt.test.ts @@ -164,7 +164,6 @@ describe("Moves - Fusion Flare and Fusion Bolt", () => { const enemyParty = game.scene.getEnemyParty(); // Get rid of any modifiers that may alter power - game.scene.clearEnemyHeldItemModifiers(); game.scene.clearEnemyItems(); // Mock stats by replacing entries in copy with desired values for specific stats @@ -218,7 +217,6 @@ describe("Moves - Fusion Flare and Fusion Bolt", () => { const enemyParty = game.scene.getEnemyParty(); // Get rid of any modifiers that may alter power - game.scene.clearEnemyHeldItemModifiers(); game.scene.clearEnemyItems(); // Mock stats by replacing entries in copy with desired values for specific stats diff --git a/test/moves/glaive_rush.test.ts b/test/moves/glaive_rush.test.ts index 0b6f30da71a..ac2df2baefe 100644 --- a/test/moves/glaive_rush.test.ts +++ b/test/moves/glaive_rush.test.ts @@ -1,5 +1,6 @@ import { allMoves } from "#app/data/data-lists"; import { AbilityId } from "#enums/ability-id"; +import { HeldItemId } from "#enums/held-item-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import GameManager from "#test/testUtils/gameManager"; @@ -60,7 +61,7 @@ describe("Moves - Glaive Rush", () => { }); it("interacts properly with multi-lens", async () => { - game.override.startingHeldItems([{ name: "MULTI_LENS", count: 2 }]).enemyMoveset([MoveId.AVALANCHE]); + game.override.startingHeldItems([{ entry: HeldItemId.MULTI_LENS, count: 2 }]).enemyMoveset([MoveId.AVALANCHE]); await game.classicMode.startBattle([SpeciesId.KLINK]); const player = game.scene.getPlayerPokemon()!; diff --git a/test/moves/heal_block.test.ts b/test/moves/heal_block.test.ts index dc69b5c2974..c5696dab473 100644 --- a/test/moves/heal_block.test.ts +++ b/test/moves/heal_block.test.ts @@ -9,6 +9,7 @@ import { SpeciesId } from "#enums/species-id"; import { WeatherType } from "#enums/weather-type"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; +import { HeldItemId } from "#enums/held-item-id"; // Bulbapedia Reference: https://bulbapedia.bulbagarden.net/wiki/Heal_Block_(move) describe("Moves - Heal Block", () => { @@ -132,7 +133,7 @@ describe("Moves - Heal Block", () => { }); it("should stop healing from items", async () => { - game.override.startingHeldItems([{ name: "LEFTOVERS" }]); + game.override.startingHeldItems([{ entry: HeldItemId.LEFTOVERS }]); await game.classicMode.startBattle([SpeciesId.CHARIZARD]); diff --git a/test/moves/safeguard.test.ts b/test/moves/safeguard.test.ts index 91aa298a8ca..9abf074ebd1 100644 --- a/test/moves/safeguard.test.ts +++ b/test/moves/safeguard.test.ts @@ -7,6 +7,7 @@ import { SpeciesId } from "#enums/species-id"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { AbilityId } from "#enums/ability-id"; +import { HeldItemId } from "#enums/held-item-id"; describe("Moves - Safeguard", () => { let phaserGame: Phaser.Game; @@ -113,7 +114,7 @@ describe("Moves - Safeguard", () => { }); it("doesn't protect from self-inflicted status from Rest or Flame Orb", async () => { - game.override.enemyHeldItems([{ name: "FLAME_ORB" }]); + game.override.enemyHeldItems([{ entry: HeldItemId.FLAME_ORB }]); await game.classicMode.startBattle(); const enemyPokemon = game.scene.getEnemyPokemon()!; enemyPokemon.hp = 1; diff --git a/test/moves/substitute.test.ts b/test/moves/substitute.test.ts index 182fefb74d7..eb1f3a776fd 100644 --- a/test/moves/substitute.test.ts +++ b/test/moves/substitute.test.ts @@ -11,13 +11,13 @@ import { UiMode } from "#enums/ui-mode"; import { AbilityId } from "#enums/ability-id"; import { ArenaTagType } from "#enums/arena-tag-type"; import { BattlerTagType } from "#enums/battler-tag-type"; -import { BerryType } from "#enums/berry-type"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { StatusEffect } from "#enums/status-effect"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; +import { HeldItemId } from "#enums/held-item-id"; describe("Moves - Substitute", () => { let phaserGame: Phaser.Game; @@ -296,7 +296,7 @@ describe("Moves - Substitute", () => { }); it("should prevent the user's items from being stolen", async () => { - game.override.enemyMoveset(MoveId.THIEF).startingHeldItems([{ name: "BERRY", type: BerryType.SITRUS }]); + game.override.enemyMoveset(MoveId.THIEF).startingHeldItems([{ entry: HeldItemId.SITRUS_BERRY }]); vi.spyOn(allMoves[MoveId.THIEF], "attrs", "get").mockReturnValue([new StealHeldItemChanceAttr(1.0)]); // give Thief 100% steal rate await game.classicMode.startBattle([SpeciesId.BLASTOISE]); @@ -313,7 +313,7 @@ describe("Moves - Substitute", () => { }); it("should prevent the user's items from being removed", async () => { - game.override.moveset([MoveId.KNOCK_OFF]).enemyHeldItems([{ name: "BERRY", type: BerryType.SITRUS }]); + game.override.moveset([MoveId.KNOCK_OFF]).enemyHeldItems([{ entry: HeldItemId.SITRUS_BERRY }]); await game.classicMode.startBattle([SpeciesId.BLASTOISE]); @@ -330,7 +330,7 @@ describe("Moves - Substitute", () => { }); it("move effect should prevent the user's berries from being stolen and eaten", async () => { - game.override.enemyMoveset(MoveId.BUG_BITE).startingHeldItems([{ name: "BERRY", type: BerryType.SITRUS }]); + game.override.enemyMoveset(MoveId.BUG_BITE).startingHeldItems([{ entry: HeldItemId.SITRUS_BERRY }]); await game.classicMode.startBattle([SpeciesId.BLASTOISE]); diff --git a/test/mystery-encounter/encounters/an-offer-you-cant-refuse-encounter.test.ts b/test/mystery-encounter/encounters/an-offer-you-cant-refuse-encounter.test.ts index fc92b9cadda..f7f09189f0c 100644 --- a/test/mystery-encounter/encounters/an-offer-you-cant-refuse-encounter.test.ts +++ b/test/mystery-encounter/encounters/an-offer-you-cant-refuse-encounter.test.ts @@ -15,10 +15,10 @@ import { MysteryEncounterTier } from "#enums/mystery-encounter-tier"; import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils"; import { getPokemonSpecies } from "#app/utils/pokemon-utils"; import { MoveId } from "#enums/move-id"; -import { ShinyRateBoosterModifier } from "#app/modifier/modifier"; import { SelectRewardPhase } from "#app/phases/select-reward-phase"; import i18next from "i18next"; import { AbilityId } from "#enums/ability-id"; +import { TrainerItemId } from "#enums/trainer-item-id"; const namespace = "mysteryEncounters/anOfferYouCantRefuse"; /** Gyarados for Indimidate */ @@ -144,10 +144,7 @@ describe("An Offer You Can't Refuse - Mystery Encounter", () => { await game.runToMysteryEncounter(MysteryEncounterType.AN_OFFER_YOU_CANT_REFUSE, defaultParty); await runMysteryEncounterToEnd(game, 1); - const itemModifier = scene.findModifier(m => m instanceof ShinyRateBoosterModifier) as ShinyRateBoosterModifier; - - expect(itemModifier).toBeDefined(); - expect(itemModifier?.stackCount).toBe(1); + expect(scene.trainerItems.getStack(TrainerItemId.SHINY_CHARM)).toBe(1); }); it("Should remove the Pokemon from the party", async () => {