Cleaned up more files

This commit is contained in:
Wlowscha 2025-07-13 12:34:18 +02:00
parent 8118d00a07
commit d411702716
No known key found for this signature in database
GPG Key ID: 3C8F1AD330565D04
19 changed files with 75 additions and 61 deletions

View File

@ -1,7 +1,7 @@
import { AbilityId } from "#enums/ability-id"; import { AbilityId } from "#enums/ability-id";
import { HeldItemId } from "#enums/held-item-id";
import { MoveId } from "#enums/move-id"; import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id"; import { SpeciesId } from "#enums/species-id";
import { Stat } from "#enums/stat";
import { WeatherType } from "#enums/weather-type"; import { WeatherType } from "#enums/weather-type";
import { GameManager } from "#test/testUtils/gameManager"; import { GameManager } from "#test/testUtils/gameManager";
import Phaser from "phaser"; import Phaser from "phaser";
@ -48,7 +48,7 @@ describe("Ability Activation Order", () => {
.enemySpecies(SpeciesId.MAGIKARP) .enemySpecies(SpeciesId.MAGIKARP)
.enemyAbility(AbilityId.DROUGHT) .enemyAbility(AbilityId.DROUGHT)
.ability(AbilityId.DRIZZLE) .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]); await game.classicMode.startBattle([SpeciesId.MAGIKARP]);
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SUNNY); expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SUNNY);
@ -61,7 +61,7 @@ describe("Ability Activation Order", () => {
.enemySpecies(SpeciesId.DITTO) .enemySpecies(SpeciesId.DITTO)
.enemyAbility(AbilityId.DROUGHT) .enemyAbility(AbilityId.DROUGHT)
.ability(AbilityId.DRIZZLE) .ability(AbilityId.DRIZZLE)
.startingHeldItems([{ name: "SPECIES_STAT_BOOSTER", type: "QUICK_POWDER" }]); .startingHeldItems([{ entry: HeldItemId.QUICK_POWDER }]);
await game.classicMode.startBattle([SpeciesId.DITTO]); await game.classicMode.startBattle([SpeciesId.DITTO]);
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SUNNY); expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SUNNY);

View File

@ -2,6 +2,7 @@ import { allAbilities } from "#data/data-lists";
import { AbilityId } from "#enums/ability-id"; import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id"; import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id"; import { SpeciesId } from "#enums/species-id";
import { TrainerItemId } from "#enums/trainer-item-id";
import { GameManager } from "#test/testUtils/gameManager"; import { GameManager } from "#test/testUtils/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";
@ -46,7 +47,7 @@ describe("Abilities - Arena Trap", () => {
}); });
it("should guarantee double battle with any one LURE", async () => { 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(); await game.classicMode.startBattle();

View File

@ -1,4 +1,5 @@
import { AbilityId } from "#enums/ability-id"; import { AbilityId } from "#enums/ability-id";
import { HeldItemId } from "#enums/held-item-id";
import { MoveId } from "#enums/move-id"; import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id"; import { SpeciesId } from "#enums/species-id";
import { Stat } from "#enums/stat"; import { Stat } from "#enums/stat";
@ -59,7 +60,7 @@ describe("Abilities - Competitive", () => {
}); });
it("white herb should remove only the negative effects", async () => { 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]); await game.classicMode.startBattle([SpeciesId.FLYGON]);
const playerPokemon = game.scene.getPlayerPokemon()!; const playerPokemon = game.scene.getPlayerPokemon()!;

View File

@ -1,4 +1,5 @@
import { AbilityId } from "#enums/ability-id"; import { AbilityId } from "#enums/ability-id";
import { HeldItemId } from "#enums/held-item-id";
import { MoveId } from "#enums/move-id"; import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id"; import { SpeciesId } from "#enums/species-id";
import { Stat } from "#enums/stat"; import { Stat } from "#enums/stat";
@ -58,7 +59,7 @@ describe("Abilities - Defiant", () => {
}); });
it("white herb should remove only the negative effects", async () => { 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]); await game.classicMode.startBattle([SpeciesId.FLYGON]);
const playerPokemon = game.scene.getPlayerPokemon()!; const playerPokemon = game.scene.getPlayerPokemon()!;

View File

@ -2,6 +2,7 @@ import { allAbilities, allMoves } from "#data/data-lists";
import { AbilityId } from "#enums/ability-id"; import { AbilityId } from "#enums/ability-id";
import { BattlerIndex } from "#enums/battler-index"; import { BattlerIndex } from "#enums/battler-index";
import { BattlerTagType } from "#enums/battler-tag-type"; import { BattlerTagType } from "#enums/battler-tag-type";
import { HeldItemId } from "#enums/held-item-id";
import { MoveId } from "#enums/move-id"; import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id"; import { SpeciesId } from "#enums/species-id";
import { Stat } from "#enums/stat"; import { Stat } from "#enums/stat";
@ -44,7 +45,7 @@ describe("Abilities - Flower Veil", () => {
game.override game.override
.enemyMoveset([MoveId.TACKLE, MoveId.SPLASH]) .enemyMoveset([MoveId.TACKLE, MoveId.SPLASH])
.moveset([MoveId.REST, MoveId.SPLASH]) .moveset([MoveId.REST, MoveId.SPLASH])
.startingHeldItems([{ name: "FLAME_ORB" }]); .startingHeldItems([{ entry: HeldItemId.FLAME_ORB }]);
await game.classicMode.startBattle([SpeciesId.BULBASAUR]); await game.classicMode.startBattle([SpeciesId.BULBASAUR]);
const user = game.scene.getPlayerPokemon()!; const user = game.scene.getPlayerPokemon()!;
game.move.select(MoveId.REST); game.move.select(MoveId.REST);

View File

@ -1,6 +1,7 @@
import { AbilityId } from "#enums/ability-id"; import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id"; import { MoveId } from "#enums/move-id";
import { Stat } from "#enums/stat"; import { Stat } from "#enums/stat";
import { TrainerItemId } from "#enums/trainer-item-id";
import { GameManager } from "#test/testUtils/gameManager"; import { GameManager } from "#test/testUtils/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";
@ -45,7 +46,7 @@ describe("Abilities - Illuminate", () => {
}); });
it("should guarantee double battle with any one LURE", async () => { 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(); await game.classicMode.startBattle();

View File

@ -1,5 +1,6 @@
import { Gender } from "#data/gender"; import { Gender } from "#data/gender";
import { AbilityId } from "#enums/ability-id"; import { AbilityId } from "#enums/ability-id";
import { HeldItemId } from "#enums/held-item-id";
import { MoveId } from "#enums/move-id"; import { MoveId } from "#enums/move-id";
import { PokeballType } from "#enums/pokeball"; import { PokeballType } from "#enums/pokeball";
import { SpeciesId } from "#enums/species-id"; import { SpeciesId } from "#enums/species-id";
@ -28,9 +29,9 @@ describe("Abilities - Illusion", () => {
.enemySpecies(SpeciesId.ZORUA) .enemySpecies(SpeciesId.ZORUA)
.enemyAbility(AbilityId.ILLUSION) .enemyAbility(AbilityId.ILLUSION)
.enemyMoveset(MoveId.TACKLE) .enemyMoveset(MoveId.TACKLE)
.enemyHeldItems([{ name: "WIDE_LENS", count: 3 }]) .enemyHeldItems([{ entry: HeldItemId.WIDE_LENS, count: 3 }])
.moveset([MoveId.WORRY_SEED, MoveId.SOAK, MoveId.TACKLE]) .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 () => { it("creates illusion at the start", async () => {

View File

@ -3,6 +3,7 @@ import { BattlerIndex } from "#enums/battler-index";
import { HitCheckResult } from "#enums/hit-check-result"; import { HitCheckResult } from "#enums/hit-check-result";
import { MoveId } from "#enums/move-id"; import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id"; import { SpeciesId } from "#enums/species-id";
import { TrainerItemId } from "#enums/trainer-item-id";
import { MoveEffectPhase } from "#phases/move-effect-phase"; import { MoveEffectPhase } from "#phases/move-effect-phase";
import { MoveEndPhase } from "#phases/move-end-phase"; import { MoveEndPhase } from "#phases/move-end-phase";
import { GameManager } from "#test/testUtils/gameManager"; import { GameManager } from "#test/testUtils/gameManager";
@ -54,7 +55,7 @@ describe("Abilities - No Guard", () => {
}); });
it("should guarantee double battle with any one LURE", async () => { 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(); await game.classicMode.startBattle();

View File

@ -2,9 +2,11 @@ import { TYPE_BOOST_ITEM_BOOST_PERCENT } from "#app/constants";
import { allAbilities, allMoves } from "#data/data-lists"; import { allAbilities, allMoves } from "#data/data-lists";
import { AbilityId } from "#enums/ability-id"; import { AbilityId } from "#enums/ability-id";
import { BattlerIndex } from "#enums/battler-index"; import { BattlerIndex } from "#enums/battler-index";
import { HeldItemId } from "#enums/held-item-id";
import { MoveId } from "#enums/move-id"; import { MoveId } from "#enums/move-id";
import { PokemonType } from "#enums/pokemon-type"; import { PokemonType } from "#enums/pokemon-type";
import { SpeciesId } from "#enums/species-id"; import { SpeciesId } from "#enums/species-id";
import { attackTypeToHeldItem } from "#items/attack-type-booster";
import { GameManager } from "#test/testUtils/gameManager"; import { GameManager } from "#test/testUtils/gameManager";
import { toDmgValue } from "#utils/common"; import { toDmgValue } from "#utils/common";
import Phaser from "phaser"; 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 () => { 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(); await game.classicMode.startBattle();
const testMoveInstance = allMoves[MoveId.TACKLE]; 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 () => { 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(); await game.classicMode.startBattle();
// get the power boost from the ability so we can compare it to the item // get the power boost from the ability so we can compare it to the item

View File

@ -1,6 +1,7 @@
import { TYPE_BOOST_ITEM_BOOST_PERCENT } from "#app/constants"; import { TYPE_BOOST_ITEM_BOOST_PERCENT } from "#app/constants";
import { allMoves } from "#data/data-lists"; import { allMoves } from "#data/data-lists";
import { AbilityId } from "#enums/ability-id"; import { AbilityId } from "#enums/ability-id";
import { HeldItemId } from "#enums/held-item-id";
import { MoveId } from "#enums/move-id"; import { MoveId } from "#enums/move-id";
import { PokemonType } from "#enums/pokemon-type"; import { PokemonType } from "#enums/pokemon-type";
import { SpeciesId } from "#enums/species-id"; 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 () => { it("should not apply the old type boost item after changing a move's type", async () => {
game.override game.override.startingHeldItems([{ entry: HeldItemId.MIRACLE_SEED }]).moveset([MoveId.LEAFAGE]);
.startingHeldItems([{ name: "ATTACK_TYPE_BOOSTER", count: 1, type: PokemonType.GRASS }])
.moveset([MoveId.LEAFAGE]);
const powerSpy = vi.spyOn(allMoves[MoveId.LEAFAGE], "calculateBattlePower"); const powerSpy = vi.spyOn(allMoves[MoveId.LEAFAGE], "calculateBattlePower");
await game.classicMode.startBattle([SpeciesId.MAGIKARP]); 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 () => { it("should apply silk scarf's power boost after changing a move's type", async () => {
game.override game.override.startingHeldItems([{ entry: HeldItemId.SILK_SCARF }]).moveset([MoveId.LEAFAGE]);
.startingHeldItems([{ name: "ATTACK_TYPE_BOOSTER", count: 1, type: PokemonType.NORMAL }])
.moveset([MoveId.LEAFAGE]);
const powerSpy = vi.spyOn(allMoves[MoveId.LEAFAGE], "calculateBattlePower"); const powerSpy = vi.spyOn(allMoves[MoveId.LEAFAGE], "calculateBattlePower");
await game.classicMode.startBattle([SpeciesId.MAGIKARP]); await game.classicMode.startBattle([SpeciesId.MAGIKARP]);

View File

@ -4,6 +4,7 @@ import { MoveId } from "#enums/move-id";
import { Nature } from "#enums/nature"; import { Nature } from "#enums/nature";
import { SpeciesId } from "#enums/species-id"; import { SpeciesId } from "#enums/species-id";
import { Stat } from "#enums/stat"; import { Stat } from "#enums/stat";
import { TrainerItemId } from "#enums/trainer-item-id";
import { GameManager } from "#test/testUtils/gameManager"; import { GameManager } from "#test/testUtils/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";
@ -37,7 +38,7 @@ describe("Abilities - Protosynthesis", () => {
it("should not consider temporary items when determining which stat to boost", async () => { it("should not consider temporary items when determining which stat to boost", async () => {
// Mew has uniform base stats // Mew has uniform base stats
game.override game.override
.startingModifier([{ name: "TEMP_STAT_STAGE_BOOSTER", type: Stat.DEF }]) .startingTrainerItems([{ entry: TrainerItemId.X_DEFENSE }])
.enemyMoveset(MoveId.SUNNY_DAY) .enemyMoveset(MoveId.SUNNY_DAY)
.startingLevel(100) .startingLevel(100)
.enemyLevel(100); .enemyLevel(100);

View File

@ -76,7 +76,7 @@ describe("Abilities - Unburden", () => {
it("should activate when a berry is eaten, even if Berry Pouch preserves the berry", async () => { it("should activate when a berry is eaten, even if Berry Pouch preserves the berry", async () => {
game.override game.override
.enemyMoveset(MoveId.FALSE_SWIPE) .enemyMoveset(MoveId.FALSE_SWIPE)
.startingHeldItems([{ entry: TrainerItemId.BERRY_POUCH, count: 5850 }]); .startingTrainerItems([{ entry: TrainerItemId.BERRY_POUCH, count: 5850 }]);
await game.classicMode.startBattle([SpeciesId.TREECKO]); await game.classicMode.startBattle([SpeciesId.TREECKO]);
const playerPokemon = game.scene.getPlayerPokemon()!; const playerPokemon = game.scene.getPlayerPokemon()!;

View File

@ -4,6 +4,7 @@ import { ArenaTagSide } from "#enums/arena-tag-side";
import { ArenaTagType } from "#enums/arena-tag-type"; import { ArenaTagType } from "#enums/arena-tag-type";
import { BattlerIndex } from "#enums/battler-index"; import { BattlerIndex } from "#enums/battler-index";
import { BattlerTagType } from "#enums/battler-tag-type"; import { BattlerTagType } from "#enums/battler-tag-type";
import { HeldItemId } from "#enums/held-item-id";
import { MoveId } from "#enums/move-id"; import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id"; import { SpeciesId } from "#enums/species-id";
import { Stat } from "#enums/stat"; import { Stat } from "#enums/stat";
@ -205,7 +206,7 @@ describe("Abilities - Wimp Out", () => {
game.override game.override
.moveset([MoveId.DOUBLE_EDGE]) .moveset([MoveId.DOUBLE_EDGE])
.enemyMoveset([MoveId.SPLASH]) .enemyMoveset([MoveId.SPLASH])
.startingHeldItems([{ name: "SHELL_BELL", count: 4 }]); .startingHeldItems([{ entry: HeldItemId.SHELL_BELL, count: 4 }]);
await game.classicMode.startBattle([SpeciesId.WIMPOD, SpeciesId.TYRUNT]); await game.classicMode.startBattle([SpeciesId.WIMPOD, SpeciesId.TYRUNT]);
const wimpod = game.scene.getPlayerPokemon()!; 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 () => { 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]); await game.classicMode.startBattle([SpeciesId.WIMPOD, SpeciesId.TYRUNT]);
game.scene.getPlayerPokemon()!.hp *= 0.51; game.scene.getPlayerPokemon()!.hp *= 0.51;

View File

@ -1,7 +1,9 @@
import { modifierTypes } from "#data/data-lists"; import { modifierTypes } from "#data/data-lists";
import { HeldItemId } from "#enums/held-item-id";
import { SpeciesId } from "#enums/species-id"; import { SpeciesId } from "#enums/species-id";
import { Stat } from "#enums/stat"; 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 i18next from "#plugins/i18n";
import { GameManager } from "#test/testUtils/gameManager"; import { GameManager } from "#test/testUtils/gameManager";
import { NumberHolder } from "#utils/common"; import { NumberHolder } from "#utils/common";
@ -29,7 +31,7 @@ describe("Items - Metal Powder", () => {
}); });
it("METAL_POWDER activates in battle correctly", async () => { 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"); const consoleSpy = vi.spyOn(console, "log");
await game.classicMode.startBattle([SpeciesId.DITTO]); await game.classicMode.startBattle([SpeciesId.DITTO]);
@ -90,7 +92,7 @@ describe("Items - Metal Powder", () => {
// Making sure modifier is not applied without holding item // Making sure modifier is not applied without holding item
const defValue = new NumberHolder(defStat); 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); expect(defValue.value / defStat).toBe(1);
@ -99,7 +101,7 @@ describe("Items - Metal Powder", () => {
modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["METAL_POWDER"])!.newModifier(partyMember), modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["METAL_POWDER"])!.newModifier(partyMember),
true, 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); expect(defValue.value / defStat).toBe(2);
}); });
@ -123,7 +125,7 @@ describe("Items - Metal Powder", () => {
// Making sure modifier is not applied without holding item // Making sure modifier is not applied without holding item
const defValue = new NumberHolder(defStat); 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); expect(defValue.value / defStat).toBe(1);
@ -132,7 +134,7 @@ describe("Items - Metal Powder", () => {
modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["METAL_POWDER"])!.newModifier(partyMember), modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["METAL_POWDER"])!.newModifier(partyMember),
true, 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); expect(defValue.value / defStat).toBe(2);
}); });
@ -156,7 +158,7 @@ describe("Items - Metal Powder", () => {
// Making sure modifier is not applied without holding item // Making sure modifier is not applied without holding item
const defValue = new NumberHolder(defStat); 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); expect(defValue.value / defStat).toBe(1);
@ -165,7 +167,7 @@ describe("Items - Metal Powder", () => {
modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["METAL_POWDER"])!.newModifier(partyMember), modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["METAL_POWDER"])!.newModifier(partyMember),
true, 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); expect(defValue.value / defStat).toBe(2);
}); });
@ -179,7 +181,7 @@ describe("Items - Metal Powder", () => {
// Making sure modifier is not applied without holding item // Making sure modifier is not applied without holding item
const defValue = new NumberHolder(defStat); 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); expect(defValue.value / defStat).toBe(1);
@ -188,7 +190,7 @@ describe("Items - Metal Powder", () => {
modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["METAL_POWDER"])!.newModifier(partyMember), modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["METAL_POWDER"])!.newModifier(partyMember),
true, 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); expect(defValue.value / defStat).toBe(1);
}); });

View File

@ -1,7 +1,9 @@
import { modifierTypes } from "#data/data-lists"; import { modifierTypes } from "#data/data-lists";
import { HeldItemId } from "#enums/held-item-id";
import { SpeciesId } from "#enums/species-id"; import { SpeciesId } from "#enums/species-id";
import { Stat } from "#enums/stat"; 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 i18next from "#plugins/i18n";
import { GameManager } from "#test/testUtils/gameManager"; import { GameManager } from "#test/testUtils/gameManager";
import { NumberHolder } from "#utils/common"; import { NumberHolder } from "#utils/common";
@ -29,7 +31,7 @@ describe("Items - Quick Powder", () => {
}); });
it("QUICK_POWDER activates in battle correctly", async () => { 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"); const consoleSpy = vi.spyOn(console, "log");
await game.classicMode.startBattle([SpeciesId.DITTO]); await game.classicMode.startBattle([SpeciesId.DITTO]);
@ -90,7 +92,7 @@ describe("Items - Quick Powder", () => {
// Making sure modifier is not applied without holding item // Making sure modifier is not applied without holding item
const spdValue = new NumberHolder(spdStat); 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); expect(spdValue.value / spdStat).toBe(1);
@ -99,7 +101,7 @@ describe("Items - Quick Powder", () => {
modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["QUICK_POWDER"])!.newModifier(partyMember), modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["QUICK_POWDER"])!.newModifier(partyMember),
true, 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); expect(spdValue.value / spdStat).toBe(2);
}); });
@ -123,7 +125,7 @@ describe("Items - Quick Powder", () => {
// Making sure modifier is not applied without holding item // Making sure modifier is not applied without holding item
const spdValue = new NumberHolder(spdStat); 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); expect(spdValue.value / spdStat).toBe(1);
@ -132,7 +134,7 @@ describe("Items - Quick Powder", () => {
modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["QUICK_POWDER"])!.newModifier(partyMember), modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["QUICK_POWDER"])!.newModifier(partyMember),
true, 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); expect(spdValue.value / spdStat).toBe(2);
}); });
@ -156,7 +158,7 @@ describe("Items - Quick Powder", () => {
// Making sure modifier is not applied without holding item // Making sure modifier is not applied without holding item
const spdValue = new NumberHolder(spdStat); 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); expect(spdValue.value / spdStat).toBe(1);
@ -165,7 +167,7 @@ describe("Items - Quick Powder", () => {
modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["QUICK_POWDER"])!.newModifier(partyMember), modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["QUICK_POWDER"])!.newModifier(partyMember),
true, 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); expect(spdValue.value / spdStat).toBe(2);
}); });
@ -179,7 +181,7 @@ describe("Items - Quick Powder", () => {
// Making sure modifier is not applied without holding item // Making sure modifier is not applied without holding item
const spdValue = new NumberHolder(spdStat); 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); expect(spdValue.value / spdStat).toBe(1);
@ -188,7 +190,7 @@ describe("Items - Quick Powder", () => {
modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["QUICK_POWDER"])!.newModifier(partyMember), modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["QUICK_POWDER"])!.newModifier(partyMember),
true, 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); expect(spdValue.value / spdStat).toBe(1);
}); });

View File

@ -2,6 +2,8 @@ import { modifierTypes } from "#data/data-lists";
import { HeldItemId } from "#enums/held-item-id"; import { HeldItemId } from "#enums/held-item-id";
import { SpeciesId } from "#enums/species-id"; import { SpeciesId } from "#enums/species-id";
import { Stat } from "#enums/stat"; import { Stat } from "#enums/stat";
import { applyHeldItems } from "#items/all-held-items";
import { HeldItemEffect } from "#items/held-item";
import i18next from "#plugins/i18n"; import i18next from "#plugins/i18n";
import { GameManager } from "#test/testUtils/gameManager"; import { GameManager } from "#test/testUtils/gameManager";
import { NumberHolder, randInt } from "#utils/common"; import { NumberHolder, randInt } from "#utils/common";
@ -90,7 +92,7 @@ describe("Items - Thick Club", () => {
// Making sure modifier is not applied without holding item // Making sure modifier is not applied without holding item
const atkValue = new NumberHolder(atkStat); 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); expect(atkValue.value / atkStat).toBe(1);
@ -99,7 +101,7 @@ describe("Items - Thick Club", () => {
modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["THICK_CLUB"])!.newModifier(partyMember), modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["THICK_CLUB"])!.newModifier(partyMember),
true, 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); expect(atkValue.value / atkStat).toBe(2);
}); });
@ -113,7 +115,7 @@ describe("Items - Thick Club", () => {
// Making sure modifier is not applied without holding item // Making sure modifier is not applied without holding item
const atkValue = new NumberHolder(atkStat); 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); expect(atkValue.value / atkStat).toBe(1);
@ -122,7 +124,7 @@ describe("Items - Thick Club", () => {
modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["THICK_CLUB"])!.newModifier(partyMember), modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["THICK_CLUB"])!.newModifier(partyMember),
true, 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); expect(atkValue.value / atkStat).toBe(2);
}); });
@ -136,7 +138,7 @@ describe("Items - Thick Club", () => {
// Making sure modifier is not applied without holding item // Making sure modifier is not applied without holding item
const atkValue = new NumberHolder(atkStat); 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); expect(atkValue.value / atkStat).toBe(1);
@ -145,7 +147,7 @@ describe("Items - Thick Club", () => {
modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["THICK_CLUB"])!.newModifier(partyMember), modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["THICK_CLUB"])!.newModifier(partyMember),
true, 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); expect(atkValue.value / atkStat).toBe(2);
}); });
@ -173,7 +175,7 @@ describe("Items - Thick Club", () => {
// Making sure modifier is not applied without holding item // Making sure modifier is not applied without holding item
const atkValue = new NumberHolder(atkStat); 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); expect(atkValue.value / atkStat).toBe(1);
@ -182,7 +184,7 @@ describe("Items - Thick Club", () => {
modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["THICK_CLUB"])!.newModifier(partyMember), modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["THICK_CLUB"])!.newModifier(partyMember),
true, 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); expect(atkValue.value / atkStat).toBe(2);
}); });
@ -210,7 +212,7 @@ describe("Items - Thick Club", () => {
// Making sure modifier is not applied without holding item // Making sure modifier is not applied without holding item
const atkValue = new NumberHolder(atkStat); 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); expect(atkValue.value / atkStat).toBe(1);
@ -219,7 +221,7 @@ describe("Items - Thick Club", () => {
modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["THICK_CLUB"])!.newModifier(partyMember), modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["THICK_CLUB"])!.newModifier(partyMember),
true, 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); expect(atkValue.value / atkStat).toBe(2);
}); });
@ -233,7 +235,7 @@ describe("Items - Thick Club", () => {
// Making sure modifier is not applied without holding item // Making sure modifier is not applied without holding item
const atkValue = new NumberHolder(atkStat); 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); expect(atkValue.value / atkStat).toBe(1);
@ -242,7 +244,7 @@ describe("Items - Thick Club", () => {
modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["THICK_CLUB"])!.newModifier(partyMember), modifierTypes.RARE_SPECIES_STAT_BOOSTER().generateType([], ["THICK_CLUB"])!.newModifier(partyMember),
true, 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); expect(atkValue.value / atkStat).toBe(1);
}); });

View File

@ -1,5 +1,6 @@
import { AbilityId } from "#enums/ability-id"; import { AbilityId } from "#enums/ability-id";
import { BattlerTagType } from "#enums/battler-tag-type"; import { BattlerTagType } from "#enums/battler-tag-type";
import { HeldItemId } from "#enums/held-item-id";
import { MoveId } from "#enums/move-id"; import { MoveId } from "#enums/move-id";
import { MoveResult } from "#enums/move-result"; import { MoveResult } from "#enums/move-result";
import { SpeciesId } from "#enums/species-id"; 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 () => { 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]); await game.classicMode.startBattle([SpeciesId.MAGIKARP]);

View File

@ -1,6 +1,7 @@
import { allMoves } from "#data/data-lists"; import { allMoves } from "#data/data-lists";
import { AbilityId } from "#enums/ability-id"; import { AbilityId } from "#enums/ability-id";
import { BattlerIndex } from "#enums/battler-index"; import { BattlerIndex } from "#enums/battler-index";
import { HeldItemId } from "#enums/held-item-id";
import { MoveId } from "#enums/move-id"; import { MoveId } from "#enums/move-id";
import { PokemonType } from "#enums/pokemon-type"; import { PokemonType } from "#enums/pokemon-type";
import { SpeciesId } from "#enums/species-id"; 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 () => { it("does not change its move category from stat changes due to held items", async () => {
game.override game.override.startingHeldItems([{ entry: HeldItemId.THICK_CLUB }]).starterSpecies(SpeciesId.CUBONE);
.startingHeldItems([{ name: "SPECIES_STAT_BOOSTER", type: "THICK_CLUB" }])
.starterSpecies(SpeciesId.CUBONE);
await game.classicMode.startBattle(); await game.classicMode.startBattle();
const playerPokemon = game.scene.getPlayerPokemon()!; const playerPokemon = game.scene.getPlayerPokemon()!;

View File

@ -3,7 +3,7 @@ import { AbilityId } from "#enums/ability-id";
import { BattleType } from "#enums/battle-type"; import { BattleType } from "#enums/battle-type";
import { BattlerIndex } from "#enums/battler-index"; import { BattlerIndex } from "#enums/battler-index";
import { BattlerTagType } from "#enums/battler-tag-type"; 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 { MoveId } from "#enums/move-id";
import { MoveResult } from "#enums/move-result"; import { MoveResult } from "#enums/move-result";
import { PokemonType } from "#enums/pokemon-type"; 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.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 () => { 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]); await game.classicMode.startBattle([SpeciesId.DITTO]);
const ditto = game.field.getPlayerPokemon(); const ditto = game.field.getPlayerPokemon();