Update phases.ts

pull/472/head
Benjamin Odom 2024-05-04 21:34:24 -05:00
parent 480d097dd3
commit 2f5d2a8776
1 changed files with 2 additions and 1 deletions

View File

@ -1189,7 +1189,8 @@ export class SummonPhase extends PartyMemberPokemonPhase {
console.warn("The Pokemon about to be sent out is fainted. Attempting to resolve..."); console.warn("The Pokemon about to be sent out is fainted. Attempting to resolve...");
const party = this.getParty(); 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) { if (nonFaintedIndex === -1) {
console.error("Party Details:\n", party); console.error("Party Details:\n", party);
throw new Error("All available Pokemon were fainted!"); throw new Error("All available Pokemon were fainted!");