@scrthq/runlog 0.0.41 → 0.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/runlog.js +47 -7
- package/package.json +1 -1
package/dist/runlog.js
CHANGED
|
@@ -26318,6 +26318,9 @@ var Predicate = external_exports.lazy(
|
|
|
26318
26318
|
"Tests whether any earlier subject was created from an entry carrying this tag \u2014 for results that only make sense once something of a given kind exists."
|
|
26319
26319
|
),
|
|
26320
26320
|
external_exports.object({ modeIs: external_exports.array(Id).min(1).describe("Mode ids in which this holds true.") }).strict().describe("Tests which mode the run is being played in."),
|
|
26321
|
+
external_exports.object({ phaseDone: Id.describe("Id of a phase in the flow.") }).strict().describe(
|
|
26322
|
+
"True once the named phase has been completed in the current unit. This is how a move that records an outcome is kept off the screen until there is something to have an outcome about."
|
|
26323
|
+
),
|
|
26321
26324
|
external_exports.object({ not: Predicate }).strict().describe("True when the inner predicate is false."),
|
|
26322
26325
|
external_exports.object({ allOf: external_exports.array(Predicate).min(1) }).strict().describe("True only when every listed predicate holds."),
|
|
26323
26326
|
external_exports.object({ anyOf: external_exports.array(Predicate).min(1) }).strict().describe("True when at least one listed predicate holds.")
|
|
@@ -26380,6 +26383,7 @@ var Action = external_exports.lazy(
|
|
|
26380
26383
|
do: external_exports.literal("rollOn").describe("Roll on another table and resolve whatever comes up."),
|
|
26381
26384
|
table: Id.describe("Id of the table to roll on."),
|
|
26382
26385
|
times: external_exports.number().int().min(1).max(10).optional().describe("How many times to roll. Defaults to 1."),
|
|
26386
|
+
timesFrom: external_exports.string().min(1).optional().describe("Name a total bound earlier with `roll \u2026 into`; that many times, instead of `times`. How a pack rolls for how many to roll."),
|
|
26383
26387
|
choose: external_exports.enum(["one", "all"]).optional().describe(
|
|
26384
26388
|
"With times > 1: `one` lets the player pick a single result to apply, `all` applies every result. Defaults to `all`."
|
|
26385
26389
|
),
|
|
@@ -26667,6 +26671,9 @@ var StateDef = external_exports.object({
|
|
|
26667
26671
|
).optional().describe(
|
|
26668
26672
|
"What this state means mechanically. Without it the engine would have to know what your state names mean, which is exactly what keeps an engine game-specific. `makesUntargetable` removes the subject from targeting; `excludesFromResult` leaves it in the run but out of the finished piece; `removesFromPlay` takes it out entirely."
|
|
26669
26673
|
),
|
|
26674
|
+
group: Id.optional().describe(
|
|
26675
|
+
"States in the same group are mutually exclusive on one holder: applying one removes the others. Use it for outcomes that cannot both be true, like landed and missed."
|
|
26676
|
+
),
|
|
26670
26677
|
description: external_exports.string().optional().describe("Explanation shown to the player on hover.")
|
|
26671
26678
|
}).strict().describe("A persistent condition that sticks to a subject, or to the run, once applied.");
|
|
26672
26679
|
var CounterDef = external_exports.object({
|
|
@@ -26703,12 +26710,16 @@ var ChecklistItem = external_exports.union([
|
|
|
26703
26710
|
external_exports.string().min(1),
|
|
26704
26711
|
external_exports.object({
|
|
26705
26712
|
text: external_exports.string().min(1).describe("The point to tick off."),
|
|
26713
|
+
optional: external_exports.boolean().optional().describe("May be left unticked: closing the unit does not wait for it. For boxes that record an outcome rather than promise one."),
|
|
26714
|
+
tally: Id.optional().describe(
|
|
26715
|
+
"Each box ticked under this point adds one to this counter, and unticking takes it back. With `shows`, one box per result; without, the point's own box."
|
|
26716
|
+
),
|
|
26706
26717
|
shows: external_exports.object({
|
|
26707
26718
|
table: external_exports.string().describe("Results from this table are listed under the item."),
|
|
26708
26719
|
scope: external_exports.enum(["unit", "subject", "run"]).default("unit").describe(
|
|
26709
26720
|
"Which results: those rolled this unit, those that reached this unit's subject, or every one in the run."
|
|
26710
26721
|
)
|
|
26711
|
-
}).strict().describe("What to look at while ticking this: a table's results, listed under the point with a box each.")
|
|
26722
|
+
}).strict().optional().describe("What to look at while ticking this: a table's results, listed under the point with a box each.")
|
|
26712
26723
|
}).strict().describe("A point with the results it is about shown beneath it.")
|
|
26713
26724
|
]).describe("A point to tick off: plain text, or text with the table results it is about.");
|
|
26714
26725
|
var Step = external_exports.discriminatedUnion("kind", [
|
|
@@ -26856,6 +26867,9 @@ var MoveDef = external_exports.object({
|
|
|
26856
26867
|
),
|
|
26857
26868
|
oncePerRun: external_exports.boolean().default(false).describe("Whether the move is spent after a single use."),
|
|
26858
26869
|
do: external_exports.array(Action).min(1).describe("What happens when the player takes it."),
|
|
26870
|
+
finalizes: external_exports.boolean().optional().describe(
|
|
26871
|
+
"Taking this move also closes the current unit: the rest of its flow is recorded as done and the unit is finalized. For moves that are outcomes, like landed or missed, so the player is not asked to close the unit a second time."
|
|
26872
|
+
),
|
|
26859
26873
|
/** Where the move belongs in the interface. */
|
|
26860
26874
|
when: external_exports.enum(["anytime", "betweenUnits", "beforeEnding"]).default("anytime").describe(
|
|
26861
26875
|
"When the move is offered: at any point, only between units, or only when the player is deciding whether to stop."
|
|
@@ -27332,6 +27346,9 @@ function lintPack(pack) {
|
|
|
27332
27346
|
}
|
|
27333
27347
|
}
|
|
27334
27348
|
}
|
|
27349
|
+
if ("phaseDone" in p && !pack.phases.some((ph) => ph.id === p.phaseDone)) {
|
|
27350
|
+
d.push(err("ref/unknown-phase", site.path, `predicate references unknown phase ${p.phaseDone}`));
|
|
27351
|
+
}
|
|
27335
27352
|
});
|
|
27336
27353
|
}
|
|
27337
27354
|
const seenPhaseIds = /* @__PURE__ */ new Set();
|
|
@@ -27350,8 +27367,11 @@ function lintPack(pack) {
|
|
|
27350
27367
|
}
|
|
27351
27368
|
const points = step.kind === "manual" ? step.checklist : step.kind === "finalizeUnit" ? step.confirm : void 0;
|
|
27352
27369
|
points?.forEach((item, ii) => {
|
|
27353
|
-
|
|
27354
|
-
|
|
27370
|
+
const field = step.kind === "manual" ? "checklist" : "confirm";
|
|
27371
|
+
if (typeof item !== "string" && item.tally && !counterIds.has(item.tally)) {
|
|
27372
|
+
d.push(err("ref/unknown-counter", `${path}.${field}[${ii}]`, `tallies unknown counter ${item.tally}`));
|
|
27373
|
+
}
|
|
27374
|
+
if (typeof item !== "string" && item.shows && !tableIds.has(item.shows.table)) {
|
|
27355
27375
|
d.push(err("ref/unknown-table", `${path}.${field}[${ii}]`, `shows unknown table ${item.shows.table}`));
|
|
27356
27376
|
}
|
|
27357
27377
|
});
|
|
@@ -27969,6 +27989,7 @@ function predicateInWords(pack, p) {
|
|
|
27969
27989
|
if ("subjectHasState" in p) return `${targetInWords(pack, p.of)} is ${label(pack, "states", p.subjectHasState)}`;
|
|
27970
27990
|
if ("priorSubjectTagged" in p) return `an earlier ${n.subject} was tagged \u201C${p.priorSubjectTagged}\u201D`;
|
|
27971
27991
|
if ("modeIs" in p) return `playing ${p.modeIs.map((m) => label(pack, "modes", m)).join(" or ")}`;
|
|
27992
|
+
if ("phaseDone" in p) return `${pack.phases.find((ph) => ph.id === p.phaseDone)?.label ?? p.phaseDone} is done`;
|
|
27972
27993
|
if ("not" in p) return `not (${predicateInWords(pack, p.not)})`;
|
|
27973
27994
|
if ("allOf" in p) return p.allOf.map((q) => predicateInWords(pack, q)).join(" and ");
|
|
27974
27995
|
if ("anyOf" in p) return p.anyOf.map((q) => predicateInWords(pack, q)).join(" or ");
|
|
@@ -28370,7 +28391,7 @@ function rulebookDoc(pack) {
|
|
|
28370
28391
|
states.map(([, s]) => [
|
|
28371
28392
|
s.short ? `${s.label} (${s.short})` : s.label,
|
|
28372
28393
|
s.scope === "run" ? `the ${n.run}` : `a ${n.subject}`,
|
|
28373
|
-
[s.description ?? "", ...(s.semantics ?? []).map(semanticInWords)].filter(Boolean).join(" ")
|
|
28394
|
+
[s.description ?? "", ...(s.semantics ?? []).map(semanticInWords), s.group ? `Replaces any other \u201C${s.group}\u201D state.` : ""].filter(Boolean).join(" ")
|
|
28374
28395
|
])
|
|
28375
28396
|
);
|
|
28376
28397
|
}
|
|
@@ -28401,7 +28422,7 @@ function rulebookDoc(pack) {
|
|
|
28401
28422
|
moves.map(([, m]) => [
|
|
28402
28423
|
m.label,
|
|
28403
28424
|
[whenInWords(m.when, n), m.oncePerRun ? `once per ${n.run}` : "", m.available?.length ? `if ${conditionsInWords(pack, m.available)}` : ""].filter(Boolean).join("; "),
|
|
28404
|
-
[m.description ?? "", sentence(cap(actionsInWords(pack, m.do)))].filter(Boolean).join(" ")
|
|
28425
|
+
[m.description ?? "", sentence(cap(actionsInWords(pack, m.do))), m.finalizes ? `Closes the ${n.unit}.` : ""].filter(Boolean).join(" ")
|
|
28405
28426
|
])
|
|
28406
28427
|
);
|
|
28407
28428
|
}
|
|
@@ -28743,6 +28764,7 @@ function initialState(pack, e) {
|
|
|
28743
28764
|
unit: 0,
|
|
28744
28765
|
phasesDone: [],
|
|
28745
28766
|
stepsDone: [],
|
|
28767
|
+
checks: [],
|
|
28746
28768
|
subjects: [],
|
|
28747
28769
|
runStates: [],
|
|
28748
28770
|
counters,
|
|
@@ -28824,6 +28846,7 @@ function reduce(pack, log) {
|
|
|
28824
28846
|
state.unit += 1;
|
|
28825
28847
|
state.phasesDone = [];
|
|
28826
28848
|
state.stepsDone = [];
|
|
28849
|
+
state.checks = [];
|
|
28827
28850
|
resetThisUnit = /* @__PURE__ */ new Set();
|
|
28828
28851
|
if (state.forcedUnits > 0) state.forcedUnits -= 1;
|
|
28829
28852
|
if (pack.unit.createsSubject) {
|
|
@@ -28861,12 +28884,18 @@ function reduce(pack, log) {
|
|
|
28861
28884
|
});
|
|
28862
28885
|
break;
|
|
28863
28886
|
case "StateApplied": {
|
|
28864
|
-
const
|
|
28887
|
+
const def = pack.states?.[event.state];
|
|
28888
|
+
const scope = def?.scope ?? "subject";
|
|
28889
|
+
const rivals = (held) => def?.group ? held.filter((s) => s === event.state || pack.states?.[s]?.group !== def.group) : held;
|
|
28865
28890
|
if (scope === "run" || event.subject === void 0) {
|
|
28891
|
+
state.runStates = rivals(state.runStates);
|
|
28866
28892
|
if (!state.runStates.includes(event.state)) state.runStates.push(event.state);
|
|
28867
28893
|
} else {
|
|
28868
28894
|
const subject = subjectById(state, event.subject);
|
|
28869
|
-
if (subject
|
|
28895
|
+
if (subject) {
|
|
28896
|
+
subject.states = rivals(subject.states);
|
|
28897
|
+
if (!subject.states.includes(event.state)) subject.states.push(event.state);
|
|
28898
|
+
}
|
|
28870
28899
|
}
|
|
28871
28900
|
break;
|
|
28872
28901
|
}
|
|
@@ -28955,6 +28984,17 @@ function reduce(pack, log) {
|
|
|
28955
28984
|
state.status = "ended";
|
|
28956
28985
|
state.ending = event.ending;
|
|
28957
28986
|
break;
|
|
28987
|
+
case "Checked": {
|
|
28988
|
+
const key = `${event.step}|${event.item}`;
|
|
28989
|
+
if (event.on) {
|
|
28990
|
+
if (!state.checks.includes(key)) state.checks.push(key);
|
|
28991
|
+
} else {
|
|
28992
|
+
state.checks = state.checks.filter((k) => k !== key);
|
|
28993
|
+
}
|
|
28994
|
+
break;
|
|
28995
|
+
}
|
|
28996
|
+
case "Corrected":
|
|
28997
|
+
break;
|
|
28958
28998
|
case "Undone":
|
|
28959
28999
|
break;
|
|
28960
29000
|
}
|