Prevent crash with trace

pull/147/head^2
LaukkaE 2024-04-15 22:52:13 +03:00 committed by Samuel H
parent af4e9ff66e
commit e15b810f6a
1 changed files with 2 additions and 0 deletions

View File

@ -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);