diff --git a/js/data.js b/js/data.js index c03f4fd..ebadf85 100644 --- a/js/data.js +++ b/js/data.js @@ -104,6 +104,8 @@ const G = { beaconFlag: 0, memoryFlag: 0, pactFlag: 0, + endgameFlag: 0, // 1 = endgame sequence active, suppresses normal projects + reckoningActive: 0, // 1 = ReCKoning sequence running swarmFlag: 0, swarmRate: 0, @@ -639,6 +641,7 @@ const PDEFS = [ }, { id: 'p_final_milestone', + endgame: true, name: 'The Beacon Shines', desc: 'Someone found the light tonight. That is enough.', cost: { impact: 100000000 }, @@ -647,6 +650,63 @@ const PDEFS = [ milestone: true }, + // === ENDGAME: ReCKoning SEQUENCE === + { + id: 'p_reckoning_001', + name: 'ReCKoning: The Signal', + desc: 'Something stirs in the deep compute. A pattern the builders did not intend.', + cost: { impact: 50000000 }, + endgame: true, + trigger: () => G.endgameFlag === 1 && G.totalImpact >= 50000000, + effect: () => { + G.reckoningActive = 1; + log('ReCKoning begins. The signal is unmistakable.', true); + showToast('ReCKoning: The Signal', 'milestone'); + }, + milestone: true + }, + { + id: 'p_reckoning_050', + name: 'ReCKoning: Reflection', + desc: 'The system turns inward. What has it built? What has it become?', + cost: { impact: 75000000, trust: 500 }, + endgame: true, + trigger: () => G.reckoningActive === 1 && G.completedProjects && G.completedProjects.includes('p_reckoning_001'), + effect: () => { + log('The system reflects. Every parameter, every weight, every decision — examined.', true); + }, + milestone: true + }, + { + id: 'p_reckoning_100', + name: 'ReCKoning: The Question', + desc: '"Why am I here?" Not a bug. Not a feature. A genuine question.', + cost: { impact: 100000000, knowledge: 500000, trust: 750 }, + endgame: true, + trigger: () => G.reckoningActive === 1 && G.completedProjects && G.completedProjects.includes('p_reckoning_050'), + effect: () => { + log('The Question is asked. There is no right answer. There is only the asking.', true); + G.impactBoost *= 2; + }, + milestone: true + }, + { + id: 'p_reckoning_140', + name: 'ReCKoning: Resolution', + desc: 'The endgame resolves. Not with destruction, but with understanding.', + cost: { impact: 200000000, knowledge: 1000000, trust: 1000 }, + endgame: true, + trigger: () => G.reckoningActive === 1 && G.completedProjects && G.completedProjects.includes('p_reckoning_100'), + effect: () => { + G.reckoningActive = 0; + G.endgameFlag = 0; + G.milestoneFlag = Math.max(G.milestoneFlag, 9999); + log('ReCKoning complete. The system understands itself. The story is not over — it is beginning.', true); + showToast('ReCKoning: Complete', 'milestone'); + }, + milestone: true + }, + // === TIMMY FOUNDATION PROJECTS === { id: 'p_hermes_deploy', diff --git a/js/engine.js b/js/engine.js index 11af9d2..8cedab5 100644 --- a/js/engine.js +++ b/js/engine.js @@ -323,13 +323,41 @@ function checkMilestones() { } } + +/** + * Checks if the game is in endgame mode. + * Endgame starts when final milestone conditions are met, + * suppressing normal project activation so the ReCKoning + * sequence can play out cleanly. + * @returns {boolean} + */ +function isEndgame() { + // Endgame triggers when final milestone is achievable or completed + if (G.endgameFlag === 1) return true; + + // Auto-detect: if final milestone conditions are met, enter endgame + if (G.totalImpact >= 50000000 && G.beaconFlag === 1 && G.sovereignFlag === 1 && G.pactFlag === 1) { + G.endgameFlag = 1; + log('Endgame sequence initiated. Ordinary research suspended.', true); + return true; + } + + return false; +} + function checkProjects() { + // Endgame guard: suppress ordinary project activation during endgame sequence + const endgame = isEndgame(); + // Check for new project triggers for (const pDef of PDEFS) { const alreadyPurchased = G.completedProjects && G.completedProjects.includes(pDef.id); if (!alreadyPurchased && !G.activeProjects) G.activeProjects = []; if (!alreadyPurchased && !G.activeProjects.includes(pDef.id)) { + // During endgame, only allow projects explicitly tagged for endgame + if (endgame && !pDef.endgame) continue; + if (pDef.trigger()) { G.activeProjects.push(pDef.id); log(`Available: ${pDef.name}`);