Fix recruit: always available, scaling cost; log newest-first at top
recruit_neighbor was gated behind !first_meeting so it vanished after the first upgrade. Now a single repeatable recruit with scaling cost. Log scrolls to top on new entries so most recent is always visible. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -168,11 +168,17 @@ function renderUpgrades(state: State): void {
|
|||||||
}).join('');
|
}).join('');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let lastLogLength = 0;
|
||||||
|
|
||||||
function renderLog(state: State): void {
|
function renderLog(state: State): void {
|
||||||
const log = document.getElementById('log')!;
|
const log = document.getElementById('log')!;
|
||||||
|
if (state.log.length === lastLogLength) return;
|
||||||
|
lastLogLength = state.log.length;
|
||||||
|
// state.log is newest-first (unshift); render as-is, scroll to top
|
||||||
log.innerHTML = state.log.map(e =>
|
log.innerHTML = state.log.map(e =>
|
||||||
`<div class="log-entry ${e.kind}">${e.text}</div>`
|
`<div class="log-entry ${e.kind}">${e.text}</div>`
|
||||||
).join('');
|
).join('');
|
||||||
|
log.scrollTop = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function showOverlay(state: State): void {
|
function showOverlay(state: State): void {
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ export interface Upgrade {
|
|||||||
export const UPGRADES: Upgrade[] = [
|
export const UPGRADES: Upgrade[] = [
|
||||||
{
|
{
|
||||||
id: 'recruit_neighbor',
|
id: 'recruit_neighbor',
|
||||||
name: 'Rekrytera en granne',
|
name: 'Rekrytera en troende',
|
||||||
desc: '+1 Troende. De undrade varför källarlamporna flimrade. Nu vet de.',
|
desc: '+1 Troende. De undrade varför källarlamporna flimrade. Nu vet de.',
|
||||||
cost: { andakt: 20 },
|
cost: { andakt: 20 },
|
||||||
effect: s => { s.troende += 1; },
|
effect: s => { s.troende += 1; s.andakt = Math.max(0, s.andakt - 20 * Math.max(1, s.troende - 2)); },
|
||||||
available: s => !s.upgrades.has('first_meeting'),
|
available: s => s.troende < 12,
|
||||||
once: false,
|
once: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -56,15 +56,6 @@ export const UPGRADES: Upgrade[] = [
|
|||||||
available: s => s.upgrades.has('idol_under_bridge') && s.dread >= 50 && !s.upgrades.has('varnhem_circle'),
|
available: s => s.upgrades.has('idol_under_bridge') && s.dread >= 50 && !s.upgrades.has('varnhem_circle'),
|
||||||
once: true,
|
once: true,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
id: 'recruit_2',
|
|
||||||
name: 'Rekrytera ytterligare troende',
|
|
||||||
desc: '+2 Troende. Ryktet sprids längs de rätta kanalerna.',
|
|
||||||
cost: { andakt: 150 },
|
|
||||||
effect: s => { s.troende += 2; s.andaktRate += 0.5; },
|
|
||||||
available: s => s.upgrades.has('first_meeting') && s.troende < 8,
|
|
||||||
once: false,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
id: 'torso_beacon',
|
id: 'torso_beacon',
|
||||||
name: 'Altaret vid Turning Torso',
|
name: 'Altaret vid Turning Torso',
|
||||||
|
|||||||
Reference in New Issue
Block a user