From e15b810f6aa36381f4df164e7114b2f050ca8769 Mon Sep 17 00:00:00 2001 From: LaukkaE Date: Mon, 15 Apr 2024 22:52:13 +0300 Subject: [PATCH] Prevent crash with trace --- src/data/ability.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/data/ability.ts b/src/data/ability.ts index 768dcd04b..05b74ece6 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -1155,6 +1155,8 @@ export class PostSummonFormChangeAbAttr extends PostSummonAbAttr { export class TraceAbAttr extends PostSummonAbAttr { applyPostSummon(pokemon: Pokemon, passive: boolean, args: any[]): boolean { const targets = pokemon.getOpponents(); + if (!targets.length) + return false; let target: Pokemon; if (targets.length > 1) pokemon.scene.executeWithSeedOffset(() => target = Utils.randSeedItem(targets), pokemon.scene.currentBattle.waveIndex);