Addressed PigeonBar's comments

This commit is contained in:
frutescens 2024-11-15 09:59:35 -08:00
parent 10f3ff1ef8
commit 4b5cb44884
2 changed files with 8 additions and 9 deletions

View File

@ -291,7 +291,7 @@ export function applyDamageToPokemon(scene: BattleScene, pokemon: PlayerPokemon,
console.warn("Healing pokemon with `applyDamageToPokemon` is not recommended! Please use `applyHealToPokemon` instead."); 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 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; damage = pokemon.hp - 1;
} }
applyHpChangeToPokemon(scene, pokemon, -damage); applyHpChangeToPokemon(scene, pokemon, -damage);

View File

@ -115,12 +115,8 @@ export class GameOverPhase extends BattlePhase {
this.scene.gameData.gameStats.dailyRunSessionsWon++; 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; const fadeDuration = this.isVictory ? 10000 : 5000;
this.scene.fadeOutBgm(fadeDuration, true); this.scene.fadeOutBgm(fadeDuration, true);
const activeBattlers = this.scene.getField().filter(p => p?.isActive(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.unshiftPhase(new GameOverModifierRewardPhase(this.scene, modifierTypes.VOUCHER_PREMIUM));
} }
} }
this.scene.pushPhase(new PostGameOverPhase(this.scene, endCardPhase)); this.getRunHistoryEntry().then(runHistoryEntry => {
this.end(); 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) { if (this.isVictory && this.scene.gameMode.isClassic) {