@scrthq/runlog 0.0.42 → 0.0.43
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 +61 -4
- package/package.json +1 -1
package/dist/runlog.js
CHANGED
|
@@ -26520,7 +26520,10 @@ var EntryBase = {
|
|
|
26520
26520
|
grants: external_exports.array(Id).optional().describe(
|
|
26521
26521
|
"States applied to the relevant subject on resolution. Shorthand for an applyState trigger."
|
|
26522
26522
|
),
|
|
26523
|
-
tags: external_exports.array(external_exports.string()).optional().describe("Free tags, for cross-referencing and for filtering results out in some modes.")
|
|
26523
|
+
tags: external_exports.array(external_exports.string()).optional().describe("Free tags, for cross-referencing and for filtering results out in some modes."),
|
|
26524
|
+
points: external_exports.number().int().min(0).optional().describe(
|
|
26525
|
+
"What a contestant earns for completing this result in a moderated mode. A result with points is a challenge the moderator can award; one without is an effect that lands on everyone."
|
|
26526
|
+
)
|
|
26524
26527
|
};
|
|
26525
26528
|
var LookupEntry = external_exports.object({
|
|
26526
26529
|
...EntryBase,
|
|
@@ -26640,7 +26643,8 @@ var Capability = external_exports.enum([
|
|
|
26640
26643
|
"journal",
|
|
26641
26644
|
"bandsResolution",
|
|
26642
26645
|
"opposedResolution",
|
|
26643
|
-
"keyedResolution"
|
|
26646
|
+
"keyedResolution",
|
|
26647
|
+
"moderated"
|
|
26644
26648
|
]).describe("An engine feature this pack needs in order to play correctly.");
|
|
26645
26649
|
var Vocabulary = external_exports.object({
|
|
26646
26650
|
run: external_exports.object({
|
|
@@ -26855,6 +26859,16 @@ var Mode = external_exports.object({
|
|
|
26855
26859
|
).optional().describe(
|
|
26856
26860
|
"Per-unit overrides, for modes with a fixed shape \u2014 'unit three always suffers a consequence', and the like."
|
|
26857
26861
|
),
|
|
26862
|
+
moderated: external_exports.object({
|
|
26863
|
+
contestants: external_exports.object({
|
|
26864
|
+
min: external_exports.number().int().min(1).default(2).describe("Fewest contestants."),
|
|
26865
|
+
max: external_exports.number().int().min(1).default(10).describe("Most contestants.")
|
|
26866
|
+
}).strict().default({ min: 2, max: 10 }).describe("How many people race. The moderator is not one of them."),
|
|
26867
|
+
award: external_exports.enum(["first", "everyone"]).default("first").describe("Whether only the first to finish a challenge scores it, or everyone who finishes does."),
|
|
26868
|
+
firstBonus: external_exports.number().int().min(0).default(0).describe("Extra points for finishing first, on top of the result's own. Meaningful with `everyone`.")
|
|
26869
|
+
}).strict().optional().describe(
|
|
26870
|
+
"Moderated play: one person runs the game on the device, a roster of named contestants races every drawn result, and the moderator awards points. Results with `points` are the challenges; everything else lands on everyone."
|
|
26871
|
+
),
|
|
26858
26872
|
notes: external_exports.array(external_exports.string()).optional().describe("Reminders shown to the player in this mode.")
|
|
26859
26873
|
}).strict().describe(
|
|
26860
26874
|
"A set of deltas over the base ruleset. Keeping modes as deltas rather than separate rulesets is what stops them drifting apart as the pack evolves."
|
|
@@ -27555,6 +27569,17 @@ function lintPack(pack) {
|
|
|
27555
27569
|
);
|
|
27556
27570
|
}
|
|
27557
27571
|
};
|
|
27572
|
+
const moderatedModes = Object.values(pack.modes).filter((m) => m.moderated);
|
|
27573
|
+
const scoringEntries = Object.values(pack.tables).some((t) => t.entries.some((e) => (e.points ?? 0) > 0));
|
|
27574
|
+
requireCap("moderated", moderatedModes.length > 0, "has a moderated mode");
|
|
27575
|
+
if (moderatedModes.length > 0 && !scoringEntries) {
|
|
27576
|
+
d.push(warn("mode/nothing-to-award", "modes", "a mode is moderated, but no table entry carries points, so there is nothing to award"));
|
|
27577
|
+
}
|
|
27578
|
+
for (const [modeId, m] of Object.entries(pack.modes)) {
|
|
27579
|
+
if (m.moderated && m.moderated.contestants.max < m.moderated.contestants.min) {
|
|
27580
|
+
d.push(err("mode/contestant-range", `modes.${modeId}.moderated.contestants`, `max (${m.moderated.contestants.max}) is below min (${m.moderated.contestants.min})`));
|
|
27581
|
+
}
|
|
27582
|
+
}
|
|
27558
27583
|
requireCap("decks", usesDecks, "uses decks");
|
|
27559
27584
|
requireCap("resources", usesResources, "uses resources");
|
|
27560
27585
|
requireCap("counters", counterIds.size > 0, "declares counters");
|
|
@@ -27613,7 +27638,8 @@ var IMPLEMENTED_CAPABILITIES = [
|
|
|
27613
27638
|
"journal",
|
|
27614
27639
|
"bandsResolution",
|
|
27615
27640
|
"opposedResolution",
|
|
27616
|
-
"keyedResolution"
|
|
27641
|
+
"keyedResolution",
|
|
27642
|
+
"moderated"
|
|
27617
27643
|
];
|
|
27618
27644
|
function parsePack(input2) {
|
|
27619
27645
|
if (typeof input2 !== "object" || input2 === null) {
|
|
@@ -28106,6 +28132,11 @@ function modeLength(pack, mode) {
|
|
|
28106
28132
|
return `as many ${n.units} as you like${max ? `, up to ${max}` : ""}`;
|
|
28107
28133
|
}
|
|
28108
28134
|
function modePlayers(mode) {
|
|
28135
|
+
const m = mode.moderated;
|
|
28136
|
+
if (m) {
|
|
28137
|
+
const n = m.contestants.min === m.contestants.max ? `${m.contestants.min}` : `${m.contestants.min}\u2013${m.contestants.max}`;
|
|
28138
|
+
return `moderated, ${n} contestants, ${m.award === "everyone" ? "everyone who finishes scores" : "first to finish scores"}${m.firstBonus ? ` (+${m.firstBonus} for first)` : ""}`;
|
|
28139
|
+
}
|
|
28109
28140
|
const p = mode.players;
|
|
28110
28141
|
if (!p || p.min <= 1 && p.max <= 1) return "solo";
|
|
28111
28142
|
return p.min === p.max ? `${p.min} players` : `${p.min}\u2013${p.max} players`;
|
|
@@ -28294,7 +28325,8 @@ function tableRows(pack, table, opts) {
|
|
|
28294
28325
|
if (e.requires?.length) extras.push(`Only if ${conditionsInWords(pack, e.requires)}; otherwise roll again.`);
|
|
28295
28326
|
}
|
|
28296
28327
|
const text = [e.title ? `${e.title}. ` : "", sentence(e.text), ...extras.map((x) => ` ${x}`)].join("");
|
|
28297
|
-
|
|
28328
|
+
const pts = e.points !== void 0 && e.points > 0 ? `${keys[i] ?? ""} \xB7 ${e.points} pt${e.points === 1 ? "" : "s"}` : keys[i] ?? "";
|
|
28329
|
+
return [pts, text];
|
|
28298
28330
|
});
|
|
28299
28331
|
}
|
|
28300
28332
|
function license(pack) {
|
|
@@ -28777,6 +28809,8 @@ function initialState(pack, e) {
|
|
|
28777
28809
|
outcomes: [],
|
|
28778
28810
|
obligations: [],
|
|
28779
28811
|
firedOnce: [],
|
|
28812
|
+
contestants: [],
|
|
28813
|
+
awards: [],
|
|
28780
28814
|
ending: null
|
|
28781
28815
|
};
|
|
28782
28816
|
}
|
|
@@ -28984,6 +29018,29 @@ function reduce(pack, log) {
|
|
|
28984
29018
|
state.status = "ended";
|
|
28985
29019
|
state.ending = event.ending;
|
|
28986
29020
|
break;
|
|
29021
|
+
case "ContestantAdded":
|
|
29022
|
+
if (!state.contestants.some((c) => c.id === event.contestant)) {
|
|
29023
|
+
state.contestants.push({ id: event.contestant, name: event.name });
|
|
29024
|
+
}
|
|
29025
|
+
break;
|
|
29026
|
+
case "ContestantRemoved":
|
|
29027
|
+
state.contestants = state.contestants.filter((c) => c.id !== event.contestant);
|
|
29028
|
+
break;
|
|
29029
|
+
case "Awarded":
|
|
29030
|
+
if (!state.awards.some((a) => a.contestant === event.contestant && a.outcome === event.outcome)) {
|
|
29031
|
+
state.awards.push({
|
|
29032
|
+
contestant: event.contestant,
|
|
29033
|
+
outcome: event.outcome,
|
|
29034
|
+
table: event.table,
|
|
29035
|
+
entryId: event.entryId,
|
|
29036
|
+
points: event.points,
|
|
29037
|
+
at: event.at
|
|
29038
|
+
});
|
|
29039
|
+
}
|
|
29040
|
+
break;
|
|
29041
|
+
case "AwardRevoked":
|
|
29042
|
+
state.awards = state.awards.filter((a) => !(a.contestant === event.contestant && a.outcome === event.outcome));
|
|
29043
|
+
break;
|
|
28987
29044
|
case "Checked": {
|
|
28988
29045
|
const key = `${event.step}|${event.item}`;
|
|
28989
29046
|
if (event.on) {
|