Add total game timer and fix bugs related to NG

This commit is contained in:
SpectralFlame 2023-01-30 06:29:52 -06:00 committed by cyip92
parent 2deee74e79
commit 8398c0585b
5 changed files with 22 additions and 6 deletions

View File

@ -856,6 +856,8 @@ export const AutomatorBackend = {
},
start(scriptID = this.state.topLevelScript, initialMode = AUTOMATOR_MODE.RUN, compile = true) {
// Automator execution behaves oddly across new games, so we explicitly stop it from running if not unlocked
if (!Player.automatorUnlocked) return;
this.hasJustCompleted = false;
this.state.topLevelScript = scriptID;
const scriptObject = this.findScript(scriptID);

View File

@ -18,17 +18,22 @@ export const NG = {
const automatorConstants = JSON.stringify(player.reality.automator.constants);
const automatorScripts = JSON.stringify(player.reality.automator.scripts);
const fullCompletions = player.records.fullGameCompletions;
const fullTimePlayed = player.records.previousRunRealTime + player.records.realTimePlayed;
GlyphAppearanceHandler.unlockSet();
const glyphCosmetics = JSON.stringify(player.reality.glyphs.cosmetics);
Modal.hideAll();
Quote.clearAll();
GameStorage.hardReset();
player.options = JSON.parse(backUpOptions);
// We need to force this one to be true because otherwise the player will be unable to select their glyphs
// until they can auto-reality
player.options.confirmations.glyphSelection = true;
player.secretUnlocks = secretUnlocks;
player.secretAchievementBits = JSON.parse(secretAchievements);
player.reality.automator.constants = JSON.parse(automatorConstants);
player.reality.automator.scripts = JSON.parse(automatorScripts);
player.records.fullGameCompletions = fullCompletions + 1;
player.records.previousRunRealTime = fullTimePlayed;
ui.view.newUI = player.options.newUI;
ui.view.news = player.options.news.enabled;
player.reality.glyphs.cosmetics = JSON.parse(glyphCosmetics);

View File

@ -273,6 +273,7 @@ window.player = {
realTimePlayed: 0,
realTimeDoomed: 0,
fullGameCompletions: 0,
previousRunRealTime: 0,
totalAntimatter: DC.E1,
recentInfinities: Array.range(0, 10).map(() =>
[Number.MAX_VALUE, Number.MAX_VALUE, DC.D1, DC.D1, ""]),

View File

@ -210,13 +210,15 @@ GameStorage.migrations = {
delete player.options.showLastTenResourceGain;
// Fixes a desync which occasionally causes unique > total seen due to total not being updated properly
let unique = 0;
for (const bitmaskArray of Object.values(player.news.seen)) {
for (const bitmask of bitmaskArray) {
unique += countValuesFromBitmask(bitmask);
if (player.news.seen) {
let unique = 0;
for (const bitmaskArray of Object.values(player.news.seen)) {
for (const bitmask of bitmaskArray) {
unique += countValuesFromBitmask(bitmask);
}
}
player.news.totalSeen = Math.max(player.news.totalSeen, unique);
}
player.news.totalSeen = Math.max(player.news.totalSeen, unique);
}
},

View File

@ -51,6 +51,7 @@ export default {
matterScale: [],
lastMatterTime: 0,
paperclips: 0,
fullTimePlayed: 0,
};
},
computed: {
@ -77,6 +78,7 @@ export default {
const records = player.records;
this.totalAntimatter.copyFrom(records.totalAntimatter);
this.realTimePlayed.setFrom(records.realTimePlayed);
this.fullTimePlayed = TimeSpan.fromMilliseconds(records.previousRunRealTime + records.realTimePlayed);
this.uniqueNews = NewsHandler.uniqueTickersSeen;
this.totalNews = player.news.totalSeen;
this.secretAchievementCount = SecretAchievements.all.filter(a => a.isUnlocked).length;
@ -181,7 +183,11 @@ export default {
You have {{ quantifyInt("useless paperclip", paperclips) }}.
</div>
<div v-if="fullGameCompletions">
<b>You have completed the entire game {{ quantifyInt("time", fullGameCompletions) }}.</b>
<b>
You have completed the entire game {{ quantifyInt("time", fullGameCompletions) }}.
<br>
You have played for {{ fullTimePlayed }} across all playthroughs.
</b>
</div>
<div>
<br>