From 08e22e680de78ea735c8d8a14a5eb4b99593b346 Mon Sep 17 00:00:00 2001 From: PrabbyDD Date: Fri, 18 Oct 2024 15:01:50 -0700 Subject: [PATCH] adding fainted check to fix the bug --- src/phases/faint-phase.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/phases/faint-phase.ts b/src/phases/faint-phase.ts index fa8c7c3e445..b042e082ef7 100644 --- a/src/phases/faint-phase.ts +++ b/src/phases/faint-phase.ts @@ -44,9 +44,14 @@ export class FaintPhase extends PokemonPhase { } } - /** In case the current pokemon was just switched in, make sure it is counted as participating in the combat */ + /** + * In case the current pokemon was just switched in, make sure it is counted as participating in the combat. + * For EXP_SHARE purposes, if the current pokemon faints as the combat ends and it was the ONLY player pokemon + * involved in combat, it needs to be counted as a participant so the other party pokemon can get their EXP, + * so the fainted pokemon has been included. + */ this.scene.getField().forEach((pokemon, i) => { - if (pokemon?.isActive()) { + if (pokemon?.isActive() || pokemon?.isFainted()) { if (pokemon.isPlayer()) { this.scene.currentBattle.addParticipant(pokemon as PlayerPokemon); }