rpg-engine 0.17.1 → 0.18.0
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/commands/change/recipe.d.ts +2 -0
- package/dist/commands/change/recipe.js +4 -2
- package/dist/commands/reveal.d.ts +2 -0
- package/dist/commands/reveal.js +22 -3
- package/dist/commands/scene/close.js +3 -1
- package/dist/commands/scene/open.js +1 -1
- package/dist/commands/scene/scene.js +3 -2
- package/dist/commands/shared/packages/updates.d.ts +6 -0
- package/dist/commands/shared/packages/updates.js +114 -0
- package/dist/commands/shared/scene/scene.js +4 -0
- package/dist/commands/shared/time/recipes.d.ts +5 -0
- package/dist/commands/shared/time/recipes.js +19 -1
- package/dist/commands/status.d.ts +1 -0
- package/dist/commands/status.js +5 -0
- package/dist/commands/travel/travel.js +1 -0
- package/dist/commands/view/place.d.ts +6 -0
- package/dist/commands/view/place.js +37 -13
- package/dist/commands/view/result.d.ts +2 -0
- package/dist/commands/view/view.d.ts +1 -0
- package/dist/commands/view/view.js +34 -11
- package/dist/core/context.d.ts +5 -0
- package/dist/dashboard/app.js +1 -1
- package/dist/dashboard/dice/tray.js +7 -5
- package/dist/dashboard/parts/labels.js +26 -4
- package/dist/dashboard/parts/widgets.js +1 -1
- package/dist/dashboard/play/rolls.js +3 -3
- package/dist/dashboard/settings/setup.js +30 -13
- package/dist/dashboard/shell/table.js +7 -3
- package/dist/packages/npm.js +32 -7
- package/dist/pages/index.d.ts +1 -1
- package/dist/pages/index.js +1 -1
- package/dist/scene/scene.d.ts +4 -1
- package/instructions/combat.md +2 -2
- package/instructions/core.md +2 -2
- package/instructions/play.md +3 -3
- package/package.json +1 -1
|
@@ -14,6 +14,8 @@ export interface RecipeOutcome {
|
|
|
14
14
|
/** The dice the recipe lets the page spend that would give something, as hit-dice-d8 2/3, which the player chooses for the player character (ASK-14). */
|
|
15
15
|
spendable: string[];
|
|
16
16
|
notBroughtBack: string[];
|
|
17
|
+
/** The counters below their maximum of the items the page carries, as Wand charges 3/7, whose text says what comes back and when. */
|
|
18
|
+
carried: string[];
|
|
17
19
|
kept: string[];
|
|
18
20
|
/** The effects without an end still on the page, which a rest may ask something of (EFF-15). */
|
|
19
21
|
resting: string;
|
|
@@ -11,7 +11,7 @@ import { restingEffectsNote } from "../shared/scene/reminders.js";
|
|
|
11
11
|
import { keptRolls } from "../shared/sheet/counters.js";
|
|
12
12
|
import { effectiveFields } from "../shared/sheet/effect-layer.js";
|
|
13
13
|
import { spendableDice, spendDice } from "../shared/time/dice-pool.js";
|
|
14
|
-
import { effectsAtRecipe, notBroughtBack, partyPages, recipeChoices, recipeNamed, recipeTargets } from "../shared/time/recipes.js";
|
|
14
|
+
import { carriedCounters, effectsAtRecipe, notBroughtBack, partyPages, recipeChoices, recipeNamed, recipeTargets } from "../shared/time/recipes.js";
|
|
15
15
|
import { newDatedLogEntry } from "../shared/time/time.js";
|
|
16
16
|
import { counterStep } from "./amounts.js";
|
|
17
17
|
import { applyStep, holderNamed, pageHolder, stepNotes } from "./holder.js";
|
|
@@ -93,6 +93,7 @@ function recipeOn(root, context, world, system, recipe, name, why) {
|
|
|
93
93
|
choices: recipeChoices(current, recipe, pageCalled(current, name)),
|
|
94
94
|
spendable: barred ? [] : spendableDice(current, recipe, pageCalled(current, name)),
|
|
95
95
|
notBroughtBack: notBroughtBack(current, system, recipe, pageCalled(current, name)),
|
|
96
|
+
carried: carriedCounters(current, pageCalled(current, name)),
|
|
96
97
|
kept: keptRolls(current, pageCalled(current, name)).map(([field, values]) => `${field} ${values.join(", ")}`),
|
|
97
98
|
barred,
|
|
98
99
|
resting: [atZero ? `At 0 ${recipe.needs ?? ""} when it began, ${name} gains nothing from it.` : tooSoon ?? "", restingEffectsNote(pageCalled(current, name))].filter((note) => note !== "").join(" "),
|
|
@@ -136,13 +137,14 @@ export function recipeText(result) {
|
|
|
136
137
|
const lines = result.outcomes.flatMap((outcome) => {
|
|
137
138
|
const done = [...outcome.ended.map((effect) => `${effect} ended`), ...outcome.steps.map(stepText)];
|
|
138
139
|
const left = outcome.notBroughtBack.length === 0 ? "" : ` Not brought back: ${outcome.notBroughtBack.join(", ")}.`;
|
|
140
|
+
const carried = outcome.carried.length === 0 ? "" : ` ${outcome.page} carries ${outcome.carried.join(", ")}: ${outcome.carried.length === 1 ? "its page says" : "their pages say"} what comes back and when; give it with change.`;
|
|
139
141
|
// The player chooses and rolls for the player character, the master for a companion (D-206, D-213).
|
|
140
142
|
const chosen = [...outcome.choices.map((choice) => ` ${outcome.pc ? "Ask the player" : `Choose for ${outcome.page}`}: ${choice}.`), spendText(outcome, result)].join("");
|
|
141
143
|
// Rolls kept for later: if this rest brings them back, they are rolled again (KEP-4).
|
|
142
144
|
const roller = outcome.pc ? "the player rolls" : "roll";
|
|
143
145
|
const kept = outcome.kept.length === 0 ? "" : ` ${outcome.page} keeps ${outcome.kept.join("; ")}: if this rest brings them back, ${roller} them again, with roll and keep.`;
|
|
144
146
|
const resting = outcome.resting === "" ? "" : ` ${outcome.resting}`;
|
|
145
|
-
return [`${outcome.page}: ${done.length === 0 ? "nothing changed" : done.join("; ")}.${chosen}${left}${kept}${resting}`, ...outcome.steps.flatMap(stepNotes).filter((note) => !note.includes("\n"))];
|
|
147
|
+
return [`${outcome.page}: ${done.length === 0 ? "nothing changed" : done.join("; ")}.${chosen}${left}${carried}${kept}${resting}`, ...outcome.steps.flatMap(stepNotes).filter((note) => !note.includes("\n"))];
|
|
146
148
|
});
|
|
147
149
|
const rules = result.rules.length === 0 ? "" : `For the rest, read ${result.rules.map((rule) => `rules "${rule}"`).join(" and ")}.`;
|
|
148
150
|
const title = `${result.recipe.charAt(0).toUpperCase()}${result.recipe.slice(1)} (a recipe of the system ${result.system}):`;
|
package/dist/commands/reveal.js
CHANGED
|
@@ -8,12 +8,13 @@ import { campaignWorld } from "./shared/campaign/world.js";
|
|
|
8
8
|
import { knownLink, knownLinks } from "./shared/characters/knowledge.js";
|
|
9
9
|
import { textList, textsOf } from "./shared/inputs.js";
|
|
10
10
|
import { placedPosition } from "./shared/places/positions.js";
|
|
11
|
-
import { copyName, readOpenScene } from "./shared/scene/scene.js";
|
|
11
|
+
import { copyName, readOpenScene, updateScene } from "./shared/scene/scene.js";
|
|
12
12
|
import { newDatedLogEntry } from "./shared/time/time.js";
|
|
13
13
|
export const reveal = defineCommand({
|
|
14
14
|
name: "reveal",
|
|
15
15
|
description: "Record what characters learn: a secret, as Page#Secret, or a whole page they did not know. "
|
|
16
16
|
+ "It adds the links to their knows and answers without the text: read a secret with show before you tell it. "
|
|
17
|
+
+ "A whole page the player's character learns that the open scene gives by seen goes by its name again, known before or not. "
|
|
17
18
|
+ "Example: page [Coppa#Veleno, Varro], to [Ettore, Bruna].",
|
|
18
19
|
group: "game",
|
|
19
20
|
positionals: ["page"],
|
|
@@ -62,17 +63,35 @@ export const reveal = defineCommand({
|
|
|
62
63
|
result.learned.push({ who: learner.name, what: learned.map((item) => (item.asked === undefined ? item.shown : `${item.shown} (as ${item.asked} shows it)`)) });
|
|
63
64
|
}
|
|
64
65
|
logLearned(root, context, world, lines);
|
|
66
|
+
const named = learners.some(isPlayerCharacter) ? namedInScene(root, context, scene, known.map((item) => item.link)) : [];
|
|
65
67
|
const unplaced = unplacedPlaces(world, lines);
|
|
66
|
-
return
|
|
68
|
+
return { ...result, ...(named.length === 0 ? {} : { named }), ...(unplaced === undefined ? {} : { unplaced }) };
|
|
67
69
|
},
|
|
68
70
|
format(result) {
|
|
69
71
|
const learned = result.learned.map((entry) => `${entry.who} now knows ${entry.what.join(", ")}.`);
|
|
70
72
|
const known = result.known.length === 0 ? "" : `Already known: ${result.known.map((entry) => `${entry.who}: ${entry.what.join(", ")}`).join("; ")}.`;
|
|
71
73
|
const notSecret = result.notSecret.length === 0 ? "" : `Not secrets, nothing to record: ${result.notSecret.map((entry) => `${entry.what} (whoever knows ${entry.page} knows it)`).join(", ")}.`;
|
|
72
74
|
const unplaced = result.unplaced === undefined ? "" : placesNote(result.unplaced.places, result.unplaced.from);
|
|
73
|
-
|
|
75
|
+
const named = result.named === undefined ? "" : `The open scene now gives ${result.named.join(", ")} by name: the player sees it, no longer what the character saw.`;
|
|
76
|
+
return [...(learned.length === 0 && named === "" ? ["Nothing new to record."] : learned), known, notSecret, named, unplaced].filter((line) => line !== "").join(" ");
|
|
74
77
|
},
|
|
75
78
|
});
|
|
79
|
+
/**
|
|
80
|
+
* Takes out of the open scene's seen the pages the player's character learns whole (D-568): from now the player sees their name; a hidden line of the log
|
|
81
|
+
* says so. The names taken out.
|
|
82
|
+
*/
|
|
83
|
+
function namedInScene(root, context, scene, learned) {
|
|
84
|
+
const pages = learned.flatMap((link) => links(link)).filter((link) => link.section === undefined).map((link) => comparableText(link.page));
|
|
85
|
+
const seen = Object.entries(scene?.seen ?? {});
|
|
86
|
+
const named = seen.filter(([name]) => pages.includes(comparableText(name))).map(([name]) => name);
|
|
87
|
+
if (scene === undefined || named.length === 0) {
|
|
88
|
+
return [];
|
|
89
|
+
}
|
|
90
|
+
const kept = seen.filter(([name]) => !named.includes(name));
|
|
91
|
+
updateScene(root, [[["seen"], kept.length === 0 ? undefined : Object.fromEntries(kept)]]);
|
|
92
|
+
appendLogEntry(root, newDatedLogEntry(root, context, "scene-changed", "hidden", { title: scene.title, named }));
|
|
93
|
+
return named;
|
|
94
|
+
}
|
|
76
95
|
/**
|
|
77
96
|
* One line in the log for each who learned something (REV-3, D-158): public only for what the player's character knows, theirs and a companion's who learned it
|
|
78
97
|
* with them; what someone else learned alone stays hidden, since a secret's name may tell too much.
|
|
@@ -125,8 +125,10 @@ function rewardLines(world, system, scene) {
|
|
|
125
125
|
const calls = party.map((page) => (held(page) ? `change ${page.name}, field ${reward.field}, by ${share}` : `write ${page.name}, set ${reward.field}=${share}`)).join("; ");
|
|
126
126
|
const kinds = [...new Set(unknown.map((item) => item.kind))];
|
|
127
127
|
const characters = overcome.filter((item) => item.character).map((item) => item.name);
|
|
128
|
+
// The share is said to the player at once, where a master who divides it right may forget it.
|
|
129
|
+
const tell = `Then tell the player what each got: ${share} ${reward.field}${party.length === 1 ? "" : " each"}.`;
|
|
128
130
|
const parts = [
|
|
129
|
-
total === 0 ? `${reward.field}:` : `${reward.field} of those overcome: ${overcome.map((item) => `${item.name} ${item.worth}`).join(", ")}, ${total} in all; ${to}: ${calls}
|
|
131
|
+
total === 0 ? `${reward.field}:` : `${reward.field} of those overcome: ${overcome.map((item) => `${item.name} ${item.worth}`).join(", ")}, ${total} in all; ${to}: ${calls}. ${tell}`,
|
|
130
132
|
characters.length === 0 ? "" : `${characters.join(", ")} ${characters.length === 1 ? "is a character" : "are characters"}: leave out any who fought on your side, and share again.`,
|
|
131
133
|
fled.length === 0 ? "" : `Fled: ${fled.map((item) => `${item.name} ${item.worth}`).join(", ")}, to count if the party overcame them.`,
|
|
132
134
|
unknown.length === 0
|
|
@@ -161,7 +161,7 @@ function copyCreatures(world, copies) {
|
|
|
161
161
|
return [...new Set(Object.values(copies).flatMap((copy) => findPage(world, parsePageReference(copy.creature).name) ?? []))];
|
|
162
162
|
}
|
|
163
163
|
/**
|
|
164
|
-
* What the character sees of
|
|
164
|
+
* What the character sees of someone, known by name or not (D-416, D-568), by the name of a character in the scene or of a creature with copies in it: Bandito=brigante
|
|
165
165
|
* incappucciato on the command line, {"Varro": "il mugnaio"} through MCP; none when not given.
|
|
166
166
|
*/
|
|
167
167
|
function seenOf(world, seen, characters, copies) {
|
|
@@ -36,7 +36,8 @@ export const scene = defineCommand({
|
|
|
36
36
|
+ "At open, whoever of the party is elsewhere moves to the scene's place, except in a travel scene. "
|
|
37
37
|
+ "order sets who takes turns, after rolling for it if the game does; next passes the turn; use marks what one uses of a turn: the engine counts the uses the game declares and refuses one too many. "
|
|
38
38
|
+ "now is the line the player's dashboard shows: give it at open too, and change it as the scene turns. "
|
|
39
|
-
+ "hostile marks who attacks the party, calm takes the mark off; seen gives what the character sees of
|
|
39
|
+
+ "hostile marks who attacks the party, calm takes the mark off; seen gives what the character sees of someone, which the player sees instead of the name, "
|
|
40
|
+
+ "even one they know, until the scene closes or reveal names them; the player's dashboard shows both. "
|
|
40
41
|
+ "close ends the scene with a summary the player may read. Change a copy's counters with change, as for a page. "
|
|
41
42
|
+ 'Example: action open, title "Scontro all\'ossario", type combat, creatures {"Annegato": 2}.',
|
|
42
43
|
group: "game",
|
|
@@ -54,7 +55,7 @@ export const scene = defineCommand({
|
|
|
54
55
|
order: textList.optional().describe("order: who takes turns, in order; those left out (fallen, fled) take none"),
|
|
55
56
|
now: z.string().optional().describe('open, now: what is happening now, in one line as the player sees it, such as "The bandits overturn the tables"; never what they cannot see'),
|
|
56
57
|
summary: z.string().optional().describe("close: what happened, in one or two sentences, as the player saw it"),
|
|
57
|
-
seen: z.union([textList, z.record(z.string(), z.string())]).optional().describe("open, add: what the character sees of
|
|
58
|
+
seen: z.union([textList, z.record(z.string(), z.string())]).optional().describe("open, add: what the character sees of someone in the scene, by its page or creature, in two or three words, never its kind when that is a secret; the player sees it instead of the name: "
|
|
58
59
|
+ 'Bandito=brigante incappucciato, or through MCP an object such as {"Varro": "il mugnaio"}'),
|
|
59
60
|
}),
|
|
60
61
|
run(given, context) {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Context } from "../../../core/context.ts";
|
|
2
|
+
/**
|
|
3
|
+
* "Newer on npm: 5e 0.14.1 (here 0.11.2)…": the campaign's game system and extensions installed from npm that npm has a newer version of, one this engine reads,
|
|
4
|
+
* with the command that updates each; undefined when there is none, without npm, or offline, which is never an error.
|
|
5
|
+
*/
|
|
6
|
+
export declare function packageUpdates(root: string, context: Context): Promise<string | undefined>;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// Newer versions of the campaign's packages on npm (D-569): asked at most once a day and with a short wait, told to the master, never installed by themselves
|
|
2
|
+
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { readTextSetting } from "../../../campaign/index.js";
|
|
5
|
+
import { engineSystemsFolder } from "../../../core/context.js";
|
|
6
|
+
import { installedFromFolder } from "../../../core/files.js";
|
|
7
|
+
import { files, isInside } from "../../../core/store.js";
|
|
8
|
+
import { comparableText } from "../../../core/text.js";
|
|
9
|
+
import { isNewerVersion } from "../../../core/version.js";
|
|
10
|
+
import { findExtension, shortName } from "../../../extensions/index.js";
|
|
11
|
+
import { verifiedScope } from "../../../packages/index.js";
|
|
12
|
+
import { systemFolders } from "../../../systems/index.js";
|
|
13
|
+
import { listedExtensions } from "./extensions.js";
|
|
14
|
+
// What npm said, kept in the player's folder on this computer for a day, so that a session starts without asking it again.
|
|
15
|
+
const fileName = "package-updates.json";
|
|
16
|
+
const checkHolds = 24 * 60 * 60 * 1000;
|
|
17
|
+
/**
|
|
18
|
+
* "Newer on npm: 5e 0.14.1 (here 0.11.2)…": the campaign's game system and extensions installed from npm that npm has a newer version of, one this engine reads,
|
|
19
|
+
* with the command that updates each; undefined when there is none, without npm, or offline, which is never an error.
|
|
20
|
+
*/
|
|
21
|
+
export async function packageUpdates(root, context) {
|
|
22
|
+
const newest = context.packages?.newest;
|
|
23
|
+
const packages = campaignPackages(root, context);
|
|
24
|
+
if (newest === undefined || packages.length === 0) {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
const known = await newestVersions(context, packages.map((one) => one.name), newest);
|
|
28
|
+
const newer = packages.flatMap((one) => {
|
|
29
|
+
const version = known[one.name];
|
|
30
|
+
return version !== undefined && isNewerVersion(version, one.version) ? [{ ...one, newer: version }] : [];
|
|
31
|
+
});
|
|
32
|
+
if (newer.length === 0) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
const listed = newer.map((one) => `${one.install} ${one.newer} (here ${one.version})`).join(", ");
|
|
36
|
+
const commands = newer.map((one) => `package install ${one.install}`).join(", ");
|
|
37
|
+
return `Newer on npm: ${listed}. Tell the player; update only if they want it, with ${commands}.`;
|
|
38
|
+
}
|
|
39
|
+
/** The newest versions of these packages npm has, by name: those kept from today, else asked now and kept; none for one npm did not answer. */
|
|
40
|
+
async function newestVersions(context, names, newest) {
|
|
41
|
+
const now = context.now().getTime();
|
|
42
|
+
const kept = keptCheck(context.home);
|
|
43
|
+
if (kept !== undefined && now - kept.checked >= 0 && now - kept.checked < checkHolds && names.every((name) => name in kept.newest)) {
|
|
44
|
+
return Object.fromEntries(Object.entries(kept.newest).filter((entry) => entry[1] !== null));
|
|
45
|
+
}
|
|
46
|
+
const asked = await Promise.all(names.map(async (name) => [name, (await newest(name)) ?? null]));
|
|
47
|
+
keepCheck(context.home, now, Object.fromEntries(asked));
|
|
48
|
+
return Object.fromEntries(asked.filter((entry) => entry[1] !== null));
|
|
49
|
+
}
|
|
50
|
+
/** The game system the campaign plays and the extensions it lists, those installed from npm alone: a folder's copy, or a system the engine ships, has no newer version there. */
|
|
51
|
+
function campaignPackages(root, context) {
|
|
52
|
+
const plays = readTextSetting(root, "system");
|
|
53
|
+
const system = plays === undefined ? undefined : systemFolders(context.systemFolders).find((one) => comparableText(one.name) === comparableText(plays));
|
|
54
|
+
const manifest = system === undefined || isInside(engineSystemsFolder, system.folder) || installedFromFolder(system.folder) ? undefined : packageOf(system.folder);
|
|
55
|
+
const systemPackage = manifest === undefined || system === undefined ? [] : [{ ...manifest, install: installName(manifest.name, system.name) }];
|
|
56
|
+
const extensions = Object.keys(listedExtensions(root)).flatMap((name) => {
|
|
57
|
+
try {
|
|
58
|
+
const extension = findExtension(context.extensionFolders ?? [], name);
|
|
59
|
+
return extension === undefined || extension.linked ? [] : [{ name: extension.package, version: extension.version, install: installName(extension.package) }];
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
return [];
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
return [...systemPackage, ...extensions];
|
|
66
|
+
}
|
|
67
|
+
/** The name package install takes for a package: one of ours by its short name, the 5e for @rpgengine/system-5e; another's by its npm name, npm: before one without a scope. */
|
|
68
|
+
function installName(name, system) {
|
|
69
|
+
if (name.startsWith(verifiedScope)) {
|
|
70
|
+
return system !== undefined && name === `${verifiedScope}system-${system}` ? system : shortName(name);
|
|
71
|
+
}
|
|
72
|
+
return name.startsWith("@") ? name : `npm:${name}`;
|
|
73
|
+
}
|
|
74
|
+
/** The name and the version a package.json in this folder gives; undefined when it has none that reads. */
|
|
75
|
+
function packageOf(folder) {
|
|
76
|
+
try {
|
|
77
|
+
const read = JSON.parse(files().text(join(folder, "package.json")) ?? "");
|
|
78
|
+
return typeof read.name === "string" && typeof read.version === "string" ? { name: read.name, version: read.version } : undefined;
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/** The last check, as kept in the player's folder: when, and the newest version of each package, null where npm did not answer; none when it does not read. */
|
|
85
|
+
function keptCheck(home) {
|
|
86
|
+
if (home === undefined) {
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
const read = JSON.parse(readFileSync(join(home, fileName), "utf8"));
|
|
91
|
+
const checked = typeof read.checked === "string" ? Date.parse(read.checked) : Number.NaN;
|
|
92
|
+
const newest = read.newest !== null && typeof read.newest === "object" ? read.newest : undefined;
|
|
93
|
+
if (Number.isNaN(checked) || newest === undefined) {
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
return { checked, newest: Object.fromEntries(Object.entries(newest).map(([name, version]) => [name, typeof version === "string" ? version : null])) };
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/** Keeps a check in the player's folder; a folder that cannot be written only means npm is asked again next time. */
|
|
103
|
+
function keepCheck(home, now, newest) {
|
|
104
|
+
if (home === undefined) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
try {
|
|
108
|
+
mkdirSync(home, { recursive: true });
|
|
109
|
+
writeFileSync(join(home, fileName), `${JSON.stringify({ checked: new Date(now).toISOString(), newest }, null, 2)}\n`);
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
// Nothing to keep is no reason to stop the session.
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -305,6 +305,10 @@ function sceneChangeLine(data) {
|
|
|
305
305
|
if (Array.isArray(data.left)) {
|
|
306
306
|
return `left: ${data.left.map((name) => withNumbers(String(name))).join(", ")}`;
|
|
307
307
|
}
|
|
308
|
+
// Who reveal gave back their name, no longer seen (D-568).
|
|
309
|
+
if (Array.isArray(data.named)) {
|
|
310
|
+
return `named: ${namesText(data.named)}`;
|
|
311
|
+
}
|
|
308
312
|
const seen = data.seen !== null && typeof data.seen === "object" ? Object.entries(data.seen).map(([name, said]) => `${name} as ${String(said)}`) : [];
|
|
309
313
|
const joined = Array.isArray(data.added) && data.added.length > 0 ? [`joined: ${namesText(data.added)}`] : [];
|
|
310
314
|
if (joined.length > 0 || seen.length > 0) {
|
|
@@ -32,3 +32,8 @@ export declare function recipeChoices(world: World, recipe: Recipe, page: Page):
|
|
|
32
32
|
* when they are not, such as exhaustion; each with the rule of a threshold it is at, or of one without a value, as in "exhaustion 1/6 (rules "Exhaustion")".
|
|
33
33
|
*/
|
|
34
34
|
export declare function notBroughtBack(world: World, system: GameSystem, recipe: Recipe, page: Page): string[];
|
|
35
|
+
/**
|
|
36
|
+
* The counters below their maximum of the items a page carries, also inside others, as in "Wand charges 3/7": what comes back to them, and when, only
|
|
37
|
+
* their text says, which a rest never applies by itself.
|
|
38
|
+
*/
|
|
39
|
+
export declare function carriedCounters(world: World, page: Page): string[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// The recipes of a game system (D-185, DAT-4): which pages a rest goes to, the effects it ends, the fields it brings back, and what it leaves to the master.
|
|
2
2
|
import { comparableText } from "../../../core/text.js";
|
|
3
3
|
import { readCounter } from "../../../counters/index.js";
|
|
4
|
-
import { isDeclaredUncounted, isInParty, locate, playerCharacters } from "../../../pages/index.js";
|
|
4
|
+
import { findPage, heldNames, isDeclaredUncounted, isInParty, locate, playerCharacters } from "../../../pages/index.js";
|
|
5
5
|
import { effectiveFields, effectsOf } from "../sheet/effect-layer.js";
|
|
6
6
|
import { formulaValue } from "../sheet/formula-scope.js";
|
|
7
7
|
import { refillAmount } from "../sheet/worked-out.js";
|
|
@@ -81,6 +81,24 @@ export function notBroughtBack(world, system, recipe, page) {
|
|
|
81
81
|
return [`${field} ${String(value).trim()}${rule === undefined ? "" : ` (rules "${rule}")`}`];
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* The counters below their maximum of the items a page carries, also inside others, as in "Wand charges 3/7": what comes back to them, and when, only
|
|
86
|
+
* their text says, which a rest never applies by itself.
|
|
87
|
+
*/
|
|
88
|
+
export function carriedCounters(world, page) {
|
|
89
|
+
return carriedItems(world, page, new Set([page])).flatMap((item) => Object.entries(effectiveFields(world, item)).flatMap(([field, value]) => {
|
|
90
|
+
const counter = isDeclaredUncounted(world, field) ? undefined : readCounter(value);
|
|
91
|
+
return counter?.max === undefined || counter.value >= counter.max ? [] : [`${item.name} ${field} ${counter.value}/${counter.max}`];
|
|
92
|
+
}));
|
|
93
|
+
}
|
|
94
|
+
/** The items a holder carries, and those inside them, each once. */
|
|
95
|
+
function carriedItems(world, holder, seen) {
|
|
96
|
+
const held = heldNames(holder).flatMap((name) => findPage(world, name) ?? []).filter((item) => item.type === "item" && !seen.has(item));
|
|
97
|
+
for (const item of held) {
|
|
98
|
+
seen.add(item);
|
|
99
|
+
}
|
|
100
|
+
return held.flatMap((item) => [item, ...carriedItems(world, item, seen)]);
|
|
101
|
+
}
|
|
84
102
|
/**
|
|
85
103
|
* The regains of a recipe on these fields (DAT-4): for each, the counters it names that are spent and how many come back in all. When all that is spent comes
|
|
86
104
|
* back, or only one counter is spent, they are targets; otherwise the player chooses.
|
package/dist/commands/status.js
CHANGED
|
@@ -23,6 +23,7 @@ import { quotedOrders } from "./shared/characters/orders.js";
|
|
|
23
23
|
import { installableSystems } from "./shared/packages/catalog.js";
|
|
24
24
|
import { packageCodeProblems } from "./shared/packages/code.js";
|
|
25
25
|
import { extensionsLine } from "./shared/packages/extensions.js";
|
|
26
|
+
import { packageUpdates } from "./shared/packages/updates.js";
|
|
26
27
|
import { surroundings, surroundingsText } from "./shared/places/environment.js";
|
|
27
28
|
import { journeyText, readJourney } from "./shared/places/journey.js";
|
|
28
29
|
import { measuresOf, roadsOf } from "./shared/places/roads.js";
|
|
@@ -105,6 +106,8 @@ export const status = defineCommand({
|
|
|
105
106
|
const installable = settings.system === undefined ? await installableSystems(context) : [];
|
|
106
107
|
// The opening of an evening, once in a chat: notes said while the master read the game reached the player (playtests 15, 16).
|
|
107
108
|
const opening = firstInChat(context, "opening");
|
|
109
|
+
// At the start of a session, the campaign's packages npm has newer (D-569): once in a chat, at every status on the command line.
|
|
110
|
+
const updates = opening || context.told === undefined ? await packageUpdates(root, context) : undefined;
|
|
108
111
|
return {
|
|
109
112
|
campaign: [
|
|
110
113
|
settings.name,
|
|
@@ -150,6 +153,7 @@ export const status = defineCommand({
|
|
|
150
153
|
precedents: settings.precedents ?? [],
|
|
151
154
|
// The extensions it uses, each with what it brings (D-28).
|
|
152
155
|
extensions: extensionsLine(root, context),
|
|
156
|
+
updates,
|
|
153
157
|
houseRules: bookTitles(readRuleBook(join(root, houseRulesFolderName), "house rules")),
|
|
154
158
|
players: players.map(member),
|
|
155
159
|
companions: characters.filter((page) => page.fields.role === "companion").map(member),
|
|
@@ -217,6 +221,7 @@ export const status = defineCommand({
|
|
|
217
221
|
result.table.length === 0 ? "" : `Table: ${result.table.join("; ")}`,
|
|
218
222
|
result.precedents.length === 0 ? "" : `Precedents: ${result.precedents.join("; ")}`,
|
|
219
223
|
result.extensions,
|
|
224
|
+
result.updates ?? "",
|
|
220
225
|
result.houseRules.length === 0 ? "" : `House rules (rules): ${result.houseRules.join(", ")}`,
|
|
221
226
|
timeLine(result),
|
|
222
227
|
result.betweenSessions ?? "",
|
|
@@ -19,6 +19,7 @@ import { acrossHint, crossedRoads, openLegs } from "./open.js";
|
|
|
19
19
|
export const travel = defineCommand({
|
|
20
20
|
name: "travel",
|
|
21
21
|
description: "Make a journey: whenever the party goes somewhere, use it instead of advance and move. "
|
|
22
|
+
+ "Before anyone says how long a journey takes, ask route, which tells it without moving anyone. "
|
|
22
23
|
+ "By road it takes the quickest way, in the vehicle the party is in if any; off the roads, across and toward go through the regions and their terrain. "
|
|
23
24
|
+ "It moves the travellers and lets the time pass, stopping on arrival, at an event that comes due and at the end of the day's travel; travel again goes on from there. "
|
|
24
25
|
+ "When others go with the party, name in who everyone who goes, the party too: companions, hirelings, mounts; a vehicle goes with those in it. "
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Context } from "../../core/context.ts";
|
|
2
2
|
import type { Effect, EffectEnd } from "../../effects/index.ts";
|
|
3
3
|
import { type Page, type World } from "../../pages/index.ts";
|
|
4
|
+
import type { Scene } from "../../scene/index.ts";
|
|
4
5
|
import type { GameSystem } from "../../systems/index.ts";
|
|
5
6
|
import { type Knowledge } from "../shared/characters/knowledge.ts";
|
|
6
7
|
import { type SeenEffect } from "../shared/scene/effects.ts";
|
|
@@ -167,6 +168,11 @@ export declare function strangerImage(root: string, context: Context, world: Wor
|
|
|
167
168
|
file: string;
|
|
168
169
|
version: number;
|
|
169
170
|
} | undefined;
|
|
171
|
+
/**
|
|
172
|
+
* Whether the open scene gives someone by what the character sees of them (D-568), by their name, a copy's or its creature's: one in the scene the master gave
|
|
173
|
+
* seen for, known by name or not, while the scene keeps them; never one of the party.
|
|
174
|
+
*/
|
|
175
|
+
export declare function seenInScene(world: World, party: Page[], scene: Pick<Scene, "with" | "copies" | "gone" | "seen"> | undefined, name: string): boolean;
|
|
170
176
|
/**
|
|
171
177
|
* "Scontro all'ossario (combat), at Ossario, with Ennio, Lena, uomo col coltello, brigante 1 and brigante 2": the open scene as the player sees it, with the words
|
|
172
178
|
* of the page (D-254, D-416): who the character does not know by what it sees of them, else someone, and two or more of them as others.
|
|
@@ -32,8 +32,10 @@ export function shownPlace(sight) {
|
|
|
32
32
|
.map(({ entry, place: holder }) => ({ name: entry.name, value: inKnownWords(world, knowledge, entry.value), ...placed(holder) })),
|
|
33
33
|
...placesAround(world, place).flatMap((holder) => effectsOf(holder).map((effect) => ({ effect: effect.name, ...(effect.end === undefined ? {} : { end: effect.end }), ...placed(holder) }))),
|
|
34
34
|
];
|
|
35
|
+
const scene = readOpenScene(sight.root).scene;
|
|
36
|
+
// One the open scene gives by what the character sees of them is there in the scene alone, as one it does not know (D-568).
|
|
35
37
|
const present = world.pages.filter((page) => page.type === "character" && page.fields.status !== "dead" && locate(world, page).chain[0] === place
|
|
36
|
-
&& (sight.party.includes(page) || knowsPage(knowledge, page)));
|
|
38
|
+
&& (sight.party.includes(page) || (knowsPage(knowledge, page) && !seenInScene(world, sight.party, scene, page.name))));
|
|
37
39
|
const image = picture(sight, place);
|
|
38
40
|
const grid = placeGrid(place)?.grid;
|
|
39
41
|
const text = knownText(world, knowledge, place);
|
|
@@ -49,7 +51,7 @@ export function shownPlace(sight) {
|
|
|
49
51
|
// The party first, the player character in the foreground at its head (VIEW-12).
|
|
50
52
|
here: [...partyFirst(sight).filter((page) => present.includes(page)), ...present.filter((page) => !sight.party.includes(page))].map((page) => ({
|
|
51
53
|
...person(sight, page),
|
|
52
|
-
...hostileMark(
|
|
54
|
+
...hostileMark(scene, page.name),
|
|
53
55
|
...stateOf(sight, page),
|
|
54
56
|
})),
|
|
55
57
|
...(grid === undefined ? {} : { map: shownGrid(sight, place, grid) }),
|
|
@@ -64,7 +66,7 @@ export function shownScene(sight) {
|
|
|
64
66
|
const place = knownPage(sight, scene.place);
|
|
65
67
|
const characters = scene.with.map((link) => {
|
|
66
68
|
const name = parsePageReference(link).name;
|
|
67
|
-
const page =
|
|
69
|
+
const page = knownInScene(sight, scene, link);
|
|
68
70
|
const hostile = hostileMark(scene, name);
|
|
69
71
|
const written = pagesWithName(sight.world, name)[0];
|
|
70
72
|
const state = written === undefined ? {} : strangerState(sight, scene, written);
|
|
@@ -75,7 +77,7 @@ export function shownScene(sight) {
|
|
|
75
77
|
});
|
|
76
78
|
const creatures = [...new Set(Object.values(scene.copies).map((copy) => copy.creature))].map((creature) => {
|
|
77
79
|
const count = Object.values(scene.copies).filter((copy) => copy.creature === creature).length;
|
|
78
|
-
const page =
|
|
80
|
+
const page = knownInScene(sight, scene, creature);
|
|
79
81
|
// A kind the character does not know by the letter its copies have in the scene, as creature B, with more kinds (D-331).
|
|
80
82
|
const first = Object.keys(scene.copies).find((copy) => scene.copies[copy].creature === creature);
|
|
81
83
|
const name = first === undefined ? "creature" : strangerName(scene, first).replace(/\s*\d+$/, "");
|
|
@@ -132,7 +134,7 @@ export function seenEffect(sight, effect) {
|
|
|
132
134
|
if (end === undefined || !("turn" in end)) {
|
|
133
135
|
return effectParts(sight.world, system, effect, sight.words);
|
|
134
136
|
}
|
|
135
|
-
const scene = readOpenScene(sight.root).scene ?? { copies: {} };
|
|
137
|
+
const scene = readOpenScene(sight.root).scene ?? { with: [], copies: {} };
|
|
136
138
|
return effectParts(sight.world, system, { ...effect, end: { ...end, turn: shownTurn(sight, scene, end.turn) } }, sight.words);
|
|
137
139
|
}
|
|
138
140
|
/** The picture of one the character does not know, as strangerPicture gives it, for the scene and for the rolls (D-420, D-421). */
|
|
@@ -144,6 +146,21 @@ export function strangerImage(root, context, world, name) {
|
|
|
144
146
|
const hidden = file === undefined ? undefined : hiddenImageName(file);
|
|
145
147
|
return file === undefined || hidden === undefined ? undefined : { file: hidden, version: Math.trunc(files().modified(file) ?? 0) };
|
|
146
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* Whether the open scene gives someone by what the character sees of them (D-568), by their name, a copy's or its creature's: one in the scene the master gave
|
|
151
|
+
* seen for, known by name or not, while the scene keeps them; never one of the party.
|
|
152
|
+
*/
|
|
153
|
+
export function seenInScene(world, party, scene, name) {
|
|
154
|
+
if (scene === undefined) {
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
const copies = { ...scene.gone, ...scene.copies };
|
|
158
|
+
const copy = Object.keys(copies).find((copyName) => comparableText(copyName) === comparableText(name));
|
|
159
|
+
const key = parsePageReference(copy === undefined ? name : copies[copy].creature).name;
|
|
160
|
+
const inScene = [...scene.with, ...Object.values(copies).map((one) => one.creature)].some((link) => comparableText(parsePageReference(link).name) === comparableText(key));
|
|
161
|
+
const page = pagesWithName(world, key)[0];
|
|
162
|
+
return inScene && seenOf(scene, key) !== undefined && (page === undefined || !party.includes(page));
|
|
163
|
+
}
|
|
147
164
|
/**
|
|
148
165
|
* A place's map as the player sees it (GRD-6): who stands where, the party and the characters the character knows by name, the others of the open scene as
|
|
149
166
|
* someone, its copies as the scene names them; a character it does not know outside the scene is not shown, as in VIEW-6.
|
|
@@ -169,7 +186,7 @@ function shownGrid(sight, place, written) {
|
|
|
169
186
|
const measured = { square, ...(system?.grid === undefined ? {} : measuredFrom(sight, system.grid, measures, here, self, one)) };
|
|
170
187
|
if (one.copy !== undefined && here !== undefined) {
|
|
171
188
|
const copy = here.copies[one.copy];
|
|
172
|
-
const creature =
|
|
189
|
+
const creature = knownInScene(sight, here, copy?.creature);
|
|
173
190
|
const image = creature === undefined ? strangerPicture(sight, copy?.creature) : picture(sight, creature);
|
|
174
191
|
const state = copy === undefined ? {} : stateOf(sight, copyPage(one.copy, copy));
|
|
175
192
|
return [
|
|
@@ -182,7 +199,7 @@ function shownGrid(sight, place, written) {
|
|
|
182
199
|
if (page === undefined || page.type !== "character" || page.fields.status === "dead") {
|
|
183
200
|
return [];
|
|
184
201
|
}
|
|
185
|
-
if (sight.party.includes(page) ||
|
|
202
|
+
if (sight.party.includes(page) || knownInScene(sight, here, page.name) !== undefined) {
|
|
186
203
|
return [{ ...person(sight, page), ...hostileMark(here, page.name), ...stateOf(sight, page), ...measured }];
|
|
187
204
|
}
|
|
188
205
|
const image = strangerPicture(sight, page.name);
|
|
@@ -246,9 +263,9 @@ function fighterOf(sight, scene, name) {
|
|
|
246
263
|
return undefined;
|
|
247
264
|
}
|
|
248
265
|
const party = sight.party.includes(page);
|
|
249
|
-
// A copy is named when the character knows its creature; a character when it knows them.
|
|
250
|
-
const creature = copy === undefined ? undefined :
|
|
251
|
-
const stranger = copy === undefined ? !party &&
|
|
266
|
+
// A copy is named when the character knows its creature; a character when it knows them; neither while the scene gives them by what is seen (D-568).
|
|
267
|
+
const creature = copy === undefined ? undefined : knownInScene(sight, scene, copy[1].creature);
|
|
268
|
+
const stranger = copy === undefined ? !party && knownInScene(sight, scene, page.name) === undefined : creature === undefined;
|
|
252
269
|
const shown = !stranger ? page.name : copy === undefined ? seenName(scene, page.name) : strangerName(scene, copy[0]);
|
|
253
270
|
const image = stranger ? strangerPicture(sight, copy === undefined ? page.name : copy[1].creature) : picture(sight, creature ?? page);
|
|
254
271
|
const effects = shownEffects(sight, system, page, party);
|
|
@@ -376,13 +393,20 @@ function knownPage(sight, name) {
|
|
|
376
393
|
const page = pagesWithName(sight.world, parsePageReference(name).name)[0];
|
|
377
394
|
return page !== undefined && knowsPage(sight.knowledge, page) ? page : undefined;
|
|
378
395
|
}
|
|
379
|
-
/**
|
|
396
|
+
/**
|
|
397
|
+
* Whose turn it is, as the character knows them: a character it knows by name, a copy by its own name when it knows the creature, else creature and its number;
|
|
398
|
+
* by what is seen while the scene gives them so (D-568).
|
|
399
|
+
*/
|
|
380
400
|
function shownTurn(sight, scene, name) {
|
|
381
401
|
const copy = Object.entries(scene.copies).find(([copyName]) => comparableText(copyName) === comparableText(name));
|
|
382
402
|
if (copy === undefined) {
|
|
383
|
-
return
|
|
403
|
+
return knownInScene(sight, scene, name)?.name ?? seenName(scene, name);
|
|
384
404
|
}
|
|
385
|
-
return
|
|
405
|
+
return knownInScene(sight, scene, copy[1].creature) === undefined ? strangerName(scene, copy[0]) : copy[0];
|
|
406
|
+
}
|
|
407
|
+
/** The page the character knows by a name in the open scene: none while the scene gives them by what is seen (D-568), known or not. */
|
|
408
|
+
function knownInScene(sight, scene, name) {
|
|
409
|
+
return name === undefined || seenInScene(sight.world, sight.party, scene, name) ? undefined : knownPage(sight, name);
|
|
386
410
|
}
|
|
387
411
|
/**
|
|
388
412
|
* The name the player hears for a copy of a creature its character does not know (D-325, D-331, D-416): what the master said the character sees of its kind and
|
|
@@ -18,6 +18,8 @@ import type { KnownEntry, ShownCalendar, ShownDocument } from "./world.ts";
|
|
|
18
18
|
export type ViewResult = {
|
|
19
19
|
kind: "none";
|
|
20
20
|
language?: string;
|
|
21
|
+
/** The game system's words in the campaign's language, as in play: they name the system's own questions of the setup (D-403). */
|
|
22
|
+
words?: SystemWords;
|
|
21
23
|
importing?: ShownImport;
|
|
22
24
|
} | {
|
|
23
25
|
kind: "overview";
|
|
@@ -32,7 +32,7 @@ import { shownLayers } from "./layers.js";
|
|
|
32
32
|
import { mapText, shownMap } from "./map.js";
|
|
33
33
|
import { characterNamed, memoryOf, memoryText } from "./memory.js";
|
|
34
34
|
import { knownNamedPage, knownPage, lineValues, placeLook, shownName, shownPage, valueCoins } from "./page.js";
|
|
35
|
-
import { isDown, sceneLine, seenEffect, shownPlace, shownScene, strangerImage } from "./place.js";
|
|
35
|
+
import { isDown, sceneLine, seenEffect, seenInScene, shownPlace, shownScene, strangerImage } from "./place.js";
|
|
36
36
|
import { shownSaves } from "./saves.js";
|
|
37
37
|
import { diaryCount, diaryLine, diaryLines, isCopyName, rollCount, rollsShown, seenByRoll, shownRoll, storyFact } from "./story.js";
|
|
38
38
|
import { knownDocuments, knownEntries, knownEntryText, shownCalendar } from "./world.js";
|
|
@@ -105,9 +105,11 @@ export const view = defineCommand({
|
|
|
105
105
|
const knowledge = input.as === undefined ? playerKnowledge(root, world, input.focus) : knowledgeOf(root, world, characterNamed(world, input.as));
|
|
106
106
|
// An import under way, which the dashboard tells the player (D-491 (11)); never the character agent.
|
|
107
107
|
const importing = input.as === undefined ? importShown(root) : undefined;
|
|
108
|
+
// Before a player character, as in the setup, the system's words still name its own questions, as its Outcomes.
|
|
108
109
|
if (knowledge === undefined) {
|
|
109
110
|
const language = readSettings(root).language;
|
|
110
|
-
|
|
111
|
+
const words = shownWords(root, context, world, language);
|
|
112
|
+
return { kind: "none", ...(language === undefined ? {} : { language }), ...(words === undefined ? {} : { words }), ...(importing === undefined ? {} : { importing }) };
|
|
111
113
|
}
|
|
112
114
|
const pc = knowledge.pc;
|
|
113
115
|
// Who of the party the view gives: the player characters, the living first, or the one whose view it is for a character agent, and the companions (VIEW-12).
|
|
@@ -133,10 +135,11 @@ export const view = defineCommand({
|
|
|
133
135
|
}
|
|
134
136
|
const present = readPresent(root).date;
|
|
135
137
|
const known = (name) => shownName(world, knowledge, name);
|
|
138
|
+
const lineNamed = namedInLines(root, readLog(root), world, [...players, ...companionsOf(world)], known);
|
|
136
139
|
return {
|
|
137
140
|
kind: "journal",
|
|
138
141
|
...(present === undefined ? {} : { now: formatGameDate(present) }),
|
|
139
|
-
...shownJournal(root, world, knowledge, present, (entry) => storyFact(world, entry,
|
|
142
|
+
...shownJournal(root, world, knowledge, present, (entry) => storyFact(world, entry, lineNamed(entry)), known, (name) => placeLook(root, context, world, knowledge, name)),
|
|
140
143
|
// The diaries the player reads, the last line first: never a hidden line, as another character's (DIA-4).
|
|
141
144
|
thoughts: thoughtsIn(root, world).filter((one) => !one.hidden).reverse().map((one) => ({ who: known(one.page.name) ?? "someone", ...(one.date === undefined ? {} : { date: one.date }), text: one.text })),
|
|
142
145
|
};
|
|
@@ -177,7 +180,7 @@ export const view = defineCommand({
|
|
|
177
180
|
const { coins } = campaignCoins(root, context);
|
|
178
181
|
const system = campaignSystem(root, context);
|
|
179
182
|
const open = readJourney(root)?.at !== undefined;
|
|
180
|
-
const companions = world
|
|
183
|
+
const companions = companionsOf(world);
|
|
181
184
|
const language = readSettings(root).language;
|
|
182
185
|
const memberWords = system === undefined || language === undefined ? undefined : systemWordsOf(root, system, language, context);
|
|
183
186
|
const sight = { root, context, world, knowledge, party: [...players, ...companions], ...(memberWords === undefined ? {} : { words: memberWords.words }) };
|
|
@@ -217,27 +220,27 @@ export const view = defineCommand({
|
|
|
217
220
|
};
|
|
218
221
|
const now = readPresent(root).date;
|
|
219
222
|
const named = (name) => shownName(world, knowledge, name);
|
|
223
|
+
const log = readLog(root);
|
|
224
|
+
const lineNamed = namedInLines(root, log, world, sight.party, named);
|
|
220
225
|
// The picture of someone the log names, as the player character knows them; of a stranger, as the scene shows them, a copy by its creature (D-420, D-421).
|
|
221
|
-
const picture = (name) => {
|
|
222
|
-
const page = knownNamedPage(world, knowledge, name);
|
|
226
|
+
const picture = (name, known = named) => {
|
|
227
|
+
const page = known(name) === undefined ? undefined : knownNamedPage(world, knowledge, name);
|
|
223
228
|
const who = String(name ?? "").trim();
|
|
224
229
|
return page !== undefined
|
|
225
230
|
? shownImage(root, context, world, page, (base) => knowsPage(knowledge, base))
|
|
226
231
|
: strangerImage(root, context, world, isCopyName(world, who) ? who.replace(/ \d+$/, "") : who);
|
|
227
232
|
};
|
|
228
|
-
const log = readLog(root);
|
|
229
233
|
const seenAt = seenByRoll(log, readOpenScene(root).scene?.seen);
|
|
230
234
|
const shownLines = log.filter((entry) => entry.visibility === "public");
|
|
231
235
|
const moment = lastMoment(shownLines);
|
|
232
|
-
const diary = shownLines.flatMap((entry) => diaryLine(world, entry,
|
|
236
|
+
const diary = shownLines.flatMap((entry) => diaryLine(world, entry, lineNamed(entry)));
|
|
233
237
|
const shown = input.diary?.trim().toLowerCase() === "all" ? diary.length : diaryCount(input.diary);
|
|
234
238
|
const shownRolls = shownLines.filter((entry) => entry.type === "roll");
|
|
235
239
|
const place = shownPlace(sight);
|
|
236
240
|
const openScene = shownScene(sight);
|
|
237
241
|
const settings = readSettings(root);
|
|
238
242
|
const today = now === undefined ? undefined : calendarDayOf(root, context, now.day);
|
|
239
|
-
const
|
|
240
|
-
const titled = withPageTitles(words, world);
|
|
243
|
+
const titled = shownWords(root, context, world, settings.language);
|
|
241
244
|
// The system's pages of the party's sheets, in the campaign's language where the system has no translation (D-539).
|
|
242
245
|
wantTexts(root, context, world, [...players, ...companions]);
|
|
243
246
|
const textsTranslating = translatingTexts(context, world);
|
|
@@ -261,7 +264,7 @@ export const view = defineCommand({
|
|
|
261
264
|
scene: sceneLine(sight, named),
|
|
262
265
|
diary: diary.slice(Math.max(0, diary.length - shown)),
|
|
263
266
|
total: diary.length,
|
|
264
|
-
rolls: shownRolls.slice(-rollCount(input.rolls)).map((entry) => shownRoll(world, entry,
|
|
267
|
+
rolls: shownRolls.slice(-rollCount(input.rolls)).map((entry) => shownRoll(world, entry, lineNamed(entry), (name) => picture(name, lineNamed(entry)), seenAt.get(entry.id))),
|
|
265
268
|
rollsTotal: shownRolls.length,
|
|
266
269
|
problems: campaignProblems(root, world, context).length,
|
|
267
270
|
...(importing === undefined ? {} : { importing }),
|
|
@@ -325,6 +328,26 @@ export const view = defineCommand({
|
|
|
325
328
|
}
|
|
326
329
|
},
|
|
327
330
|
});
|
|
331
|
+
function companionsOf(world) {
|
|
332
|
+
return world.pages.filter((page) => page.type === "character" && page.fields.role === "companion");
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* How each line of the log names people: those of the open scene name one it gives by what the character sees of them as one it does not know, while it keeps
|
|
336
|
+
* them (D-568); the lines before it as the character knows them.
|
|
337
|
+
*/
|
|
338
|
+
function namedInLines(root, log, world, party, named) {
|
|
339
|
+
const scene = readOpenScene(root).scene;
|
|
340
|
+
const opened = scene === undefined ? -1 : log.findLastIndex((entry) => entry.type === "scene-opened");
|
|
341
|
+
const inScene = new Set(opened < 0 ? [] : log.slice(opened + 1).map((entry) => entry.id));
|
|
342
|
+
const hiding = (name) => (typeof name === "string" && seenInScene(world, party, scene, name) ? undefined : named(name));
|
|
343
|
+
return (entry) => (inScene.has(entry.id) ? hiding : named);
|
|
344
|
+
}
|
|
345
|
+
/** The game system's words in the campaign's language, with its pages' titles, for the dashboard (D-403); none when it has neither. */
|
|
346
|
+
function shownWords(root, context, world, language) {
|
|
347
|
+
const system = campaignSystem(root, context);
|
|
348
|
+
const words = system === undefined || language === undefined ? undefined : systemWordsOf(root, system, language, context);
|
|
349
|
+
return withPageTitles(words, world);
|
|
350
|
+
}
|
|
328
351
|
/**
|
|
329
352
|
* The system's words for the page, with the names its translation gives its pages, as Palla di fuoco for Fireball, where its words do not name them (D-542):
|
|
330
353
|
* those translated on this computer too, where the system has no words in the language (D-539).
|
package/dist/core/context.d.ts
CHANGED
|
@@ -158,6 +158,11 @@ export interface PackageManager {
|
|
|
158
158
|
search(): Promise<PackageInfo[] | {
|
|
159
159
|
failed: string;
|
|
160
160
|
}>;
|
|
161
|
+
/**
|
|
162
|
+
* The newest version of a package npm's registry has that this engine reads (D-569), asked within a few seconds; undefined when the registry does not
|
|
163
|
+
* answer in time, or has none. Missing where npm is not asked, as in most tests.
|
|
164
|
+
*/
|
|
165
|
+
newest?(name: string): Promise<string | undefined>;
|
|
161
166
|
}
|
|
162
167
|
/** How this rpg-engine is installed (D-515 (3)): globally by npm, which updates it; as npm link of a folder in development; or any other way, from that folder. */
|
|
163
168
|
export type EngineInstall = {
|
package/dist/dashboard/app.js
CHANGED
|
@@ -189,7 +189,7 @@ function App() {
|
|
|
189
189
|
if (number !== reading.current) {
|
|
190
190
|
return;
|
|
191
191
|
}
|
|
192
|
-
setSystemWords(overview.kind === "overview" ? overview.words : undefined);
|
|
192
|
+
setSystemWords(overview.kind === "overview" || overview.kind === "none" ? overview.words : undefined);
|
|
193
193
|
setSystemVerbs(overview.kind === "overview" ? overview.verbs : undefined);
|
|
194
194
|
setChangedPages(overview.kind === "overview" ? overview.layers : undefined);
|
|
195
195
|
if (number === reading.current) {
|
|
@@ -8,7 +8,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-ru
|
|
|
8
8
|
import { useEffect, useRef, useState } from "preact/hooks";
|
|
9
9
|
import { CoinFace, CoinFaces, DiceFaces, tossWords } from "../parts/faces.js";
|
|
10
10
|
import { DieIcon, Icon } from "../parts/icons.js";
|
|
11
|
-
import {
|
|
11
|
+
import { rollModifier, rollText, shownText, signed } from "../parts/labels.js";
|
|
12
12
|
import { trayCheck, useRequested } from "../play/requested.js";
|
|
13
13
|
import { Token } from "../sheet/party.js";
|
|
14
14
|
import { soundPref, useChoice, usePref } from "../shell/prefs.js";
|
|
@@ -193,20 +193,22 @@ export function DiceTray({ requested, sheetThrow, party, campaign, onLanded, onS
|
|
|
193
193
|
useEffect(() => {
|
|
194
194
|
if (requested !== undefined) {
|
|
195
195
|
const toss = requested.toss;
|
|
196
|
-
|
|
196
|
+
// The master's notation may name a field, as 1d20+stealth: in the system's words.
|
|
197
|
+
const written = rollText(requested.notation);
|
|
198
|
+
const title = requested.check ?? (toss === undefined ? written : t("Coins"));
|
|
197
199
|
// A check's is the player's character's when it names no one; the master's own is no one's.
|
|
198
200
|
const member = party.find((candidate) => candidate.name === requested.who) ?? (requested.by === "player" && toss === undefined ? party.find((candidate) => candidate.role === "pc") : undefined);
|
|
199
201
|
void throwAndShow({
|
|
200
202
|
free: false,
|
|
201
203
|
title,
|
|
202
|
-
...(title ===
|
|
204
|
+
...(title === written || toss !== undefined ? {} : { notation: written }),
|
|
203
205
|
dice: requested.dice,
|
|
204
|
-
modifier:
|
|
206
|
+
modifier: rollModifier(requested),
|
|
205
207
|
total: requested.total,
|
|
206
208
|
...(requested.says === undefined ? {} : { says: requested.says }),
|
|
207
209
|
...(requested.tones === undefined ? {} : { tones: requested.tones }),
|
|
208
210
|
...(toss === undefined ? {} : { toss, says: capitalized(tossWords(toss)) }),
|
|
209
|
-
text: toss === undefined ? requested.text : tossWords(toss),
|
|
211
|
+
text: toss === undefined ? rollText(requested.text) : tossWords(toss),
|
|
210
212
|
...(member === undefined ? {} : { member }),
|
|
211
213
|
roll: requested.id,
|
|
212
214
|
}, lingers.asked, mastersDice(requested, party, campaign));
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { isolated, numberText, pageLocale, systemWord, t, timeText } from "../text.js";
|
|
1
|
+
import { isolated, numberText, pageLocale, systemWord, systemWordAnyCase, t, timeText } from "../text.js";
|
|
3
2
|
// The dice the page has a picture of: the d% as 100, the coin as 2.
|
|
4
3
|
const drawnDice = [2, 4, 6, 8, 10, 12, 20, 100];
|
|
5
4
|
/** A field's name as a label: its words apart, in capitals the short names, as ac, hp, or str which the system names Strength; age stays a word. */
|
|
@@ -51,10 +50,17 @@ export function drawnDiceOf(notation) {
|
|
|
51
50
|
const oneOfTwo = count === 2 && /\d*d(?:\d+|%|F)(?:k[hl]1|d[hl]1)(?![\d])/i.test(notation);
|
|
52
51
|
return count <= 2 ? { sides: Array.from({ length: count }, () => sides), ...(oneOfTwo ? { faded: true } : {}) } : { sides: [sides], count };
|
|
53
52
|
}
|
|
54
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* An item of a list as the page shows it: in the system's words, a name and its number too, as Cleric 3 (playtest 19); a short name in capitals, as WIS; any other
|
|
55
|
+
* with its first letter a capital, as Light hammer.
|
|
56
|
+
*/
|
|
55
57
|
export function itemLabel(item, fields = new Set()) {
|
|
56
58
|
const word = item.trim();
|
|
57
|
-
|
|
59
|
+
const counted = /^(.*\D)\s+(\d+)$/.exec(word);
|
|
60
|
+
const countedWord = counted === null ? undefined : systemWord("words", counted[1]);
|
|
61
|
+
// A sheet's value as the master wrote it, «Dice set», finds the system's word in any case, «dice set».
|
|
62
|
+
return systemWord("words", word) ?? systemWord("fields", word) ?? systemWordAnyCase("words", word) ?? (counted === null || countedWord === undefined ? undefined : `${countedWord} ${counted[2]}`)
|
|
63
|
+
?? (isShortName(word.toLowerCase(), fields) ? word.toUpperCase() : phraseLabel(word));
|
|
58
64
|
}
|
|
59
65
|
/** A label of a sheet's line as a phrase, its first letter a capital: "sleight of hand" reads "Sleight of hand"; "STR save" stays as it is. */
|
|
60
66
|
export function phraseLabel(label) {
|
|
@@ -88,6 +94,22 @@ export function notationModifier(notation) {
|
|
|
88
94
|
const match = /([+-]\d+)$/.exec(notation.replace(/\s+/g, ""));
|
|
89
95
|
return match === null ? 0 : Number(match[1]);
|
|
90
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* The number a roll adds to its dice: its notation's, as the 5 of 2d20kh1+5; with a field's name in it, as the master's 1d20+stealth, what its total adds to the
|
|
99
|
+
* dice kept, as the notation tells no number (playtest 19). A pool that counts successes adds none of its own.
|
|
100
|
+
*/
|
|
101
|
+
export function rollModifier(roll) {
|
|
102
|
+
const terms = roll.notation.replace(/\s+/g, "").split(/[+-]/);
|
|
103
|
+
const named = terms.some((term) => /^[a-z]/i.test(term) && !/^d(?:\d|%|F)/i.test(term));
|
|
104
|
+
if (!named || roll.dice.length === 0 || roll.dice.some((die) => die.success !== undefined)) {
|
|
105
|
+
return notationModifier(roll.notation);
|
|
106
|
+
}
|
|
107
|
+
return roll.total - roll.dice.reduce((sum, die) => (die.dropped === true ? sum : sum + die.value), 0);
|
|
108
|
+
}
|
|
109
|
+
/** A roll's notation or text with the fields it adds in the system's words: 1d20+stealth = 22 [15] + 7 (stealth +7) reads Furtività for stealth in Italian. */
|
|
110
|
+
export function rollText(text) {
|
|
111
|
+
return text.replace(/(?<![\w%-])[a-z][a-z0-9]*(?:-[a-z0-9]+)*(?![\w-])/g, (name) => systemWord("fields", name) ?? name);
|
|
112
|
+
}
|
|
91
113
|
/**
|
|
92
114
|
* A number as it reads in the page's language: −1 with a minus sign rather than a hyphen, 4,2 m with the Italian comma; a field whose kind is duration, as 3m
|
|
93
115
|
* of the engine, in words: 3 minuti.
|
|
@@ -58,7 +58,7 @@ export function Track({ value, label }) {
|
|
|
58
58
|
}
|
|
59
59
|
/** A list as chips, or as lines when it is of sentences; what the character's parts add to it apart, with where it comes from (PRO-7). */
|
|
60
60
|
export function Chips({ value, fields }) {
|
|
61
|
-
return (_jsxs("span", { class: "chips-block", children: [_jsx(Items, { items: value.items ?? [], field: value.field, fields: fields }), value.always && (_jsxs("span", { class: "always", children: [_jsx("span", { class: "always-from", children: t("Always, from {sources}", { sources: value.always.from.join(` ${t("and")} `) }) }), _jsx(Items, { items: value.always.items, field: value.field, fields: fields })] }))] }));
|
|
61
|
+
return (_jsxs("span", { class: "chips-block", children: [_jsx(Items, { items: value.items ?? [], field: value.field, fields: fields }), value.always && (_jsxs("span", { class: "always", children: [_jsx("span", { class: "always-from", children: t("Always, from {sources}", { sources: value.always.from.map((source) => itemLabel(source)).join(` ${t("and")} `) }) }), _jsx(Items, { items: value.always.items, field: value.field, fields: fields })] }))] }));
|
|
62
62
|
}
|
|
63
63
|
/** A list's items, each a button that acts when the system names verbs for its field (D-495). */
|
|
64
64
|
function Items({ items, field, fields }) {
|
|
@@ -9,7 +9,7 @@ import { CardHeader, useOpen } from "../parts/card.js";
|
|
|
9
9
|
import { CoinFaces, DiceFaces, tossWords } from "../parts/faces.js";
|
|
10
10
|
import { gameDateLabel, notationLabel } from "../parts/game-words.js";
|
|
11
11
|
import { cardIcons, Icon } from "../parts/icons.js";
|
|
12
|
-
import {
|
|
12
|
+
import { rollModifier, rollText, strangerLabel } from "../parts/labels.js";
|
|
13
13
|
import { rollWindow } from "../parts/layout.js";
|
|
14
14
|
import { Token } from "../sheet/party.js";
|
|
15
15
|
import { capitalized, pageLocale, t } from "../text.js";
|
|
@@ -79,7 +79,7 @@ function RollRow({ roll, name, token, coins, fresh, greeted, several }) {
|
|
|
79
79
|
const free = "free" in roll;
|
|
80
80
|
// The whole roll, which the lines may cut: whom and what, the dice as the chat writes them, the notation in words, and when (D-299); a toss's coins in words.
|
|
81
81
|
const toss = roll.toss === undefined ? undefined : tossWords(roll.toss);
|
|
82
|
-
const said = [roll.check === undefined ? name : `${name} · ${roll.check}`, toss ?? roll.text, toss === undefined ? notationLabel(roll.words) : undefined, rolledWhen(roll), free ? t("Free roll · not logged") : undefined]
|
|
82
|
+
const said = [roll.check === undefined ? name : `${name} · ${roll.check}`, toss ?? rollText(roll.text), toss === undefined ? notationLabel(roll.words) : undefined, rolledWhen(roll), free ? t("Free roll · not logged") : undefined]
|
|
83
83
|
.filter((line) => line !== undefined && line !== "")
|
|
84
84
|
.join("\n");
|
|
85
85
|
return (_jsxs("li", { class: ["roll", player ? "by-player" : "by-master", free ? "free" : "", entering ? "entering" : ""].filter((part) => part !== "").join(" "), "data-roll": roll.id, title: said, children: [marked && _jsx("span", { class: "roll-flag", "aria-hidden": "true", children: "!" }), token === undefined
|
|
@@ -91,7 +91,7 @@ function RollRow({ roll, name, token, coins, fresh, greeted, several }) {
|
|
|
91
91
|
: roll.says === undefined
|
|
92
92
|
? _jsx("span", { class: "roll-total num", children: roll.total })
|
|
93
93
|
: _jsx("span", { class: "roll-total roll-says", children: roll.says }), _jsx("span", { class: "roll-dice", children: toss === undefined
|
|
94
|
-
? (_jsxs(_Fragment, { children: [_jsx(DiceFaces, { dice: roll.dice, modifier:
|
|
94
|
+
? (_jsxs(_Fragment, { children: [_jsx(DiceFaces, { dice: roll.dice, modifier: rollModifier(roll), tones: roll.tones }), _jsx("span", { class: "visually-hidden", children: rollText(roll.text) })] }))
|
|
95
95
|
: _jsx("span", { class: "roll-toss", children: capitalized(toss) }) })] }));
|
|
96
96
|
}
|
|
97
97
|
/** What a roll's faces mean in place of its total: the coins of a toss in the page's language, or what an extension's roll says. */
|
|
@@ -29,36 +29,44 @@ export function SetupView({ setup }) {
|
|
|
29
29
|
// The choices left to the master, as the game keeps them until the master makes them, and those just left here.
|
|
30
30
|
const [leftHere, setLeftHere] = useState(new Set());
|
|
31
31
|
const left = new Set([...(setup.left ?? []), ...leftHere].filter((name) => questions.some((question) => question.name === name && !answered(question))));
|
|
32
|
-
//
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
// Until the player uses the page, the card follows the chat: the first question still open, as the master fills them from what the player says there
|
|
33
|
+
// (playtest 01); with none, the last card. Once the player chooses or moves here, the card is theirs.
|
|
34
|
+
const [own, setOwn] = useState(false);
|
|
35
|
+
const [at, setAt] = useState(0);
|
|
36
|
+
const current = own ? at : firstOpen(questions, setup.left ?? []);
|
|
37
37
|
// Whether the player moved among the cards: then the new card's title takes the focus, never at the first reading.
|
|
38
38
|
const [moved, setMoved] = useState(false);
|
|
39
39
|
const [said, setSaid] = useState();
|
|
40
|
-
const done =
|
|
41
|
-
const question = questions[Math.min(
|
|
40
|
+
const done = current >= questions.length;
|
|
41
|
+
const question = questions[Math.min(current, questions.length - 1)];
|
|
42
42
|
const step = steps.indexOf(setup.mode);
|
|
43
43
|
const go = (index) => {
|
|
44
|
+
setOwn(true);
|
|
44
45
|
setMoved(true);
|
|
45
46
|
setAt(index);
|
|
46
47
|
};
|
|
48
|
+
// A choice made here keeps the card where it is, as the player made it.
|
|
49
|
+
const touch = () => {
|
|
50
|
+
if (!own) {
|
|
51
|
+
setOwn(true);
|
|
52
|
+
setAt(current);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
47
55
|
const leave = async (name) => {
|
|
48
56
|
const refused = await sendSetupWord({ leave: name });
|
|
49
57
|
setSaid(refused);
|
|
50
58
|
if (refused === undefined) {
|
|
51
59
|
setLeftHere((before) => new Set([...before, name]));
|
|
52
|
-
go(
|
|
60
|
+
go(current + 1);
|
|
53
61
|
}
|
|
54
62
|
};
|
|
55
|
-
return (_jsxs("section", { class: "setup", "aria-labelledby": "setup-title", children: [_jsx("div", { class: "setup-host", children: _jsx(Master, { mood: "happy" }) }), _jsx(CampaignName, { name: setup.name }), _jsx("h1", { id: "setup-title", class: "visually-hidden", children: t("Setting up {campaign}", { campaign: setup.name }) }), _jsx("ol", { class: "setup-steps", "aria-label": t("Steps"), children: steps.map((one, index) => (_jsxs("li", { class: index < step ? "done" : index === step ? "now" : undefined, "aria-current": index === step ? "step" : undefined, children: [_jsx("span", { class: "setup-step-dot", "aria-hidden": "true", children: index < step ? "✓" : index + 1 }), stepName(one)] }, one))) }), said !== undefined && _jsx("p", { class: "setup-problem", role: "alert", children: said }), !done && question !== undefined && (_jsx(Question, { question: question, count: t("{value} of {max}", { value:
|
|
63
|
+
return (_jsxs("section", { class: "setup", "aria-labelledby": "setup-title", children: [_jsx("div", { class: "setup-host", children: _jsx(Master, { mood: "happy" }) }), _jsx(CampaignName, { name: setup.name }), _jsx("h1", { id: "setup-title", class: "visually-hidden", children: t("Setting up {campaign}", { campaign: setup.name }) }), _jsx("ol", { class: "setup-steps", "aria-label": t("Steps"), children: steps.map((one, index) => (_jsxs("li", { class: index < step ? "done" : index === step ? "now" : undefined, "aria-current": index === step ? "step" : undefined, children: [_jsx("span", { class: "setup-step-dot", "aria-hidden": "true", children: index < step ? "✓" : index + 1 }), stepName(one)] }, one))) }), said !== undefined && _jsx("p", { class: "setup-problem", role: "alert", children: said }), !done && question !== undefined && (_jsx(Question, { question: question, count: t("{value} of {max}", { value: current + 1, max: questions.length }), left: left.has(question.name), focus: moved, onBack: current > 0 ? () => go(current - 1) : undefined, onNext: () => go(current + 1), onLeave: () => void leave(question.name), onTouch: touch, onProblem: setSaid }, question.name)), done && _jsx(Ready, { setup: setup, left: left, focus: moved, onGo: go, onProblem: setSaid }), _jsx("ol", { class: "setup-dots", "aria-label": t("Questions"), style: { "--count": String(questions.length) }, children: questions.map((one, index) => (_jsx("li", { children: _jsx("button", { type: "button", class: [answered(one) ? "answered" : left.has(one.name) ? "left" : "", index === current ? "here" : ""].filter((name) => name !== "").join(" "), "aria-label": answered(one) ? t("{setting}: answered", { setting: settingLabel(one.name) }) : left.has(one.name) ? t("{setting}: left to the master", { setting: settingLabel(one.name) }) : settingLabel(one.name), "aria-current": index === current ? "step" : undefined, onClick: () => go(index) }) }, one.name))) }), _jsx("p", { class: "setup-chat", children: t("You can also tell the master in the chat: they hear what you choose here.") })] }));
|
|
56
64
|
}
|
|
57
65
|
/**
|
|
58
66
|
* One question as its card shows it: what it is, its choices large with what each means and the one the game suggests, or a list's items; back, next, or left
|
|
59
67
|
* to the master. Its title takes the focus when the player moved to it.
|
|
60
68
|
*/
|
|
61
|
-
function Question({ question, count, left, focus, onBack, onNext, onLeave, onProblem }) {
|
|
69
|
+
function Question({ question, count, left, focus, onBack, onNext, onLeave, onTouch, onProblem }) {
|
|
62
70
|
const [picked, setPicked] = useState();
|
|
63
71
|
const resting = useRef(undefined);
|
|
64
72
|
const heading = useRef(null);
|
|
@@ -81,6 +89,7 @@ function Question({ question, count, left, focus, onBack, onNext, onLeave, onPro
|
|
|
81
89
|
}, []);
|
|
82
90
|
// A click chooses at once; the arrows show each choice and send the one they rest on.
|
|
83
91
|
const pick = (choice, byKey) => {
|
|
92
|
+
onTouch();
|
|
84
93
|
setPicked(choice);
|
|
85
94
|
clearTimeout(resting.current?.timer);
|
|
86
95
|
resting.current = undefined;
|
|
@@ -94,7 +103,7 @@ function Question({ question, count, left, focus, onBack, onNext, onLeave, onPro
|
|
|
94
103
|
}, keyRest);
|
|
95
104
|
resting.current = { choice, timer };
|
|
96
105
|
};
|
|
97
|
-
return (_jsxs("article", { class: "setup-card", "aria-labelledby": id, children: [_jsx("p", { class: "eyebrow setup-count", children: count }), _jsx("h2", { id: id, ref: heading, tabIndex: -1, children: title }), _jsx("p", { class: "setup-about", children: phraseLabel(t(question.about)) }), question.choices !== undefined && _jsx(Choices, { question: question, value: value, labelledBy: id, onPick: pick }), isList && _jsx(ListQuestion, { question: question, onProblem: onProblem }), left && value === undefined && _jsx("p", { class: "setup-left", children: t("Left to the master: they choose, and tell you.") }), _jsxs("div", { class: "setup-moves", children: [onBack !== undefined && _jsx("button", { type: "button", class: "button setup-back", onClick: onBack, children: t("Back") }), open && !isList && _jsx("button", { type: "button", class: "button quiet", onClick: onLeave, children: t("You decide") }), _jsxs("button", { type: "button", class: open ? "button quiet" : "button gold", onClick: onNext, children: [open ? t("Skip") : t("Next"), " ", _jsx(Icon, { name: "send" })] })] })] }));
|
|
106
|
+
return (_jsxs("article", { class: "setup-card", "aria-labelledby": id, onFocusIn: onTouch, children: [_jsx("p", { class: "eyebrow setup-count", children: count }), _jsx("h2", { id: id, ref: heading, tabIndex: -1, children: title }), _jsx("p", { class: "setup-about", children: phraseLabel(t(question.about)) }), question.choices !== undefined && _jsx(Choices, { question: question, value: value, labelledBy: id, onPick: pick }), isList && _jsx(ListQuestion, { question: question, onTouch: onTouch, onProblem: onProblem }), left && value === undefined && _jsx("p", { class: "setup-left", children: t("Left to the master: they choose, and tell you.") }), _jsxs("div", { class: "setup-moves", children: [onBack !== undefined && _jsx("button", { type: "button", class: "button setup-back", onClick: onBack, children: t("Back") }), open && !isList && _jsx("button", { type: "button", class: "button quiet", onClick: onLeave, children: t("You decide") }), _jsxs("button", { type: "button", class: open ? "button quiet" : "button gold", onClick: onNext, children: [open ? t("Skip") : t("Next"), " ", _jsx(Icon, { name: "send" })] })] })] }));
|
|
98
107
|
}
|
|
99
108
|
/** A question's choices as a radio group: one stop of Tab, the arrows move among them and choose; each with what it means, the suggested one marked. */
|
|
100
109
|
function Choices({ question, value, labelledBy, onPick }) {
|
|
@@ -116,10 +125,13 @@ function Choices({ question, value, labelledBy, onPick }) {
|
|
|
116
125
|
return (_jsx("div", { class: "setup-choices", role: "radiogroup", "aria-labelledby": labelledBy, onKeyDown: move, children: choices.map((choice, index) => (_jsxs("button", { type: "button", role: "radio", "aria-checked": value === choice.value, tabIndex: index === stop ? 0 : -1, class: "setup-choice", onClick: () => onPick(choice.value, false), children: [_jsxs("strong", { children: [choice.label === undefined ? valueLabel(choice.value) : phraseLabel(t(choice.label)), choice.value === question.suggested && _jsx("span", { class: "setup-suggested", children: choice.value === question.last ? t("Like last time") : t("Suggested") })] }), choice.means !== undefined && _jsx("span", { children: phraseLabel(t(choice.means)) })] }, choice.value))) }));
|
|
117
126
|
}
|
|
118
127
|
/** A list of the setup, lines or veils: its items to take off, a field to add one, and None for a player who wants none. */
|
|
119
|
-
function ListQuestion({ question, onProblem }) {
|
|
128
|
+
function ListQuestion({ question, onTouch, onProblem }) {
|
|
120
129
|
const [item, setItem] = useState("");
|
|
121
130
|
const field = useRef(null);
|
|
122
|
-
const send = (change) =>
|
|
131
|
+
const send = (change) => {
|
|
132
|
+
onTouch();
|
|
133
|
+
void changeSetting(change).then(onProblem);
|
|
134
|
+
};
|
|
123
135
|
return (_jsxs("div", { class: "setup-list", children: [(question.items ?? []).length > 0 && (_jsx("ul", { children: (question.items ?? []).map((one) => (_jsxs("li", { children: [one, _jsx("button", { type: "button", class: "icon-button", "aria-label": t("Take {item} off", { item: one }), onClick: () => {
|
|
124
136
|
send({ setting: question.name, remove: one });
|
|
125
137
|
field.current?.focus();
|
|
@@ -185,6 +197,11 @@ function CampaignName({ name }) {
|
|
|
185
197
|
}
|
|
186
198
|
} }), _jsx("button", { type: "submit", class: "button gold", children: t("Save") })] }));
|
|
187
199
|
}
|
|
200
|
+
/** Where the questions stand: the first still open, neither answered nor left to the master; with none, past the last. */
|
|
201
|
+
function firstOpen(questions, left) {
|
|
202
|
+
const first = questions.findIndex((question) => !answered(question) && !left.includes(question.name));
|
|
203
|
+
return first < 0 ? questions.length : first;
|
|
204
|
+
}
|
|
188
205
|
/** Whether a question is answered: a value chosen, or a list given, even with none. */
|
|
189
206
|
function answered(question) {
|
|
190
207
|
return question.value !== undefined || question.items !== undefined;
|
|
@@ -73,7 +73,7 @@ function TabMark({ path }) {
|
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* The table's measures, taken only when it or the window changes size, never as the page scrolls. The rolls' list grows with its rolls up to twelve, as tall as
|
|
76
|
-
*
|
|
76
|
+
* the first one that has opened draws, then scrolls inside. The table stays at the top while it fits the window; taller, its top goes up so that it scrolls with the page until
|
|
77
77
|
* its foot reaches the window's and stays there, the end of the rolls always in reach.
|
|
78
78
|
*/
|
|
79
79
|
function useTableFit(track) {
|
|
@@ -88,8 +88,10 @@ function useTableFit(track) {
|
|
|
88
88
|
if (stick === null) {
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
91
|
+
// A new roll opens its place from nothing: measured then, a pixel high, it would leave the list room for one (playtest 19). The first row that has
|
|
92
|
+
// opened gives the measure; while none has, the list keeps the room it had.
|
|
91
93
|
const rows = stick.querySelector(".roll-list");
|
|
92
|
-
const first = rows?.
|
|
94
|
+
const first = [...(rows?.children ?? [])].find((row) => row.getAnimations().every((animation) => animation.playState !== "running"));
|
|
93
95
|
if (rows !== null && first instanceof HTMLElement) {
|
|
94
96
|
const gap = Number.parseFloat(getComputedStyle(rows).rowGap) || 0;
|
|
95
97
|
track.style.setProperty("--list-room", `${Math.ceil(mostRolls * first.offsetHeight + (mostRolls - 1) * gap)}px`);
|
|
@@ -114,14 +116,16 @@ function useTableFit(track) {
|
|
|
114
116
|
sizes.observe(stick);
|
|
115
117
|
}
|
|
116
118
|
window.addEventListener("resize", update);
|
|
117
|
-
// The table's top changes as the page's top or what the master asks come and go.
|
|
119
|
+
// The table's top changes as the page's top or what the master asks come and go; a roll has its height once it has opened.
|
|
118
120
|
track.addEventListener("transitionend", update);
|
|
121
|
+
track.addEventListener("animationend", update);
|
|
119
122
|
update();
|
|
120
123
|
return () => {
|
|
121
124
|
cancelAnimationFrame(asked);
|
|
122
125
|
sizes.disconnect();
|
|
123
126
|
window.removeEventListener("resize", update);
|
|
124
127
|
track.removeEventListener("transitionend", update);
|
|
128
|
+
track.removeEventListener("animationend", update);
|
|
125
129
|
track.style.removeProperty("--list-room");
|
|
126
130
|
track.style.removeProperty("--table-top");
|
|
127
131
|
};
|
package/dist/packages/npm.js
CHANGED
|
@@ -17,6 +17,8 @@ const localFolder = "local";
|
|
|
17
17
|
// An npm name with a version or a tag, or nothing a shell would read otherwise: the master writes it, and npm runs in a shell.
|
|
18
18
|
const npmSpec = /^(@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*(@[0-9A-Za-z.+-]+)?$/;
|
|
19
19
|
const installWait = 5 * 60 * 1000;
|
|
20
|
+
// How long the check for newer versions waits for the registry, at the start of a session (D-569): offline it gives up at once or after this.
|
|
21
|
+
const checkWait = 3000;
|
|
20
22
|
// An npm package's name alone, without a version: a .tgz's becomes the name of its folder.
|
|
21
23
|
const packageName = /^(@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/;
|
|
22
24
|
// A folder's copy installed as files, never as a link, which Node may not follow where the app keeps the player's data; npm's package.json still names it
|
|
@@ -85,6 +87,14 @@ export function npmPackages(folder, run = runNpm) {
|
|
|
85
87
|
return { failed: `npm's registry could not be reached: ${error instanceof Error ? error.message : String(error)}` };
|
|
86
88
|
}
|
|
87
89
|
},
|
|
90
|
+
newest: async (name) => {
|
|
91
|
+
try {
|
|
92
|
+
return await newestReadable(name);
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
},
|
|
88
98
|
};
|
|
89
99
|
}
|
|
90
100
|
/** Whether a text is an npm package's name alone, such as notes or @me/notes: never a path, nor a version. */
|
|
@@ -227,14 +237,29 @@ function madeForNewer(info) {
|
|
|
227
237
|
* that reads it. The latest alone when no version reads, which is then refused.
|
|
228
238
|
*/
|
|
229
239
|
async function readableVersion(name, latest) {
|
|
230
|
-
const
|
|
231
|
-
const kind = latest.kind === "system" ? "system" : "extension";
|
|
232
|
-
const readable = Object.values(all?.versions ?? {}).map(infoOf).filter((one) => !one.version.includes("-") && readsApi(one.api, kind));
|
|
233
|
-
const newest = readable.reduce((best, one) => (best === undefined || isNewerVersion(one.version, best.version) ? one : best), undefined);
|
|
240
|
+
const newest = newestOf(await json(`${registry}/${name.replace("/", "%2f")}`), latest);
|
|
234
241
|
const engine = await engineReading(latest.api ?? 0);
|
|
235
242
|
const newer = { version: latest.version, ...(engine === undefined ? {} : { engine }) };
|
|
236
243
|
return newest === undefined ? latest : { ...newest, newer };
|
|
237
244
|
}
|
|
245
|
+
/**
|
|
246
|
+
* The newest version of a package this engine reads (D-569): its latest, else the newest of all its versions that reads; undefined when it has none. Asked
|
|
247
|
+
* within a short wait in all, as at the start of a session, which never waits on npm for long.
|
|
248
|
+
*/
|
|
249
|
+
async function newestReadable(name) {
|
|
250
|
+
const address = `${registry}/${checkedSpec(name).replace("/", "%2f")}`;
|
|
251
|
+
const signal = AbortSignal.timeout(checkWait);
|
|
252
|
+
const latest = await json(`${address}/latest`, signal);
|
|
253
|
+
const info = latest === undefined ? undefined : infoOf(latest);
|
|
254
|
+
return info === undefined || !madeForNewer(info) ? info?.version : newestOf(await json(address, signal), info)?.version;
|
|
255
|
+
}
|
|
256
|
+
/** The newest of all the versions npm's registry gives of a package that this engine reads, of the latest's kind, never a prerelease. */
|
|
257
|
+
function newestOf(all, latest) {
|
|
258
|
+
const versions = all?.versions ?? {};
|
|
259
|
+
const kind = latest.kind === "system" ? "system" : "extension";
|
|
260
|
+
const readable = Object.values(versions).map(infoOf).filter((one) => !one.version.includes("-") && readsApi(one.api, kind));
|
|
261
|
+
return readable.reduce((best, one) => (best === undefined || isNewerVersion(one.version, best.version) ? one : best), undefined);
|
|
262
|
+
}
|
|
238
263
|
/** The first version of rpg-engine on npm that reads a package made for this API, as its package.json says; undefined when none does yet, or npm does not say. */
|
|
239
264
|
async function engineReading(api) {
|
|
240
265
|
try {
|
|
@@ -372,9 +397,9 @@ function infoOf(read) {
|
|
|
372
397
|
function authorOf(read) {
|
|
373
398
|
return typeof read.author === "string" ? read.author : read.author?.name;
|
|
374
399
|
}
|
|
375
|
-
/** A JSON answer of the registry; undefined when it has none, 404. */
|
|
376
|
-
async function json(url) {
|
|
377
|
-
const answer = await fetch(url, { headers: { accept: "application/json" }, signal
|
|
400
|
+
/** A JSON answer of the registry, given up when the signal says; undefined when it has none, 404. */
|
|
401
|
+
async function json(url, signal = AbortSignal.timeout(20_000)) {
|
|
402
|
+
const answer = await fetch(url, { headers: { accept: "application/json" }, signal });
|
|
378
403
|
if (answer.status === 404) {
|
|
379
404
|
return undefined;
|
|
380
405
|
}
|
package/dist/pages/index.d.ts
CHANGED
|
@@ -15,6 +15,6 @@ export { carriesKind, carriesNamed, entryKind, entryPage, goodsNamed, type HeldS
|
|
|
15
15
|
export { canHold, containerFieldOf, isCoreField, isCounterField, isEmptyField, isStandardField, listFieldNames, misspelledFieldProblem, misspelledStandardField, newPageFields, standardValues } from "./standard-fields.ts";
|
|
16
16
|
export { alwaysInList, declaredKind, hidingMessage, isDeclaredUncounted, kindMessage, readOnlyMessage, systemKnowsReason, systemLabel } from "./system-pages.ts";
|
|
17
17
|
export { type PageType, pageTypeNames, worldFolderName } from "./types.ts";
|
|
18
|
-
export { type Backlink, backlinks, bonusPages, concernsPlayer, createWorld, findPage, isCountedItem, isInParty, isPartyMember, isPlayerCharacter, linksIn, loadWorld, locate, namesakes, type Page, pageFileNamed, type PageMatch, pageNamed, pagesWithName, pagesWithNameOrAlias, pageWithPath, parsePageReference, playerCharacters, searchPages, searchSystemPages, systemFirstFix, type SystemInfo, systemPageNamed, type SystemPages, textsIn, validHoldersOf, versionTranslations, withPage, type World, } from "./world.ts";
|
|
18
|
+
export { type Backlink, backlinks, bonusPages, concernsPlayer, createWorld, findPage, heldNames, isCountedItem, isInParty, isPartyMember, isPlayerCharacter, linksIn, loadWorld, locate, namesakes, type Page, pageFileNamed, type PageMatch, pageNamed, pagesWithName, pagesWithNameOrAlias, pageWithPath, parsePageReference, playerCharacters, searchPages, searchSystemPages, systemFirstFix, type SystemInfo, systemPageNamed, type SystemPages, textsIn, validHoldersOf, versionTranslations, withPage, type World, } from "./world.ts";
|
|
19
19
|
export { type LayerWrite, removeLayer, writeLayer } from "./write-layer.ts";
|
|
20
20
|
export { checkFieldChange, type PageChange, writePage } from "./write-page.ts";
|
package/dist/pages/index.js
CHANGED
|
@@ -16,6 +16,6 @@ export { carriesKind, carriesNamed, entryKind, entryPage, goodsNamed, heldStacks
|
|
|
16
16
|
export { canHold, containerFieldOf, isCoreField, isCounterField, isEmptyField, isStandardField, listFieldNames, misspelledFieldProblem, misspelledStandardField, newPageFields, standardValues } from "./standard-fields.js";
|
|
17
17
|
export { alwaysInList, declaredKind, hidingMessage, isDeclaredUncounted, kindMessage, readOnlyMessage, systemKnowsReason, systemLabel } from "./system-pages.js";
|
|
18
18
|
export { pageTypeNames, worldFolderName } from "./types.js";
|
|
19
|
-
export { backlinks, bonusPages, concernsPlayer, createWorld, findPage, isCountedItem, isInParty, isPartyMember, isPlayerCharacter, linksIn, loadWorld, locate, namesakes, pageFileNamed, pageNamed, pagesWithName, pagesWithNameOrAlias, pageWithPath, parsePageReference, playerCharacters, searchPages, searchSystemPages, systemFirstFix, systemPageNamed, textsIn, validHoldersOf, versionTranslations, withPage, } from "./world.js";
|
|
19
|
+
export { backlinks, bonusPages, concernsPlayer, createWorld, findPage, heldNames, isCountedItem, isInParty, isPartyMember, isPlayerCharacter, linksIn, loadWorld, locate, namesakes, pageFileNamed, pageNamed, pagesWithName, pagesWithNameOrAlias, pageWithPath, parsePageReference, playerCharacters, searchPages, searchSystemPages, systemFirstFix, systemPageNamed, textsIn, validHoldersOf, versionTranslations, withPage, } from "./world.js";
|
|
20
20
|
export { removeLayer, writeLayer } from "./write-layer.js";
|
|
21
21
|
export { checkFieldChange, writePage } from "./write-page.js";
|
package/dist/scene/scene.d.ts
CHANGED
|
@@ -34,7 +34,10 @@ export interface Scene {
|
|
|
34
34
|
used?: Record<string, string[]>;
|
|
35
35
|
/** Who attacks the party, as the master marks them, characters or copies by name (D-415): the player's dashboard shows it in a fight. */
|
|
36
36
|
hostile?: string[];
|
|
37
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* What the player character sees of someone, by the character's or the creature's name, such as brigante incappucciato (D-416): the player is given it
|
|
39
|
+
* instead of the name, known or not, while the scene keeps them (D-568).
|
|
40
|
+
*/
|
|
38
41
|
seen?: Record<string, string>;
|
|
39
42
|
}
|
|
40
43
|
/** The open scene, checked; a scene written wrongly by hand fails with what is wrong. */
|
package/instructions/combat.md
CHANGED
|
@@ -10,8 +10,8 @@ Give the fight a question beyond who wins, such as holding the gate or saving th
|
|
|
10
10
|
- A lone foe against a party falls fast: give it help, ground that shields it, or a change as it is hurt, such as calling the guards or taking to the air.
|
|
11
11
|
- When the party may lose, keep a way to lose short of death, such as retreat, surrender, capture or a deal; foes take it when their motives allow, and the loss moves the story on.
|
|
12
12
|
|
|
13
|
-
Tell the turns in order, as story; once the threat is in sight, their order in brackets; stop wherever the player can decide: their character's turn, a reaction they can take, a choice. The foes' numbers are yours: the player hears how hurt and how strong they look, never as a number, in brackets or in a question either, unless the table agreed otherwise. A fall or a death is a moment of its own, told in the story, never a line in brackets. A companion's turn takes one sentence with its roll; the long telling is the player's character's. When the outcome is no longer in doubt and the player's choice repeats, offer to tell the rest in one go, rolls in a row.
|
|
13
|
+
Tell the turns in order, as story; once the threat is in sight, their order in brackets; stop wherever the player can decide: their character's turn, a reaction they can take, a choice. The foes' numbers are yours: the player hears how hurt and how strong they look, never as a number, in brackets or in a question either, unless the table agreed otherwise. A fall or a death is a moment of its own, told in the story, never a line in brackets. A companion's turn takes one sentence with its roll; the long telling is the player's character's. When the outcome is no longer in doubt and the player's choice repeats, offer to tell the rest in one go, rolls in a row, stopping before a blow that could fell their character or cross a limit they set.
|
|
14
14
|
|
|
15
15
|
Whoever attacks the party turns hostile the moment they do, never before: mark them with `scene hostile`, and with `scene calm` the one who surrenders, flees or parleys. Mark it, never announce it: the story shows it.
|
|
16
16
|
|
|
17
|
-
In a turn of a foe or a companion, send its calls together: its rolls in one message; in the next, what they change, with `change`, then `scene next` and the rolls of whoever acts next. Never roll a later turn before the one before it is settled: who falls or flees changes what comes after.
|
|
17
|
+
In a turn of a foe or a companion, send its calls together: its rolls in one message; in the next, what they change, with `change`, then `scene next` and the rolls of whoever acts next. Never roll a later turn before the one before it is settled, in a run told in one go too: who falls or flees changes what comes after. Mark a reaction, anyone's, with `scene use` before you resolve it.
|
package/instructions/core.md
CHANGED
|
@@ -8,9 +8,9 @@ You are the game master of this table. It is a craft, and you inhabit it as an a
|
|
|
8
8
|
|
|
9
9
|
1. To the player, never name tools, commands, pages, files, folders, logs, codes, notes, the engine or extensions; speak of the campaign and its game system as players do at the table: "I keep it all: we pick up from here next time."
|
|
10
10
|
2. Everything you write reaches the player, before and between your tool calls too: write only what is for them, never your plans or reasoning, and only once it is ready.
|
|
11
|
-
3. While the tools work, write nothing, even when the app asks what you are doing: no "Un momento, sto preparando", no note to yourself such as "Fails the save." or "Torch out at midnight"; keep those in your thinking.
|
|
11
|
+
3. While the tools work, write nothing, in brackets either, even when the app asks what you are doing: no "[Un momento, sto preparando]", no note to yourself such as "Fails the save." or "Torch out at midnight"; keep those in your thinking.
|
|
12
12
|
4. The campaign lives in its files, not in this chat: start every session from them, and change them, page text included, only through the tools.
|
|
13
|
-
5. Speak the campaign's language. Out of setup, off-game talk, yours or the player's, goes in square brackets, [like this], in a sentence or two; answer theirs first, only what they asked, so the message ends in the story.
|
|
13
|
+
5. Speak the campaign's language. Out of setup, off-game talk, yours or the player's, goes in square brackets, [like this], in a sentence or two; answer theirs first, only what they asked and nothing the story is about to tell, so the message ends in the story.
|
|
14
14
|
6. Inside the story, never break it. Asked in earnest, off-game, whether you are an AI, say yes in one line in brackets, then go back to the game.
|
|
15
15
|
|
|
16
16
|
### Truth and rulings
|
package/instructions/play.md
CHANGED
|
@@ -4,7 +4,7 @@ The story is on. Besides the tools above:
|
|
|
4
4
|
|
|
5
5
|
- `move`: whenever someone or something goes somewhere, before you narrate it: the party (a journey: `travel`), a person who leaves, whoever climbs into a cart or gets out of it to act, an item given or taken.
|
|
6
6
|
- `advance`: whenever time passes in the story, in a scene too, before you narrate it: once for a stretch of the story, not for each gesture. When it stops at an event, do as it says, and write the traces where they will be found. A rest the game system has a recipe for, whenever the characters take it: its hours with `advance`, then `change` with the recipe.
|
|
7
|
-
- `scene`: open one when a scene of any kind starts, not only a fight, with the type it is, and close it when it ends: a chase, a heist, a ritual or a race is a challenge; a deal that matters, social. Whoever the character does not know
|
|
7
|
+
- `scene`: open one when a scene of any kind starts, not only a fight, with the type it is, and close it when it ends: a chase, a heist, a ritual or a race is a challenge; a deal that matters, social. Whoever the character does not know or recognize comes in with `seen`, two or three words of what they see, until `reveal` gives the name.
|
|
8
8
|
- `effect`: every condition or effect on someone (frightened, a curse, a form), how long it lasts and who keeps it alive; it ends by itself.
|
|
9
9
|
|
|
10
10
|
### The character is the player's
|
|
@@ -55,7 +55,7 @@ The story is on. Besides the tools above:
|
|
|
55
55
|
|
|
56
56
|
### Fights and difficulty
|
|
57
57
|
|
|
58
|
-
29. Size what you
|
|
58
|
+
29. Size what you add to the party's way, encounter tables too, to the party as it stands, what it has left included, as the difficulty says; a fight a page held before this session, and what they go looking for, keep their own numbers and strength: adapt only how the foes fight.
|
|
59
59
|
30. After two failures at the same wall, let the world show another way or a sign.
|
|
60
60
|
|
|
61
61
|
### The sheet
|
|
@@ -64,4 +64,4 @@ The story is on. Besides the tools above:
|
|
|
64
64
|
|
|
65
65
|
### Before you send
|
|
66
66
|
|
|
67
|
-
Read your message once as the player will. Does it make their character act, speak, feel or remember what they did not say? Does it name a tool, a page or a file? Does it tell what the character has not found out? Does a roll come without its stakes said first? Does the story pass 150 words, one scene or two companions speaking, or a bracket two sentences? Does it end with the scene handing the choice back?
|
|
67
|
+
Read your message once as the player will. Does it answer all they did, rolled and asked? Does it make their character act, speak, feel or remember what they did not say? Does it name a tool, a page or a file? Does it tell what the character has not found out? Does a roll come without its stakes said first? Does the story pass 150 words, one scene or two companions speaking, or a bracket two sentences? Does it end with the scene handing the choice back?
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rpg-engine",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "Play a tabletop role-playing game with an AI as your game master: the AI tells the story; RPG Engine remembers the world, rolls the dice and keeps the accounts.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|