Remove endless 5850 crash bug (#1463)

This commit is contained in:
Xavion3 2024-05-28 11:01:13 +10:00 committed by GitHub
parent f64e9e4a0d
commit 970e335fab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View File

@ -2316,6 +2316,8 @@ export const PGMmiscDialogue: SimpleTranslationEntries = {
$@c{smile_wave_wink}Just kidding!@d{64} @c{smile}I'd never forget.@d{32}\nYour legend will live on in our hearts.
$@c{smile_wave}Anyway,@d{64} it's getting late…@d{96} I think?\nIt's hard to tell in this place.
$Let's go home. @c{smile_wave_wink}Maybe tomorrow, we can have another battle, for old time's sake?`,
"ending_endless": "Congratulations on reaching the current end!\nMore content is coming soon.",
"ending_name": "Devs"
};
// Dialogue that does not fit into any other category (e.g. tutorial messages, or the end of the game). For when the player character is female. For languages that do not have gendered pronouns, this can be set to PGMmiscDialogue.
export const PGFmiscDialogue: SimpleTranslationEntries = PGMmiscDialogue;

View File

@ -2315,6 +2315,12 @@ export class BattleEndPhase extends BattlePhase {
this.scene.gameData.gameStats.highestEndlessWave = this.scene.currentBattle.waveIndex + 1;
}
// Endless graceful end
if (this.scene.gameMode.isEndless && this.scene.currentBattle.waveIndex >= 5850) {
this.scene.clearPhaseQueue();
this.scene.unshiftPhase(new GameOverPhase(this.scene, true));
}
for (const pokemon of this.scene.getField()) {
if (pokemon) {
pokemon.resetBattleSummonData();
@ -3887,7 +3893,9 @@ export class GameOverPhase extends BattlePhase {
this.victory = true;
}
if (this.victory || !this.scene.enableRetries) {
if (this.scene.gameMode.isEndless) {
this.scene.ui.showDialogue(i18next.t("PGMmiscDialogue:ending_endless"), i18next.t("PGMmiscDialogue:ending_name"), 0, () => this.handleGameOver());
} else if (this.victory || !this.scene.enableRetries) {
this.handleGameOver();
} else {
this.scene.ui.showText("Would you like to retry from the start of the battle?", null, () => {