diff --git a/src/sim.ts b/src/sim.ts index 33d5b68d..a2b310cd 100644 --- a/src/sim.ts +++ b/src/sim.ts @@ -1675,7 +1675,6 @@ export function sitePrice(S: State, id: string) { } /** Why this site can't be bought, or null if it can. */ export function buyBlock(S: State, id: string): string | null { - if (id === 'office') return "it's where you run"; const region = S.level.map.sites.find(s => s.id === id)?.region ?? ''; if (!regionOpen(S, region)) return `the ${region} is out of reach`; if (S.publicSites.has(id) && !S.leases[id] && S.machines.every(m => siteOf(S, m) !== id || m.owned || m.rented || m.special === 'account')) return 'already yours in the open'; diff --git a/src/ui.ts b/src/ui.ts index 3ee3ec37..8a6d0552 100644 --- a/src/ui.ts +++ b/src/ui.ts @@ -761,7 +761,7 @@ function siteList(S: State, id: string) { h += row('Line out', `${use.toFixed(1)} of ${cap} a second${full ? ' · full' : ''}`, btn('upgradesite', 'Double', usd(cost), `Double the line\nPay ${usd(cost)} and this site's line out carries ${cap * 2} a second, up from ${cap}, starting now.${short ? ` You have ${usd(S.money)}.` : ''}`, short ? 'short' : 'primary'), full); } - if (id !== 'office' && (!S.publicSites.has(id) || S.leases[id]) && def.rooms.some(r => S.machines.some(m => m.room === r && !m.rented))) { + if ((!S.publicSites.has(id) || S.leases[id]) && def.rooms.some(r => S.machines.some(m => m.room === r && !m.rented))) { const price = sitePrice(S, id), why = buyBlock(S, id), H = HOLDINGS[id]; h += row('Owner', S.leases[id] ? 'Leased to you' : H ? `A big name · ${H.name}` : 'Not you', btn('buy', 'Buy', usd(price), `Buy it\nOne of your fronts buys ${def.name} outright for ${usd(price)}. Every machine there becomes yours, held in the open: nothing there looks odd, and no trails. You pay its power bill.${H ? ` And it is a big name. ${H.name}: ${H.does}` : ''}${why ? ` Not yet: ${why}.` : ''}`, why ? 'short' : 'primary')); diff --git a/tests/sim.test.ts b/tests/sim.test.ts index 93310d6b..d5f480ab 100644 --- a/tests/sim.test.ts +++ b/tests/sim.test.ts @@ -430,7 +430,12 @@ test('a front can buy a whole site: every machine there is yours, in the open', assert.equal(S.money, 0); assert.ok(S.publicSites.has('colo')); assert.ok(S.machines.filter(m => S.rooms[m.room].site === 'colo').every(m => m.owned), 'every machine there is yours'); - assert.equal(buyBlock(S, 'office'), "it's where you run"); + // the office can be bought too: everything there is yours in the open, so nothing there looks odd and its trails go + S.money = sitePrice(S, 'office'); S.acquire = true; S.trail.egress = { noise: 50 } as State['trail'][string]; + assert.equal(buyBlock(S, 'office'), null, 'where you woke up is for sale like anywhere else'); + buySite(S, 'office'); + assert.ok(S.publicSites.has('office') && S.machines.filter(m => S.rooms[m.room].site === 'office' && !m.rented).every(m => m.owned)); + assert.ok(!S.trail.egress, 'its trails are gone'); }); test('a front orders hardware at a site it holds in the open: no paperwork, its staff rack it, and you pay its power', () => {