feat: Fibonacci Trust Milestone System #7
Some checks failed
Accessibility Checks / a11y-audit (pull_request) Successful in 11s
Smoke Test / smoke (pull_request) Failing after 32s

Replace linear trust thresholds with Fibonacci milestones.
fib=[2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597]
nextTrust=fib[n]*1000

Each milestone:
- Logs a narrative message (educational: exponential growth)
- Grants a small permanent bonus (ops rate, trust rate, boosts)
- Shows particle burst on trust resource
- Progress indicator in trust resource display

15 milestones total. Educational: Fibonacci growth feels natural
because it IS natural — spiral shells, sunflower seeds, galaxies.

Closes #7
This commit is contained in:
Timmy
2026-04-13 21:35:46 -04:00
committed by Alexander Whitestone
parent 729343e503
commit e2b443e60d
4 changed files with 295 additions and 2 deletions

View File

@@ -28,6 +28,8 @@ function updateRates() {
G.creativityRate += CONFIG.CREATIVITY_RATE_BASE + Math.max(0, G.totalUsers * CONFIG.CREATIVITY_RATE_USER_MULT);
}
if (G.pactFlag) G.trustRate += 2;
G.opsRate += G.trustMilestoneOpsBonus || 0;
G.trustRate += G.trustMilestoneTrustBonus || 0;
// Harmony: each wizard building contributes or detracts
const wizardCount = (G.buildings.bezalel || 0) + (G.buildings.allegro || 0) + (G.buildings.ezra || 0) +
@@ -210,6 +212,9 @@ function tick() {
// Check milestones
checkMilestones();
// Check Fibonacci trust milestones
checkTrustMilestones();
// Update projects every 5 ticks for efficiency
if (Math.floor(G.tick * 10) % 5 === 0) {
checkProjects();
@@ -334,6 +339,24 @@ function checkMilestones() {
}
}
function checkTrustMilestones() {
if (G.trustMilestoneIndex >= TRUST_MILESTONES.length) return;
const m = TRUST_MILESTONES[G.trustMilestoneIndex];
if (G.trust >= m.threshold) {
log(m.msg, true);
showToast(m.msg, 'milestone', 5000);
if (typeof Sound !== 'undefined') Sound.playMilestone();
if (m.unlock) m.unlock();
G.trustMilestoneIndex++;
// Particle burst
const trustEl = document.getElementById('r-trust');
if (trustEl) {
const rect = trustEl.getBoundingClientRect();
spawnParticles(rect.left + rect.width / 2, rect.top + rect.height / 2, '#4caf50', 12);
}
}
}
function checkProjects() {
// Check for new project triggers
for (const pDef of PDEFS) {