From 07c14916499652675c3153101832111d73a93d77 Mon Sep 17 00:00:00 2001 From: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Date: Tue, 7 Oct 2025 23:23:25 -0500 Subject: [PATCH] [Misc] fix error throwing in forewarn --- src/data/abilities/ability.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/data/abilities/ability.ts b/src/data/abilities/ability.ts index 188df4bb915..7d239a2772c 100644 --- a/src/data/abilities/ability.ts +++ b/src/data/abilities/ability.ts @@ -4342,6 +4342,10 @@ export class ForewarnAbAttr extends PostSummonAbAttr { super(true); } + override canApply({ pokemon }: AbAttrBaseParams): boolean { + return pokemon.getOpponents().some(opp => opp.getMoveset().length > 0); + } + override apply({ simulated, pokemon }: AbAttrBaseParams): void { if (simulated) { return; @@ -4374,8 +4378,7 @@ export class ForewarnAbAttr extends PostSummonAbAttr { // Pick a random move in our list. if (movesAtMaxPower.length === 0) { - // NB: The ONLY way this can happen is if both opponents have 0 moves in their moveset - throw new Error("Forewarn ability found 0 valid moves!"); + return; } const chosenMove = movesAtMaxPower[pokemon.randBattleSeedInt(movesAtMaxPower.length)]; globalScene.phaseManager.queueMessage(