Simplify PostSummonFormChangeByWeather's canApplyPostSummon

This commit is contained in:
Sirz Benjie 2025-05-30 23:17:24 -05:00
parent 2d2420aaaa
commit 45499a2e59
No known key found for this signature in database
GPG Key ID: 38AC42D68CF5E138

View File

@ -3979,10 +3979,9 @@ export class PostSummonFormChangeByWeatherAbAttr extends PostSummonAbAttr {
* @param args - unused
*/
override canApplyPostSummon(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean {
const fc = (pokemonFormChanges[pokemon.species.speciesId]?.filter(
fc => fc.findTrigger(SpeciesFormChangeWeatherTrigger) && fc.canChange(pokemon)
) || [])[0];
return !isNullOrUndefined(fc);
return !!pokemonFormChanges[pokemon.species.speciesId]?.some(
fc => fc.findTrigger(SpeciesFormChangeWeatherTrigger) && fc.canChange(pokemon),
);
}
/**