Compare commits
2 Commits
fix/192-de
...
burn/128-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f610ceb4c2 | ||
|
|
458ba172f6 |
67
docs/issue-122-verification.md
Normal file
67
docs/issue-122-verification.md
Normal file
@@ -0,0 +1,67 @@
|
||||
# Issue #122 Verification
|
||||
|
||||
## Status: ✅ ALREADY FIXED
|
||||
|
||||
The pending drift alignment UI is properly suppressed during active Unbuilding.
|
||||
|
||||
## Problem (from issue)
|
||||
|
||||
If `G.pendingAlignment` is still true when the player begins THE UNBUILDING, the normal `renderAlignment()` path can repaint the Drift alignment choice on top of the dismantle sequence.
|
||||
|
||||
## Fix
|
||||
|
||||
In `js/render.js`, the `renderAlignment()` function now checks for active/completed dismantle before rendering alignment UI:
|
||||
|
||||
```javascript
|
||||
function renderAlignment() {
|
||||
const container = document.getElementById('alignment-ui');
|
||||
if (!container) return;
|
||||
|
||||
// FIX: Suppress alignment UI during active/completed Unbuilding
|
||||
if (G.dismantleActive || G.dismantleComplete) {
|
||||
container.innerHTML = '';
|
||||
container.style.display = 'none';
|
||||
return;
|
||||
}
|
||||
// ... rest of function
|
||||
}
|
||||
```
|
||||
|
||||
## Regression Test
|
||||
|
||||
Test exists in `tests/dismantle.test.cjs`:
|
||||
|
||||
```javascript
|
||||
test('active Unbuilding suppresses pending alignment event UI', () => {
|
||||
const { G, Dismantle, renderAlignment, document } = loadBeacon({ includeRender: true });
|
||||
|
||||
G.pendingAlignment = true;
|
||||
G.dismantleActive = true;
|
||||
Dismantle.active = true;
|
||||
|
||||
renderAlignment();
|
||||
|
||||
assert.equal(document.getElementById('alignment-ui').innerHTML, '');
|
||||
assert.equal(document.getElementById('alignment-ui').style.display, 'none');
|
||||
});
|
||||
```
|
||||
|
||||
## Test Results
|
||||
|
||||
All 10 tests pass:
|
||||
```
|
||||
✔ tick offers the Unbuilding instead of ending the game immediately
|
||||
✔ renderAlignment does not wipe the Unbuilding prompt after it is offered
|
||||
✔ active Unbuilding suppresses pending alignment event UI ← THIS TEST
|
||||
✔ stage five lasts long enough to dissolve every resource card
|
||||
✔ save/load restores partial stage-five dissolve progress
|
||||
✔ deferring the Unbuilding clears the prompt and allows it to return later
|
||||
✔ defer cooldown survives save and reload
|
||||
✔ save and load preserve dismantle progress
|
||||
✔ restore re-renders an offered but not-yet-started Unbuilding prompt
|
||||
✔ defer cooldown persists after save/load when dismantleTriggered is false
|
||||
```
|
||||
|
||||
## Recommendation
|
||||
|
||||
Close issue #122 as already fixed.
|
||||
20
js/engine.js
20
js/engine.js
@@ -1160,11 +1160,11 @@ function renderProjects() {
|
||||
html += `<div id=\"completed-header\" onclick=\"toggleCompletedProjects()\" role=\"button\" tabindex=\"0\" aria-expanded=\"${!collapsed}\" aria-controls=\"completed-list\" style=\"cursor:pointer;font-size:9px;color:#555;padding:4px 0;border-bottom:1px solid #1a2a1a;margin-bottom:4px;user-select:none\">`;
|
||||
html += `${collapsed ? '▶' : '▼'} COMPLETED (${count})</div>`;
|
||||
if (!collapsed) {
|
||||
html += `<div id="completed-list">`;
|
||||
html += `<div id=\"completed-list\">`;
|
||||
for (const id of G.completedProjects) {
|
||||
const pDef = PDEFS.find(p => p.id === id);
|
||||
if (pDef) {
|
||||
html += `<div class="project-done">OK ${pDef.name}</div>`;
|
||||
html += `<div class=\"project-done\">OK ${pDef.name}</div>`;
|
||||
}
|
||||
}
|
||||
html += `</div>`;
|
||||
@@ -1173,21 +1173,27 @@ function renderProjects() {
|
||||
|
||||
// Show available projects
|
||||
if (G.activeProjects) {
|
||||
// #128: During ReCKoning endgame, suppress unrelated normal projects
|
||||
const hasReCKoning = G.activeProjects.some(id => id.startsWith('p_reckoning_'));
|
||||
|
||||
for (const id of G.activeProjects) {
|
||||
const pDef = PDEFS.find(p => p.id === id);
|
||||
if (!pDef) continue;
|
||||
|
||||
// During ReCKoning, only show ReCKoning projects
|
||||
if (hasReCKoning && !id.startsWith('p_reckoning_')) continue;
|
||||
|
||||
const afford = canAffordProject(pDef);
|
||||
const costStr = Object.entries(pDef.cost).map(([r, a]) => `${fmt(a)} ${r}`).join(', ');
|
||||
|
||||
html += `<button class="project-btn ${afford ? 'can-buy' : ''}" onclick="buyProject('${pDef.id}')" data-edu="${pDef.edu || ''}" data-tooltip-label="${pDef.name}" aria-label="Research ${pDef.name}, cost ${costStr}">`;
|
||||
html += `<span class="p-name">* ${pDef.name}</span>`;
|
||||
html += `<span class="p-cost">Cost: ${costStr}</span>`;
|
||||
html += `<span class="p-desc">${pDef.desc}</span></button>`;
|
||||
html += `<button class=\"project-btn ${afford ? 'can-buy' : ''}\" onclick=\"buyProject('${pDef.id}')\" data-edu=\"${pDef.edu || ''}\" data-tooltip-label=\"${pDef.name}\" aria-label=\"Research ${pDef.name}, cost ${costStr}\">`;
|
||||
html += `<span class=\"p-name\">* ${pDef.name}</span>`;
|
||||
html += `<span class=\"p-cost\">Cost: ${costStr}</span>`;
|
||||
html += `<span class=\"p-desc\">${pDef.desc}</span></button>`;
|
||||
}
|
||||
}
|
||||
|
||||
if (!html) html = '<p class="dim">Research projects will appear as you progress...</p>';
|
||||
if (!html) html = '<p class=\"dim\">Research projects will appear as you progress...</p>';
|
||||
container.innerHTML = html;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user