diff --git a/src/data/mystery-encounters/utils/encounter-pokemon-utils.ts b/src/data/mystery-encounters/utils/encounter-pokemon-utils.ts index 2117386d14d..4800989d837 100644 --- a/src/data/mystery-encounters/utils/encounter-pokemon-utils.ts +++ b/src/data/mystery-encounters/utils/encounter-pokemon-utils.ts @@ -291,7 +291,7 @@ export function applyDamageToPokemon(scene: BattleScene, pokemon: PlayerPokemon, console.warn("Healing pokemon with `applyDamageToPokemon` is not recommended! Please use `applyHealToPokemon` instead."); } // If a Pokemon would faint from the damage applied, its HP is instead set to 1. - if (pokemon.hp - damage <= 0) { + if (pokemon.isAllowedInBattle() && pokemon.hp - damage <= 0) { damage = pokemon.hp - 1; } applyHpChangeToPokemon(scene, pokemon, -damage); diff --git a/src/phases/game-over-phase.ts b/src/phases/game-over-phase.ts index c748a6b9069..1d954cc2c2a 100644 --- a/src/phases/game-over-phase.ts +++ b/src/phases/game-over-phase.ts @@ -115,12 +115,8 @@ export class GameOverPhase extends BattlePhase { this.scene.gameData.gameStats.dailyRunSessionsWon++; } } - - this.getRunHistoryEntry().then(runHistoryEntry => { - this.scene.gameData.saveRunHistory(this.scene, runHistoryEntry, this.victory); - }); - const fadeDuration = this.victory ? 10000 : 5000; - this.scene.gameData.saveRunHistory(this.scene, this.scene.gameData.getSessionSaveData(this.scene), this.isVictory); + + const fadeDuration = this.isVictory ? 10000 : 5000; this.scene.fadeOutBgm(fadeDuration, true); const activeBattlers = this.scene.getField().filter(p => p?.isActive(true)); @@ -146,8 +142,11 @@ export class GameOverPhase extends BattlePhase { this.scene.unshiftPhase(new GameOverModifierRewardPhase(this.scene, modifierTypes.VOUCHER_PREMIUM)); } } - this.scene.pushPhase(new PostGameOverPhase(this.scene, endCardPhase)); - this.end(); + this.getRunHistoryEntry().then(runHistoryEntry => { + this.scene.gameData.saveRunHistory(this.scene, runHistoryEntry, this.isVictory); + this.scene.pushPhase(new PostGameOverPhase(this.scene, endCardPhase)); + this.end(); + }); }; if (this.isVictory && this.scene.gameMode.isClassic) {