From 1f860d6d1db27a11b82aa59918f21ac9f2dd05c6 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Sat, 6 Apr 2024 14:32:55 -0400 Subject: [PATCH] Fix fusion evolution items not working on fully evolved species --- src/modifier/modifier.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/modifier/modifier.ts b/src/modifier/modifier.ts index a75f59631..d047c3ddb 100644 --- a/src/modifier/modifier.ts +++ b/src/modifier/modifier.ts @@ -1183,9 +1183,11 @@ export class EvolutionItemModifier extends ConsumablePokemonModifier { apply(args: any[]): boolean { const pokemon = args[0] as PlayerPokemon; - let matchingEvolution = pokemonEvolutions[pokemon.species.speciesId].find(e => e.item === (this.type as ModifierTypes.EvolutionItemModifierType).evolutionItem - && (e.evoFormKey === null || (e.preFormKey || '') === pokemon.getFormKey()) - && (!e.condition || e.condition.predicate(pokemon))); + let matchingEvolution = pokemonEvolutions.hasOwnProperty(pokemon.species.speciesId) + ? pokemonEvolutions[pokemon.species.speciesId].find(e => e.item === (this.type as ModifierTypes.EvolutionItemModifierType).evolutionItem + && (e.evoFormKey === null || (e.preFormKey || '') === pokemon.getFormKey()) + && (!e.condition || e.condition.predicate(pokemon))) + : null; if (!matchingEvolution && pokemon.isFusion()) { matchingEvolution = pokemonEvolutions[pokemon.fusionSpecies.speciesId].find(e => e.item === (this.type as ModifierTypes.EvolutionItemModifierType).evolutionItem