Add the Corporate Ladder pack, and two engine features it needed
Seventeen events across the mailroom: ordinary days, Marlene Hobb and Trevor Pike, a misrouted envelope that can be delivered or kept, and a hard-times branch that fires on negative money and always leaves an ungated way out. Writing real content turned up two things the engine could not express. Per-turn upkeep (`pack.upkeep`): the MVP spec wants recurring income and costs, but effects only run when a player chooses something, and baking wages into every option would be tedious and easy to get wrong. Upkeep entries carry their own conditions, which turned out to be enough for the loan service charge to be a three-step function that escalates with the size of the debt — no multiply operation, no engine change. Upkeep changes are recorded separately from choice changes so the UI can distinguish them. Per-character starting relationships: Trevor starts below the pack default on `likes_you` because he arrived two weeks earlier and has priced that in. Characterisation as data rather than as an opening cutscene. Nobody starts feared, either — `fears_you` defaults to 10, since a midpoint default would mean every new hire arrives already intimidating. The content suite plays 60 seeded runs and asserts every event fires and every option is taken at least once. That caught real dead content: Trevor's favour chain sat behind a gate no plausible player could reach, taking two events and a hard-times escape route with it, and debt could pass 5,500 while the service charge stayed flat, so the failure spiral flattened out instead of tightening. Both fixed in the data — the gate softened and given another route up, the loan capped and its charge tiered. The validator also gained a real fix: it counted an event with a cooldown as a stage's fallback, but a cooldown can exclude it, so a stage could still run dry. 86 tests. Reasoning in docs/DECISIONS.md §11-13, including the seeding trap that makes a correlated chooser look exactly like a content bug. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VMSFHyVPitUoosW5wyEADj
This commit is contained in:
co-authored by
Claude Opus 5
parent
cc59b81155
commit
1d4ac0fdbd
@@ -14,17 +14,21 @@ be new data and no new code.
|
|||||||
|
|
||||||
## Status
|
## Status
|
||||||
|
|
||||||
Engine core is built and tested. No UI yet.
|
Engine and the first content pack are built and tested. No UI yet — the game is
|
||||||
|
currently playable only from a test harness.
|
||||||
|
|
||||||
| Piece | State |
|
| Piece | State |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| Path-addressed state, conditions, effects | done |
|
| Path-addressed state, conditions, effects | done |
|
||||||
| Seeded RNG, save/resume | done |
|
| Seeded RNG, save/resume | done |
|
||||||
| Event selection, option gating | done |
|
| Event selection, option gating | done |
|
||||||
| Turn loop | done |
|
| Turn loop, per-turn upkeep | done |
|
||||||
| Content validator | done |
|
| Content validator + reachability tests | done |
|
||||||
| Corporate Ladder content pack | not started |
|
| Corporate Ladder pack — 17 events, 2 characters | done |
|
||||||
| UI, save/export, feedback log | not started |
|
| UI | not started |
|
||||||
|
| Save to local storage, export/import | not started |
|
||||||
|
| Feedback widget and log export | not started |
|
||||||
|
| Retrospective screen | not started |
|
||||||
|
|
||||||
## Running
|
## Running
|
||||||
|
|
||||||
@@ -115,6 +119,10 @@ turn draws from the whole eligible pool by weight.
|
|||||||
Conditions may read engine bookkeeping (`turn`, `stage`, `seen.<eventId>`,
|
Conditions may read engine bookkeeping (`turn`, `stage`, `seen.<eventId>`,
|
||||||
`lastSeen.<eventId>`) as well as pack state. Effects may not write it.
|
`lastSeen.<eventId>`) as well as pack state. Effects may not write it.
|
||||||
|
|
||||||
|
A pack also declares `upkeep` — a list of `{ label, requires?, effects }`
|
||||||
|
applied at the end of every turn, after the choice. Corporate Ladder uses it for
|
||||||
|
wages, living costs, and a loan service charge that steps up as the debt grows.
|
||||||
|
|
||||||
Run `validatePack(pack)` when loading in development — it catches undeclared
|
Run `validatePack(pack)` when loading in development — it catches undeclared
|
||||||
paths, unknown characters, unusable ids, unreachable events and stages with no
|
paths, unknown characters, unusable ids, unreachable events and stages with no
|
||||||
fallback event, all of which otherwise fail silently mid-playthrough.
|
fallback event, all of which otherwise fail silently mid-playthrough.
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
// The mailroom, as staffed.
|
||||||
|
//
|
||||||
|
// `description` is pure colour — the engine never reads it. What the engine
|
||||||
|
// does read is `startingRelationship`, where a character departs from the
|
||||||
|
// pack's defaults: nobody fears a new hire, and Trevor started two weeks
|
||||||
|
// earlier and has priced that in.
|
||||||
|
|
||||||
|
export const characters = [
|
||||||
|
{
|
||||||
|
id: 'marlene',
|
||||||
|
name: 'Marlene Hobb',
|
||||||
|
title: 'Mailroom Supervisor',
|
||||||
|
role_type: 'boss',
|
||||||
|
description:
|
||||||
|
'Has worked here nineteen years. Refers to the building as "the plant." ' +
|
||||||
|
'Keeps a laminated card of the org chart, updated in pen.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'trevor',
|
||||||
|
name: 'Trevor Pike',
|
||||||
|
title: 'Mail Associate II',
|
||||||
|
role_type: 'rival',
|
||||||
|
description:
|
||||||
|
'Arrived two weeks before you and has never once let that go. ' +
|
||||||
|
'Photographs his lunch.',
|
||||||
|
startingRelationship: { likes_you: 35, wants_to_help_you: 25 },
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export default characters;
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
// Running out of money.
|
||||||
|
//
|
||||||
|
// There is no game over here and no separate failure mode in the engine — this
|
||||||
|
// is an ordinary event whose conditions happen to be "your money is negative",
|
||||||
|
// carrying enough weight to crowd out an ordinary day. Every route out costs
|
||||||
|
// something other than money, and every one of them leaves you still playing.
|
||||||
|
//
|
||||||
|
// Both events always offer at least one ungated option, so a player with no
|
||||||
|
// skills and no friends is never stuck.
|
||||||
|
|
||||||
|
export const hardTimes = [
|
||||||
|
{
|
||||||
|
id: 'rent_bounced',
|
||||||
|
stage: 'mailroom',
|
||||||
|
weight: 5000,
|
||||||
|
requires: [{ path: 'money', op: '<', value: 0 }],
|
||||||
|
description:
|
||||||
|
'Rent came out and did not clear. The letter uses the word ' +
|
||||||
|
'"unfortunately" four times and encloses a form.',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
id: 'take_loan',
|
||||||
|
label: 'Take the loan the letter suggests.',
|
||||||
|
// They stop lending eventually, which is when the spiral gets real:
|
||||||
|
// past this, the only ways out cost standing rather than interest.
|
||||||
|
requires: [{ path: 'debt', op: '<', value: 2000 }],
|
||||||
|
result:
|
||||||
|
'The money arrives the same afternoon, which tells you something about ' +
|
||||||
|
'the rate.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'money', op: 'add', value: 500 },
|
||||||
|
{ path: 'debt', op: 'add', value: 500 },
|
||||||
|
{ path: 'flags.took_loan', op: 'set', value: true },
|
||||||
|
{ path: 'reputation', op: 'add', value: -2 },
|
||||||
|
{ path: 'notable', op: 'push', value: 'Took the loan.' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'ask_trevor',
|
||||||
|
label: 'Ask Trevor for a float.',
|
||||||
|
requires: [{ path: 'relationships.trevor.likes_you', op: '>=', value: 40 }],
|
||||||
|
result:
|
||||||
|
'He lends it without making a thing of it, and from then on he is a ' +
|
||||||
|
'man who lent you money.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'money', op: 'add', value: 150 },
|
||||||
|
{ path: 'reputation', op: 'add', value: -3 },
|
||||||
|
{ path: 'relationships.trevor.fears_you', op: 'add', value: -8 },
|
||||||
|
{ path: 'relationships.trevor.wants_to_help_you', op: 'add', value: -5 },
|
||||||
|
{ path: 'notable', op: 'push', value: 'Borrowed money from Trevor.' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'ask_marlene',
|
||||||
|
label: 'Ask Marlene for an advance.',
|
||||||
|
requires: [{ path: 'relationships.marlene.wants_to_help_you', op: '>=', value: 55 }],
|
||||||
|
result:
|
||||||
|
'She processes it herself and does not put it through the system. ' +
|
||||||
|
'Neither of you mentions it again.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'money', op: 'add', value: 200 },
|
||||||
|
{ path: 'relationships.marlene.wants_to_help_you', op: 'add', value: -10 },
|
||||||
|
{ path: 'relationships.marlene.likes_you', op: 'add', value: -3 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'extra_shifts',
|
||||||
|
label: 'Take every shift going.',
|
||||||
|
result:
|
||||||
|
'You do eleven days without one off. The bins stop being individual ' +
|
||||||
|
'bins after a while.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'money', op: 'add', value: 120 },
|
||||||
|
{ path: 'skills.logistics', op: 'add', value: 2 },
|
||||||
|
{ path: 'reputation', op: 'add', value: -1 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
id: 'debt_collector',
|
||||||
|
stage: 'mailroom',
|
||||||
|
weight: 25,
|
||||||
|
cooldown: 4,
|
||||||
|
requires: [{ path: 'debt', op: '>', value: 0 }],
|
||||||
|
description:
|
||||||
|
'A man from the lender calls the mailroom phone. Marlene answers it. She ' +
|
||||||
|
'hands it to you without expression and then, notably, without leaving.',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
id: 'pay_chunk',
|
||||||
|
label: 'Pay a real chunk of it down.',
|
||||||
|
requires: [{ path: 'money', op: '>=', value: 200 }],
|
||||||
|
result: 'He is audibly disappointed.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'money', op: 'add', value: -200 },
|
||||||
|
{ path: 'debt', op: 'add', value: -200 },
|
||||||
|
{ path: 'reputation', op: 'add', value: 1 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'pay_minimum',
|
||||||
|
label: 'Pay what you can.',
|
||||||
|
requires: [{ path: 'money', op: '>=', value: 60 }],
|
||||||
|
result: 'Sixty dollars, fifty of which is the loan.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'money', op: 'add', value: -60 },
|
||||||
|
{ path: 'debt', op: 'add', value: -50 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'stall',
|
||||||
|
label: 'Tell him next month.',
|
||||||
|
result: 'He says next month. Marlene goes back to her desk.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'debt', op: 'add', value: 25 },
|
||||||
|
{ path: 'reputation', op: 'add', value: -3 },
|
||||||
|
{ path: 'relationships.marlene.likes_you', op: 'add', value: -4 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export default hardTimes;
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
import { routine } from './routine.js';
|
||||||
|
import { people } from './people.js';
|
||||||
|
import { hardTimes } from './hard-times.js';
|
||||||
|
|
||||||
|
export const events = [...routine, ...people, ...hardTimes];
|
||||||
|
export default events;
|
||||||
@@ -0,0 +1,313 @@
|
|||||||
|
// Events that turn on where you stand with someone.
|
||||||
|
//
|
||||||
|
// These are gated on relationship state rather than skills, which is the point
|
||||||
|
// of tracking three separate numbers per character: a door can open because
|
||||||
|
// somebody likes you, or because they would rather you did not make a thing of
|
||||||
|
// it. The envelope chain is the pack's first taste of leverage — held, then
|
||||||
|
// spent or put back.
|
||||||
|
|
||||||
|
export const people = [
|
||||||
|
{
|
||||||
|
id: 'marlene_late',
|
||||||
|
stage: 'mailroom',
|
||||||
|
weight: 80,
|
||||||
|
cooldown: 3,
|
||||||
|
description:
|
||||||
|
'Marlene needs someone to stay until the six o\'clock courier. She is not ' +
|
||||||
|
'asking you specifically. She is looking at you specifically.',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
id: 'stay',
|
||||||
|
label: 'Stay.',
|
||||||
|
result: 'The courier is twenty minutes late. Marlene waits with you.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'money', op: 'add', value: 45 },
|
||||||
|
{ path: 'relationships.marlene.likes_you', op: 'add', value: 5 },
|
||||||
|
{ path: 'relationships.marlene.wants_to_help_you', op: 'add', value: 4 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'decline',
|
||||||
|
label: 'Say you have somewhere to be.',
|
||||||
|
requires: [{ path: 'skills.negotiation', op: '>=', value: 15 }],
|
||||||
|
result: 'She says "of course" in a way that files it somewhere.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'skills.negotiation', op: 'add', value: 2 },
|
||||||
|
{ path: 'relationships.marlene.likes_you', op: 'add', value: -3 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'volunteer_trevor',
|
||||||
|
label: 'Suggest Trevor is free.',
|
||||||
|
result: 'Trevor is, as it turns out, free. He finds out the way you did.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'relationships.trevor.likes_you', op: 'add', value: -6 },
|
||||||
|
{ path: 'relationships.trevor.fears_you', op: 'add', value: 4 },
|
||||||
|
{ path: 'relationships.marlene.likes_you', op: 'add', value: 1 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
id: 'trevor_credit',
|
||||||
|
stage: 'mailroom',
|
||||||
|
weight: 60,
|
||||||
|
cooldown: 6,
|
||||||
|
description:
|
||||||
|
'The floor manager thanks Trevor for the reorganised outbound shelf. ' +
|
||||||
|
'Trevor accepts this. You built the shelf on Tuesday.',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
id: 'let_it_go',
|
||||||
|
label: 'Let it go.',
|
||||||
|
result: 'Trevor is warmer to you all week, which is somehow worse.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'reputation', op: 'add', value: -1 },
|
||||||
|
{ path: 'relationships.trevor.likes_you', op: 'add', value: 4 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'correct',
|
||||||
|
label: 'Correct the record, politely.',
|
||||||
|
requires: [{ path: 'skills.negotiation', op: '>=', value: 15 }],
|
||||||
|
result:
|
||||||
|
'You do it well enough that nobody is embarrassed except Trevor, who ' +
|
||||||
|
'is embarrassed thoroughly.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'skills.negotiation', op: 'add', value: 2 },
|
||||||
|
{ path: 'reputation', op: 'add', value: 4 },
|
||||||
|
{ path: 'relationships.trevor.likes_you', op: 'add', value: -8 },
|
||||||
|
{ path: 'relationships.trevor.fears_you', op: 'add', value: 5 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'private',
|
||||||
|
label: 'Mention it to Trevor later, alone.',
|
||||||
|
result: 'He apologises twice, which is once more than he needed to.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'skills.negotiation', op: 'add', value: 3 },
|
||||||
|
{ path: 'relationships.trevor.likes_you', op: 'add', value: -2 },
|
||||||
|
{ path: 'relationships.trevor.fears_you', op: 'add', value: 6 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
id: 'misrouted_envelope',
|
||||||
|
stage: 'mailroom',
|
||||||
|
weight: 35,
|
||||||
|
cooldown: 8,
|
||||||
|
requires: [{ path: 'flags.holds_the_envelope', op: '==', value: false }],
|
||||||
|
description:
|
||||||
|
'A sealed envelope, misrouted. Wrong floor, wrong name — and the name is ' +
|
||||||
|
'one you have seen on the quarterly. It is not sealed especially well.',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
id: 'deliver',
|
||||||
|
label: 'Deliver it. Say nothing.',
|
||||||
|
result: 'It goes where it was going. You think about it on the way back.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'reputation', op: 'add', value: 2 },
|
||||||
|
{ path: 'notable', op: 'push', value: 'Delivered the misrouted envelope unopened.' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'hold',
|
||||||
|
label: 'Put it in your locker for now.',
|
||||||
|
result: 'For now.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'flags.holds_the_envelope', op: 'set', value: true },
|
||||||
|
{ path: 'notable', op: 'push', value: 'Kept an envelope that was not addressed to you.' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'to_marlene',
|
||||||
|
label: 'Take it to Marlene.',
|
||||||
|
result: 'She reroutes it without looking at it, which took her years.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'relationships.marlene.likes_you', op: 'add', value: 4 },
|
||||||
|
{ path: 'relationships.marlene.wants_to_help_you', op: 'add', value: 3 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
id: 'envelope_pressure',
|
||||||
|
stage: 'mailroom',
|
||||||
|
weight: 45,
|
||||||
|
cooldown: 6,
|
||||||
|
requires: [{ path: 'flags.holds_the_envelope', op: '==', value: true }],
|
||||||
|
description:
|
||||||
|
'The envelope is still in your locker. It has begun to feel heavier than paper.',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
id: 'return_it',
|
||||||
|
label: 'Put it back into the system, late.',
|
||||||
|
result: 'Late mail is nobody\'s scandal. It clears.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'flags.holds_the_envelope', op: 'set', value: false },
|
||||||
|
{ path: 'reputation', op: 'add', value: -1 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'let_it_be_known',
|
||||||
|
label: 'Let it be known, quietly, that you have it.',
|
||||||
|
requires: [{ path: 'skills.negotiation', op: '>=', value: 30 }],
|
||||||
|
result:
|
||||||
|
'You never say what is in it. You never have to. The mailroom gets ' +
|
||||||
|
'noticeably more punctual.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'relationships.marlene.fears_you', op: 'add', value: 10 },
|
||||||
|
{ path: 'relationships.trevor.fears_you', op: 'add', value: 10 },
|
||||||
|
{ path: 'reputation', op: 'add', value: -4 },
|
||||||
|
{ path: 'notable', op: 'push', value: 'Let it be known you had the envelope.' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'leave_it',
|
||||||
|
label: 'Leave it where it is.',
|
||||||
|
result: 'You check the locker twice on your way out.',
|
||||||
|
effects: [{ path: 'reputation', op: 'add', value: -1 }],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
id: 'trevor_favor',
|
||||||
|
stage: 'mailroom',
|
||||||
|
weight: 55,
|
||||||
|
cooldown: 5,
|
||||||
|
requires: [
|
||||||
|
{ path: 'relationships.trevor.likes_you', op: '>=', value: 48 },
|
||||||
|
{ path: 'flags.covered_for_trevor', op: '==', value: false },
|
||||||
|
],
|
||||||
|
description:
|
||||||
|
'Trevor asks if you would cover the last hour on Thursday. He does not ' +
|
||||||
|
'say why. He does say it twice.',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
id: 'cover',
|
||||||
|
label: 'Cover it.',
|
||||||
|
result: 'Thursday is quiet. Trevor is not there to see how quiet.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'flags.covered_for_trevor', op: 'set', value: true },
|
||||||
|
{ path: 'relationships.trevor.likes_you', op: 'add', value: 6 },
|
||||||
|
{ path: 'relationships.trevor.wants_to_help_you', op: 'add', value: 8 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'trade',
|
||||||
|
label: 'Cover it, and say what you want in return.',
|
||||||
|
requires: [{ path: 'skills.negotiation', op: '>=', value: 15 }],
|
||||||
|
result: 'He agrees quickly, and then thinks about how quickly he agreed.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'flags.covered_for_trevor', op: 'set', value: true },
|
||||||
|
{ path: 'skills.negotiation', op: 'add', value: 3 },
|
||||||
|
{ path: 'relationships.trevor.wants_to_help_you', op: 'add', value: 5 },
|
||||||
|
{ path: 'relationships.trevor.fears_you', op: 'add', value: 4 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'refuse',
|
||||||
|
label: 'Say no.',
|
||||||
|
result: 'He says it is fine. He asks Marlene, who says no as well.',
|
||||||
|
effects: [{ path: 'relationships.trevor.likes_you', op: 'add', value: -5 }],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
id: 'call_in_favor',
|
||||||
|
stage: 'mailroom',
|
||||||
|
weight: 50,
|
||||||
|
cooldown: 4,
|
||||||
|
requires: [{ path: 'flags.covered_for_trevor', op: '==', value: true }],
|
||||||
|
description:
|
||||||
|
'Thursday was a while ago now. Trevor has not brought it up, which is its ' +
|
||||||
|
'own kind of answer.',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
id: 'call_it_in',
|
||||||
|
label: 'Ask him to take the afternoon bins.',
|
||||||
|
result: 'He takes them. The ledger is closed and both of you know it.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'flags.covered_for_trevor', op: 'set', value: false },
|
||||||
|
{ path: 'skills.logistics', op: 'add', value: 1 },
|
||||||
|
{ path: 'reputation', op: 'add', value: 1 },
|
||||||
|
{ path: 'relationships.trevor.wants_to_help_you', op: 'add', value: -4 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'bank_it',
|
||||||
|
label: 'Leave it. It keeps.',
|
||||||
|
result: 'It keeps. He knows it keeps.',
|
||||||
|
effects: [{ path: 'relationships.trevor.fears_you', op: 'add', value: 2 }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'forgive',
|
||||||
|
label: 'Tell him to forget it.',
|
||||||
|
result: 'He does not forget it, but he does stop bringing you coffee wrong.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'flags.covered_for_trevor', op: 'set', value: false },
|
||||||
|
{ path: 'relationships.trevor.likes_you', op: 'add', value: 7 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
id: 'marlene_confides',
|
||||||
|
stage: 'mailroom',
|
||||||
|
weight: 50,
|
||||||
|
cooldown: 8,
|
||||||
|
requires: [{ path: 'relationships.marlene.likes_you', op: '>=', value: 65 }],
|
||||||
|
description:
|
||||||
|
'Marlene tells you, without preamble, that she was told nineteen years ago ' +
|
||||||
|
'that the mailroom was a two-year posting. She then asks whether the ' +
|
||||||
|
'third-floor bins have gone up.',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
id: 'ask_about_it',
|
||||||
|
label: 'Ask her about it.',
|
||||||
|
result: 'She talks for a while. She has not told this to Trevor.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'skills.negotiation', op: 'add', value: 2 },
|
||||||
|
{ path: 'relationships.marlene.likes_you', op: 'add', value: 5 },
|
||||||
|
{ path: 'relationships.marlene.wants_to_help_you', op: 'add', value: 6 },
|
||||||
|
{
|
||||||
|
path: 'notable',
|
||||||
|
op: 'push',
|
||||||
|
value: 'Marlene told you about the two-year posting.',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'answer_the_bins',
|
||||||
|
label: 'Tell her the bins have gone up.',
|
||||||
|
result: 'She writes it down. The subject is closed with visible relief.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'skills.logistics', op: 'add', value: 1 },
|
||||||
|
{ path: 'relationships.marlene.likes_you', op: 'add', value: 2 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'ask_how_to_leave',
|
||||||
|
label: 'Ask her how to get out of the mailroom.',
|
||||||
|
requires: [{ path: 'skills.negotiation', op: '>=', value: 15 }],
|
||||||
|
result:
|
||||||
|
'She gives you three names and a piece of advice she says she wishes ' +
|
||||||
|
'someone had given her, which is how you know it is good.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'skills.negotiation', op: 'add', value: 4 },
|
||||||
|
{ path: 'reputation', op: 'add', value: 2 },
|
||||||
|
{ path: 'relationships.marlene.wants_to_help_you', op: 'add', value: 5 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export default people;
|
||||||
@@ -0,0 +1,349 @@
|
|||||||
|
// Ordinary days in the mailroom.
|
||||||
|
//
|
||||||
|
// The first three carry no conditions, no cooldown and no `once`, which makes
|
||||||
|
// them the stage's floor: whatever else is excluded, there is always a turn to
|
||||||
|
// play. Everything else in the pack leans on that.
|
||||||
|
|
||||||
|
export const routine = [
|
||||||
|
{
|
||||||
|
id: 'first_day',
|
||||||
|
stage: 'mailroom',
|
||||||
|
weight: 99999,
|
||||||
|
once: true,
|
||||||
|
description:
|
||||||
|
'Marlene Hobb hands you a laminated card with the org chart on it. Your ' +
|
||||||
|
'name is not on the card. She says it will be, eventually, in pen.',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
id: 'listen',
|
||||||
|
label: 'Ask her to walk you through it.',
|
||||||
|
result: 'She walks you through it. Then she walks you through it again.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'skills.negotiation', op: 'add', value: 2 },
|
||||||
|
{ path: 'relationships.marlene.likes_you', op: 'add', value: 4 },
|
||||||
|
{ path: 'notable', op: 'push', value: 'Let Marlene explain the org chart. Twice.' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'wing_it',
|
||||||
|
label: "Say you'll pick it up as you go.",
|
||||||
|
result: 'She puts the card back in her pocket without comment.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'skills.logistics', op: 'add', value: 2 },
|
||||||
|
{ path: 'relationships.marlene.likes_you', op: 'add', value: -2 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'ask_trevor',
|
||||||
|
label: 'Ask Trevor where you actually sit.',
|
||||||
|
result:
|
||||||
|
'He shows you a desk, then mentions he has been here two weeks longer ' +
|
||||||
|
'than you. This will not be the last time.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'relationships.trevor.likes_you', op: 'add', value: 3 },
|
||||||
|
{ path: 'relationships.trevor.wants_to_help_you', op: 'add', value: 2 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
id: 'mail_cart',
|
||||||
|
stage: 'mailroom',
|
||||||
|
weight: 100,
|
||||||
|
description:
|
||||||
|
"The mail cart's left front wheel has developed a shriek. Facilities has " +
|
||||||
|
'classified it as "cosmetic."',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
id: 'push',
|
||||||
|
label: "Push it anyway. Everyone will know you're coming.",
|
||||||
|
result: 'By Thursday, two floors can time their morning by you.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'skills.logistics', op: 'add', value: 1 },
|
||||||
|
{ path: 'reputation', op: 'add', value: -2 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'requisition',
|
||||||
|
label: 'Spend the morning on a requisition form.',
|
||||||
|
result:
|
||||||
|
'The form requires the cart\'s asset number. The asset number is on the ' +
|
||||||
|
'wheel. You fill it in from underneath.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'skills.negotiation', op: 'add', value: 2 },
|
||||||
|
{ path: 'skills.logistics', op: 'add', value: 1 },
|
||||||
|
{ path: 'relationships.marlene.likes_you', op: 'add', value: 1 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'swap',
|
||||||
|
label: 'Swap it with the good cart from the third floor.',
|
||||||
|
result: 'The third floor has no way of proving anything. They try anyway.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'skills.logistics', op: 'add', value: 3 },
|
||||||
|
{ path: 'reputation', op: 'add', value: -3 },
|
||||||
|
{ path: 'relationships.trevor.fears_you', op: 'add', value: 3 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
id: 'sorting_backlog',
|
||||||
|
stage: 'mailroom',
|
||||||
|
weight: 100,
|
||||||
|
description:
|
||||||
|
'Two bins came in overnight and neither is labelled. Trevor has decided ' +
|
||||||
|
'this is a good day to reorganise his desk.',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
id: 'grind',
|
||||||
|
label: 'Sort both bins yourself.',
|
||||||
|
result: 'It takes until four. Marlene notices, which is the point.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'skills.logistics', op: 'add', value: 3 },
|
||||||
|
{ path: 'reputation', op: 'add', value: 2 },
|
||||||
|
{ path: 'relationships.marlene.likes_you', op: 'add', value: 3 },
|
||||||
|
// Trevor's bin got sorted too, and he is not too proud to notice.
|
||||||
|
{ path: 'relationships.trevor.likes_you', op: 'add', value: 2 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'split',
|
||||||
|
label: 'Ask Trevor to take one.',
|
||||||
|
requires: [{ path: 'skills.negotiation', op: '>=', value: 15 }],
|
||||||
|
result: 'He takes one. He takes the lighter one, but he takes one.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'skills.negotiation', op: 'add', value: 2 },
|
||||||
|
{ path: 'skills.logistics', op: 'add', value: 1 },
|
||||||
|
{ path: 'relationships.trevor.likes_you', op: 'add', value: -2 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'halfway',
|
||||||
|
label: 'Sort what fits before lunch and leave the rest.',
|
||||||
|
result: 'The rest is still there on Monday, and so are you.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'reputation', op: 'add', value: -2 },
|
||||||
|
{ path: 'relationships.marlene.likes_you', op: 'add', value: -2 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
id: 'franking_machine',
|
||||||
|
stage: 'mailroom',
|
||||||
|
weight: 70,
|
||||||
|
description:
|
||||||
|
'The franking machine is making a noise it has not made before. The manual ' +
|
||||||
|
'is in a drawer that is locked, and the key is a subject nobody will be ' +
|
||||||
|
'drawn on.',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
id: 'fix',
|
||||||
|
label: 'Take the panel off and have a look.',
|
||||||
|
requires: [{ path: 'skills.logistics', op: '>=', value: 20 }],
|
||||||
|
result: 'It was a spring. It is now a spring in the right place.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'skills.logistics', op: 'add', value: 3 },
|
||||||
|
{ path: 'reputation', op: 'add', value: 4 },
|
||||||
|
{ path: 'relationships.marlene.likes_you', op: 'add', value: 3 },
|
||||||
|
{
|
||||||
|
path: 'notable',
|
||||||
|
op: 'push',
|
||||||
|
value: 'Fixed the franking machine, which nobody had managed since 2019.',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'cycle',
|
||||||
|
label: 'Turn it off and on.',
|
||||||
|
result: 'The noise stops. Nothing has been learned by anyone.',
|
||||||
|
effects: [{ path: 'skills.logistics', op: 'add', value: 1 }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'escalate',
|
||||||
|
label: 'Log it with Facilities and wait.',
|
||||||
|
result: 'Facilities classifies it as cosmetic.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'skills.negotiation', op: 'add', value: 1 },
|
||||||
|
{ path: 'relationships.marlene.likes_you', op: 'add', value: -1 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
id: 'birthday_card',
|
||||||
|
stage: 'mailroom',
|
||||||
|
weight: 45,
|
||||||
|
cooldown: 5,
|
||||||
|
description:
|
||||||
|
'A card is going round for someone on the fourth floor. You have never met ' +
|
||||||
|
'them. The envelope already has two twenties in it and your name is next ' +
|
||||||
|
'on the list.',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
id: 'contribute',
|
||||||
|
label: 'Put something in.',
|
||||||
|
result: 'You are now a person who puts something in.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'money', op: 'add', value: -20 },
|
||||||
|
{ path: 'reputation', op: 'add', value: 3 },
|
||||||
|
{ path: 'relationships.marlene.likes_you', op: 'add', value: 2 },
|
||||||
|
{ path: 'relationships.trevor.likes_you', op: 'add', value: 2 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'sign_only',
|
||||||
|
label: 'Sign it and pass it on.',
|
||||||
|
result: 'You write "all the best" and immediately regret the phrasing.',
|
||||||
|
effects: [{ path: 'reputation', op: 'add', value: -1 }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'pass',
|
||||||
|
label: 'Pass it on unsigned.',
|
||||||
|
result: 'Trevor checks the list. Trevor notices the list.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'reputation', op: 'add', value: -3 },
|
||||||
|
{ path: 'relationships.trevor.likes_you', op: 'add', value: -2 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
id: 'elevator',
|
||||||
|
stage: 'mailroom',
|
||||||
|
weight: 30,
|
||||||
|
cooldown: 10,
|
||||||
|
description:
|
||||||
|
'You are alone in the elevator with a man whose name is on the quarterly. ' +
|
||||||
|
'He looks at your cart. He asks how long the mail takes to get to eleven.',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
id: 'honest',
|
||||||
|
label: 'Tell him the truth: forty minutes, on a good day.',
|
||||||
|
result: 'He says "forty" once, to himself, and gets out on nine.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'reputation', op: 'add', value: 5 },
|
||||||
|
{ path: 'skills.negotiation', op: 'add', value: 2 },
|
||||||
|
{
|
||||||
|
path: 'notable',
|
||||||
|
op: 'push',
|
||||||
|
value: 'Told an executive the truth about the eleventh floor.',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'optimistic',
|
||||||
|
label: 'Tell him twenty.',
|
||||||
|
result: 'He seems pleased. Somebody, eventually, will have to make it twenty.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'reputation', op: 'add', value: -3 },
|
||||||
|
{ path: 'skills.negotiation', op: 'add', value: 1 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'unsure',
|
||||||
|
label: "Say you're not sure.",
|
||||||
|
result: 'The rest of the ride is four floors long.',
|
||||||
|
effects: [{ path: 'reputation', op: 'add', value: -1 }],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
id: 'overtime_week',
|
||||||
|
stage: 'mailroom',
|
||||||
|
weight: 40,
|
||||||
|
cooldown: 7,
|
||||||
|
description:
|
||||||
|
'There is a weekend inventory. It pays. Marlene mentions it in the tone of ' +
|
||||||
|
'someone who has been told to mention it.',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
id: 'take',
|
||||||
|
label: 'Take the shift.',
|
||||||
|
result: 'Two days of counting things that were already counted.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'money', op: 'add', value: 180 },
|
||||||
|
{ path: 'skills.logistics', op: 'add', value: 2 },
|
||||||
|
{ path: 'reputation', op: 'add', value: 2 },
|
||||||
|
{ path: 'relationships.marlene.likes_you', op: 'add', value: 2 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'negotiate',
|
||||||
|
label: 'Take it, for a bit more.',
|
||||||
|
requires: [{ path: 'skills.negotiation', op: '>=', value: 30 }],
|
||||||
|
result:
|
||||||
|
'Marlene does not enjoy the conversation, but she does have the ' +
|
||||||
|
'authority, and you both find that out at the same time.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'money', op: 'add', value: 260 },
|
||||||
|
{ path: 'skills.negotiation', op: 'add', value: 3 },
|
||||||
|
{ path: 'relationships.marlene.likes_you', op: 'add', value: -1 },
|
||||||
|
{
|
||||||
|
path: 'notable',
|
||||||
|
op: 'push',
|
||||||
|
value: 'Negotiated a better rate for the weekend inventory.',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'decline',
|
||||||
|
label: 'Pass.',
|
||||||
|
result: 'You have a weekend. It is the only one anyone gets.',
|
||||||
|
effects: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
id: 'promotion_rumor',
|
||||||
|
stage: 'mailroom',
|
||||||
|
weight: 25,
|
||||||
|
cooldown: 12,
|
||||||
|
requires: [{ path: 'turn', op: '>=', value: 30 }],
|
||||||
|
description:
|
||||||
|
'There is a post going in Dispatch. Trevor has heard about it. Trevor ' +
|
||||||
|
'mentions that he has heard about it.',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
id: 'ask_marlene',
|
||||||
|
label: 'Ask Marlene to put your name forward.',
|
||||||
|
requires: [{ path: 'relationships.marlene.wants_to_help_you', op: '>=', value: 60 }],
|
||||||
|
result: 'She says she will see. From Marlene this is close to a contract.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'reputation', op: 'add', value: 5 },
|
||||||
|
{ path: 'relationships.marlene.wants_to_help_you', op: 'add', value: -5 },
|
||||||
|
{
|
||||||
|
path: 'notable',
|
||||||
|
op: 'push',
|
||||||
|
value: 'Asked Marlene to put your name forward for Dispatch.',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'ask_around',
|
||||||
|
label: 'Ask around on your own.',
|
||||||
|
result: 'You learn the post has been open for eleven months.',
|
||||||
|
effects: [
|
||||||
|
{ path: 'skills.negotiation', op: 'add', value: 3 },
|
||||||
|
{ path: 'reputation', op: 'add', value: 2 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'ignore',
|
||||||
|
label: 'Stay where you are for now.',
|
||||||
|
result: 'Trevor mentions it again on Thursday.',
|
||||||
|
effects: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export default routine;
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
// Corporate Ladder — the default content pack for The Ladder.
|
||||||
|
//
|
||||||
|
// A modern office, the mailroom, and two people who have been there longer
|
||||||
|
// than you. Everything the engine needs to run this setting is in this file
|
||||||
|
// and the ones it imports; the engine itself knows nothing about mailrooms.
|
||||||
|
|
||||||
|
import { characters } from './characters.js';
|
||||||
|
import { events } from './events/index.js';
|
||||||
|
|
||||||
|
export const corporateLadder = {
|
||||||
|
id: 'corporateladder',
|
||||||
|
name: 'Corporate Ladder',
|
||||||
|
version: '0.1.0',
|
||||||
|
turnUnit: 'day',
|
||||||
|
startingStage: 'mailroom',
|
||||||
|
|
||||||
|
stages: {
|
||||||
|
mailroom: { label: 'Mailroom', title: 'Mail Associate I' },
|
||||||
|
},
|
||||||
|
|
||||||
|
// Money is deliberately tight: the baseline is a slow bleed (see `upkeep`),
|
||||||
|
// so the pressure that eventually forces a hard-times turn comes from doing
|
||||||
|
// nothing about it, and most of the ways out cost standing rather than cash.
|
||||||
|
state: {
|
||||||
|
'money': { initial: 400, min: -5000, max: 1000000 },
|
||||||
|
'debt': { initial: 0, min: 0, max: 1000000 },
|
||||||
|
'reputation': { initial: 50, min: 0, max: 100 },
|
||||||
|
'skills.negotiation': { initial: 5, min: 0, max: 100 },
|
||||||
|
'skills.logistics': { initial: 5, min: 0, max: 100 },
|
||||||
|
'flags.took_loan': { initial: false },
|
||||||
|
'flags.holds_the_envelope': { initial: false },
|
||||||
|
'flags.covered_for_trevor': { initial: false },
|
||||||
|
// Moments the retrospective reads back. Content decides what is memorable;
|
||||||
|
// the full turn-by-turn record lives in history regardless.
|
||||||
|
'notable': { initial: [] },
|
||||||
|
},
|
||||||
|
|
||||||
|
// Nobody fears a new hire. Trevor's defaults are lower still — see
|
||||||
|
// characters.js, where he starts two weeks ahead of you and knows it.
|
||||||
|
relationshipStats: {
|
||||||
|
likes_you: { initial: 50, min: 0, max: 100 },
|
||||||
|
fears_you: { initial: 10, min: 0, max: 100 },
|
||||||
|
wants_to_help_you: { initial: 40, min: 0, max: 100 },
|
||||||
|
},
|
||||||
|
|
||||||
|
// Applied at the end of every turn, after the player's choice. Net -25 a day
|
||||||
|
// before anything else happens, so a run drifts toward trouble in about
|
||||||
|
// sixteen days if it is left alone.
|
||||||
|
upkeep: [
|
||||||
|
{ label: 'Wages', effects: [{ path: 'money', op: 'add', value: 115 }] },
|
||||||
|
{ label: 'Living costs', effects: [{ path: 'money', op: 'add', value: -140 }] },
|
||||||
|
// The service charge steps up with the size of the debt, so the spiral
|
||||||
|
// tightens instead of flattening out. A step function in data costs the
|
||||||
|
// engine nothing; a percentage would have needed a multiply operation.
|
||||||
|
{
|
||||||
|
label: 'Loan service charge',
|
||||||
|
requires: [{ path: 'debt', op: '>', value: 0 }],
|
||||||
|
effects: [{ path: 'money', op: 'add', value: -10 }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Loan service charge (arrears)',
|
||||||
|
requires: [{ path: 'debt', op: '>=', value: 1000 }],
|
||||||
|
effects: [{ path: 'money', op: 'add', value: -15 }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Loan service charge (collections)',
|
||||||
|
requires: [{ path: 'debt', op: '>=', value: 2000 }],
|
||||||
|
effects: [{ path: 'money', op: 'add', value: -25 }],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
characters,
|
||||||
|
events,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default corporateLadder;
|
||||||
@@ -107,3 +107,45 @@ The product is **The Ladder**; the default content pack is **Corporate
|
|||||||
Ladder**. The planning docs use "Corporate Ladder" as the working title for
|
Ladder**. The planning docs use "Corporate Ladder" as the working title for
|
||||||
both, which would have baked one setting into the product name, against the
|
both, which would have baked one setting into the product name, against the
|
||||||
explicit goal that corporate is one pack among many.
|
explicit goal that corporate is one pack among many.
|
||||||
|
|
||||||
|
## 11. Per-turn upkeep is declared by the pack
|
||||||
|
|
||||||
|
The MVP spec wants "basic income and basic recurring costs", but effects only
|
||||||
|
run when a player chooses something. Baking wages and rent into every option
|
||||||
|
would be tedious and easy to get wrong.
|
||||||
|
|
||||||
|
`pack.upkeep` is a list of `{ label, requires?, effects }` applied at the end of
|
||||||
|
each turn, after the choice lands. It is still data — the engine reads it and
|
||||||
|
knows nothing about wages — and the conditions make it expressive enough to be
|
||||||
|
useful: Corporate Ladder's loan service charge is three conditional entries
|
||||||
|
forming a step function that escalates with the size of the debt, which needed
|
||||||
|
no multiply operation and no engine change.
|
||||||
|
|
||||||
|
Upkeep changes are recorded separately from choice changes in the turn record,
|
||||||
|
so the UI can show "you chose this" and "and then the month happened" as
|
||||||
|
different things.
|
||||||
|
|
||||||
|
## 12. Characters may start somewhere other than the pack default
|
||||||
|
|
||||||
|
`relationshipStats` sets the defaults; a character's `startingRelationship`
|
||||||
|
overrides individual stats. Trevor starts below the default on `likes_you`
|
||||||
|
because he arrived two weeks before you and has priced that in — which is
|
||||||
|
characterisation expressed as data rather than as an opening cutscene.
|
||||||
|
|
||||||
|
Nobody starts feared: `fears_you` defaults to 10 rather than 50, because a
|
||||||
|
midpoint default would mean every new hire arrives already intimidating.
|
||||||
|
|
||||||
|
## 13. Content is tested for reachability, not just validity
|
||||||
|
|
||||||
|
`validatePack` proves a pack *can* run. It does not prove any of it is ever
|
||||||
|
seen. The content suite plays 60 seeded runs and asserts that every event fires
|
||||||
|
and every option is taken at least once — dead content is otherwise invisible,
|
||||||
|
and two whole events plus a hard-times escape route were in fact unreachable on
|
||||||
|
the first pass because Trevor's gate sat above anything a player could
|
||||||
|
plausibly reach.
|
||||||
|
|
||||||
|
**A trap that cost a cycle:** the chooser's RNG must be seeded differently from
|
||||||
|
the game's. Both draw exactly one number per turn from the same generator, so a
|
||||||
|
shared seed correlates the choice index with the event draw and makes whole
|
||||||
|
option combinations structurally unreachable. It presents as a content bug and
|
||||||
|
is not one. Any headless playtest harness written later has to know this.
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
import { createRng } from './rng.js';
|
import { createRng } from './rng.js';
|
||||||
import { applyEffects } from './effects.js';
|
import { applyEffects } from './effects.js';
|
||||||
|
import { check } from './conditions.js';
|
||||||
import { resolveSchema, createState } from './state.js';
|
import { resolveSchema, createState } from './state.js';
|
||||||
import { selectEvent, resolveOptions, findOption } from './select.js';
|
import { selectEvent, resolveOptions, findOption } from './select.js';
|
||||||
import { setPath, getPath } from './paths.js';
|
import { setPath, getPath } from './paths.js';
|
||||||
@@ -29,6 +30,24 @@ function advance(pack, state) {
|
|||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply the pack's per-turn upkeep — wages in, rent out, whatever a loan
|
||||||
|
* costs to carry. Each entry may carry its own conditions, evaluated after the
|
||||||
|
* player's choice has landed, so upkeep is content's business and not a
|
||||||
|
* special case in the loop.
|
||||||
|
*/
|
||||||
|
function applyUpkeep(pack, state, schema) {
|
||||||
|
let next = state;
|
||||||
|
const changes = [];
|
||||||
|
for (const entry of pack.upkeep ?? []) {
|
||||||
|
if (!check(next, entry.requires).passed) continue;
|
||||||
|
const applied = applyEffects(next, entry.effects, schema);
|
||||||
|
next = applied.state;
|
||||||
|
changes.push(...applied.changes.map((change) => ({ ...change, label: entry.label ?? null })));
|
||||||
|
}
|
||||||
|
return { state: next, changes };
|
||||||
|
}
|
||||||
|
|
||||||
/** Begin a run. `seed` is any string or number; it is stored in the save. */
|
/** Begin a run. `seed` is any string or number; it is stored in the save. */
|
||||||
export function startGame(pack, { seed = Date.now(), schema = resolveSchema(pack), now = null } = {}) {
|
export function startGame(pack, { seed = Date.now(), schema = resolveSchema(pack), now = null } = {}) {
|
||||||
let state = createState(pack, { seed, schema });
|
let state = createState(pack, { seed, schema });
|
||||||
@@ -73,6 +92,9 @@ export function takeTurn(pack, state, optionId, { schema = resolveSchema(pack),
|
|||||||
next = setPath(next, `seen.${event.id}`, seenCount + 1);
|
next = setPath(next, `seen.${event.id}`, seenCount + 1);
|
||||||
next = setPath(next, `lastSeen.${event.id}`, next.turn);
|
next = setPath(next, `lastSeen.${event.id}`, next.turn);
|
||||||
|
|
||||||
|
const upkeep = applyUpkeep(pack, next, schema);
|
||||||
|
next = upkeep.state;
|
||||||
|
|
||||||
const record = {
|
const record = {
|
||||||
turn: next.turn,
|
turn: next.turn,
|
||||||
stage: next.stage,
|
stage: next.stage,
|
||||||
@@ -80,6 +102,7 @@ export function takeTurn(pack, state, optionId, { schema = resolveSchema(pack),
|
|||||||
optionId: option.id,
|
optionId: option.id,
|
||||||
optionLabel: option.label,
|
optionLabel: option.label,
|
||||||
changes: applied.changes,
|
changes: applied.changes,
|
||||||
|
upkeep: upkeep.changes,
|
||||||
offered: resolved.map((r) => ({
|
offered: resolved.map((r) => ({
|
||||||
id: r.option.id,
|
id: r.option.id,
|
||||||
label: r.option.label,
|
label: r.option.label,
|
||||||
|
|||||||
+5
-1
@@ -27,7 +27,11 @@ export function resolveSchema(pack) {
|
|||||||
}
|
}
|
||||||
for (const character of pack.characters ?? []) {
|
for (const character of pack.characters ?? []) {
|
||||||
for (const [stat, rule] of Object.entries(pack.relationshipStats ?? {})) {
|
for (const [stat, rule] of Object.entries(pack.relationshipStats ?? {})) {
|
||||||
schema[`relationships.${character.id}.${stat}`] = { ...rule };
|
// A character may start somewhere other than the pack default — a rival
|
||||||
|
// who already resents you, a boss who has not formed an opinion.
|
||||||
|
const override = character.startingRelationship?.[stat];
|
||||||
|
schema[`relationships.${character.id}.${stat}`] =
|
||||||
|
override === undefined ? { ...rule } : { ...rule, initial: override };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return schema;
|
return schema;
|
||||||
|
|||||||
@@ -95,6 +95,29 @@ export function validatePack(pack) {
|
|||||||
list.forEach(walk);
|
list.forEach(walk);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
(pack.upkeep ?? []).forEach((entry, index) => {
|
||||||
|
const where = `upkeep[${index}]${entry.label ? ` "${entry.label}"` : ''}`;
|
||||||
|
checkConditions(where, entry.requires);
|
||||||
|
if (!entry.effects?.length) fail(where, 'has no effects');
|
||||||
|
for (const effect of entry.effects ?? []) {
|
||||||
|
if (!OPERATIONS.includes(effect.op)) {
|
||||||
|
fail(where, `unknown effect operation ${JSON.stringify(effect.op)}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const path of effectPaths(entry.effects)) {
|
||||||
|
const problem = writable(path);
|
||||||
|
if (problem) fail(where, `effect writes ${problem}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
for (const character of pack.characters ?? []) {
|
||||||
|
for (const stat of Object.keys(character.startingRelationship ?? {})) {
|
||||||
|
if (!(stat in (pack.relationshipStats ?? {}))) {
|
||||||
|
fail(`character "${character.id}"`, `startingRelationship names unknown stat "${stat}"`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const stages = new Set();
|
const stages = new Set();
|
||||||
const unconditional = new Set();
|
const unconditional = new Set();
|
||||||
const seenEvents = new Set();
|
const seenEvents = new Set();
|
||||||
|
|||||||
@@ -0,0 +1,136 @@
|
|||||||
|
// Tests for the shipped Corporate Ladder pack.
|
||||||
|
//
|
||||||
|
// These are content tests, not engine tests: they assert that the pack is
|
||||||
|
// playable, that none of it is dead, and that its economy behaves. Engine
|
||||||
|
// behaviour is covered against the fixture pack instead, so tuning the game
|
||||||
|
// cannot break the engine suite and vice versa.
|
||||||
|
//
|
||||||
|
// One trap, learned the hard way: the chooser's RNG must be seeded
|
||||||
|
// *differently* from the game's. Both draw one number per turn from the same
|
||||||
|
// generator, so sharing a seed correlates the choice index with the event
|
||||||
|
// draw and silently makes whole option combinations unreachable — which looks
|
||||||
|
// exactly like a content bug.
|
||||||
|
|
||||||
|
import { test } from 'node:test';
|
||||||
|
import assert from 'node:assert/strict';
|
||||||
|
import { corporateLadder as pack } from '../content/corporateladder/index.js';
|
||||||
|
import { validatePack } from '../src/engine/validate.js';
|
||||||
|
import { startGame, currentTurn, takeTurn } from '../src/engine/game.js';
|
||||||
|
import { createRng } from '../src/engine/rng.js';
|
||||||
|
|
||||||
|
/** Play `turns` turns with independently-seeded random choices. */
|
||||||
|
function randomRun(runSeed, turns, visit = () => {}) {
|
||||||
|
const rng = createRng(`chooser-${runSeed}`);
|
||||||
|
let state = startGame(pack, { seed: `run-${runSeed}` });
|
||||||
|
for (let t = 0; t < turns; t++) {
|
||||||
|
const turn = currentTurn(pack, state);
|
||||||
|
const available = turn.options.filter((o) => o.available);
|
||||||
|
assert.ok(available.length > 0, `no available option on event "${turn.event.id}"`);
|
||||||
|
const choice = rng.pick(available).option.id;
|
||||||
|
visit(turn, state, choice);
|
||||||
|
state = takeTurn(pack, state, choice).state;
|
||||||
|
}
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
test('the pack is valid, with no warnings', () => {
|
||||||
|
const result = validatePack(pack);
|
||||||
|
assert.deepEqual(result.errors, []);
|
||||||
|
assert.deepEqual(result.warnings, []);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('no content is dead: every event fires and every option can be taken', () => {
|
||||||
|
const firedEvents = new Set();
|
||||||
|
const takenOptions = new Set();
|
||||||
|
for (let seed = 0; seed < 60; seed++) {
|
||||||
|
randomRun(seed, 200, (turn, _state, choice) => {
|
||||||
|
firedEvents.add(turn.event.id);
|
||||||
|
takenOptions.add(`${turn.event.id}.${choice}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const allEvents = pack.events.map((e) => e.id);
|
||||||
|
const allOptions = pack.events.flatMap((e) => e.options.map((o) => `${e.id}.${o.id}`));
|
||||||
|
assert.deepEqual(allEvents.filter((e) => !firedEvents.has(e)), [], 'events that can never fire');
|
||||||
|
assert.deepEqual(allOptions.filter((o) => !takenOptions.has(o)), [], 'options that can never be taken');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('every turn always offers something to do, however badly the run is going', () => {
|
||||||
|
// randomRun asserts this on every turn; 40 long runs is the coverage.
|
||||||
|
for (let seed = 100; seed < 140; seed++) randomRun(seed, 150);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('the economy bleeds, so doing nothing about money eventually bites', () => {
|
||||||
|
const turns = [];
|
||||||
|
for (let seed = 0; seed < 30; seed++) {
|
||||||
|
let firstHardTimes = null;
|
||||||
|
randomRun(seed, 120, (turn, state) => {
|
||||||
|
if (turn.event.id === 'rent_bounced' && firstHardTimes === null) firstHardTimes = state.turn;
|
||||||
|
});
|
||||||
|
assert.ok(firstHardTimes, `run ${seed} never hit hard times in 120 turns`);
|
||||||
|
turns.push(firstHardTimes);
|
||||||
|
}
|
||||||
|
turns.sort((a, b) => a - b);
|
||||||
|
const median = turns[Math.floor(turns.length / 2)];
|
||||||
|
assert.ok(median > 10 && median < 45, `hard times should land mid-run, median was turn ${median}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('hard times is survivable without any relationship or skill', () => {
|
||||||
|
const event = pack.events.find((e) => e.id === 'rent_bounced');
|
||||||
|
const ungated = event.options.filter((o) => !o.requires);
|
||||||
|
assert.ok(ungated.length > 0, 'a player with nothing must still have a way out');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('the run recovers from hard times rather than sticking there', () => {
|
||||||
|
let sawNegative = false;
|
||||||
|
let recovered = false;
|
||||||
|
randomRun(7, 200, (_turn, state) => {
|
||||||
|
if (state.money < 0) sawNegative = true;
|
||||||
|
else if (sawNegative) recovered = true;
|
||||||
|
});
|
||||||
|
assert.ok(sawNegative && recovered, 'money should go negative and come back');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('debt cannot spiral without limit: lending stops and the charge escalates', () => {
|
||||||
|
let peakDebt = 0;
|
||||||
|
for (let seed = 0; seed < 40; seed++) {
|
||||||
|
randomRun(seed, 200, (_turn, state) => { peakDebt = Math.max(peakDebt, state.debt); });
|
||||||
|
}
|
||||||
|
// The loan is gated at debt < 2000 and lends 500, so 2500 plus stalled
|
||||||
|
// interest is the ceiling. Well above that means the gate has stopped working.
|
||||||
|
assert.ok(peakDebt <= 3000, `debt reached ${peakDebt}; the borrowing ceiling is not holding`);
|
||||||
|
|
||||||
|
const charges = pack.upkeep.filter((u) => u.label?.startsWith('Loan service charge'));
|
||||||
|
assert.ok(charges.length >= 3, 'the service charge should step up as debt grows');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('a deliberate player can reach relationship-gated content in a reasonable run', () => {
|
||||||
|
// The Trevor chain is the deepest gate in the pack. A player cultivating him
|
||||||
|
// should get there well inside a normal session, not at turn 100.
|
||||||
|
const regard = (o) => (o.option.effects ?? [])
|
||||||
|
.filter((e) => e.path === 'relationships.trevor.likes_you')
|
||||||
|
.reduce((sum, e) => sum + e.value, 0);
|
||||||
|
|
||||||
|
let state = startGame(pack, { seed: 'befriend-trevor' });
|
||||||
|
let reached = null;
|
||||||
|
for (let t = 0; t < 60 && reached === null; t++) {
|
||||||
|
const turn = currentTurn(pack, state);
|
||||||
|
if (turn.event.id === 'trevor_favor') { reached = state.turn; break; }
|
||||||
|
const best = turn.options.filter((o) => o.available).sort((a, b) => regard(b) - regard(a))[0];
|
||||||
|
state = takeTurn(pack, state, best.option.id).state;
|
||||||
|
}
|
||||||
|
assert.ok(reached && reached < 45, `Trevor's chain opened at turn ${reached ?? 'never'}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('a played run replays identically from its seed', () => {
|
||||||
|
const a = randomRun(42, 80);
|
||||||
|
const b = randomRun(42, 80);
|
||||||
|
assert.deepEqual(a, b);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('the retrospective has something to read back', () => {
|
||||||
|
const state = randomRun(3, 60);
|
||||||
|
assert.ok(state.notable.length > 0, 'notable moments should accumulate');
|
||||||
|
assert.equal(state.history.length, 60, 'every turn is recorded');
|
||||||
|
assert.ok(state.history.every((h) => Array.isArray(h.upkeep)), 'upkeep is recorded per turn');
|
||||||
|
});
|
||||||
+40
-1
@@ -1,7 +1,7 @@
|
|||||||
import { test } from 'node:test';
|
import { test } from 'node:test';
|
||||||
import assert from 'node:assert/strict';
|
import assert from 'node:assert/strict';
|
||||||
import { startGame, currentTurn, takeTurn, MoveError } from '../src/engine/game.js';
|
import { startGame, currentTurn, takeTurn, MoveError } from '../src/engine/game.js';
|
||||||
import { getPath } from '../src/engine/paths.js';
|
import { getPath, setPath } from '../src/engine/paths.js';
|
||||||
import { testPack } from './fixtures/test-pack.js';
|
import { testPack } from './fixtures/test-pack.js';
|
||||||
|
|
||||||
/** Play `turns` turns, always taking the first available option. */
|
/** Play `turns` turns, always taking the first available option. */
|
||||||
@@ -163,3 +163,42 @@ test('the run never ends on its own', () => {
|
|||||||
assert.equal(state.turn, 201);
|
assert.equal(state.turn, 201);
|
||||||
assert.ok(currentTurn(testPack, state).options.some((o) => o.available), 'there is always something to do');
|
assert.ok(currentTurn(testPack, state).options.some((o) => o.available), 'there is always something to do');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('upkeep runs every turn and is recorded separately from the choice', () => {
|
||||||
|
const upkeepPack = structuredClone(testPack);
|
||||||
|
upkeepPack.upkeep = [
|
||||||
|
{ label: 'wage', effects: [{ path: 'money', op: 'add', value: 20 }] },
|
||||||
|
{
|
||||||
|
label: 'debt service',
|
||||||
|
requires: [{ path: 'flags.in_debt', op: '==', value: true }],
|
||||||
|
effects: [{ path: 'money', op: 'add', value: -5 }],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
let state = startGame(upkeepPack, { seed: 'upkeep' });
|
||||||
|
const before = state.money;
|
||||||
|
const first = takeTurn(upkeepPack, state, currentTurn(upkeepPack, state).options[0].option.id);
|
||||||
|
|
||||||
|
assert.equal(first.record.upkeep.length, 1, 'the conditional entry is skipped while it does not apply');
|
||||||
|
assert.equal(first.record.upkeep[0].label, 'wage');
|
||||||
|
const fromChoice = first.record.changes
|
||||||
|
.filter((c) => c.path === 'money')
|
||||||
|
.reduce((sum, c) => sum + (c.to - c.from), 0);
|
||||||
|
assert.equal(first.state.money, before + fromChoice + 20);
|
||||||
|
|
||||||
|
// Once the flag is set, the conditional entry starts applying.
|
||||||
|
const nowIndebted = setPath(first.state, 'flags.in_debt', true);
|
||||||
|
const nextOption = currentTurn(upkeepPack, nowIndebted).options.find((o) => o.available).option.id;
|
||||||
|
const indebted = takeTurn(upkeepPack, nowIndebted, nextOption);
|
||||||
|
assert.deepEqual(indebted.record.upkeep.map((c) => c.label), ['wage', 'debt service']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('a character can start somewhere other than the pack default', () => {
|
||||||
|
const pack = structuredClone(testPack);
|
||||||
|
pack.characters.find((c) => c.id === 'pat').startingRelationship = { likes_you: 20 };
|
||||||
|
|
||||||
|
const state = startGame(pack, { seed: 'starts' });
|
||||||
|
assert.equal(state.relationships.pat.likes_you, 20, 'the override applies');
|
||||||
|
assert.equal(state.relationships.pat.fears_you, 50, 'unnamed stats keep the pack default');
|
||||||
|
assert.equal(state.relationships.chief.likes_you, 50, 'other characters are unaffected');
|
||||||
|
});
|
||||||
|
|||||||
@@ -119,3 +119,25 @@ test('assertValidPack throws with every error listed', () => {
|
|||||||
assert.throws(() => assertValidPack(pack), /is invalid/);
|
assert.throws(() => assertValidPack(pack), /is invalid/);
|
||||||
assert.doesNotThrow(() => assertValidPack(testPack));
|
assert.doesNotThrow(() => assertValidPack(testPack));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('upkeep is validated like any other effect list', () => {
|
||||||
|
const badPath = broken((pack) => {
|
||||||
|
pack.upkeep = [{ label: 'wage', effects: [{ path: 'monie', op: 'add', value: 20 }] }];
|
||||||
|
});
|
||||||
|
assert.match(messages(badPath), /monie.*not declared/s);
|
||||||
|
|
||||||
|
const empty = broken((pack) => { pack.upkeep = [{ label: 'wage', effects: [] }]; });
|
||||||
|
assert.match(messages(empty), /has no effects/);
|
||||||
|
|
||||||
|
const writesReserved = broken((pack) => {
|
||||||
|
pack.upkeep = [{ effects: [{ path: 'turn', op: 'add', value: 1 }] }];
|
||||||
|
});
|
||||||
|
assert.match(messages(writesReserved), /engine-owned state/);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('a starting relationship for a stat that does not exist is caught', () => {
|
||||||
|
const result = broken((pack) => {
|
||||||
|
pack.characters[0].startingRelationship = { respects_you: 10 };
|
||||||
|
});
|
||||||
|
assert.match(messages(result), /unknown stat "respects_you"/);
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user