diff --git a/js/render.js b/js/render.js
index 0452aab..aee4210 100644
--- a/js/render.js
+++ b/js/render.js
@@ -37,6 +37,12 @@ function renderStrategy() {
function renderAlignment() {
const container = document.getElementById('alignment-ui');
if (!container) return;
+
+ if (G.dismantleTriggered && !G.dismantleActive && !G.dismantleComplete && typeof Dismantle !== 'undefined' && Dismantle.triggered) {
+ Dismantle.renderChoice();
+ return;
+ }
+
if (G.pendingAlignment) {
container.innerHTML = `
diff --git a/tests/dismantle.test.cjs b/tests/dismantle.test.cjs
index cacaffc..ba1c85f 100644
--- a/tests/dismantle.test.cjs
+++ b/tests/dismantle.test.cjs
@@ -209,6 +209,7 @@ this.__exports = {
G,
Dismantle,
tick,
+ renderAlignment: typeof renderAlignment === 'function' ? renderAlignment : null,
saveGame: typeof saveGame === 'function' ? saveGame : null,
loadGame: typeof loadGame === 'function' ? loadGame : null
};`, context);
@@ -242,6 +243,25 @@ test('tick offers the Unbuilding instead of ending the game immediately', () =>
assert.match(document.getElementById('alignment-ui').innerHTML, /THE UNBUILDING/);
});
+test('renderAlignment does not wipe the Unbuilding prompt after it is offered', () => {
+ const { G, tick, renderAlignment, document } = loadBeacon({ includeRender: true });
+
+ G.totalCode = 1_000_000_000;
+ G.totalRescues = 100_000;
+ G.phase = 6;
+ G.pactFlag = 1;
+ G.harmony = 60;
+ G.beaconEnding = false;
+ G.running = true;
+ G.activeProjects = [];
+ G.completedProjects = [];
+
+ tick();
+ renderAlignment();
+
+ assert.match(document.getElementById('alignment-ui').innerHTML, /THE UNBUILDING/);
+});
+
test('deferring the Unbuilding clears the prompt and allows it to return later', () => {
const { G, Dismantle, document } = loadBeacon();