The Peak, scoring & endgame
The once-per-run surge, the score formula, and how a run is finished and recorded.
Three things close out a run: the once-per-run Peak, the score, and endGame, which persists and evaluates everything.
The Peak
A scripted stat surge, one per run, keyed by role. It becomes eligible from stop 2 (a 45% chance per leg in resumeLeg) and is guaranteed on the final leg if it hasn't fired.
1640 function showPeak() { 1641 var p = PEAKS[S.role] || DEFAULT_PEAK; 1642 var target = p.to + (S.flags.nightOwl ? 4 : 0); 1643 S[p.stat] = clamp(target, 0, statCap(p.stat)); 1644 S.peaked = true; 1645 S.peakData = p; 1646 addLog(S, "You PEAKED -- " + p.title.toLowerCase() + ".", "good"); 1647 Sound.peak(); 1648 S.view = "peak"; render();
Note it clamps against statCap(p.stat) — the same cap machinery from the economy chapter — so a Peak can't blow past a ceiling a van part just raised or lowered.
The score
One expression, no hidden state:
2035 function computeScore() { 2036 return Math.round(S.tapes * 8 + S.showsAttended * 15 + S.legendaryTapes * DNA.legend + S.vibes + S.cred + S.cash / 5 + S.miles / 40); 2037 }
The weighting is the design: legendary tapes (×60) dwarf everything, shows (×15) and tapes (×8) reward playing the tour fully, and the trailing cash/5 + miles/40 keep a careful, well-traveled run ahead of a reckless one.
Ending the run
endGame(won, cause, finaleResult) (game.js:1944) is the single exit. It sets the outcome, plays the sound, persists a Hall record stamped with TOUR_YEAR, clears the save, and evaluates achievements. causeText(cause) renders "dosed" / "alone" / a custom string on the gameover card.
Achievements are checked here, against a read-only snapshot rather than live state:
runContext(s, won) // game.js:2062 -> { won, showsAttended, tapes, legendaryTapes,
// peaked, miles, cash, vibes, cred, role, fullCrew, crewPooled }
evaluateAchievements (game.js:2072) runs every badge's check(ctx) against that snapshot, unlocks any newly earned into a localStorage map, and returns the fresh ones for the end screen to celebrate. Adding a badge is one ACHIEVEMENTS entry whose check reads those context fields — no new plumbing.
In a campaign, a finale doesn't always end things: finishTourLeg rolls into next year's tour with the same character, crew, and van until the final year.
- The Peak is a role-keyed surge, guaranteed by the last leg, clamped by
statCap. - The score is one weighted expression; legendary tapes dominate it.
endGameis the single exit; achievements check a read-only run snapshot, so a new badge is just an entry.