rpg-engine 0.4.1 → 0.6.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.
Files changed (231) hide show
  1. package/README.md +1 -1
  2. package/dist/campaign/settings.d.ts +1 -0
  3. package/dist/campaign/settings.js +6 -5
  4. package/dist/command-line.js +12 -5
  5. package/dist/commands/advance.js +1 -1
  6. package/dist/commands/ask.d.ts +37 -2
  7. package/dist/commands/ask.js +106 -35
  8. package/dist/commands/change.js +28 -17
  9. package/dist/commands/config.d.ts +1 -1
  10. package/dist/commands/config.js +69 -21
  11. package/dist/commands/effect.js +42 -23
  12. package/dist/commands/find.js +1 -1
  13. package/dist/commands/game-adventures.js +2 -2
  14. package/dist/commands/game-catalog.d.ts +13 -0
  15. package/dist/commands/game-catalog.js +26 -2
  16. package/dist/commands/game-checks.js +23 -21
  17. package/dist/commands/{game-hit-dice.d.ts → game-dice-pool.d.ts} +3 -3
  18. package/dist/commands/{game-hit-dice.js → game-dice-pool.js} +7 -7
  19. package/dist/commands/game-effects.d.ts +12 -4
  20. package/dist/commands/game-effects.js +21 -13
  21. package/dist/commands/game-examples.d.ts +22 -0
  22. package/dist/commands/game-examples.js +72 -0
  23. package/dist/commands/game-extension-list.d.ts +31 -3
  24. package/dist/commands/game-extension-list.js +94 -6
  25. package/dist/commands/game-images.d.ts +1 -1
  26. package/dist/commands/game-images.js +3 -2
  27. package/dist/commands/game-library.d.ts +3 -0
  28. package/dist/commands/game-library.js +2 -2
  29. package/dist/commands/game-mode.js +1 -1
  30. package/dist/commands/game-package-code.d.ts +87 -0
  31. package/dist/commands/game-package-code.js +648 -0
  32. package/dist/commands/game-package-hooks.d.ts +37 -0
  33. package/dist/commands/game-package-hooks.js +116 -0
  34. package/dist/commands/game-recipes.js +2 -2
  35. package/dist/commands/game-reminders.d.ts +5 -2
  36. package/dist/commands/game-reminders.js +7 -4
  37. package/dist/commands/game-rules.d.ts +4 -1
  38. package/dist/commands/game-rules.js +7 -1
  39. package/dist/commands/game-upkeep.js +3 -3
  40. package/dist/commands/game-view-place.d.ts +8 -20
  41. package/dist/commands/game-view-place.js +16 -35
  42. package/dist/commands/game-widgets.d.ts +42 -8
  43. package/dist/commands/game-widgets.js +182 -31
  44. package/dist/commands/game-world.d.ts +32 -3
  45. package/dist/commands/game-world.js +113 -24
  46. package/dist/commands/image.js +1 -1
  47. package/dist/commands/init.js +2 -2
  48. package/dist/commands/mode.d.ts +1 -1
  49. package/dist/commands/package.d.ts +15 -1
  50. package/dist/commands/package.js +96 -24
  51. package/dist/commands/progression.d.ts +2 -0
  52. package/dist/commands/progression.js +7 -2
  53. package/dist/commands/roll.d.ts +2 -0
  54. package/dist/commands/roll.js +50 -24
  55. package/dist/commands/rules.js +6 -4
  56. package/dist/commands/scene.d.ts +2 -2
  57. package/dist/commands/scene.js +13 -10
  58. package/dist/commands/sheet.js +10 -1
  59. package/dist/commands/status.d.ts +1 -0
  60. package/dist/commands/status.js +14 -4
  61. package/dist/commands/trade.js +6 -4
  62. package/dist/commands/translate.js +2 -2
  63. package/dist/commands/travel.js +1 -1
  64. package/dist/commands/validate.js +2 -2
  65. package/dist/commands/view.d.ts +12 -4
  66. package/dist/commands/view.js +11 -8
  67. package/dist/commands/worked-out.js +11 -5
  68. package/dist/commands/write.d.ts +8 -1
  69. package/dist/commands/write.js +84 -25
  70. package/dist/core/command-reference.js +3 -2
  71. package/dist/core/consents.d.ts +18 -0
  72. package/dist/core/consents.js +93 -0
  73. package/dist/core/context.d.ts +68 -27
  74. package/dist/core/context.js +3 -1
  75. package/dist/core/examples.d.ts +25 -0
  76. package/dist/core/examples.js +19 -0
  77. package/dist/core/files.d.ts +2 -0
  78. package/dist/core/files.js +10 -1
  79. package/dist/core/package-api.d.ts +388 -0
  80. package/dist/core/package-declarations.d.ts +102 -0
  81. package/dist/core/package-declarations.js +81 -0
  82. package/dist/core/registry.d.ts +4 -0
  83. package/dist/core/text.d.ts +5 -0
  84. package/dist/core/text.js +12 -0
  85. package/dist/dashboard/acts.js +31 -24
  86. package/dist/dashboard/address.js +4 -1
  87. package/dist/dashboard/api.js +65 -3
  88. package/dist/dashboard/app.js +222 -98
  89. package/dist/dashboard/ask-card.js +169 -0
  90. package/dist/dashboard/asked-dice.js +57 -0
  91. package/dist/dashboard/dice/tray.js +6 -4
  92. package/dist/dashboard/extension-widgets.js +136 -16
  93. package/dist/dashboard/faces.js +6 -4
  94. package/dist/dashboard/help.js +10 -3
  95. package/dist/dashboard/i18n/ar.json +34 -29
  96. package/dist/dashboard/i18n/cs.json +34 -29
  97. package/dist/dashboard/i18n/da.json +34 -29
  98. package/dist/dashboard/i18n/de.json +34 -29
  99. package/dist/dashboard/i18n/el.json +34 -29
  100. package/dist/dashboard/i18n/es.json +34 -29
  101. package/dist/dashboard/i18n/fi.json +34 -29
  102. package/dist/dashboard/i18n/fr.json +34 -29
  103. package/dist/dashboard/i18n/he.json +34 -29
  104. package/dist/dashboard/i18n/hi.json +34 -29
  105. package/dist/dashboard/i18n/hu.json +34 -29
  106. package/dist/dashboard/i18n/is.json +34 -29
  107. package/dist/dashboard/i18n/it.json +34 -29
  108. package/dist/dashboard/i18n/ja.json +34 -29
  109. package/dist/dashboard/i18n/ko.json +34 -29
  110. package/dist/dashboard/i18n/nb.json +34 -29
  111. package/dist/dashboard/i18n/nl.json +34 -29
  112. package/dist/dashboard/i18n/pl.json +34 -29
  113. package/dist/dashboard/i18n/pt.json +34 -29
  114. package/dist/dashboard/i18n/ro.json +34 -29
  115. package/dist/dashboard/i18n/ru.json +34 -29
  116. package/dist/dashboard/i18n/sv.json +34 -29
  117. package/dist/dashboard/i18n/tr.json +34 -29
  118. package/dist/dashboard/i18n/uk.json +34 -29
  119. package/dist/dashboard/i18n/zh.json +34 -29
  120. package/dist/dashboard/icons.js +4 -1
  121. package/dist/dashboard/kit.js +35 -0
  122. package/dist/dashboard/labels.js +1 -0
  123. package/dist/dashboard/pack-card.js +97 -0
  124. package/dist/dashboard/package-page.js +50 -0
  125. package/dist/dashboard/packages.js +180 -24
  126. package/dist/dashboard/page-code.js +248 -0
  127. package/dist/dashboard/party.js +13 -14
  128. package/dist/dashboard/people.js +4 -0
  129. package/dist/dashboard/person-panel.js +110 -0
  130. package/dist/dashboard/place-map-view.js +11 -6
  131. package/dist/dashboard/rolls.js +2 -2
  132. package/dist/dashboard/scene.js +12 -9
  133. package/dist/dashboard/settings.js +55 -9
  134. package/dist/dashboard/sheet.js +21 -13
  135. package/dist/dashboard/status.js +69 -15
  136. package/dist/dashboard/style.css +859 -574
  137. package/dist/dashboard/top.js +75 -25
  138. package/dist/dashboard/turns.js +34 -13
  139. package/dist/dashboard/widgets.js +9 -2
  140. package/dist/dashboard-server.js +246 -11
  141. package/dist/dice/roll-dice.js +1 -1
  142. package/dist/effects/effect.d.ts +7 -4
  143. package/dist/effects/effect.js +12 -9
  144. package/dist/extensions/engine.d.ts +4 -0
  145. package/dist/extensions/engine.js +74 -0
  146. package/dist/extensions/extension.d.ts +28 -33
  147. package/dist/extensions/extension.js +37 -46
  148. package/dist/extensions/index.d.ts +4 -3
  149. package/dist/extensions/index.js +5 -2
  150. package/dist/extensions/packages.d.ts +14 -0
  151. package/dist/extensions/packages.js +148 -12
  152. package/dist/extensions/words.d.ts +2 -1
  153. package/dist/extensions/words.js +5 -4
  154. package/dist/index.d.ts +1 -3
  155. package/dist/mcp-server.js +52 -15
  156. package/dist/page-words.d.ts +4 -0
  157. package/dist/page-words.js +4 -4
  158. package/dist/page.d.ts +218 -0
  159. package/dist/page.js +2 -0
  160. package/dist/pages/index.d.ts +1 -1
  161. package/dist/pages/index.js +1 -1
  162. package/dist/pages/load.d.ts +7 -1
  163. package/dist/pages/load.js +10 -5
  164. package/dist/pages/page-file.js +1 -1
  165. package/dist/pages/stack-writes.js +5 -4
  166. package/dist/pages/standard-fields.d.ts +2 -0
  167. package/dist/pages/standard-fields.js +8 -1
  168. package/dist/pages/world.d.ts +8 -0
  169. package/dist/pages/world.js +9 -2
  170. package/dist/systems/game-system.d.ts +61 -30
  171. package/dist/systems/game-system.js +159 -50
  172. package/dist/systems/index.d.ts +3 -3
  173. package/dist/systems/index.js +3 -3
  174. package/dist/systems/system-code.d.ts +29 -88
  175. package/dist/systems/system-code.js +68 -23
  176. package/dist/systems/words.d.ts +2 -0
  177. package/dist/systems/words.js +11 -0
  178. package/dist/testing.d.ts +76 -0
  179. package/dist/testing.js +197 -0
  180. package/instructions/combat.md +2 -2
  181. package/instructions/core.md +2 -2
  182. package/instructions/dashboard.md +1 -1
  183. package/instructions/mentor-tutorial.md +1 -1
  184. package/instructions/play.md +2 -2
  185. package/instructions/setup.md +1 -1
  186. package/package.json +15 -2
  187. package/systems/5e/LICENSE.md +13 -3
  188. package/systems/5e/dist/dying.js +83 -16
  189. package/systems/5e/dist/index.js +2 -2
  190. package/systems/5e/dist/page-style.js +634 -0
  191. package/systems/5e/dist/page.js +166 -0
  192. package/systems/5e/dist/shown.js +23 -0
  193. package/systems/5e/instructions/combat.md +1 -0
  194. package/systems/5e/package.json +4 -2
  195. package/systems/5e/system.yaml +35 -7
  196. package/systems/5e/versions/srd-5.1/system.yaml +2 -0
  197. package/systems/5e/words/ar.yaml +30 -0
  198. package/systems/5e/words/cs.yaml +30 -0
  199. package/systems/5e/words/da.yaml +30 -0
  200. package/systems/5e/words/de.yaml +30 -0
  201. package/systems/5e/words/el.yaml +30 -0
  202. package/systems/5e/words/es.yaml +30 -0
  203. package/systems/5e/words/fi.yaml +30 -0
  204. package/systems/5e/words/fr.yaml +30 -0
  205. package/systems/5e/words/he.yaml +30 -0
  206. package/systems/5e/words/hi.yaml +30 -0
  207. package/systems/5e/words/hu.yaml +30 -0
  208. package/systems/5e/words/is.yaml +30 -0
  209. package/systems/5e/words/it.yaml +30 -0
  210. package/systems/5e/words/ja.yaml +30 -0
  211. package/systems/5e/words/ko.yaml +30 -0
  212. package/systems/5e/words/nb.yaml +30 -0
  213. package/systems/5e/words/nl.yaml +30 -0
  214. package/systems/5e/words/pl.yaml +30 -0
  215. package/systems/5e/words/pt.yaml +30 -0
  216. package/systems/5e/words/ro.yaml +30 -0
  217. package/systems/5e/words/ru.yaml +30 -0
  218. package/systems/5e/words/sv.yaml +30 -0
  219. package/systems/5e/words/tr.yaml +30 -0
  220. package/systems/5e/words/uk.yaml +30 -0
  221. package/systems/5e/words/zh.yaml +30 -0
  222. package/dist/commands/game-extensions.d.ts +0 -34
  223. package/dist/commands/game-extensions.js +0 -182
  224. package/dist/commands/game-system-code.d.ts +0 -25
  225. package/dist/commands/game-system-code.js +0 -172
  226. package/dist/dashboard/death-save.js +0 -67
  227. package/dist/dashboard/dying.js +0 -46
  228. package/dist/dashboard/save-outcome.js +0 -42
  229. package/dist/dashboard/spend.js +0 -115
  230. package/dist/extensions/api.d.ts +0 -155
  231. /package/dist/{extensions/api.js → core/package-api.js} +0 -0
@@ -2,16 +2,17 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-ru
2
2
  // The player's dashboard (D-269, D-272, D-276): the master and the campaign on top, the party's strip, what the master asks, the sheet of whom the address
3
3
  // names and the table beside it, the turns of a fight, the followed quest and the rolls (D-279), read again whenever the server says something changed.
4
4
  import { render } from "preact";
5
- import { useEffect, useRef, useState } from "preact/hooks";
5
+ import { useEffect, useMemo, useRef, useState } from "preact/hooks";
6
6
  import { PlayerActsContext } from "./act-names.js";
7
7
  import { ActSheet } from "./act-sheet.js";
8
8
  import { ActStrip } from "./act-strip.js";
9
- import { saidStates } from "./acts.js";
9
+ import { saidStates, setSystemVerbs } from "./acts.js";
10
10
  import { readAddress, sectionAddress } from "./address.js";
11
- import { answer, readActs, readAsked, readView, readWidgets, sayAct, sendSeen, withdrawAct } from "./api.js";
11
+ import { answer, closeCard, readActs, readAsked, readModules, readView, readWidgets, sayAct, sendSeen, withdrawAct } from "./api.js";
12
+ import { AskCard } from "./ask-card.js";
13
+ import { AskedDice } from "./asked-dice.js";
12
14
  import { AskedBanner } from "./asked.js";
13
15
  import { useMedia } from "./card.js";
14
- import { DeathSaveCard } from "./death-save.js";
15
16
  import { DiceTray } from "./dice/tray.js";
16
17
  import { WidgetCards, WidgetsContext } from "./extension-widgets.js";
17
18
  import { PageFoot } from "./footer.js";
@@ -19,20 +20,23 @@ import { readFree, withFree, writeFree } from "./free-rolls.js";
19
20
  import { Help } from "./help.js";
20
21
  import { Icon } from "./icons.js";
21
22
  import { FollowedQuests, JournalView, QuestEndings } from "./journal.js";
23
+ import { checkOf } from "./labels.js";
22
24
  import { gameNotices, importNotices, Notices } from "./notices.js";
25
+ import { inCard, nextPackCard } from "./pack-card.js";
26
+ import { PackagePage } from "./package-page.js";
23
27
  import { PackagesPage } from "./packages.js";
28
+ import { codeOfModule, ModulesContext, ownKey, preloadModules, useNavPages } from "./page-code.js";
24
29
  import { About } from "./pages.js";
25
30
  import { PartyStrip } from "./party.js";
31
+ import { PeopleContext } from "./people.js";
26
32
  import { rollReaction } from "./reactions.js";
27
33
  import { requestedOf, RequestedRoll } from "./requested.js";
28
34
  import { RollLog } from "./rolls.js";
29
- import { saveOutcome } from "./save-outcome.js";
30
35
  import { SavesView } from "./saves.js";
31
36
  import { SceneView } from "./scene.js";
32
37
  import { SettingsView } from "./settings.js";
33
38
  import { SetupView, useSetup } from "./setup.js";
34
39
  import { MemberSheet } from "./sheet.js";
35
- import { SpendCard } from "./spend.js";
36
40
  import { PlayTable, tableBeside, TableTab, useTableAway } from "./table.js";
37
41
  import { browserLanguage, pageDirection, setLanguage, setSystemWords, t } from "./text.js";
38
42
  import { restoreTheme } from "./theme.js";
@@ -43,7 +47,7 @@ import { WorldView } from "./world.js";
43
47
  const productName = "RPG Engine";
44
48
  // How many of the last rolls the page reads at first, and how many more each time the player asks for older ones (D-302).
45
49
  const firstRolls = 20;
46
- // How long at most what a death save or a die of a rest changed waits for its dice, when they never land.
50
+ // How long at most what a roll from a card or a die of a rest changed waits for its dice, when they never land.
47
51
  const longestHold = 15_000;
48
52
  // How long a sentence the master heard, or one copied for the chat, stays in the strip (D-495).
49
53
  const heardTime = 6000;
@@ -72,15 +76,8 @@ function App() {
72
76
  const [sheetThrow, setSheetThrow] = useState();
73
77
  // The question answered from the sheet or the tray, while the engine rolls it (D-330); the free rolls, in this browser alone.
74
78
  const [answering, setAnswering] = useState();
75
- // The death save asked of the player, a card that stays until its outcome is told (D-461): the question, whether the player rolled, its roll once landed
76
- // with what the system's code wrote of it.
77
- const [saving, setSaving] = useState();
78
- const savingNow = useRef(saving);
79
- savingNow.current = saving;
80
- // The roll that answers it while its dice fly: what it changes of the sheet waits for them (D-461).
79
+ // The roll that answers a card, or a die of a rest, while its dice fly: what it changes of the sheet waits for them (D-461).
81
80
  const holding = useRef();
82
- // The party as last read, never held back: what a death save's roll left of them.
83
- const partyNow = useRef([]);
84
81
  const [free, setFree] = useState([]);
85
82
  // On a wide screen the table stands beside the page, unless the player folded it; folded, or under that width, the turns and the followed quest go back to
86
83
  // the page.
@@ -100,7 +97,17 @@ function App() {
100
97
  // The widgets of the campaign's extensions (D-502), read beside the rest and shown as they come, so that a slow hook never holds the page back; kept as they
101
98
  // were when a reading of them fails, and an answer older than one shown left out.
102
99
  const [widgets, setWidgets] = useState([]);
100
+ const [modules, setModules] = useState([]);
103
101
  const widgetReading = useRef({ asked: 0, shown: 0 });
102
+ const moduleReading = useRef({ asked: 0, shown: 0 });
103
+ // The card of a package's question as last read, even while the dice that changed it fly; the attempts the player let go, with the question then (D-507).
104
+ const packNow = useRef();
105
+ const packsGone = useRef(new Map());
106
+ // In the card of a rest's dice, how many dice were rolled as the player pressed one, until its roll lands.
107
+ const restSent = useRef();
108
+ // The widgets as read while a card's dice fly, which show only once they land, as the rest of what the roll changed: a panel on the party never tells the
109
+ // outcome of a death save before its die (D-461).
110
+ const widgetsHeld = useRef();
104
111
  // Reads view again for whom the address names, or the player character the master calls, and what the master asks; an answer that comes after a newer one
105
112
  // is left out.
106
113
  const read = async () => {
@@ -109,18 +116,35 @@ function App() {
109
116
  void readWidgets().then((read) => {
110
117
  if (widgetsAsked > widgetReading.current.shown) {
111
118
  widgetReading.current.shown = widgetsAsked;
112
- setWidgets(read);
119
+ // Their extensions' page code comes before a card of a roll needs it (D-510).
120
+ preloadModules(read);
121
+ if (holding.current !== undefined || packNow.current?.sent !== undefined) {
122
+ widgetsHeld.current = read;
123
+ }
124
+ else {
125
+ widgetsHeld.current = undefined;
126
+ setWidgets(read);
127
+ }
128
+ }
129
+ }, () => undefined);
130
+ // The page modules of the system and the extensions, for their cards in the pages and their own pages (D-511).
131
+ const modulesAsked = ++moduleReading.current.asked;
132
+ void readModules().then((read) => {
133
+ if (modulesAsked <= moduleReading.current.shown) {
134
+ return;
113
135
  }
136
+ moduleReading.current.shown = modulesAsked;
137
+ preloadModules(read.map(codeOfModule));
138
+ setModules((before) => (JSON.stringify(before) === JSON.stringify(read) ? before : read));
114
139
  }, () => undefined);
115
140
  try {
116
- const [first, told, actsNow] = await Promise.all([readView(undefined, rollsAsked.current), readAsked().catch(() => undefined), readActs().catch(() => undefined)]);
117
- const asked = told;
141
+ const [first, askedNow, actsNow] = await Promise.all([readView(undefined, rollsAsked.current), readAsked().catch(() => undefined), readActs().catch(() => undefined)]);
142
+ const asked = askedNow === undefined ? undefined : askedNow.asked ?? undefined;
118
143
  // With more than one player character, a question for one elsewhere puts them in the foreground: the place, the map and the squares are theirs (VIEW-12).
119
144
  const here = first.kind === "overview" && (first.place?.here ?? []).some((one) => one.name === asked?.who);
120
145
  const focus = first.kind === "overview" && first.foreground !== undefined && asked?.who !== first.foreground && !here ? playerNamed(first.party, asked?.who)?.name : undefined;
121
146
  const overview = focus === undefined ? first : await readView(undefined, rollsAsked.current, focus).catch(() => first);
122
147
  const party = overview.kind === "overview" ? overview.party : [];
123
- partyNow.current = party;
124
148
  const rolls = overview.kind === "overview" ? overview.rolls : [];
125
149
  const address = readAddress(window.location.hash);
126
150
  const scene = overview.kind === "overview" ? overview.openScene : undefined;
@@ -142,6 +166,7 @@ function App() {
142
166
  const language = (overview.kind === "overview" || overview.kind === "none" ? overview.language : undefined) ?? browserLanguage();
143
167
  await setLanguage(language);
144
168
  setSystemWords(overview.kind === "overview" ? overview.words : undefined);
169
+ setSystemVerbs(overview.kind === "overview" ? overview.verbs : undefined);
145
170
  if (number === reading.current) {
146
171
  document.documentElement.lang = language ?? "en";
147
172
  document.documentElement.dir = pageDirection();
@@ -172,15 +197,19 @@ function App() {
172
197
  setThrown(asking);
173
198
  setHeld(asking.id);
174
199
  }
175
- // A death save asked becomes its card; another question takes its place. The roll that answers it holds back what it changes (D-461).
176
- const card = asked?.save === undefined ? (asked === undefined ? savingNow.current : undefined) : savingNow.current?.asked.id === asked.id ? savingNow.current : { asked, save: asked.save };
177
- // Dice landed before what the system's code wrote was read: the outcome as soon as it is.
178
- const shownCard = card?.roll !== undefined && card.outcome === undefined ? toldCard(card, party) : card;
179
- savingNow.current = shownCard;
180
- setSaving(shownCard);
181
- // So does a die of a rest the player spends, whose card shows it once it lands (D-492).
200
+ // A roll from a package's card, as a death save, holds back what it changes until its dice land, its marks too (D-461, D-507); so does a die of a
201
+ // rest the player spends (D-492).
182
202
  const spent = asked?.spend?.rolls.some((roll) => roll.id === asking?.id) === true;
183
- if (asking !== undefined && ((card !== undefined && card.roll === undefined) || spent) && holding.current === undefined) {
203
+ const packRolled = packNow.current?.sent !== undefined;
204
+ const next = askedNow === undefined ? packNow.current : packOf(askedNow);
205
+ // The roll that answers a card is its last, for its drawing to tell (D-510).
206
+ const pack = packRolled && asking !== undefined && next !== undefined ? { ...next, rolled: { total: asking.total, faces: asking.dice.map((die) => die.value) } } : next;
207
+ packNow.current = pack;
208
+ // A die of a rest's card whose roll came with none to wait for, as with no dice to throw: its buttons free at once.
209
+ if (restSent.current !== undefined && (pack?.asked?.spend?.rolls.length ?? 0) > restSent.current && !spent) {
210
+ window.setTimeout(unpressRest);
211
+ }
212
+ if (asking !== undefined && (spent || packRolled) && holding.current === undefined) {
184
213
  holding.current = { roll: asking, timer: window.setTimeout(() => land(asking.id), longestHold) };
185
214
  }
186
215
  setShown((before) => withHeld(before, {
@@ -203,6 +232,7 @@ function App() {
203
232
  place: overview.kind === "overview" ? overview.place : undefined,
204
233
  openScene: overview.kind === "overview" ? overview.openScene : undefined,
205
234
  asked,
235
+ pack,
206
236
  version: before.version + 1,
207
237
  readAt: new Date(),
208
238
  noCharacter: overview.kind === "none",
@@ -217,7 +247,105 @@ function App() {
217
247
  }
218
248
  }
219
249
  };
220
- // The death save's dice, or a rest's die, have landed: its outcome on the card, and the sheet as the roll left it (D-461, D-492).
250
+ // The card of a package's question after a reading (D-507): an attempt asked again is no longer let go; one whose card went unanswered is.
251
+ const packOf = (told) => {
252
+ const key = told.asked?.card?.key;
253
+ if (key !== undefined && packsGone.current.has(key) && packsGone.current.get(key) !== told.asked?.id) {
254
+ packsGone.current.delete(key);
255
+ }
256
+ const next = nextPackCard(packNow.current, told, packsGone.current);
257
+ if (next.let !== undefined) {
258
+ packsGone.current.set(next.let, undefined);
259
+ }
260
+ packNow.current = next.card;
261
+ return next.card;
262
+ };
263
+ // The card shown, and as last read, the same: pressed, closed.
264
+ const setPack = (pack) => {
265
+ packNow.current = pack;
266
+ setShown((before) => ({ ...before, pack, ...(before.pending === undefined ? {} : { pending: { ...before.pending, pack } }) }));
267
+ };
268
+ // A button of a package's card (D-507): the card waits with it pressed while the answer goes; the core's change of mind takes the card away with it.
269
+ const answerPack = async (index) => {
270
+ const card = packNow.current;
271
+ const asked = card?.asked;
272
+ if (card === undefined || asked === undefined || card.ended === true || card.sent !== undefined) {
273
+ return;
274
+ }
275
+ if (asked.spend !== undefined) {
276
+ await spendFromCard(card, asked, index);
277
+ return;
278
+ }
279
+ const leaves = checkOf(asked.labels[index] ?? "", asked.title) === undefined && (asked.buttons?.[index] ?? undefined) === undefined;
280
+ if (leaves) {
281
+ packsGone.current.set(card.key, asked.id);
282
+ }
283
+ setPack(leaves ? undefined : { ...card, sent: index });
284
+ try {
285
+ await answer(asked.id, index);
286
+ }
287
+ catch {
288
+ packsGone.current.delete(card.key);
289
+ setPack({ ...card, sent: undefined });
290
+ }
291
+ void read();
292
+ };
293
+ // A button of the card of a rest's dice (ASK-14): a die of a counter, which the question keeps; the last, the end, which takes the card away with it.
294
+ const spendFromCard = async (card, asked, index) => {
295
+ const dice = asked.spend?.dice[index];
296
+ // The die's button waits, pressed, until its roll lands (or the engine refuses it).
297
+ if (dice !== undefined) {
298
+ restSent.current = asked.spend?.rolls.length;
299
+ setPack({ ...card, sent: index });
300
+ if (!await answerSpend(asked.id, { spend: dice.field })) {
301
+ restSent.current = undefined;
302
+ setPack(packNow.current === undefined ? undefined : { ...packNow.current, sent: undefined });
303
+ }
304
+ return;
305
+ }
306
+ const focused = (document.activeElement?.closest(".ask-card") ?? null) !== null;
307
+ packsGone.current.set(card.key, asked.id);
308
+ setPack(undefined);
309
+ if (await answerSpend(asked.id, 0)) {
310
+ if (focused) {
311
+ focusAfterCard();
312
+ }
313
+ return;
314
+ }
315
+ packsGone.current.delete(card.key);
316
+ setPack(card);
317
+ };
318
+ // The player's own words in place of a button (ASK-10): taken, the card goes with its question, as the master hears them.
319
+ const sayPack = async (text, focused) => {
320
+ const card = packNow.current;
321
+ const asked = card?.asked;
322
+ if (card === undefined || asked === undefined || card.ended === true || card.sent !== undefined) {
323
+ return false;
324
+ }
325
+ const taken = await answer(asked.id, text).catch(() => false);
326
+ if (taken) {
327
+ packsGone.current.set(card.key, asked.id);
328
+ setPack(undefined);
329
+ if (focused) {
330
+ focusAfterCard();
331
+ }
332
+ }
333
+ void read();
334
+ return taken;
335
+ };
336
+ const closePack = (focused) => {
337
+ const key = packNow.current?.key;
338
+ if (key !== undefined) {
339
+ packsGone.current.set(key, undefined);
340
+ // Closed for the server too: no reading, here or on another page, brings it back.
341
+ void closeCard(key);
342
+ }
343
+ setPack(undefined);
344
+ if (focused) {
345
+ focusAfterCard();
346
+ }
347
+ };
348
+ // The dice of a card's roll, or a rest's die, have landed: the card and the sheet as the roll left them (D-461, D-492).
221
349
  const land = (roll) => {
222
350
  const held = holding.current;
223
351
  if (held === undefined || held.roll.id !== roll) {
@@ -225,13 +353,25 @@ function App() {
225
353
  }
226
354
  window.clearTimeout(held.timer);
227
355
  holding.current = undefined;
228
- setSaving((before) => {
229
- if (before === undefined || before.roll !== undefined) {
230
- return before;
231
- }
232
- return { ...toldCard(before, partyNow.current), roll: held.roll };
233
- });
234
356
  setShown((before) => (before.pending === undefined ? before : { ...before, ...before.pending, pending: undefined }));
357
+ unpressRest();
358
+ };
359
+ // The card of a rest's dice, its die landed: its buttons free again, and the widgets read meanwhile shown.
360
+ const unpressRest = () => {
361
+ const card = packNow.current;
362
+ restSent.current = undefined;
363
+ showHeldWidgets();
364
+ if (card?.asked?.spend !== undefined && card.sent !== undefined) {
365
+ setPack({ ...card, sent: undefined });
366
+ }
367
+ };
368
+ // The widgets read while a card's dice flew, once they have landed.
369
+ const showHeldWidgets = () => {
370
+ const held = widgetsHeld.current;
371
+ widgetsHeld.current = undefined;
372
+ if (held !== undefined) {
373
+ setWidgets(held);
374
+ }
235
375
  };
236
376
  // A card of the master's closed, the focus goes to the notice of the turn, or else to the page (D-461, D-492).
237
377
  const focusAfterCard = () => {
@@ -241,25 +381,6 @@ function App() {
241
381
  (document.querySelector(".turn-notice") ?? page)?.focus({ preventScroll: true });
242
382
  });
243
383
  };
244
- const closeSave = () => {
245
- setSaving(undefined);
246
- focusAfterCard();
247
- };
248
- // The player rolls the death save from its card, as from a check's button.
249
- const rollSave = async () => {
250
- const id = saving?.asked.id;
251
- if (id === undefined) {
252
- return;
253
- }
254
- setSaving((before) => (before === undefined ? before : { ...before, sent: true }));
255
- try {
256
- await answer(id, 0);
257
- }
258
- catch {
259
- setSaving((before) => (before === undefined ? before : { ...before, sent: false }));
260
- }
261
- void read();
262
- };
263
384
  // A new roll's face on the robot, for a moment, when the roll is remarkable (D-305, 7).
264
385
  const react = (roll, party) => {
265
386
  const reaction = rollReaction(roll, party.map((member) => member.name));
@@ -346,7 +467,12 @@ function App() {
346
467
  void read();
347
468
  return taken;
348
469
  };
349
- const requested = live ? requestedOf(answering === shown.asked?.id ? undefined : shown.asked, (index) => void answerFrom(index)) : undefined;
470
+ // The packages' own pages, as tabs or in their menu (D-512).
471
+ const ownPages = useNavPages(modules);
472
+ // Whose portraits an extension's drawing may show (D-510): the party, then those at the place.
473
+ const people = [...shown.party, ...(shown.place?.here ?? []).filter((one) => !shown.party.some((member) => member.name === one.name))];
474
+ // A package's question is answered from its card alone (D-507).
475
+ const requested = live ? requestedOf(answering === shown.asked?.id || inCard(shown.asked) ? undefined : shown.asked, (index) => void answerFrom(index)) : undefined;
350
476
  // The open scene goes by turns, as a fight, and whether the turn is a player character's (D-314, D-315, D-444); whose, by name, when there are more.
351
477
  const fight = hasTurns(shown.openScene);
352
478
  const turnOf = fight ? playerNamed(shown.party, shown.openScene?.turn) : undefined;
@@ -354,7 +480,6 @@ function App() {
354
480
  const turnName = several ? turnOf?.name : undefined;
355
481
  // The player character the master's question is for, named on it when there are more (D-480 (7)).
356
482
  const asker = several ? playerNamed(shown.party, shown.asked?.who) : undefined;
357
- const dying = shown.party.find((candidate) => candidate.name === saving?.asked.who) ?? lead;
358
483
  // The game gone, what the master had not heard is lost with the chat: the strip says so, even once the game is back (D-495).
359
484
  useEffect(() => {
360
485
  if (!live) {
@@ -376,7 +501,7 @@ function App() {
376
501
  setActProblem(undefined);
377
502
  };
378
503
  // With a question of the master's open, the sentence answers it (ASK-10); else it rings the master, or, in a chat that hears nothing by itself, is copied.
379
- const question = saving === undefined && shown.asked !== undefined && shown.asked.spend === undefined && shown.asked.save === undefined ? shown.asked : undefined;
504
+ const question = shown.asked !== undefined && shown.asked.spend === undefined && shown.asked.forced !== true ? shown.asked : undefined;
380
505
  const reply = question !== undefined ? "answer" : acts?.bell === true ? "tell" : "copy";
381
506
  const sendAct = async (text) => {
382
507
  setActProblem(undefined);
@@ -433,6 +558,10 @@ function App() {
433
558
  document.title = shown.asked === undefined ? name : `● ${shown.asked.title} · ${name}`;
434
559
  }, [shown.campaign, shown.asked?.id]);
435
560
  const setup = useSetup(shown.version);
561
+ // While a package's card is there, its widget beside the page would show the same twice (D-507); the same list until either changes, as the cards that
562
+ // read their widget's data read it again when it does.
563
+ const packWidget = shown.pack?.widget;
564
+ const pageWidgets = useMemo(() => (packWidget === undefined ? widgets : widgets.filter((widget) => widget.id !== packWidget)), [widgets, packWidget]);
436
565
  // While the campaign is in its setup, the page is its first configuration, as a portal's (D-370).
437
566
  const inSetup = setup?.mode === "setup";
438
567
  // The page's own messages, over it (D-298): a problem, the game away, a word to know.
@@ -456,41 +585,41 @@ function App() {
456
585
  setFree([]);
457
586
  writeFree(shown.campaign, []);
458
587
  } }, shown.campaign));
459
- return (_jsx(RequestedRoll.Provider, { value: requested, children: _jsx(WidgetsContext.Provider, { value: widgets, children: _jsx(PlayerActsContext.Provider, { value: playerActs, children: _jsxs("div", { class: live ? "page" : "page stale", children: [!inSetup && (_jsx(Top, { campaign: shown.campaign, product: productName, system: shown.system?.name, now: shown.now, calendar: shown.calendar, path: shown.place === undefined ? undefined : [...shown.place.within, shown.place.name], live: live, mood: shown.masterMood, moment: moment, asleep: !live && shown.readAt !== undefined, section: address.section, fight: fight, yourTurn: yourTurn, turnName: turnName })), inSetup && _jsx(SetupCorner, { live: live }), _jsx(Notices, { notices: notices }), live && saving !== undefined && (_jsx(DeathSaveCard, { asked: saving.asked, save: saving.save, member: dying, name: several ? dying?.name : undefined, roll: saving.roll, outcome: saving.outcome, rolling: saving.sent === true || answering === saving.asked.id || shown.asked?.id !== saving.asked.id, onRoll: () => void rollSave(), onClose: closeSave }, saving.asked.id)), live && saving === undefined && shown.asked?.spend !== undefined && (_jsx(SpendCard, { asked: shown.asked, spend: shown.asked.spend, member: shown.party.find((candidate) => candidate.name === shown.asked?.spend?.who), flying: holding.current?.roll.id, onSpend: (field) => answerSpend(shown.asked?.id, { spend: field }), onDone: async (focused) => {
460
- const taken = await answerSpend(shown.asked?.id, 0);
461
- if (taken && focused) {
462
- focusAfterCard();
463
- }
464
- return taken;
465
- } }, shown.asked.id)), live && saving === undefined && shown.asked && shown.asked.spend === undefined && (_jsx(AskedBanner, { asked: shown.asked, yourTurn: yourTurn && (asker === undefined || asker.name === turnOf?.name), who: asker, turnName: turnName, map: shown.place?.map, place: shown.place?.name, answered: answering === shown.asked.id, onAnswered: () => void read() })), inSetup
466
- ? _jsx(SetupView, { setup: setup })
467
- : (_jsxs(_Fragment, { children: [live && yourTurn && address.section !== "scene" && shown.asked === undefined && saving === undefined && (_jsxs("a", { class: "turn-notice", href: sectionAddress("scene"), children: [_jsx(Icon, { name: "combat" }), _jsx("span", { children: [turnWords(turnName), shown.openScene?.round === undefined ? "" : t("Round {round}", { round: shown.openScene.round })].filter((part) => part !== "").join(" · ") }), _jsx("span", { class: "turn-notice-go", children: t("Go to the scene") })] })), _jsx(Notices, { notices: importing }), !table && _jsx(QuestEndings, { version: shown.version, campaign: shown.campaign }), address.section === "party" && _jsx(PartyStrip, { party: shown.party, chosen: shown.chosen, scene: shown.openScene }), _jsxs("div", { class: "body", children: [_jsxs("main", { children: [address.section === "about" && _jsx(About, { product: productName, system: shown.system }), address.section === "help" && _jsx(Help, {}), !table && address.section === "scene" && _jsx(FollowedQuests, { version: shown.version, campaign: shown.campaign }), address.section === "scene" && (_jsx(SceneView, { place: shown.place, scene: shown.openScene, actor: actor, foreground: shown.foreground, several: several, party: shown.party, turnsBeside: table, onShowCard: (name) => {
468
- handed.current = { who: name, turn: turnKey(shown.openScene) };
469
- void read();
470
- }, own: {
471
- sheet: shown.chosen === actor?.name ? shown.sheet : [],
472
- cards: shown.cards,
473
- version: shown.version,
474
- onRoll: throwFromSheet,
475
- } })), address.section === "world" && _jsx(WorldView, { version: shown.version, lead: lead, players: many ? players : undefined, tab: address.tab, item: address.name }), address.section === "settings" && _jsx(SettingsView, { version: shown.version, several: many }), address.section === "saves" && _jsx(SavesView, { version: shown.version, campaign: shown.campaign, several: many }), address.section === "packages" && _jsx(PackagesPage, { version: shown.version, tab: address.tab }), address.section === "journal" && _jsx(JournalView, { version: shown.version, campaign: shown.campaign, tab: address.tab, item: address.name }), address.section === "party" && member && (_jsx(PlayerActsContext.Provider, { value: member.role === "pc" || playerActs === undefined ? playerActs : { ...playerActs, actions: {} }, children: _jsx(MemberSheet, { member: member, headline: shown.headline, sheet: shown.sheet, cards: shown.cards, text: shown.text, knownBy: shown.knownBy, story: shown.story, version: shown.version, onRoll: throwFromSheet, scene: shown.openScene }, member.name) }))] }), table
476
- ? (_jsxs(PlayTable, { entering: tableMoved, onFold: () => {
477
- setTableMoved(true);
478
- setTableAway(true);
479
- }, children: [fight && _jsx(TurnsCard, { scene: shown.openScene, party: shown.party, several: several, beside: true }), _jsx(QuestEndings, { version: shown.version, campaign: shown.campaign, beside: true }), _jsx(FollowedQuests, { version: shown.version, campaign: shown.campaign, beside: true }), _jsx(WidgetCards, { place: "side" }), rolls] }))
480
- : wide
481
- ? (_jsx(TableTab, { fight: fight, focused: tableMoved, onOpen: () => {
482
- setTableMoved(true);
483
- setTableAway(false);
484
- } }))
485
- : (_jsxs(_Fragment, { children: [_jsx(WidgetCards, { place: "side" }), rolls] }))] }), _jsx(PageFoot, { product: productName, system: shown.system })] })), _jsx(DiceTray, { requested: thrown, sheetThrow: sheetThrow, party: shown.party, onLanded: land, onShown: (id) => {
486
- setHeld((now) => (now === id ? undefined : now));
487
- if (thrown?.id === id) {
488
- react(thrown, shown.party);
489
- }
490
- }, onFree: (roll) => {
491
- setFree((before) => withFree(shown.campaign, before, roll));
492
- setFresh((before) => new Set([...before, roll.id]));
493
- } }), acting !== undefined && (_jsx(ActSheet, { start: acting.start, self: several ? member?.name : undefined, place: actsElsewhere === undefined ? shown.place : actPlace?.who === actsElsewhere ? actPlace.place : undefined, scene: shown.openScene, companions: shown.party.filter((one) => one.role === "companion").map((one) => one.name), reply: reply, onSend: sendAct, onClose: closeAct })), _jsx(ActStrip, { entries: strip, problem: actProblem, onWithdraw: (id) => void withdraw(id), onCopy: (id, text) => void copyAct(text).then((done) => (done ? dismissAct(id) : setActProblem(t("Copy did not work: select the words and copy them yourself.")))), onDismiss: dismissAct })] }) }) }) }));
588
+ return (_jsx(ModulesContext.Provider, { value: modules, children: _jsx(PeopleContext.Provider, { value: people, children: _jsx(RequestedRoll.Provider, { value: requested, children: _jsx(WidgetsContext.Provider, { value: pageWidgets, children: _jsx(PlayerActsContext.Provider, { value: playerActs, children: _jsxs("div", { class: live ? "page" : "page stale", children: [!inSetup && (_jsx(Top, { campaign: shown.campaign, product: productName, system: shown.system?.name, now: shown.now, calendar: shown.calendar, path: shown.place === undefined ? undefined : [...shown.place.within, shown.place.name], live: live, mood: shown.masterMood, moment: moment, asleep: !live && shown.readAt !== undefined, section: address.section, fight: fight, yourTurn: yourTurn, turnName: turnName, ownPages: ownPages, ownShown: address.section === "pkg" && address.tab !== undefined && address.name !== undefined ? ownKey({ package: address.tab, name: address.name }) : undefined })), inSetup && _jsx(SetupCorner, { live: live }), _jsx(Notices, { notices: notices }), live && shown.pack !== undefined && (_jsx(AskCard, { card: shown.pack, name: several ? playerNamed(shown.party, shown.pack.asked?.who)?.name ?? turnName : undefined, widget: widgets.find((widget) => widget.id === shown.pack?.widget), onAnswer: (index) => void answerPack(index), onWords: sayPack, onClose: closePack }, shown.pack.key)), live && shown.pack === undefined && shown.asked?.spend !== undefined && !inCard(shown.asked) && (_jsx(AskedDice, { asked: shown.asked, spend: shown.asked.spend, flying: holding.current?.roll.id, onSpend: (field) => answerSpend(shown.asked?.id, { spend: field }), onDone: async (focused) => {
589
+ const taken = await answerSpend(shown.asked?.id, 0);
590
+ if (taken && focused) {
591
+ focusAfterCard();
592
+ }
593
+ return taken;
594
+ } }, shown.asked.id)), live && shown.pack === undefined && shown.asked && shown.asked.spend === undefined && !inCard(shown.asked) && (_jsx(AskedBanner, { asked: shown.asked, yourTurn: yourTurn && (asker === undefined || asker.name === turnOf?.name), who: asker, turnName: turnName, map: shown.place?.map, place: shown.place?.name, answered: answering === shown.asked.id, onAnswered: () => void read() })), inSetup
595
+ ? _jsx(SetupView, { setup: setup })
596
+ : (_jsxs(_Fragment, { children: [live && yourTurn && address.section !== "scene" && shown.asked === undefined && shown.pack === undefined && (_jsxs("a", { class: "turn-notice", href: sectionAddress("scene"), children: [_jsx(Icon, { name: "combat" }), _jsx("span", { children: [turnWords(turnName), shown.openScene?.round === undefined ? "" : t("Round {round}", { round: shown.openScene.round })].filter((part) => part !== "").join(" · ") }), _jsx("span", { class: "turn-notice-go", children: t("Go to the scene") })] })), _jsx(Notices, { notices: importing }), !table && _jsx(QuestEndings, { version: shown.version, campaign: shown.campaign }), address.section === "party" && _jsx(PartyStrip, { party: shown.party, chosen: shown.chosen, scene: shown.openScene }), _jsxs("div", { class: "body", children: [_jsxs("main", { children: [address.section === "about" && _jsx(About, { product: productName, system: shown.system }), address.section === "help" && _jsx(Help, {}), !table && address.section === "scene" && _jsx(FollowedQuests, { version: shown.version, campaign: shown.campaign }), address.section === "scene" && (_jsx(SceneView, { place: shown.place, scene: shown.openScene, actor: actor, foreground: shown.foreground, several: several, party: shown.party, turnsBeside: table, onShowCard: (name) => {
597
+ handed.current = { who: name, turn: turnKey(shown.openScene) };
598
+ void read();
599
+ }, own: {
600
+ sheet: shown.chosen === actor?.name ? shown.sheet : [],
601
+ cards: shown.cards,
602
+ version: shown.version,
603
+ onRoll: throwFromSheet,
604
+ } })), address.section === "world" && _jsx(WorldView, { version: shown.version, lead: lead, players: many ? players : undefined, tab: address.tab, item: address.name }), address.section === "settings" && _jsx(SettingsView, { version: shown.version, several: many }), address.section === "saves" && _jsx(SavesView, { version: shown.version, campaign: shown.campaign, several: many }), address.section === "packages" && _jsx(PackagesPage, { version: shown.version, tab: address.tab }), address.section === "pkg" && _jsx(PackagePage, { name: address.tab, page: address.name }), address.section === "journal" && _jsx(JournalView, { version: shown.version, campaign: shown.campaign, tab: address.tab, item: address.name }), address.section === "party" && member && (_jsx(PlayerActsContext.Provider, { value: member.role === "pc" || playerActs === undefined ? playerActs : { ...playerActs, actions: {} }, children: _jsx(MemberSheet, { member: member, headline: shown.headline, sheet: shown.sheet, cards: shown.cards, text: shown.text, knownBy: shown.knownBy, story: shown.story, version: shown.version, onRoll: throwFromSheet, scene: shown.openScene }, member.name) }))] }), table
605
+ ? (_jsxs(PlayTable, { entering: tableMoved, onFold: () => {
606
+ setTableMoved(true);
607
+ setTableAway(true);
608
+ }, children: [fight && _jsx(TurnsCard, { scene: shown.openScene, party: shown.party, several: several, beside: true }), _jsx(QuestEndings, { version: shown.version, campaign: shown.campaign, beside: true }), _jsx(FollowedQuests, { version: shown.version, campaign: shown.campaign, beside: true }), _jsx(WidgetCards, { place: "side" }), rolls] }))
609
+ : wide
610
+ ? (_jsx(TableTab, { fight: fight, focused: tableMoved, onOpen: () => {
611
+ setTableMoved(true);
612
+ setTableAway(false);
613
+ } }))
614
+ : (_jsxs(_Fragment, { children: [_jsx(WidgetCards, { place: "side" }), rolls] }))] }), _jsx(PageFoot, { product: productName, system: shown.system })] })), _jsx(DiceTray, { requested: thrown, sheetThrow: sheetThrow, party: shown.party, onLanded: land, onShown: (id) => {
615
+ setHeld((now) => (now === id ? undefined : now));
616
+ if (thrown?.id === id) {
617
+ react(thrown, shown.party);
618
+ }
619
+ }, onFree: (roll) => {
620
+ setFree((before) => withFree(shown.campaign, before, roll));
621
+ setFresh((before) => new Set([...before, roll.id]));
622
+ } }), acting !== undefined && (_jsx(ActSheet, { start: acting.start, self: several ? member?.name : undefined, place: actsElsewhere === undefined ? shown.place : actPlace?.who === actsElsewhere ? actPlace.place : undefined, scene: shown.openScene, companions: shown.party.filter((one) => one.role === "companion").map((one) => one.name), reply: reply, onSend: sendAct, onClose: closeAct })), _jsx(ActStrip, { entries: strip, problem: actProblem, onWithdraw: (id) => void withdraw(id), onCopy: (id, text) => void copyAct(text).then((done) => (done ? dismissAct(id) : setActProblem(t("Copy did not work: select the words and copy them yourself.")))), onDismiss: dismissAct })] }) }) }) }) }) }));
494
623
  }
495
624
  /** The player character of the party by their name; undefined for anyone else, or none. */
496
625
  function playerNamed(party, name) {
@@ -509,13 +638,7 @@ function calledOf(party, section, asked, scene, foreground) {
509
638
  function turnKey(scene) {
510
639
  return hasTurns(scene) ? `${scene.title} ${scene.since ?? ""} ${scene.round ?? ""} ${scene.turn ?? ""}` : "";
511
640
  }
512
- /** A death save's card with its outcome, as what the system's code wrote left who rolled it, in the party as last read (D-461). */
513
- function toldCard(card, party) {
514
- const who = card.asked.who;
515
- const after = party.find((member) => (who === undefined ? member.role === "pc" : member.name === who));
516
- return { ...card, outcome: after === undefined ? undefined : saveOutcome(card.save, after) };
517
- }
518
- /** The page as read now; while a death save's dice fly, with the sheet and the fight as they were, what the roll changed kept until they land (D-461). */
641
+ /** The page as read now; while a card's dice fly, with the sheet and the fight as they were, what the roll changed kept until they land (D-461). */
519
642
  function withHeld(before, next, hold) {
520
643
  if (!hold) {
521
644
  return { ...next, pending: undefined };
@@ -530,6 +653,7 @@ function withHeld(before, next, hold) {
530
653
  knownBy: shown.knownBy,
531
654
  story: shown.story,
532
655
  openScene: shown.openScene,
656
+ pack: shown.pack,
533
657
  });
534
658
  return { ...next, ...steady(before), pending: steady(next) };
535
659
  }