[Bug] Run History Not Saving Correctly (#4248)

* Fix - need to test though

* New Line for Personal Best

* Run History basic Interpretation

* Stray console log

* Added personal best message fix

* argh

* removed a stray log

---------

Co-authored-by: frutescens <info@laptop>
Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com>
This commit is contained in:
Mumble 2024-09-19 07:42:29 -07:00 committed by GitHub
parent 714630c9de
commit c4d5c923fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 14 deletions

View File

@ -243,7 +243,7 @@ export class GameOverPhase extends BattlePhase {
gameVersion: this.scene.game.config.gameVersion, gameVersion: this.scene.game.config.gameVersion,
timestamp: new Date().getTime(), timestamp: new Date().getTime(),
challenges: this.scene.gameMode.challenges.map(c => new ChallengeData(c)), challenges: this.scene.gameMode.challenges.map(c => new ChallengeData(c)),
mysteryEncounterType: this.scene.currentBattle.mysteryEncounter?.encounterType, mysteryEncounterType: this.scene.currentBattle.mysteryEncounter?.encounterType ?? -1,
mysteryEncounterSaveData: this.scene.mysteryEncounterSaveData mysteryEncounterSaveData: this.scene.mysteryEncounterSaveData
} as SessionSaveData; } as SessionSaveData;
} }

View File

@ -281,7 +281,7 @@ class RunEntryContainer extends Phaser.GameObjects.Container {
const genderIndex = this.scene.gameData.gender ?? PlayerGender.UNSET; const genderIndex = this.scene.gameData.gender ?? PlayerGender.UNSET;
const genderStr = PlayerGender[genderIndex].toLowerCase(); const genderStr = PlayerGender[genderIndex].toLowerCase();
// Defeats from wild Pokemon battles will show the Pokemon responsible by the text of the run result. // Defeats from wild Pokemon battles will show the Pokemon responsible by the text of the run result.
if (data.battleType === BattleType.WILD) { if (data.battleType === BattleType.WILD || (data.battleType === BattleType.MYSTERY_ENCOUNTER && !data.trainer)) {
const enemyContainer = this.scene.add.container(8, 5); const enemyContainer = this.scene.add.container(8, 5);
const gameOutcomeLabel = addTextObject(this.scene, 0, 0, `${i18next.t("runHistory:defeatedWild", { context: genderStr })}`, TextStyle.WINDOW); const gameOutcomeLabel = addTextObject(this.scene, 0, 0, `${i18next.t("runHistory:defeatedWild", { context: genderStr })}`, TextStyle.WINDOW);
enemyContainer.add(gameOutcomeLabel); enemyContainer.add(gameOutcomeLabel);
@ -302,7 +302,7 @@ class RunEntryContainer extends Phaser.GameObjects.Container {
enemy.destroy(); enemy.destroy();
}); });
this.add(enemyContainer); this.add(enemyContainer);
} else if (data.battleType === BattleType.TRAINER) { // Defeats from Trainers show the trainer's title and name } else if (data.battleType === BattleType.TRAINER || (data.battleType === BattleType.MYSTERY_ENCOUNTER && data.trainer)) { // Defeats from Trainers show the trainer's title and name
const tObj = data.trainer.toTrainer(this.scene); const tObj = data.trainer.toTrainer(this.scene);
// Because of the interesting mechanics behind rival names, the rival name and title have to be retrieved differently // Because of the interesting mechanics behind rival names, the rival name and title have to be retrieved differently
const RIVAL_TRAINER_ID_THRESHOLD = 375; const RIVAL_TRAINER_ID_THRESHOLD = 375;

View File

@ -211,7 +211,7 @@ export default class RunInfoUiHandler extends UiHandler {
if (!this.isVictory) { if (!this.isVictory) {
const enemyContainer = this.scene.add.container(0, 0); const enemyContainer = this.scene.add.container(0, 0);
// Wild - Single and Doubles // Wild - Single and Doubles
if (this.runInfo.battleType === BattleType.WILD) { if (this.runInfo.battleType === BattleType.WILD || (this.runInfo.battleType === BattleType.MYSTERY_ENCOUNTER && !this.runInfo.trainer)) {
switch (this.runInfo.enemyParty.length) { switch (this.runInfo.enemyParty.length) {
case 1: case 1:
// Wild - Singles // Wild - Singles
@ -222,7 +222,7 @@ export default class RunInfoUiHandler extends UiHandler {
this.parseWildDoubleDefeat(enemyContainer); this.parseWildDoubleDefeat(enemyContainer);
break; break;
} }
} else if (this.runInfo.battleType === BattleType.TRAINER) { } else if (this.runInfo.battleType === BattleType.TRAINER || (this.runInfo.battleType === BattleType.MYSTERY_ENCOUNTER && this.runInfo.trainer)) {
this.parseTrainerDefeat(enemyContainer); this.parseTrainerDefeat(enemyContainer);
} }
this.runResultContainer.add(enemyContainer); this.runResultContainer.add(enemyContainer);
@ -381,10 +381,6 @@ export default class RunInfoUiHandler extends UiHandler {
break; break;
case GameModes.SPLICED_ENDLESS: case GameModes.SPLICED_ENDLESS:
modeText.appendText(`${i18next.t("gameMode:endlessSpliced")}`, false); modeText.appendText(`${i18next.t("gameMode:endlessSpliced")}`, false);
if (this.runInfo.waveIndex === this.scene.gameData.gameStats.highestEndlessWave) {
modeText.appendText(` [${i18next.t("runHistory:personalBest")}]`, false);
modeText.setTint(0xffef5c, 0x47ff69, 0x6b6bff, 0xff6969);
}
break; break;
case GameModes.CHALLENGE: case GameModes.CHALLENGE:
modeText.appendText(`${i18next.t("gameMode:challenge")}`, false); modeText.appendText(`${i18next.t("gameMode:challenge")}`, false);
@ -403,17 +399,18 @@ export default class RunInfoUiHandler extends UiHandler {
break; break;
case GameModes.ENDLESS: case GameModes.ENDLESS:
modeText.appendText(`${i18next.t("gameMode:endless")}`, false); modeText.appendText(`${i18next.t("gameMode:endless")}`, false);
// If the player achieves a personal best in Endless, the mode text will be tinted similarly to SSS luck to celebrate their achievement.
if (this.runInfo.waveIndex === this.scene.gameData.gameStats.highestEndlessWave) {
modeText.appendText(` [${i18next.t("runHistory:personalBest")}]`, false);
modeText.setTint(0xffef5c, 0x47ff69, 0x6b6bff, 0xff6969);
}
break; break;
case GameModes.CLASSIC: case GameModes.CLASSIC:
modeText.appendText(`${i18next.t("gameMode:classic")}`, false); modeText.appendText(`${i18next.t("gameMode:classic")}`, false);
break; break;
} }
// If the player achieves a personal best in Endless, the mode text will be tinted similarly to SSS luck to celebrate their achievement.
if ((this.runInfo.gameMode === GameModes.ENDLESS || this.runInfo.gameMode === GameModes.SPLICED_ENDLESS) && this.runInfo.waveIndex === this.scene.gameData.gameStats.highestEndlessWave) {
modeText.appendText(` [${i18next.t("runHistory:personalBest")}]`);
modeText.setTint(0xffef5c, 0x47ff69, 0x6b6bff, 0xff6969);
}
// Duration + Money // Duration + Money
const runInfoTextContainer = this.scene.add.container(0, 0); const runInfoTextContainer = this.scene.add.container(0, 0);
// Japanese is set to a greater line spacing of 35px in addBBCodeTextObject() if lineSpacing < 12. // Japanese is set to a greater line spacing of 35px in addBBCodeTextObject() if lineSpacing < 12.