From a4528f5349d3e6b7074c7f3943075133d5bc1bd8 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Wed, 6 Mar 2024 21:12:31 -0500 Subject: [PATCH] Fix crash on giving a Pokemon a held item --- src/modifier/modifier-type.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modifier/modifier-type.ts b/src/modifier/modifier-type.ts index baf88fd7ac3..37562df26f3 100644 --- a/src/modifier/modifier-type.ts +++ b/src/modifier/modifier-type.ts @@ -140,7 +140,7 @@ export class PokemonHeldItemModifierType extends PokemonModifierType { super(name, description, newModifierFunc, (pokemon: PlayerPokemon) => { const dummyModifier = this.newModifier(pokemon); const matchingModifier = pokemon.scene.findModifier(m => m instanceof Modifiers.PokemonHeldItemModifier && m.pokemonId === pokemon.id && m.matchType(dummyModifier)) as Modifiers.PokemonHeldItemModifier; - const maxStackCount = matchingModifier.getMaxStackCount(pokemon.scene); + const maxStackCount = dummyModifier.getMaxStackCount(pokemon.scene); if (!maxStackCount) return `${pokemon.name} can\'t take\nthis item!`; if (matchingModifier && matchingModifier.stackCount === maxStackCount)