diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 850d0baab5d..8c0cbf0b976 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -3038,6 +3038,7 @@ export default class BattleScene extends SceneBase { const expPartyMembers = nonFaintedPartyMembers.filter(p => p.level < this.getMaxExpLevel()); const partyMemberExp: number[] = []; // EXP value calculation is based off Pokemon.getExpValue + console.log("PARTIPADOS", this.currentBattle.playerParticipantIds); if (useWaveIndexMultiplier) { expValue = Math.floor(expValue * this.currentBattle.waveIndex / 5 + 1); } @@ -3116,6 +3117,14 @@ export default class BattleScene extends SceneBase { if (exp) { const partyMemberIndex = party.indexOf(expPartyMembers[pm]); + // Maybe here? + /* + I think that this hyper specific bug is because initally, the pokemon being switched in right before opposing pokemons death is not counted as participant, + and not in the expPartyMembers maybe? + + in the other cause where I switched both in but swapped last second before toxic death, then both had already been involved in fight + + */ this.unshiftPhase(expPartyMembers[pm].isOnField() ? new ExpPhase(this, partyMemberIndex, exp) : new ShowPartyExpBarPhase(this, partyMemberIndex, exp)); } } diff --git a/src/phases/faint-phase.ts b/src/phases/faint-phase.ts index 66bb22899be..94f807b9481 100644 --- a/src/phases/faint-phase.ts +++ b/src/phases/faint-phase.ts @@ -44,6 +44,16 @@ export class FaintPhase extends PokemonPhase { } } + /** In case the current pokemon was just switched in, make sure it is counted as participating in the combat */ + this.scene.getField().forEach((pokemon, i) => { + if (pokemon?.isActive()) { + if (pokemon.isPlayer()) { + this.scene.currentBattle.addParticipant(pokemon as PlayerPokemon); + } + pokemon.resetTurnData(); + } + }); + if (!this.tryOverrideForBattleSpec()) { this.doFaint(); }