diff --git a/test/abilities/ability_activation_order.test.ts b/test/abilities/ability_activation_order.test.ts index 8344ba6be11..0f92bd974a9 100644 --- a/test/abilities/ability_activation_order.test.ts +++ b/test/abilities/ability_activation_order.test.ts @@ -1,7 +1,7 @@ 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 { Stat } from "#enums/stat"; import { WeatherType } from "#enums/weather-type"; import { GameManager } from "#test/testUtils/gameManager"; import Phaser from "phaser"; @@ -48,7 +48,7 @@ describe("Ability Activation Order", () => { .enemySpecies(SpeciesId.MAGIKARP) .enemyAbility(AbilityId.DROUGHT) .ability(AbilityId.DRIZZLE) - .startingHeldItems([{ name: "BASE_STAT_BOOSTER", type: Stat.SPD, count: 100 }]); + .startingHeldItems([{ entry: HeldItemId.CARBOS, count: 100 }]); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SUNNY); @@ -61,7 +61,7 @@ describe("Ability Activation Order", () => { .enemySpecies(SpeciesId.DITTO) .enemyAbility(AbilityId.DROUGHT) .ability(AbilityId.DRIZZLE) - .startingHeldItems([{ name: "SPECIES_STAT_BOOSTER", type: "QUICK_POWDER" }]); + .startingHeldItems([{ entry: HeldItemId.QUICK_POWDER }]); await game.classicMode.startBattle([SpeciesId.DITTO]); expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SUNNY); diff --git a/test/abilities/arena_trap.test.ts b/test/abilities/arena_trap.test.ts index c47cf3cd327..e0e1fc60a97 100644 --- a/test/abilities/arena_trap.test.ts +++ b/test/abilities/arena_trap.test.ts @@ -2,6 +2,7 @@ import { allAbilities } from "#data/data-lists"; import { AbilityId } from "#enums/ability-id"; 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"; @@ -46,7 +47,7 @@ describe("Abilities - Arena Trap", () => { }); it("should guarantee double battle with any one LURE", async () => { - game.override.startingModifier([{ name: "LURE" }]).startingWave(2); + game.override.startingTrainerItems([{ entry: TrainerItemId.LURE }]).startingWave(2); await game.classicMode.startBattle(); diff --git a/test/abilities/competitive.test.ts b/test/abilities/competitive.test.ts index 7dcc677a74e..78508e486cd 100644 --- a/test/abilities/competitive.test.ts +++ b/test/abilities/competitive.test.ts @@ -1,4 +1,5 @@ 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 { Stat } from "#enums/stat"; @@ -59,7 +60,7 @@ describe("Abilities - Competitive", () => { }); it("white herb should remove only the negative effects", async () => { - game.override.startingHeldItems([{ name: "WHITE_HERB" }]); + game.override.startingHeldItems([{ entry: HeldItemId.WHITE_HERB }]); await game.classicMode.startBattle([SpeciesId.FLYGON]); const playerPokemon = game.scene.getPlayerPokemon()!; diff --git a/test/abilities/defiant.test.ts b/test/abilities/defiant.test.ts index 44187429e2b..2e202d43fe5 100644 --- a/test/abilities/defiant.test.ts +++ b/test/abilities/defiant.test.ts @@ -1,4 +1,5 @@ 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 { Stat } from "#enums/stat"; @@ -58,7 +59,7 @@ describe("Abilities - Defiant", () => { }); it("white herb should remove only the negative effects", async () => { - game.override.startingHeldItems([{ name: "WHITE_HERB" }]); + game.override.startingHeldItems([{ entry: HeldItemId.WHITE_HERB }]); await game.classicMode.startBattle([SpeciesId.FLYGON]); const playerPokemon = game.scene.getPlayerPokemon()!; diff --git a/test/abilities/flower_veil.test.ts b/test/abilities/flower_veil.test.ts index e890ea24fad..b8844ce1025 100644 --- a/test/abilities/flower_veil.test.ts +++ b/test/abilities/flower_veil.test.ts @@ -2,6 +2,7 @@ import { allAbilities, allMoves } from "#data/data-lists"; import { AbilityId } from "#enums/ability-id"; import { BattlerIndex } from "#enums/battler-index"; import { BattlerTagType } from "#enums/battler-tag-type"; +import { HeldItemId } from "#enums/held-item-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; @@ -44,7 +45,7 @@ describe("Abilities - Flower Veil", () => { game.override .enemyMoveset([MoveId.TACKLE, MoveId.SPLASH]) .moveset([MoveId.REST, MoveId.SPLASH]) - .startingHeldItems([{ name: "FLAME_ORB" }]); + .startingHeldItems([{ entry: HeldItemId.FLAME_ORB }]); await game.classicMode.startBattle([SpeciesId.BULBASAUR]); const user = game.scene.getPlayerPokemon()!; game.move.select(MoveId.REST); diff --git a/test/abilities/illuminate.test.ts b/test/abilities/illuminate.test.ts index 0fb31379542..6e84df7bfd8 100644 --- a/test/abilities/illuminate.test.ts +++ b/test/abilities/illuminate.test.ts @@ -1,6 +1,7 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { Stat } from "#enums/stat"; +import { TrainerItemId } from "#enums/trainer-item-id"; import { GameManager } from "#test/testUtils/gameManager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; @@ -45,7 +46,7 @@ describe("Abilities - Illuminate", () => { }); it("should guarantee double battle with any one LURE", async () => { - game.override.startingModifier([{ name: "LURE" }]).startingWave(2); + game.override.startingTrainerItems([{ entry: TrainerItemId.LURE }]).startingWave(2); await game.classicMode.startBattle(); diff --git a/test/abilities/illusion.test.ts b/test/abilities/illusion.test.ts index 0624c5e19f4..01aae92ed6f 100644 --- a/test/abilities/illusion.test.ts +++ b/test/abilities/illusion.test.ts @@ -1,5 +1,6 @@ import { Gender } from "#data/gender"; import { AbilityId } from "#enums/ability-id"; +import { HeldItemId } from "#enums/held-item-id"; import { MoveId } from "#enums/move-id"; import { PokeballType } from "#enums/pokeball"; import { SpeciesId } from "#enums/species-id"; @@ -28,9 +29,9 @@ describe("Abilities - Illusion", () => { .enemySpecies(SpeciesId.ZORUA) .enemyAbility(AbilityId.ILLUSION) .enemyMoveset(MoveId.TACKLE) - .enemyHeldItems([{ name: "WIDE_LENS", count: 3 }]) + .enemyHeldItems([{ entry: HeldItemId.WIDE_LENS, count: 3 }]) .moveset([MoveId.WORRY_SEED, MoveId.SOAK, MoveId.TACKLE]) - .startingHeldItems([{ name: "WIDE_LENS", count: 3 }]); + .startingHeldItems([{ entry: HeldItemId.WIDE_LENS, count: 3 }]); }); it("creates illusion at the start", async () => { diff --git a/test/abilities/no_guard.test.ts b/test/abilities/no_guard.test.ts index f6f55ce3b80..614f043508f 100644 --- a/test/abilities/no_guard.test.ts +++ b/test/abilities/no_guard.test.ts @@ -3,6 +3,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { HitCheckResult } from "#enums/hit-check-result"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; +import { TrainerItemId } from "#enums/trainer-item-id"; import { MoveEffectPhase } from "#phases/move-effect-phase"; import { MoveEndPhase } from "#phases/move-end-phase"; import { GameManager } from "#test/testUtils/gameManager"; @@ -54,7 +55,7 @@ describe("Abilities - No Guard", () => { }); it("should guarantee double battle with any one LURE", async () => { - game.override.startingModifier([{ name: "LURE" }]).startingWave(2); + game.override.startingTrainerItems([{ entry: TrainerItemId.LURE }]).startingWave(2); await game.classicMode.startBattle(); diff --git a/test/abilities/normal-move-type-change.test.ts b/test/abilities/normal-move-type-change.test.ts index aa673ddde29..2d393218a9b 100644 --- a/test/abilities/normal-move-type-change.test.ts +++ b/test/abilities/normal-move-type-change.test.ts @@ -2,9 +2,11 @@ import { TYPE_BOOST_ITEM_BOOST_PERCENT } from "#app/constants"; import { allAbilities, allMoves } from "#data/data-lists"; import { AbilityId } from "#enums/ability-id"; import { BattlerIndex } from "#enums/battler-index"; +import { HeldItemId } from "#enums/held-item-id"; import { MoveId } from "#enums/move-id"; import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; +import { attackTypeToHeldItem } from "#items/attack-type-booster"; import { GameManager } from "#test/testUtils/gameManager"; import { toDmgValue } from "#utils/common"; import Phaser from "phaser"; @@ -151,7 +153,7 @@ describe.each([ }); it("should not be affected by silk scarf after changing the move's type", async () => { - game.override.startingHeldItems([{ name: "ATTACK_TYPE_BOOSTER", count: 1, type: PokemonType.NORMAL }]); + game.override.startingHeldItems([{ entry: HeldItemId.SILK_SCARF }]); await game.classicMode.startBattle(); const testMoveInstance = allMoves[MoveId.TACKLE]; @@ -170,7 +172,7 @@ describe.each([ }); it("should be affected by the type boosting item after changing the move's type", async () => { - game.override.startingHeldItems([{ name: "ATTACK_TYPE_BOOSTER", count: 1, type: ty }]); + game.override.startingHeldItems([{ entry: attackTypeToHeldItem[ty] }]); await game.classicMode.startBattle(); // get the power boost from the ability so we can compare it to the item diff --git a/test/abilities/normalize.test.ts b/test/abilities/normalize.test.ts index 1128dd1a562..6c19f8168e5 100644 --- a/test/abilities/normalize.test.ts +++ b/test/abilities/normalize.test.ts @@ -1,6 +1,7 @@ import { TYPE_BOOST_ITEM_BOOST_PERCENT } from "#app/constants"; import { allMoves } from "#data/data-lists"; import { AbilityId } from "#enums/ability-id"; +import { HeldItemId } from "#enums/held-item-id"; import { MoveId } from "#enums/move-id"; import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; @@ -45,9 +46,7 @@ describe("Abilities - Normalize", () => { }); it("should not apply the old type boost item after changing a move's type", async () => { - game.override - .startingHeldItems([{ name: "ATTACK_TYPE_BOOSTER", count: 1, type: PokemonType.GRASS }]) - .moveset([MoveId.LEAFAGE]); + game.override.startingHeldItems([{ entry: HeldItemId.MIRACLE_SEED }]).moveset([MoveId.LEAFAGE]); const powerSpy = vi.spyOn(allMoves[MoveId.LEAFAGE], "calculateBattlePower"); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); @@ -59,9 +58,7 @@ describe("Abilities - Normalize", () => { }); it("should apply silk scarf's power boost after changing a move's type", async () => { - game.override - .startingHeldItems([{ name: "ATTACK_TYPE_BOOSTER", count: 1, type: PokemonType.NORMAL }]) - .moveset([MoveId.LEAFAGE]); + game.override.startingHeldItems([{ entry: HeldItemId.SILK_SCARF }]).moveset([MoveId.LEAFAGE]); const powerSpy = vi.spyOn(allMoves[MoveId.LEAFAGE], "calculateBattlePower"); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); diff --git a/test/abilities/protosynthesis.test.ts b/test/abilities/protosynthesis.test.ts index 5629ea503d7..e02e8fdcf2b 100644 --- a/test/abilities/protosynthesis.test.ts +++ b/test/abilities/protosynthesis.test.ts @@ -4,6 +4,7 @@ import { MoveId } from "#enums/move-id"; import { Nature } from "#enums/nature"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; +import { TrainerItemId } from "#enums/trainer-item-id"; import { GameManager } from "#test/testUtils/gameManager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; @@ -37,7 +38,7 @@ describe("Abilities - Protosynthesis", () => { it("should not consider temporary items when determining which stat to boost", async () => { // Mew has uniform base stats game.override - .startingModifier([{ name: "TEMP_STAT_STAGE_BOOSTER", type: Stat.DEF }]) + .startingTrainerItems([{ entry: TrainerItemId.X_DEFENSE }]) .enemyMoveset(MoveId.SUNNY_DAY) .startingLevel(100) .enemyLevel(100); diff --git a/test/abilities/unburden.test.ts b/test/abilities/unburden.test.ts index 647cd28855d..2ce6841ca3e 100644 --- a/test/abilities/unburden.test.ts +++ b/test/abilities/unburden.test.ts @@ -76,7 +76,7 @@ describe("Abilities - Unburden", () => { it("should activate when a berry is eaten, even if Berry Pouch preserves the berry", async () => { game.override .enemyMoveset(MoveId.FALSE_SWIPE) - .startingHeldItems([{ entry: TrainerItemId.BERRY_POUCH, count: 5850 }]); + .startingTrainerItems([{ entry: TrainerItemId.BERRY_POUCH, count: 5850 }]); await game.classicMode.startBattle([SpeciesId.TREECKO]); const playerPokemon = game.scene.getPlayerPokemon()!; diff --git a/test/abilities/wimp_out.test.ts b/test/abilities/wimp_out.test.ts index fc27bf10c86..57f9d786654 100644 --- a/test/abilities/wimp_out.test.ts +++ b/test/abilities/wimp_out.test.ts @@ -4,6 +4,7 @@ import { ArenaTagSide } from "#enums/arena-tag-side"; import { ArenaTagType } from "#enums/arena-tag-type"; import { BattlerIndex } from "#enums/battler-index"; import { BattlerTagType } from "#enums/battler-tag-type"; +import { HeldItemId } from "#enums/held-item-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; @@ -205,7 +206,7 @@ describe("Abilities - Wimp Out", () => { game.override .moveset([MoveId.DOUBLE_EDGE]) .enemyMoveset([MoveId.SPLASH]) - .startingHeldItems([{ name: "SHELL_BELL", count: 4 }]); + .startingHeldItems([{ entry: HeldItemId.SHELL_BELL, count: 4 }]); await game.classicMode.startBattle([SpeciesId.WIMPOD, SpeciesId.TYRUNT]); const wimpod = game.scene.getPlayerPokemon()!; @@ -430,7 +431,7 @@ describe("Abilities - Wimp Out", () => { }); it("triggers after last hit of multi hit move (multi lens)", async () => { - game.override.enemyMoveset(MoveId.TACKLE).enemyHeldItems([{ name: "MULTI_LENS", count: 1 }]); + game.override.enemyMoveset(MoveId.TACKLE).enemyHeldItems([{ entry: HeldItemId.MULTI_LENS, count: 1 }]); await game.classicMode.startBattle([SpeciesId.WIMPOD, SpeciesId.TYRUNT]); game.scene.getPlayerPokemon()!.hp *= 0.51; diff --git a/test/items/metal_powder.test.ts b/test/items/metal_powder.test.ts index 17baa057fd5..3aa35d1b983 100644 --- a/test/items/metal_powder.test.ts +++ b/test/items/metal_powder.test.ts @@ -1,7 +1,9 @@ import { modifierTypes } from "#data/data-lists"; +import { HeldItemId } from "#enums/held-item-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { SpeciesStatBoosterModifier } from "#modifiers/modifier"; +import { applyHeldItems } from "#items/all-held-items"; +import { HeldItemEffect } from "#items/held-item"; import i18next from "#plugins/i18n"; import { GameManager } from "#test/testUtils/gameManager"; import { NumberHolder } from "#utils/common"; @@ -29,7 +31,7 @@ describe("Items - Metal Powder", () => { }); it("METAL_POWDER activates in battle correctly", async () => { - game.override.startingHeldItems([{ name: "RARE_SPECIES_STAT_BOOSTER", type: "METAL_POWDER" }]); + game.override.startingHeldItems([{ entry: HeldItemId.METAL_POWDER }]); const consoleSpy = vi.spyOn(console, "log"); await game.classicMode.startBattle([SpeciesId.DITTO]); @@ -90,7 +92,7 @@ describe("Items - Metal Powder", () => { // Making sure modifier is not applied without holding item const defValue = new NumberHolder(defStat); - game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.DEF, defValue); + applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.DEF, statValue: defValue }); expect(defValue.value / defStat).toBe(1); @@ -99,7 +101,7 @@ describe("Items - Metal Powder", () => { modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["METAL_POWDER"])!.newModifier(partyMember), true, ); - game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.DEF, defValue); + applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.DEF, statValue: defValue }); expect(defValue.value / defStat).toBe(2); }); @@ -123,7 +125,7 @@ describe("Items - Metal Powder", () => { // Making sure modifier is not applied without holding item const defValue = new NumberHolder(defStat); - game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.DEF, defValue); + applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.DEF, statValue: defValue }); expect(defValue.value / defStat).toBe(1); @@ -132,7 +134,7 @@ describe("Items - Metal Powder", () => { modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["METAL_POWDER"])!.newModifier(partyMember), true, ); - game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.DEF, defValue); + applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.DEF, statValue: defValue }); expect(defValue.value / defStat).toBe(2); }); @@ -156,7 +158,7 @@ describe("Items - Metal Powder", () => { // Making sure modifier is not applied without holding item const defValue = new NumberHolder(defStat); - game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.DEF, defValue); + applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.DEF, statValue: defValue }); expect(defValue.value / defStat).toBe(1); @@ -165,7 +167,7 @@ describe("Items - Metal Powder", () => { modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["METAL_POWDER"])!.newModifier(partyMember), true, ); - game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.DEF, defValue); + applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.DEF, statValue: defValue }); expect(defValue.value / defStat).toBe(2); }); @@ -179,7 +181,7 @@ describe("Items - Metal Powder", () => { // Making sure modifier is not applied without holding item const defValue = new NumberHolder(defStat); - game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.DEF, defValue); + applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.DEF, statValue: defValue }); expect(defValue.value / defStat).toBe(1); @@ -188,7 +190,7 @@ describe("Items - Metal Powder", () => { modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["METAL_POWDER"])!.newModifier(partyMember), true, ); - game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.DEF, defValue); + applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.DEF, statValue: defValue }); expect(defValue.value / defStat).toBe(1); }); diff --git a/test/items/quick_powder.test.ts b/test/items/quick_powder.test.ts index 6c8cb0751c3..4148a7df92c 100644 --- a/test/items/quick_powder.test.ts +++ b/test/items/quick_powder.test.ts @@ -1,7 +1,9 @@ import { modifierTypes } from "#data/data-lists"; +import { HeldItemId } from "#enums/held-item-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { SpeciesStatBoosterModifier } from "#modifiers/modifier"; +import { applyHeldItems } from "#items/all-held-items"; +import { HeldItemEffect } from "#items/held-item"; import i18next from "#plugins/i18n"; import { GameManager } from "#test/testUtils/gameManager"; import { NumberHolder } from "#utils/common"; @@ -29,7 +31,7 @@ describe("Items - Quick Powder", () => { }); it("QUICK_POWDER activates in battle correctly", async () => { - game.override.startingHeldItems([{ name: "RARE_SPECIES_STAT_BOOSTER", type: "QUICK_POWDER" }]); + game.override.startingHeldItems([{ entry: HeldItemId.QUICK_POWDER }]); const consoleSpy = vi.spyOn(console, "log"); await game.classicMode.startBattle([SpeciesId.DITTO]); @@ -90,7 +92,7 @@ describe("Items - Quick Powder", () => { // Making sure modifier is not applied without holding item const spdValue = new NumberHolder(spdStat); - game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.SPD, spdValue); + applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.SPD, statValue: spdValue }); expect(spdValue.value / spdStat).toBe(1); @@ -99,7 +101,7 @@ describe("Items - Quick Powder", () => { modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["QUICK_POWDER"])!.newModifier(partyMember), true, ); - game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.SPD, spdValue); + applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.SPD, statValue: spdValue }); expect(spdValue.value / spdStat).toBe(2); }); @@ -123,7 +125,7 @@ describe("Items - Quick Powder", () => { // Making sure modifier is not applied without holding item const spdValue = new NumberHolder(spdStat); - game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.SPD, spdValue); + applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.SPD, statValue: spdValue }); expect(spdValue.value / spdStat).toBe(1); @@ -132,7 +134,7 @@ describe("Items - Quick Powder", () => { modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["QUICK_POWDER"])!.newModifier(partyMember), true, ); - game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.SPD, spdValue); + applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.SPD, statValue: spdValue }); expect(spdValue.value / spdStat).toBe(2); }); @@ -156,7 +158,7 @@ describe("Items - Quick Powder", () => { // Making sure modifier is not applied without holding item const spdValue = new NumberHolder(spdStat); - game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.SPD, spdValue); + applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.SPD, statValue: spdValue }); expect(spdValue.value / spdStat).toBe(1); @@ -165,7 +167,7 @@ describe("Items - Quick Powder", () => { modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["QUICK_POWDER"])!.newModifier(partyMember), true, ); - game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.SPD, spdValue); + applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.SPD, statValue: spdValue }); expect(spdValue.value / spdStat).toBe(2); }); @@ -179,7 +181,7 @@ describe("Items - Quick Powder", () => { // Making sure modifier is not applied without holding item const spdValue = new NumberHolder(spdStat); - game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.SPD, spdValue); + applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.SPD, statValue: spdValue }); expect(spdValue.value / spdStat).toBe(1); @@ -188,7 +190,7 @@ describe("Items - Quick Powder", () => { modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["QUICK_POWDER"])!.newModifier(partyMember), true, ); - game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.SPD, spdValue); + applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.SPD, statValue: spdValue }); expect(spdValue.value / spdStat).toBe(1); }); diff --git a/test/items/thick_club.test.ts b/test/items/thick_club.test.ts index dd262600823..6fb1e6fbab7 100644 --- a/test/items/thick_club.test.ts +++ b/test/items/thick_club.test.ts @@ -2,6 +2,8 @@ import { modifierTypes } from "#data/data-lists"; import { HeldItemId } from "#enums/held-item-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; +import { applyHeldItems } from "#items/all-held-items"; +import { HeldItemEffect } from "#items/held-item"; import i18next from "#plugins/i18n"; import { GameManager } from "#test/testUtils/gameManager"; import { NumberHolder, randInt } from "#utils/common"; @@ -90,7 +92,7 @@ describe("Items - Thick Club", () => { // Making sure modifier is not applied without holding item const atkValue = new NumberHolder(atkStat); - game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.ATK, atkValue); + applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.ATK, statValue: atkValue }); expect(atkValue.value / atkStat).toBe(1); @@ -99,7 +101,7 @@ describe("Items - Thick Club", () => { modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["THICK_CLUB"])!.newModifier(partyMember), true, ); - game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.ATK, atkValue); + applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.ATK, statValue: atkValue }); expect(atkValue.value / atkStat).toBe(2); }); @@ -113,7 +115,7 @@ describe("Items - Thick Club", () => { // Making sure modifier is not applied without holding item const atkValue = new NumberHolder(atkStat); - game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.ATK, atkValue); + applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.ATK, statValue: atkValue }); expect(atkValue.value / atkStat).toBe(1); @@ -122,7 +124,7 @@ describe("Items - Thick Club", () => { modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["THICK_CLUB"])!.newModifier(partyMember), true, ); - game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.ATK, atkValue); + applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.ATK, statValue: atkValue }); expect(atkValue.value / atkStat).toBe(2); }); @@ -136,7 +138,7 @@ describe("Items - Thick Club", () => { // Making sure modifier is not applied without holding item const atkValue = new NumberHolder(atkStat); - game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.ATK, atkValue); + applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.ATK, statValue: atkValue }); expect(atkValue.value / atkStat).toBe(1); @@ -145,7 +147,7 @@ describe("Items - Thick Club", () => { modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["THICK_CLUB"])!.newModifier(partyMember), true, ); - game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.ATK, atkValue); + applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.ATK, statValue: atkValue }); expect(atkValue.value / atkStat).toBe(2); }); @@ -173,7 +175,7 @@ describe("Items - Thick Club", () => { // Making sure modifier is not applied without holding item const atkValue = new NumberHolder(atkStat); - game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.ATK, atkValue); + applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.ATK, statValue: atkValue }); expect(atkValue.value / atkStat).toBe(1); @@ -182,7 +184,7 @@ describe("Items - Thick Club", () => { modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["THICK_CLUB"])!.newModifier(partyMember), true, ); - game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.ATK, atkValue); + applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.ATK, statValue: atkValue }); expect(atkValue.value / atkStat).toBe(2); }); @@ -210,7 +212,7 @@ describe("Items - Thick Club", () => { // Making sure modifier is not applied without holding item const atkValue = new NumberHolder(atkStat); - game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.ATK, atkValue); + applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.ATK, statValue: atkValue }); expect(atkValue.value / atkStat).toBe(1); @@ -219,7 +221,7 @@ describe("Items - Thick Club", () => { modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["THICK_CLUB"])!.newModifier(partyMember), true, ); - game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.ATK, atkValue); + applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.ATK, statValue: atkValue }); expect(atkValue.value / atkStat).toBe(2); }); @@ -233,7 +235,7 @@ describe("Items - Thick Club", () => { // Making sure modifier is not applied without holding item const atkValue = new NumberHolder(atkStat); - game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.ATK, atkValue); + applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.ATK, statValue: atkValue }); expect(atkValue.value / atkStat).toBe(1); @@ -242,7 +244,7 @@ describe("Items - Thick Club", () => { modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["THICK_CLUB"])!.newModifier(partyMember), true, ); - game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.ATK, atkValue); + applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.ATK, statValue: atkValue }); expect(atkValue.value / atkStat).toBe(1); }); diff --git a/test/moves/electro_shot.test.ts b/test/moves/electro_shot.test.ts index cb696b162d5..16ae47890e4 100644 --- a/test/moves/electro_shot.test.ts +++ b/test/moves/electro_shot.test.ts @@ -1,5 +1,6 @@ import { AbilityId } from "#enums/ability-id"; import { BattlerTagType } from "#enums/battler-tag-type"; +import { HeldItemId } from "#enums/held-item-id"; import { MoveId } from "#enums/move-id"; import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; @@ -87,7 +88,7 @@ describe("Moves - Electro Shot", () => { }); it("should only increase Sp. Atk once with Multi-Lens", async () => { - game.override.weather(WeatherType.RAIN).startingHeldItems([{ name: "MULTI_LENS", count: 1 }]); + game.override.weather(WeatherType.RAIN).startingHeldItems([{ entry: HeldItemId.MULTI_LENS }]); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); diff --git a/test/moves/tera_blast.test.ts b/test/moves/tera_blast.test.ts index d6c16c31544..618e9e66d0a 100644 --- a/test/moves/tera_blast.test.ts +++ b/test/moves/tera_blast.test.ts @@ -1,6 +1,7 @@ import { allMoves } from "#data/data-lists"; import { AbilityId } from "#enums/ability-id"; import { BattlerIndex } from "#enums/battler-index"; +import { HeldItemId } from "#enums/held-item-id"; import { MoveId } from "#enums/move-id"; import { PokemonType } from "#enums/pokemon-type"; import { SpeciesId } from "#enums/species-id"; @@ -141,9 +142,7 @@ describe("Moves - Tera Blast", () => { }); it("does not change its move category from stat changes due to held items", async () => { - game.override - .startingHeldItems([{ name: "SPECIES_STAT_BOOSTER", type: "THICK_CLUB" }]) - .starterSpecies(SpeciesId.CUBONE); + game.override.startingHeldItems([{ entry: HeldItemId.THICK_CLUB }]).starterSpecies(SpeciesId.CUBONE); await game.classicMode.startBattle(); const playerPokemon = game.scene.getPlayerPokemon()!; diff --git a/test/moves/transform-imposter.test.ts b/test/moves/transform-imposter.test.ts index c12542e64e9..cf582d482ce 100644 --- a/test/moves/transform-imposter.test.ts +++ b/test/moves/transform-imposter.test.ts @@ -3,7 +3,7 @@ import { AbilityId } from "#enums/ability-id"; import { BattleType } from "#enums/battle-type"; import { BattlerIndex } from "#enums/battler-index"; import { BattlerTagType } from "#enums/battler-tag-type"; -import { BerryType } from "#enums/berry-type"; +import { HeldItemId } from "#enums/held-item-id"; import { MoveId } from "#enums/move-id"; import { MoveResult } from "#enums/move-result"; import { PokemonType } from "#enums/pokemon-type"; @@ -128,7 +128,7 @@ describe("Transforming Effects", () => { it.todo("should copy the target's rage fist hit count"); it("should not copy friendship, held items, nickname, level or non-volatile status effects", async () => { - game.override.enemyHeldItems([{ name: "BERRY", count: 1, type: BerryType.SITRUS }]); + game.override.enemyHeldItems([{ entry: HeldItemId.SITRUS_BERRY }]); await game.classicMode.startBattle([SpeciesId.DITTO]); const ditto = game.field.getPlayerPokemon();