From 2f5d2a8776b3279d2f913529329c0f1d8d583df0 Mon Sep 17 00:00:00 2001 From: Benjamin Odom Date: Sat, 4 May 2024 21:34:24 -0500 Subject: [PATCH] Update phases.ts --- src/phases.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/phases.ts b/src/phases.ts index 17c48bf41..6f1ebc261 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -1189,7 +1189,8 @@ export class SummonPhase extends PartyMemberPokemonPhase { console.warn("The Pokemon about to be sent out is fainted. Attempting to resolve..."); const party = this.getParty(); - const nonFaintedIndex = party.findIndex(x => !x.isFainted()); // Find the first non-fainted Pokemon index + // Find the first non-fainted Pokemon index above the current one + const nonFaintedIndex = party.findIndex((p, i) => i > this.partyMemberIndex && !p.isFainted()); if (nonFaintedIndex === -1) { console.error("Party Details:\n", party); throw new Error("All available Pokemon were fainted!");