Correctly maintain glyph count when undoing

This commit is contained in:
SpectralFlame 2023-04-30 07:03:16 -05:00 committed by cyip92
parent 451cfc43fe
commit 53b956080b
2 changed files with 10 additions and 1 deletions

View File

@ -31,6 +31,7 @@ export const Glyphs = {
unseen: [],
levelBoost: 0,
factorsOpen: false,
bestUndoGlyphCount: 0,
get inventoryList() {
return player.reality.glyphs.inventory;
},
@ -601,6 +602,9 @@ export const Glyphs = {
const inventorySlot = Glyphs.findFreeIndex(player.options.respecIntoProtected);
if (inventorySlot === -1 || player.reality.glyphs.undo.length === 0) return;
const undoData = player.reality.glyphs.undo.pop();
// We store this value here so that we can restore it later on in the reality reset code, since we immediately
// change equipped glyph status here but only update requirement checks within finishProcessReality()
this.bestUndoGlyphCount = player.requirementChecks.reality.maxGlyphs;
this.unequip(undoData.targetSlot, inventorySlot);
finishProcessReality({
reset: true,

View File

@ -635,7 +635,12 @@ export function finishProcessReality(realityProps) {
player.respec = false;
player.eterc8ids = 50;
player.eterc8repl = 40;
if (!realityProps.glyphUndo) Player.resetRequirements("reality");
if (realityProps.glyphUndo) {
player.requirementChecks.reality.maxGlyphs =
Math.max(Glyphs.bestUndoGlyphCount, player.requirementChecks.reality.maxGlyphs);
} else {
Player.resetRequirements("reality");
}
player.records.thisReality.time = 0;
player.records.thisReality.realTime = 0;
player.records.thisReality.maxReplicanti = DC.D0;