rpg-engine 0.15.0 → 0.16.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 (486) hide show
  1. package/dist/campaign/index.d.ts +1 -1
  2. package/dist/campaign/index.js +1 -1
  3. package/dist/campaign/settings.d.ts +6 -0
  4. package/dist/campaign/settings.js +22 -1
  5. package/dist/cli/cli.js +1 -1
  6. package/dist/cli/command-line.js +1 -1
  7. package/dist/commands/advance.d.ts +1 -1
  8. package/dist/commands/advance.js +6 -6
  9. package/dist/commands/ask.js +7 -7
  10. package/dist/commands/change/amounts.d.ts +32 -0
  11. package/dist/commands/change/amounts.js +150 -0
  12. package/dist/commands/change/change.d.ts +4 -54
  13. package/dist/commands/change/change.js +19 -749
  14. package/dist/commands/change/damage.d.ts +30 -0
  15. package/dist/commands/change/damage.js +73 -2
  16. package/dist/commands/change/dice.d.ts +34 -0
  17. package/dist/commands/change/dice.js +59 -0
  18. package/dist/commands/change/fields.d.ts +37 -0
  19. package/dist/commands/change/fields.js +156 -0
  20. package/dist/commands/change/holder.d.ts +48 -0
  21. package/dist/commands/change/holder.js +162 -0
  22. package/dist/commands/change/recipe-pace.js +1 -1
  23. package/dist/commands/change/recipe.d.ts +58 -0
  24. package/dist/commands/change/recipe.js +179 -0
  25. package/dist/commands/choices.js +3 -3
  26. package/dist/commands/config/config.d.ts +15 -0
  27. package/dist/commands/config/config.js +355 -0
  28. package/dist/commands/config/custom-levels.d.ts +7 -0
  29. package/dist/commands/config/custom-levels.js +32 -0
  30. package/dist/commands/{config.d.ts → config/dashboard.d.ts} +2 -24
  31. package/dist/commands/config/dashboard.js +171 -0
  32. package/dist/commands/config/entries.d.ts +17 -0
  33. package/dist/commands/config/entries.js +76 -0
  34. package/dist/commands/config/news.d.ts +7 -0
  35. package/dist/commands/config/news.js +88 -0
  36. package/dist/commands/config/shown.d.ts +9 -0
  37. package/dist/commands/config/shown.js +80 -0
  38. package/dist/commands/config/words.d.ts +27 -0
  39. package/dist/commands/config/words.js +204 -0
  40. package/dist/commands/effect.js +9 -9
  41. package/dist/commands/find.js +1 -1
  42. package/dist/commands/image.js +6 -6
  43. package/dist/commands/import/import.d.ts +0 -2
  44. package/dist/commands/import/import.js +45 -44
  45. package/dist/commands/import/run.js +1 -1
  46. package/dist/commands/index.js +3 -3
  47. package/dist/commands/init.js +2 -2
  48. package/dist/commands/install.js +1 -1
  49. package/dist/commands/instructions.js +6 -6
  50. package/dist/commands/mode.d.ts +2 -2
  51. package/dist/commands/mode.js +8 -8
  52. package/dist/commands/mood.js +4 -4
  53. package/dist/commands/move.js +10 -10
  54. package/dist/commands/package/consent.d.ts +11 -0
  55. package/dist/commands/package/consent.js +52 -0
  56. package/dist/commands/package/here.d.ts +51 -0
  57. package/dist/commands/package/here.js +128 -0
  58. package/dist/commands/package/install.d.ts +10 -0
  59. package/dist/commands/package/install.js +337 -0
  60. package/dist/commands/package/package.d.ts +18 -0
  61. package/dist/commands/package/package.js +236 -0
  62. package/dist/commands/package/result.d.ts +90 -0
  63. package/dist/commands/package/result.js +1 -0
  64. package/dist/commands/package/uninstall.d.ts +6 -0
  65. package/dist/commands/package/uninstall.js +70 -0
  66. package/dist/commands/rename.js +3 -3
  67. package/dist/commands/reveal.js +5 -5
  68. package/dist/commands/roll/roll.js +11 -9
  69. package/dist/commands/roll/tables.js +1 -1
  70. package/dist/commands/rules.d.ts +2 -2
  71. package/dist/commands/rules.js +3 -3
  72. package/dist/commands/save.d.ts +1 -1
  73. package/dist/commands/save.js +2 -2
  74. package/dist/commands/scene/close.d.ts +18 -0
  75. package/dist/commands/scene/close.js +179 -0
  76. package/dist/commands/scene/members.d.ts +14 -0
  77. package/dist/commands/scene/members.js +32 -0
  78. package/dist/commands/scene/open.d.ts +6 -0
  79. package/dist/commands/scene/open.js +298 -0
  80. package/dist/commands/scene/result.d.ts +98 -0
  81. package/dist/commands/scene/result.js +2 -0
  82. package/dist/commands/{scene.d.ts → scene/scene.d.ts} +10 -36
  83. package/dist/commands/scene/scene.js +210 -0
  84. package/dist/commands/scene/turns.d.ts +18 -0
  85. package/dist/commands/scene/turns.js +229 -0
  86. package/dist/commands/shared/{adventures.d.ts → books/adventures.d.ts} +5 -3
  87. package/dist/commands/shared/{adventures.js → books/adventures.js} +23 -19
  88. package/dist/commands/shared/{library-reader.js → books/library-reader.js} +3 -3
  89. package/dist/commands/shared/{library.d.ts → books/library.d.ts} +2 -2
  90. package/dist/commands/shared/{library.js → books/library.js} +9 -9
  91. package/dist/commands/shared/{rules.d.ts → books/rules.d.ts} +2 -2
  92. package/dist/commands/shared/{rules.js → books/rules.js} +5 -5
  93. package/dist/commands/shared/{system-texts.d.ts → books/system-texts.d.ts} +2 -2
  94. package/dist/commands/shared/{system-texts.js → books/system-texts.js} +9 -8
  95. package/dist/commands/shared/{page-words.d.ts → books/words.d.ts} +2 -2
  96. package/dist/commands/shared/{page-words.js → books/words.js} +4 -4
  97. package/dist/commands/shared/{checks.d.ts → campaign/checks.d.ts} +3 -3
  98. package/dist/commands/shared/{checks.js → campaign/checks.js} +7 -7
  99. package/dist/commands/shared/{images.d.ts → campaign/images.d.ts} +3 -3
  100. package/dist/commands/shared/{images.js → campaign/images.js} +5 -5
  101. package/dist/commands/shared/{mode.d.ts → campaign/mode.d.ts} +4 -4
  102. package/dist/commands/shared/{mode.js → campaign/mode.js} +24 -13
  103. package/dist/commands/shared/{money.d.ts → campaign/money.d.ts} +3 -3
  104. package/dist/commands/shared/{money.js → campaign/money.js} +2 -2
  105. package/dist/commands/shared/{offers.d.ts → campaign/offers.d.ts} +3 -3
  106. package/dist/commands/shared/{offers.js → campaign/offers.js} +3 -3
  107. package/dist/commands/shared/{outside.d.ts → campaign/outside.d.ts} +3 -3
  108. package/dist/commands/shared/{outside.js → campaign/outside.js} +7 -7
  109. package/dist/commands/shared/{parts.d.ts → campaign/parts.d.ts} +3 -3
  110. package/dist/commands/shared/{parts.js → campaign/parts.js} +3 -3
  111. package/dist/commands/shared/{problems.d.ts → campaign/problems.d.ts} +3 -3
  112. package/dist/commands/shared/{problems.js → campaign/problems.js} +17 -17
  113. package/dist/commands/shared/{quests.d.ts → campaign/quests.d.ts} +4 -4
  114. package/dist/commands/shared/{quests.js → campaign/quests.js} +6 -6
  115. package/dist/commands/shared/{saves.d.ts → campaign/saves.d.ts} +4 -4
  116. package/dist/commands/shared/{saves.js → campaign/saves.js} +10 -10
  117. package/dist/commands/shared/{theme.d.ts → campaign/theme.d.ts} +3 -3
  118. package/dist/commands/shared/{theme.js → campaign/theme.js} +1 -1
  119. package/dist/commands/shared/{world.d.ts → campaign/world.d.ts} +5 -5
  120. package/dist/commands/shared/{world.js → campaign/world.js} +17 -14
  121. package/dist/commands/shared/{knowledge.d.ts → characters/knowledge.d.ts} +3 -3
  122. package/dist/commands/shared/{knowledge.js → characters/knowledge.js} +4 -4
  123. package/dist/commands/shared/{moods.d.ts → characters/moods.d.ts} +3 -3
  124. package/dist/commands/shared/{moods.js → characters/moods.js} +3 -3
  125. package/dist/commands/shared/characters/orders.d.ts +4 -0
  126. package/dist/commands/shared/characters/orders.js +10 -0
  127. package/dist/commands/shared/{thoughts.d.ts → characters/thoughts.d.ts} +2 -2
  128. package/dist/commands/shared/{thoughts.js → characters/thoughts.js} +3 -3
  129. package/dist/commands/shared/{voices.d.ts → characters/voices.d.ts} +1 -1
  130. package/dist/commands/shared/{voices.js → characters/voices.js} +2 -2
  131. package/dist/commands/shared/examples.js +2 -2
  132. package/dist/commands/shared/packages/catalog.js +2 -2
  133. package/dist/commands/shared/packages/code.d.ts +1 -1
  134. package/dist/commands/shared/packages/code.js +8 -8
  135. package/dist/commands/shared/packages/extensions.d.ts +1 -1
  136. package/dist/commands/shared/packages/extensions.js +1 -1
  137. package/dist/commands/shared/packages/hooks.d.ts +1 -1
  138. package/dist/commands/shared/packages/hooks.js +1 -1
  139. package/dist/commands/shared/packages/widgets.d.ts +3 -3
  140. package/dist/commands/shared/packages/widgets.js +3 -3
  141. package/dist/commands/shared/{environment.d.ts → places/environment.d.ts} +1 -1
  142. package/dist/commands/shared/{environment.js → places/environment.js} +4 -4
  143. package/dist/commands/shared/{grid-moves.d.ts → places/grid-moves.d.ts} +4 -4
  144. package/dist/commands/shared/{grid-moves.js → places/grid-moves.js} +8 -7
  145. package/dist/commands/shared/{grids.d.ts → places/grids.d.ts} +4 -4
  146. package/dist/commands/shared/{grids.js → places/grids.js} +6 -6
  147. package/dist/commands/shared/{journey.d.ts → places/journey.d.ts} +3 -3
  148. package/dist/commands/shared/{journey.js → places/journey.js} +6 -6
  149. package/dist/commands/shared/{moves.d.ts → places/moves.d.ts} +2 -2
  150. package/dist/commands/shared/{moves.js → places/moves.js} +4 -4
  151. package/dist/commands/shared/{positions.d.ts → places/positions.d.ts} +2 -2
  152. package/dist/commands/shared/{positions.js → places/positions.js} +4 -4
  153. package/dist/commands/shared/{roads.d.ts → places/roads.d.ts} +5 -5
  154. package/dist/commands/shared/{roads.js → places/roads.js} +6 -6
  155. package/dist/commands/shared/{effects.d.ts → scene/effects.d.ts} +7 -7
  156. package/dist/commands/shared/{effects.js → scene/effects.js} +10 -10
  157. package/dist/commands/shared/{loot.d.ts → scene/loot.d.ts} +2 -2
  158. package/dist/commands/shared/{loot.js → scene/loot.js} +3 -3
  159. package/dist/commands/shared/{master-rolls.d.ts → scene/master-rolls.d.ts} +2 -2
  160. package/dist/commands/shared/{master-rolls.js → scene/master-rolls.js} +5 -5
  161. package/dist/commands/shared/{reminders.d.ts → scene/reminders.d.ts} +4 -4
  162. package/dist/commands/shared/{reminders.js → scene/reminders.js} +4 -4
  163. package/dist/commands/shared/{scene.d.ts → scene/scene.d.ts} +3 -3
  164. package/dist/commands/shared/{scene.js → scene/scene.js} +7 -7
  165. package/dist/commands/shared/{bonds.d.ts → sheet/bonds.d.ts} +3 -3
  166. package/dist/commands/shared/{bonds.js → sheet/bonds.js} +2 -2
  167. package/dist/commands/shared/{page-counters.d.ts → sheet/counters.d.ts} +3 -3
  168. package/dist/commands/shared/{page-counters.js → sheet/counters.js} +5 -5
  169. package/dist/commands/shared/{effect-layer.d.ts → sheet/effect-layer.d.ts} +2 -2
  170. package/dist/commands/shared/{effect-layer.js → sheet/effect-layer.js} +9 -6
  171. package/dist/commands/shared/sheet/effect-values.d.ts +9 -0
  172. package/dist/commands/shared/sheet/effect-values.js +69 -0
  173. package/dist/commands/shared/{experience.d.ts → sheet/experience.d.ts} +3 -3
  174. package/dist/commands/shared/{experience.js → sheet/experience.js} +5 -5
  175. package/dist/commands/shared/sheet/formula-problems.d.ts +8 -0
  176. package/dist/commands/shared/sheet/formula-problems.js +140 -0
  177. package/dist/commands/shared/sheet/formula-scope.d.ts +32 -0
  178. package/dist/commands/shared/sheet/formula-scope.js +235 -0
  179. package/dist/commands/shared/{limits.d.ts → sheet/limits.d.ts} +3 -3
  180. package/dist/commands/shared/{limits.js → sheet/limits.js} +5 -4
  181. package/dist/commands/shared/{progression.d.ts → sheet/progression.d.ts} +2 -2
  182. package/dist/commands/shared/{progression.js → sheet/progression.js} +4 -4
  183. package/dist/commands/shared/{sheet.d.ts → sheet/sheet.d.ts} +5 -5
  184. package/dist/commands/shared/{sheet.js → sheet/sheet.js} +11 -7
  185. package/dist/commands/shared/{stacks.d.ts → sheet/stacks.d.ts} +2 -2
  186. package/dist/commands/shared/{stacks.js → sheet/stacks.js} +4 -4
  187. package/dist/commands/shared/sheet/system-fields.d.ts +21 -0
  188. package/dist/commands/shared/sheet/system-fields.js +45 -0
  189. package/dist/commands/shared/{thresholds.d.ts → sheet/thresholds.d.ts} +1 -1
  190. package/dist/commands/shared/{thresholds.js → sheet/thresholds.js} +4 -4
  191. package/dist/commands/shared/{turn-uses.d.ts → sheet/turn-uses.d.ts} +3 -3
  192. package/dist/commands/shared/{turn-uses.js → sheet/turn-uses.js} +4 -3
  193. package/dist/commands/shared/{worked-out.d.ts → sheet/worked-out.d.ts} +11 -46
  194. package/dist/commands/shared/sheet/worked-out.js +291 -0
  195. package/dist/commands/shared/sheet/worked-text.d.ts +14 -0
  196. package/dist/commands/shared/sheet/worked-text.js +55 -0
  197. package/dist/commands/shared/{advance.d.ts → time/advance.d.ts} +3 -3
  198. package/dist/commands/shared/{advance.js → time/advance.js} +11 -11
  199. package/dist/commands/shared/{dice-pool.d.ts → time/dice-pool.d.ts} +3 -3
  200. package/dist/commands/shared/{dice-pool.js → time/dice-pool.js} +11 -11
  201. package/dist/commands/shared/{events.d.ts → time/events.d.ts} +5 -5
  202. package/dist/commands/shared/{events.js → time/events.js} +10 -13
  203. package/dist/commands/shared/{recipes.d.ts → time/recipes.d.ts} +3 -3
  204. package/dist/commands/shared/{recipes.js → time/recipes.js} +6 -5
  205. package/dist/commands/shared/{time.d.ts → time/time.d.ts} +4 -4
  206. package/dist/commands/shared/{time.js → time/time.js} +6 -6
  207. package/dist/commands/shared/{upkeep.d.ts → time/upkeep.d.ts} +3 -3
  208. package/dist/commands/shared/{upkeep.js → time/upkeep.js} +14 -13
  209. package/dist/commands/show.d.ts +3 -0
  210. package/dist/commands/show.js +28 -9
  211. package/dist/commands/status.d.ts +2 -1
  212. package/dist/commands/status.js +28 -22
  213. package/dist/commands/thoughts.js +3 -3
  214. package/dist/commands/trade.js +8 -8
  215. package/dist/commands/translate.d.ts +1 -1
  216. package/dist/commands/translate.js +3 -3
  217. package/dist/commands/travel/open.d.ts +1 -1
  218. package/dist/commands/travel/open.js +2 -2
  219. package/dist/commands/travel/route.js +7 -6
  220. package/dist/commands/travel/travel.d.ts +1 -1
  221. package/dist/commands/travel/travel.js +8 -8
  222. package/dist/commands/validate.js +3 -3
  223. package/dist/commands/view/journal.d.ts +2 -2
  224. package/dist/commands/view/journal.js +2 -2
  225. package/dist/commands/view/map.d.ts +1 -1
  226. package/dist/commands/view/map.js +6 -6
  227. package/dist/commands/view/memory.d.ts +16 -0
  228. package/dist/commands/view/memory.js +90 -0
  229. package/dist/commands/view/page.d.ts +32 -0
  230. package/dist/commands/view/page.js +163 -0
  231. package/dist/commands/view/place.d.ts +7 -2
  232. package/dist/commands/view/place.js +30 -12
  233. package/dist/commands/view/result.d.ts +245 -0
  234. package/dist/commands/view/result.js +1 -0
  235. package/dist/commands/view/saves.d.ts +6 -0
  236. package/dist/commands/view/saves.js +53 -0
  237. package/dist/commands/view/story.d.ts +32 -0
  238. package/dist/commands/view/story.js +227 -0
  239. package/dist/commands/view/view.d.ts +26 -292
  240. package/dist/commands/view/view.js +26 -534
  241. package/dist/commands/view/world.d.ts +1 -1
  242. package/dist/commands/view/world.js +3 -3
  243. package/dist/commands/write/checks.d.ts +42 -0
  244. package/dist/commands/write/checks.js +291 -0
  245. package/dist/commands/write/here.d.ts +1 -1
  246. package/dist/commands/write/here.js +5 -5
  247. package/dist/commands/write/inheritance.d.ts +40 -0
  248. package/dist/commands/write/inheritance.js +189 -0
  249. package/dist/commands/write/input.d.ts +29 -0
  250. package/dist/commands/write/input.js +124 -0
  251. package/dist/commands/write/layer.d.ts +36 -0
  252. package/dist/commands/write/layer.js +48 -0
  253. package/dist/commands/write/notes.d.ts +22 -0
  254. package/dist/commands/write/notes.js +76 -0
  255. package/dist/commands/write/progression.d.ts +27 -0
  256. package/dist/commands/write/progression.js +175 -0
  257. package/dist/commands/write/write.d.ts +1 -0
  258. package/dist/commands/write/write.js +32 -816
  259. package/dist/core/files.d.ts +2 -0
  260. package/dist/core/files.js +7 -0
  261. package/dist/core/{package-declarations.d.ts → packages/declarations.d.ts} +1 -1
  262. package/dist/core/{package-declarations.js → packages/declarations.js} +1 -1
  263. package/dist/core/session-store.js +3 -3
  264. package/dist/core/store.d.ts +2 -2
  265. package/dist/core/store.js +18 -4
  266. package/dist/dashboard/acts/acts.js +1 -1
  267. package/dist/dashboard/acts/sending.js +110 -0
  268. package/dist/dashboard/acts/sheet.js +2 -2
  269. package/dist/dashboard/acts/strip.js +1 -1
  270. package/dist/dashboard/address.js +6 -0
  271. package/dist/dashboard/api.js +1 -1
  272. package/dist/dashboard/app.js +47 -171
  273. package/dist/dashboard/dice/roller.js +1 -1
  274. package/dist/dashboard/dice/sets.js +2 -2
  275. package/dist/dashboard/dice/stage.js +1 -1
  276. package/dist/dashboard/dice/tray.js +6 -6
  277. package/dist/dashboard/guide/ar.md +5 -3
  278. package/dist/dashboard/guide/cs.md +5 -3
  279. package/dist/dashboard/guide/da.md +5 -3
  280. package/dist/dashboard/guide/de.md +5 -3
  281. package/dist/dashboard/guide/el.md +5 -3
  282. package/dist/dashboard/guide/en.md +2 -0
  283. package/dist/dashboard/guide/es.md +4 -2
  284. package/dist/dashboard/guide/fi.md +5 -3
  285. package/dist/dashboard/guide/fr.md +4 -2
  286. package/dist/dashboard/guide/he.md +4 -2
  287. package/dist/dashboard/guide/hi.md +6 -4
  288. package/dist/dashboard/guide/hu.md +4 -2
  289. package/dist/dashboard/guide/is.md +5 -3
  290. package/dist/dashboard/guide/it.md +3 -1
  291. package/dist/dashboard/guide/ja.md +7 -5
  292. package/dist/dashboard/guide/ko.md +6 -4
  293. package/dist/dashboard/guide/nb.md +4 -2
  294. package/dist/dashboard/guide/nl.md +5 -3
  295. package/dist/dashboard/guide/pl.md +4 -2
  296. package/dist/dashboard/guide/pt.md +4 -2
  297. package/dist/dashboard/guide/ro.md +5 -3
  298. package/dist/dashboard/guide/ru.md +5 -3
  299. package/dist/dashboard/guide/sv.md +5 -3
  300. package/dist/dashboard/guide/tr.md +6 -4
  301. package/dist/dashboard/guide/uk.md +4 -2
  302. package/dist/dashboard/guide/zh.md +5 -3
  303. package/dist/dashboard/help/help.js +3 -3
  304. package/dist/dashboard/i18n/ar.json +4 -0
  305. package/dist/dashboard/i18n/cs.json +4 -0
  306. package/dist/dashboard/i18n/da.json +4 -0
  307. package/dist/dashboard/i18n/de.json +4 -0
  308. package/dist/dashboard/i18n/el.json +4 -0
  309. package/dist/dashboard/i18n/es.json +4 -0
  310. package/dist/dashboard/i18n/fi.json +4 -0
  311. package/dist/dashboard/i18n/fr.json +4 -0
  312. package/dist/dashboard/i18n/he.json +4 -0
  313. package/dist/dashboard/i18n/hi.json +4 -0
  314. package/dist/dashboard/i18n/hu.json +4 -0
  315. package/dist/dashboard/i18n/is.json +4 -0
  316. package/dist/dashboard/i18n/it.json +4 -0
  317. package/dist/dashboard/i18n/ja.json +5 -1
  318. package/dist/dashboard/i18n/ko.json +4 -0
  319. package/dist/dashboard/i18n/nb.json +4 -0
  320. package/dist/dashboard/i18n/nl.json +4 -0
  321. package/dist/dashboard/i18n/pl.json +4 -0
  322. package/dist/dashboard/i18n/pt.json +4 -0
  323. package/dist/dashboard/i18n/ro.json +4 -0
  324. package/dist/dashboard/i18n/ru.json +4 -0
  325. package/dist/dashboard/i18n/sv.json +4 -0
  326. package/dist/dashboard/i18n/tr.json +4 -0
  327. package/dist/dashboard/i18n/uk.json +4 -0
  328. package/dist/dashboard/i18n/zh.json +4 -0
  329. package/dist/dashboard/{journal.js → journal/journal.js} +16 -16
  330. package/dist/dashboard/{notes.js → journal/notes.js} +4 -4
  331. package/dist/dashboard/kit.js +3 -3
  332. package/dist/dashboard/packages/ask-card.js +3 -3
  333. package/dist/dashboard/packages/catalog.js +196 -0
  334. package/dist/dashboard/packages/engine.js +87 -0
  335. package/dist/dashboard/packages/installed.js +53 -0
  336. package/dist/dashboard/packages/library.js +97 -0
  337. package/dist/dashboard/packages/outcomes.js +45 -0
  338. package/dist/dashboard/packages/packages.js +20 -576
  339. package/dist/dashboard/packages/page-code.js +15 -2
  340. package/dist/dashboard/packages/{package-page.js → page.js} +12 -5
  341. package/dist/dashboard/packages/rows.js +84 -0
  342. package/dist/dashboard/packages/share.js +44 -0
  343. package/dist/dashboard/packages/widgets.js +3 -3
  344. package/dist/dashboard/{card.js → parts/card.js} +1 -1
  345. package/dist/dashboard/{faces.js → parts/faces.js} +5 -5
  346. package/dist/dashboard/{game-words.js → parts/game-words.js} +1 -1
  347. package/dist/dashboard/{icons.js → parts/icons.js} +1 -1
  348. package/dist/dashboard/{labels.js → parts/labels.js} +2 -1
  349. package/dist/dashboard/{map-symbols.js → parts/map-symbols.js} +1 -1
  350. package/dist/dashboard/{markdown.js → parts/markdown.js} +2 -2
  351. package/dist/dashboard/{mood.js → parts/mood.js} +1 -1
  352. package/dist/dashboard/{refusals.js → parts/refusals.js} +1 -1
  353. package/dist/dashboard/{status.js → parts/status.js} +4 -4
  354. package/dist/dashboard/{widgets.js → parts/widgets.js} +2 -2
  355. package/dist/dashboard/place/key.js +24 -0
  356. package/dist/dashboard/place/paper.js +67 -0
  357. package/dist/dashboard/place/{map-sheet.js → sheet.js} +2 -2
  358. package/dist/dashboard/place/things.js +129 -0
  359. package/dist/dashboard/place/tokens.js +93 -0
  360. package/dist/dashboard/place/view.js +124 -0
  361. package/dist/dashboard/{asked-dice.js → play/asked-dice.js} +3 -3
  362. package/dist/dashboard/{asked.js → play/asked.js} +10 -10
  363. package/dist/dashboard/{choices.js → play/choices.js} +9 -9
  364. package/dist/dashboard/{requested.js → play/requested.js} +1 -1
  365. package/dist/dashboard/{rolls.js → play/rolls.js} +9 -9
  366. package/dist/dashboard/{scene.js → play/scene.js} +14 -14
  367. package/dist/dashboard/{turns.js → play/turns.js} +12 -12
  368. package/dist/dashboard/{language-choice.js → settings/language-choice.js} +1 -1
  369. package/dist/dashboard/{languages.js → settings/languages.js} +1 -1
  370. package/dist/dashboard/{saves.js → settings/saves.js} +8 -8
  371. package/dist/dashboard/{settings.js → settings/settings.js} +17 -15
  372. package/dist/dashboard/{setup.js → settings/setup.js} +5 -5
  373. package/dist/dashboard/{party.js → sheet/party.js} +8 -8
  374. package/dist/dashboard/{person-panel.js → sheet/person-panel.js} +4 -4
  375. package/dist/dashboard/{sheet.js → sheet/sheet.js} +17 -17
  376. package/dist/dashboard/{story.js → sheet/story.js} +3 -3
  377. package/dist/dashboard/{columns.js → shell/columns.js} +1 -1
  378. package/dist/dashboard/{footer.js → shell/footer.js} +3 -3
  379. package/dist/dashboard/{master.js → shell/master.js} +2 -2
  380. package/dist/dashboard/{notices.js → shell/notices.js} +3 -3
  381. package/dist/dashboard/{pages.js → shell/pages.js} +5 -5
  382. package/dist/dashboard/shell/shown.js +37 -0
  383. package/dist/dashboard/{table.js → shell/table.js} +2 -2
  384. package/dist/dashboard/{tabs.js → shell/tabs.js} +2 -2
  385. package/dist/dashboard/{top.js → shell/top.js} +7 -7
  386. package/dist/dashboard/style.css +74 -3
  387. package/dist/dashboard/world/calendar.js +4 -4
  388. package/dist/dashboard/world/drawing.js +92 -0
  389. package/dist/dashboard/world/key.js +21 -0
  390. package/dist/dashboard/world/lore.js +5 -5
  391. package/dist/dashboard/world/map-card.js +186 -0
  392. package/dist/dashboard/world/place-card.js +39 -0
  393. package/dist/dashboard/world/places.js +29 -0
  394. package/dist/dashboard/world/world.js +9 -341
  395. package/dist/extensions/extension.d.ts +1 -1
  396. package/dist/extensions/extension.js +1 -1
  397. package/dist/images/images.js +12 -9
  398. package/dist/index.d.ts +1 -1
  399. package/dist/languages/index.d.ts +1 -1
  400. package/dist/languages/index.js +1 -1
  401. package/dist/packages/npm.js +1 -1
  402. package/dist/page.d.ts +2 -2
  403. package/dist/page.js +1 -1
  404. package/dist/pages/check.js +23 -1
  405. package/dist/pages/containers.d.ts +1 -1
  406. package/dist/pages/containers.js +1 -1
  407. package/dist/pages/index.d.ts +4 -2
  408. package/dist/pages/index.js +4 -2
  409. package/dist/pages/inheritance.d.ts +2 -2
  410. package/dist/pages/layers.d.ts +50 -0
  411. package/dist/pages/layers.js +97 -0
  412. package/dist/pages/rename-page.js +1 -1
  413. package/dist/pages/stacks/writes.js +48 -22
  414. package/dist/pages/standard-fields.d.ts +1 -1
  415. package/dist/pages/system-pages.d.ts +5 -3
  416. package/dist/pages/system-pages.js +16 -7
  417. package/dist/pages/world.d.ts +8 -1
  418. package/dist/pages/world.js +16 -4
  419. package/dist/pages/write-layer.d.ts +18 -0
  420. package/dist/pages/write-layer.js +108 -0
  421. package/dist/pages/write-page.d.ts +2 -2
  422. package/dist/pages/write-page.js +2 -2
  423. package/dist/rules/index.d.ts +1 -1
  424. package/dist/rules/index.js +1 -1
  425. package/dist/rules/search.d.ts +1 -1
  426. package/dist/rules/shown.d.ts +1 -1
  427. package/dist/server/dashboard/choices.js +3 -3
  428. package/dist/server/dashboard/files.js +5 -5
  429. package/dist/server/dashboard/index.d.ts +2 -2
  430. package/dist/server/dashboard/index.js +2 -2
  431. package/dist/server/dashboard/news.js +4 -3
  432. package/dist/server/dashboard/player.js +1 -1
  433. package/dist/server/dashboard/writes.js +9 -7
  434. package/dist/server/mcp.js +28 -13
  435. package/dist/systems/campaign-data.d.ts +15 -0
  436. package/dist/systems/campaign-data.js +85 -0
  437. package/dist/systems/{system-code.d.ts → code.d.ts} +1 -1
  438. package/dist/systems/{system-code.js → code.js} +2 -2
  439. package/dist/systems/game-system.d.ts +7 -61
  440. package/dist/systems/game-system.js +1 -984
  441. package/dist/systems/index.d.ts +6 -3
  442. package/dist/systems/index.js +6 -3
  443. package/dist/systems/installed.d.ts +31 -0
  444. package/dist/systems/installed.js +89 -0
  445. package/dist/systems/maps.d.ts +3 -0
  446. package/dist/systems/maps.js +9 -0
  447. package/dist/systems/read.d.ts +3 -0
  448. package/dist/systems/read.js +471 -0
  449. package/dist/systems/schema.d.ts +289 -0
  450. package/dist/systems/schema.js +243 -0
  451. package/dist/systems/settings.d.ts +19 -0
  452. package/dist/systems/settings.js +78 -0
  453. package/dist/systems/versions.d.ts +12 -0
  454. package/dist/systems/versions.js +52 -0
  455. package/dist/testing/index.js +1 -1
  456. package/instructions/import.md +1 -1
  457. package/instructions/play.md +1 -1
  458. package/package.json +1 -1
  459. package/dist/commands/config.js +0 -948
  460. package/dist/commands/package.d.ts +0 -143
  461. package/dist/commands/package.js +0 -785
  462. package/dist/commands/scene.js +0 -894
  463. package/dist/commands/shared/worked-out.js +0 -805
  464. package/dist/dashboard/place/map-view.js +0 -417
  465. /package/dist/commands/shared/{library-reader.d.ts → books/library-reader.d.ts} +0 -0
  466. /package/dist/core/{package-api.d.ts → packages/api.d.ts} +0 -0
  467. /package/dist/core/{package-api.js → packages/api.js} +0 -0
  468. /package/dist/dashboard/{coins.js → parts/coins.js} +0 -0
  469. /package/dist/dashboard/{glass.js → parts/glass.js} +0 -0
  470. /package/dist/dashboard/{layout.js → parts/layout.js} +0 -0
  471. /package/dist/dashboard/{mood-faces.js → parts/mood-faces.js} +0 -0
  472. /package/dist/dashboard/{free-rolls.js → play/free-rolls.js} +0 -0
  473. /package/dist/dashboard/{reactions.js → play/reactions.js} +0 -0
  474. /package/dist/dashboard/{prefs.js → shell/prefs.js} +0 -0
  475. /package/dist/dashboard/{system-style.js → shell/system-style.js} +0 -0
  476. /package/dist/dashboard/{theme.js → shell/theme.js} +0 -0
  477. /package/dist/languages/{language-pack.d.ts → pack.d.ts} +0 -0
  478. /package/dist/languages/{language-pack.js → pack.js} +0 -0
  479. /package/dist/pages/{page-file.d.ts → file.d.ts} +0 -0
  480. /package/dist/pages/{page-file.js → file.js} +0 -0
  481. /package/dist/pages/{page-types.d.ts → types.d.ts} +0 -0
  482. /package/dist/pages/{page-types.js → types.js} +0 -0
  483. /package/dist/rules/{rule-book.d.ts → book.d.ts} +0 -0
  484. /package/dist/rules/{rule-book.js → book.js} +0 -0
  485. /package/dist/systems/{system-folders.d.ts → folders.d.ts} +0 -0
  486. /package/dist/systems/{system-folders.js → folders.js} +0 -0
@@ -1,31 +1,6 @@
1
1
  import { z } from "zod";
2
- /** The order of turns, where the scene has one, and whether the turn is the player's character's. */
3
- interface Turns {
4
- order: string[];
5
- round: number;
6
- turn: string;
7
- player: boolean;
8
- /** More than one living player character, each handed their turn by name (D-480 (5)). */
9
- several?: true;
10
- }
11
- /** Someone in the scene, with their counters. */
12
- interface Member {
13
- name: string;
14
- counters: Record<string, unknown>;
15
- /** A character's effects with their end, such as "Poisoned until day 1, 19:00". */
16
- effects?: string[];
17
- }
18
- /** Who of the party a scene brought into its place, and what that set off (CON-6). */
19
- interface Brought {
20
- moved: string[];
21
- notes: string[];
22
- }
23
- /** The save the end of a scene made, or why it made none (SAV-3). */
24
- interface Saved {
25
- saved?: string;
26
- unsaved?: string;
27
- }
28
- export declare const scene: import("../core/registry.ts").Command<z.ZodObject<{
2
+ import { type Brought } from "./result.ts";
3
+ export declare const scene: import("../../core/registry.ts").Command<z.ZodObject<{
29
4
  action: z.ZodEnum<{
30
5
  next: "next";
31
6
  open: "open";
@@ -64,20 +39,20 @@ export declare const scene: import("../core/registry.ts").Command<z.ZodObject<{
64
39
  type: string;
65
40
  opened?: string;
66
41
  place?: string;
67
- members: Member[];
42
+ members: import("./result.ts").Member[];
68
43
  around: string;
69
44
  part: string;
70
45
  } & Brought) | ({
71
46
  action: "add";
72
47
  title: string;
73
48
  place?: string;
74
- members: Member[];
49
+ members: import("./result.ts").Member[];
75
50
  ordered: boolean;
76
51
  seen?: Record<string, string>;
77
52
  } & Brought) | {
78
53
  action: "leave";
79
- left: Member[];
80
- turns?: Turns;
54
+ left: import("./result.ts").Member[];
55
+ turns?: import("./result.ts").Turns;
81
56
  noTurns: boolean;
82
57
  ended: string[];
83
58
  acting?: string;
@@ -86,7 +61,7 @@ export declare const scene: import("../core/registry.ts").Command<z.ZodObject<{
86
61
  noTurn: string[];
87
62
  ended: string[];
88
63
  acting?: string;
89
- } & Turns) | {
64
+ } & import("./result.ts").Turns) | {
90
65
  action: "now";
91
66
  title: string;
92
67
  now: string;
@@ -103,8 +78,8 @@ export declare const scene: import("../core/registry.ts").Command<z.ZodObject<{
103
78
  action: "close";
104
79
  title?: string;
105
80
  rounds?: number;
106
- copies: Member[];
107
- gone?: Member[];
81
+ copies: import("./result.ts").Member[];
82
+ gone?: import("./result.ts").Member[];
108
83
  unreadable?: string;
109
84
  ended: string[];
110
85
  endless: string[];
@@ -112,5 +87,4 @@ export declare const scene: import("../core/registry.ts").Command<z.ZodObject<{
112
87
  fallen?: string;
113
88
  afterPeak?: string;
114
89
  quests: string[];
115
- } & Saved)>;
116
- export {};
90
+ } & import("./result.ts").Saved)>;
@@ -0,0 +1,210 @@
1
+ // The scene command: input check, actions dispatched, results formatted; now, hostile and calm
2
+ import { z } from "zod";
3
+ import { requireCampaign } from "../../campaign/index.js";
4
+ import { appendLogEntry } from "../../core/log.js";
5
+ import { defineCommand } from "../../core/registry.js";
6
+ import { sameName } from "../../core/text.js";
7
+ import { isEmptyField, linkListItems, parsePageReference } from "../../pages/index.js";
8
+ import { sceneTypes } from "../../scene/index.js";
9
+ import { campaignWorld } from "../shared/campaign/world.js";
10
+ import { textList } from "../shared/inputs.js";
11
+ import { openScene, updateScene } from "../shared/scene/scene.js";
12
+ import { countersText } from "../shared/sheet/counters.js";
13
+ import { newDatedLogEntry } from "../shared/time/time.js";
14
+ import { close, closedText } from "./close.js";
15
+ import { memberNames, membersText } from "./members.js";
16
+ import { addTo, openNew } from "./open.js";
17
+ import { actions } from "./result.js";
18
+ import { leave, passTurn, setOrder, turnText, useOfTurn, withActing } from "./turns.js";
19
+ // The parameters each action takes; any other is refused, so that nothing given is silently ignored.
20
+ const actionParameters = {
21
+ open: ["title", "type", "place", "with", "creatures", "now", "seen"],
22
+ add: ["with", "creatures", "seen"],
23
+ leave: ["who"],
24
+ order: ["order"],
25
+ next: [],
26
+ use: ["who", "uses", "by"],
27
+ now: ["now"],
28
+ hostile: ["who"],
29
+ calm: ["who"],
30
+ close: ["summary"],
31
+ };
32
+ export const scene = defineCommand({
33
+ name: "scene",
34
+ description: "Open, run and close a scene of the story. "
35
+ + "Creatures come as numbered copies, such as Annegato 1: a copy holds only what changes, the rest is read from the creature. "
36
+ + "At open, whoever of the party is elsewhere moves to the scene's place, except in a travel scene. "
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
+ + "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 those it does not know by name; the player's dashboard shows both. "
40
+ + "close ends the scene with a summary the player may read. Change a copy's counters with change, as for a page. "
41
+ + 'Example: action open, title "Scontro all\'ossario", type combat, creatures {"Annegato": 2}.',
42
+ group: "game",
43
+ positionals: ["action"],
44
+ input: z.object({
45
+ action: z.enum(actions).describe("open, add, leave, order, next, use, now, hostile, calm or close"),
46
+ title: z.string().optional().describe("open: the scene's title"),
47
+ type: z.enum(sceneTypes).optional().describe(`open: ${sceneTypes.join(", ")}`),
48
+ place: z.string().optional().describe("open: the place, such as [[Ossario]]; the character's if left out"),
49
+ with: textList.optional().describe("open, add: the characters in the scene, the player character included, such as [[Lena]]; at open, the character and the companions with them if left out"),
50
+ creatures: z.union([textList, z.record(z.string(), z.number().int())]).optional().describe('open, add: creatures as numbered copies: Annegato=2 (Annegato alone is one), or through MCP an object such as {"Annegato": 2}'),
51
+ who: textList.optional().describe("leave: who leaves the scene; hostile, calm: who attacks the party, or stops; use: who uses it; characters or copies, such as Annegato 2"),
52
+ uses: z.string().optional().describe("use: what of a turn, by the game's names, such as {{uses}}"),
53
+ by: z.string().optional().describe("use: what gives one more, or lets it in another's turn, such as a feature"),
54
+ order: textList.optional().describe("order: who takes turns, in order; those left out (fallen, fled) take none"),
55
+ 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
+ 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 one it does not know by name, by its page or creature, in two or three words, never its kind when that is a secret: "
58
+ + 'Bandito=brigante incappucciato, or through MCP an object such as {"Varro": "il mugnaio"}'),
59
+ }),
60
+ run(given, context) {
61
+ const root = requireCampaign(context.folder);
62
+ const input = asLists(given);
63
+ checkParameters(input);
64
+ const world = campaignWorld(root, context);
65
+ if (input.action === "close") {
66
+ return close(root, world, input.summary ?? "", context);
67
+ }
68
+ const current = openScene(root);
69
+ if (input.action === "open") {
70
+ return openNew(root, world, input, context, current);
71
+ }
72
+ if (current === undefined) {
73
+ throw new Error("No scene is open: open one with scene open, giving its title and type.");
74
+ }
75
+ switch (input.action) {
76
+ case "now":
77
+ return tellNow(root, input.now ?? "", context, current);
78
+ case "add":
79
+ return addTo(root, world, input, context, current);
80
+ case "leave":
81
+ return withActing(root, context, current, leave(root, world, input.who ?? [], context, current));
82
+ case "hostile":
83
+ case "calm":
84
+ return markHostile(root, input.who ?? [], input.action === "hostile", context, current);
85
+ case "order":
86
+ return withActing(root, context, current, setOrder(root, world, input.order ?? [], context, current));
87
+ case "use":
88
+ return useOfTurn(root, world, input, context, current);
89
+ default:
90
+ return withActing(root, context, current, passTurn(root, world, context, current));
91
+ }
92
+ },
93
+ format(result) {
94
+ switch (result.action) {
95
+ case "open": {
96
+ const when = result.opened === undefined ? "" : `, ${result.opened}`;
97
+ const where = result.place === undefined ? "" : ` at ${result.place}`;
98
+ const members = result.members.length === 0 ? "No one in it yet: add who is there with scene add." : `In it: ${membersText(result.members)}.`;
99
+ const around = result.around === "" ? undefined : `Here: ${result.around}.`;
100
+ const part = result.part === "" ? undefined : result.part;
101
+ return `Scene opened${when}: ${result.title} (${result.type})${where}. ${members}${broughtText(result, result.place)}${lineOf(around)}${lineOf(part)}`;
102
+ }
103
+ case "add": {
104
+ const last = result.ordered ? " They take their turns last: change the order with scene order if needed." : "";
105
+ const added = result.members.length === 0 ? "" : `Added to ${result.title}: ${membersText(result.members)}.${last}`;
106
+ const seen = result.seen === undefined ? "" : `Seen: ${Object.entries(result.seen).map(([name, said]) => `${name} as ${said}`).join(", ")}.`;
107
+ return `${[added, seen].filter((line) => line !== "").join(" ")}${broughtText(result, result.place)}`;
108
+ }
109
+ case "leave": {
110
+ const turns = result.turns === undefined ? (result.noTurns ? "\nNo one takes turns now." : "") : `\n${turnText(result.turns)}`;
111
+ const left = result.left.map((member) => (Object.keys(member.counters).length === 0 ? member.name : `${member.name} (${countersText(member.counters)})`));
112
+ return `${left.join(", ")} left the scene.${turns}${actingText(result.acting)}${endedText(result.ended)}`;
113
+ }
114
+ case "order":
115
+ return `Order: ${result.order.join(" · ")}.${result.noTurn.length === 0 ? "" : ` No turn: ${result.noTurn.join(", ")}.`}\n${turnText(result)}${actingText(result.acting)}${endedText(result.ended)}`;
116
+ case "next":
117
+ return `${turnText(result)}${actingText(result.acting)}${endedText(result.ended)}`;
118
+ // Who is in it, so that the master sees a scene the story has left (playtest 19): another place or other people make a new one.
119
+ case "now":
120
+ return `${result.title}, with ${result.members.length === 0 ? "no one" : result.members.join(", ")}: the player's dashboard now shows "${result.now}". `
121
+ + "If the story has moved elsewhere or to other people, close this scene and open the next.";
122
+ case "use":
123
+ return result.line;
124
+ case "hostile":
125
+ case "calm":
126
+ return markedText(result);
127
+ default:
128
+ return closedText(result);
129
+ }
130
+ },
131
+ });
132
+ /** Lists as lists: one text is a list of one, or of its links when it gives them separated by commas; an empty text, list or object counts as left out (SCN-8). */
133
+ function asLists(given) {
134
+ const items = (texts) => texts.flatMap((text) => linkListItems(text) ?? [text]);
135
+ const list = (value) => {
136
+ if (isEmptyField(value) || (typeof value === "object" && Object.keys(value).length === 0)) {
137
+ return undefined;
138
+ }
139
+ return typeof value === "string" ? items([value]) : Array.isArray(value) ? items(value) : value;
140
+ };
141
+ return { ...given, with: list(given.with), creatures: list(given.creatures), who: list(given.who), order: list(given.order), seen: list(given.seen) };
142
+ }
143
+ function checkParameters(input) {
144
+ const allowed = actionParameters[input.action];
145
+ const given = (name) => {
146
+ const value = input[name];
147
+ return !isEmptyField(value) && !(Array.isArray(value) && value.length === 0) && !(typeof value === "object" && Object.keys(value).length === 0);
148
+ };
149
+ const extra = Object.keys(input).filter((name) => name !== "action" && given(name) && !allowed.includes(name));
150
+ if (extra.length > 0) {
151
+ throw new Error(`scene ${input.action} does not take ${extra.join(", ")}: it takes ${allowed.length === 0 ? "nothing else" : allowed.join(", ")}.`);
152
+ }
153
+ }
154
+ /** The line of what is happening now, which the player's dashboard shows (SCN-11): a public line of the log, out of the diary. */
155
+ function tellNow(root, now, context, current) {
156
+ if (now.trim() === "") {
157
+ throw new Error('Give now: what is happening, in one line as the player sees it, such as "The bandits overturn the tables".');
158
+ }
159
+ updateScene(root, [[["now"], now.trim()]]);
160
+ appendLogEntry(root, newDatedLogEntry(root, context, "scene-now", "public", { title: current.title, now: now.trim() }));
161
+ return { action: "now", title: current.title, now: now.trim(), members: memberNames(current) };
162
+ }
163
+ /**
164
+ * Marks who attacks the party, or takes the mark off (D-415): only in a fight, and only who is in the scene. The player's dashboard shows it, so that a token
165
+ * changes only when the master says so.
166
+ */
167
+ function markHostile(root, who, hostile, context, current) {
168
+ if (current.type !== "combat") {
169
+ throw new Error(`${current.title} is a ${current.type} scene: hostile and calm mark who fights in a combat scene. When a fight breaks out, close this one and open one of type combat.`);
170
+ }
171
+ if (who.length === 0) {
172
+ throw new Error(`Give who ${hostile ? "attacks the party" : "stops attacking"}, such as who "Annegato 2".`);
173
+ }
174
+ const members = memberNames(current);
175
+ const marked = [
176
+ ...new Set(who.map((name) => {
177
+ const member = sameName(members, parsePageReference(name).name);
178
+ if (member === undefined) {
179
+ throw new Error(`${name} is not in the scene. In it: ${members.length === 0 ? "no one" : members.join(", ")}.`);
180
+ }
181
+ return member;
182
+ })),
183
+ ];
184
+ const before = current.hostile ?? [];
185
+ const now = hostile ? [...before, ...marked.filter((name) => !before.includes(name))] : before.filter((name) => !marked.includes(name));
186
+ updateScene(root, [[["hostile"], now.length === 0 ? undefined : now]]);
187
+ appendLogEntry(root, newDatedLogEntry(root, context, "scene-changed", "hidden", { title: current.title, [hostile ? "hostile" : "calm"]: marked }));
188
+ return { action: hostile ? "hostile" : "calm", title: current.title, marked, hostile: now };
189
+ }
190
+ /** "Marked hostile: Annegato 1. Hostile now: Annegato 1, Annegato 2." (D-415). */
191
+ function markedText(result) {
192
+ const now = result.hostile.length === 0 ? "No one is hostile now." : `Hostile now: ${result.hostile.join(", ")}.`;
193
+ return `${result.action === "hostile" ? "Marked hostile" : "Calm"}: ${result.marked.join(", ")}. ${now}`;
194
+ }
195
+ /** "\nMoved into Ossario: Ennio, Lena.", with what that set off, or nothing when no one moved (CON-6). */
196
+ function broughtText(result, place) {
197
+ const moved = result.moved.length === 0 ? [] : [`Moved into ${place ?? "the scene's place"}: ${result.moved.join(", ")}.`];
198
+ return [...moved, ...result.notes].map((line) => `\n${line}`).join("");
199
+ }
200
+ function actingText(acting) {
201
+ return acting === undefined ? "" : `\n${acting}`;
202
+ }
203
+ /** "\nEnded: Spaventato on Annegato 2.", or nothing when no effect ended. */
204
+ function endedText(ended) {
205
+ return ended.length === 0 ? "" : `\nEnded: ${ended.join(" · ")}.`;
206
+ }
207
+ /** A note on a line of its own, or nothing. */
208
+ function lineOf(note) {
209
+ return note === undefined ? "" : `\n${note}`;
210
+ }
@@ -0,0 +1,18 @@
1
+ import type { Context } from "../../core/context.ts";
2
+ import { type World } from "../../pages/index.ts";
3
+ import { type Scene } from "../../scene/index.ts";
4
+ import type { SceneInput, SceneResult, Turns } from "./result.ts";
5
+ /** Takes out who goes (D-114): a copy vanishes with its numbers, a character leaves the scene without changing place. The turn of who leaves passes on. */
6
+ export declare function leave(root: string, world: World, who: string[], context: Context, current: Scene): SceneResult;
7
+ /** Who takes turns, in order; those left out take none. A new order in a running scene keeps the round, and the turn if its owner is still in it. */
8
+ export declare function setOrder(root: string, world: World, order: string[], context: Context, current: Scene): SceneResult;
9
+ /** One use of a turn by one in the scene (TRN-1–TRN-3), kept in the scene, with its line in the log. */
10
+ export declare function useOfTurn(root: string, world: World, input: SceneInput, context: Context, current: Scene): SceneResult;
11
+ export declare function passTurn(root: string, world: World, context: Context, current: Scene): SceneResult;
12
+ /**
13
+ * The result of a change of turn, with the effects on who ends the turn and on who starts the next (EFF-15), read after the effects that the turn ends have
14
+ * ended; nothing when the turn stays where it was.
15
+ */
16
+ export declare function withActing(root: string, context: Context, before: Scene, result: SceneResult): SceneResult;
17
+ /** "Round 2 · now Lena (then Annegato 2).", and on the player's character's turn, to stop there (D-139). */
18
+ export declare function turnText(result: Turns): string;
@@ -0,0 +1,229 @@
1
+ import { appendLogEntry } from "../../core/log.js";
2
+ import { comparableText, sameName } from "../../core/text.js";
3
+ import { concernsPlayer, findPage, isPlayerCharacter, parsePageReference, playerCharacters, writePage } from "../../pages/index.js";
4
+ import { nextTurn } from "../../scene/index.js";
5
+ import { newStateChecks } from "../shared/campaign/checks.js";
6
+ import { campaignSystem, campaignSystemWords, campaignWorld } from "../shared/campaign/world.js";
7
+ import { packagesTurnStarted } from "../shared/packages/hooks.js";
8
+ import { clearCopies, placeGrid, standing } from "../shared/places/grids.js";
9
+ import { endedByTurn, endEffects, keptBy, systemNamed } from "../shared/scene/effects.js";
10
+ import { turnEffectsNote } from "../shared/scene/reminders.js";
11
+ import { copyCounters, copyPage, readOpenScene, scenePlace, updateScene } from "../shared/scene/scene.js";
12
+ import { effectsOf } from "../shared/sheet/effect-layer.js";
13
+ import { turnUsesOf, useInTurn, usesAtTurn } from "../shared/sheet/turn-uses.js";
14
+ import { newDatedLogEntry } from "../shared/time/time.js";
15
+ import { memberNames } from "./members.js";
16
+ /** Takes out who goes (D-114): a copy vanishes with its numbers, a character leaves the scene without changing place. The turn of who leaves passes on. */
17
+ export function leave(root, world, who, context, current) {
18
+ if (who.length === 0) {
19
+ throw new Error('Give who leaves the scene, such as who "Annegato 2".');
20
+ }
21
+ const members = memberNames(current);
22
+ const leaving = who.map((name) => {
23
+ const member = sameName(members, parsePageReference(name).name);
24
+ if (member === undefined) {
25
+ throw new Error(`${name} is not in the scene. In it: ${members.length === 0 ? "no one" : members.join(", ")}.`);
26
+ }
27
+ return member;
28
+ }).filter((name, index, all) => all.indexOf(name) === index);
29
+ const copies = Object.fromEntries(Object.entries(current.copies).filter(([name]) => leaving.includes(name)));
30
+ const staying = Object.keys(current.copies).filter((name) => !leaving.includes(name));
31
+ const changes = [[["with"], current.with.filter((link) => !leaving.includes(parsePageReference(link).name))]];
32
+ changes.push(...(staying.length === 0 ? [[["copies"], undefined]] : Object.keys(copies).map((name) => [["copies", name], undefined])));
33
+ const order = current.order?.filter((name) => !leaving.includes(name));
34
+ const kept = order === undefined || order.length === 0 ? undefined : keptTurn(current, order);
35
+ const turns = order === undefined || kept === undefined ? undefined : { order, ...kept, player: isPlayerTurn(world, kept.turn), ...severalPlayers(world) };
36
+ if (current.order !== undefined) {
37
+ changes.push([["order"], turns?.order], [["turn"], turns?.turn]);
38
+ if (turns !== undefined) {
39
+ changes.push([["round"], turns.round]);
40
+ }
41
+ }
42
+ changes.push([["left"], [...(current.left ?? []), ...leaving]]);
43
+ // Who leaves is hostile no more (D-415).
44
+ const hostile = current.hostile?.filter((name) => !leaving.includes(name));
45
+ if (current.hostile !== undefined) {
46
+ changes.push([["hostile"], hostile === undefined || hostile.length === 0 ? undefined : hostile]);
47
+ }
48
+ // A copy that leaves, fallen or fled, is kept as it left, without its effects, which go with it (D-145): closing the scene counts what overcoming it gives (DAT-11).
49
+ changes.push(...Object.entries(copies).map(([name, copy]) => [["gone", name], Object.fromEntries(Object.entries(copy).filter(([field]) => field !== "effects"))]));
50
+ updateScene(root, changes);
51
+ clearCopies(world, current, Object.keys(copies));
52
+ // The turn it moves to, as next logs it, so that the open scene's log reads the round (SCN-10).
53
+ const moved = turns === undefined || (turns.turn === current.turn && turns.round === (current.round ?? 1)) ? {} : { round: turns.round, turn: turns.turn };
54
+ appendLogEntry(root, newDatedLogEntry(root, context, "scene-changed", "hidden", { title: current.title, left: leaving, copies: Object.keys(copies).length === 0 ? undefined : copies, ...moved }));
55
+ const left = leaving.map((name) => (name in copies ? { name, counters: copyCounters(world, copies[name]) } : { name, counters: {} }));
56
+ // The copies that left are gone with their effects, and with those they kept alive (D-145); the turn may have passed, and with it the end of some effects.
57
+ const remaining = { ...current, copies: Object.fromEntries(Object.entries(current.copies).filter(([name]) => !leaving.includes(name))) };
58
+ const keptByGone = (effect) => Object.keys(copies).some((name) => keptBy(effect, name));
59
+ const byTurn = (effect) => turns !== undefined && endedByTurn(effect, turns.round, turns.turn, turns.order);
60
+ const ended = endEffects(root, context, world, remaining, (effect) => keptByGone(effect) || byTurn(effect), (effect) => (keptByGone(effect) ? "who kept it left" : "turn"));
61
+ return { action: "leave", left, turns, noTurns: current.order !== undefined && turns === undefined, ended };
62
+ }
63
+ /** Who takes turns, in order; those left out take none. A new order in a running scene keeps the round, and the turn if its owner is still in it. */
64
+ export function setOrder(root, world, order, context, current) {
65
+ const members = memberNames(current);
66
+ const inScene = members.length === 0 ? "no one yet" : members.join(", ");
67
+ const named = order.map((name) => {
68
+ const member = sameName(members, parsePageReference(name).name);
69
+ if (member === undefined) {
70
+ throw new Error(`${name} is not in the scene. In it: ${inScene}.`);
71
+ }
72
+ return member;
73
+ });
74
+ const repeated = named.find((name, index) => named.indexOf(name) !== index);
75
+ if (repeated !== undefined) {
76
+ throw new Error(`${repeated} is in the order twice: give each one once.`);
77
+ }
78
+ if (named.length === 0) {
79
+ throw new Error(`Give who takes turns, in order. In the scene: ${inScene}.`);
80
+ }
81
+ const { round, turn } = keptTurn(current, named);
82
+ updateScene(root, [[["order"], named], [["round"], round], [["turn"], turn]]);
83
+ appendLogEntry(root, newDatedLogEntry(root, context, "scene-changed", "hidden", { title: current.title, order: named }));
84
+ const ended = endEffects(root, context, world, current, (effect) => endedByTurn(effect, round, turn, named), "turn");
85
+ return { action: "order", order: named, round, turn, player: isPlayerTurn(world, turn), ...severalPlayers(world), noTurn: members.filter((name) => !named.includes(name)), ended };
86
+ }
87
+ /**
88
+ * The round and turn after a new order. A first order starts round 1. In a running scene the round goes on: the turn stays with its owner,
89
+ * or, if they left the order, passes to the next of the old order still in it, or to a new round when no one after them is.
90
+ */
91
+ function keptTurn(current, named) {
92
+ const round = current.round ?? 1;
93
+ if (current.order === undefined || current.turn === undefined) {
94
+ return { round: 1, turn: named[0] };
95
+ }
96
+ if (named.includes(current.turn)) {
97
+ return { round, turn: current.turn };
98
+ }
99
+ const after = current.order.slice(current.order.indexOf(current.turn) + 1).find((name) => named.includes(name));
100
+ return after === undefined ? { round: round + 1, turn: named[0] } : { round, turn: after };
101
+ }
102
+ /** One use of a turn by one in the scene (TRN-1–TRN-3), kept in the scene, with its line in the log. */
103
+ export function useOfTurn(root, world, input, context, current) {
104
+ const [who, ...others] = input.who ?? [];
105
+ if (who === undefined || input.uses === undefined || input.uses.trim() === "") {
106
+ // The example by the game's own names: a game without uses of a turn has none to give.
107
+ const uses = turnUsesOf(campaignSystem(root, context));
108
+ throw new Error(`Give who and what they use of the turn${uses.length === 0 ? "" : `, one of ${uses.join(", ")}`}.`);
109
+ }
110
+ if (others.length > 0) {
111
+ throw new Error(`One at a time: give who as one name, then use again for ${others.join(", ")}. Nothing changed.`);
112
+ }
113
+ if (current.order === undefined) {
114
+ throw new Error("The scene has no order of turns, so no turn to use: set it with scene order first, after rolling for it if the game does.");
115
+ }
116
+ const name = memberNames(current).find((member) => comparableText(member) === comparableText(parsePageReference(who).name));
117
+ if (name === undefined) {
118
+ throw new Error(`${who} is not in the scene ${current.title}: bring them in with scene add, or give one of ${memberNames(current).join(", ")}.`);
119
+ }
120
+ const copy = current.copies[name];
121
+ const page = copy === undefined ? findPage(world, name) : copyPage(name, copy);
122
+ if (page === undefined) {
123
+ throw new Error(`There is no page named ${name}. Look for it with the find command.`);
124
+ }
125
+ const by = input.by?.trim() === "" ? undefined : input.by?.trim();
126
+ const system = campaignSystem(root, context);
127
+ const done = useInTurn(world, system, current, { name, page }, input.uses.trim(), by);
128
+ updateScene(root, [[["used", name], done.used]]);
129
+ appendLogEntry(root, newDatedLogEntry(root, context, "turn-used", "hidden", { title: current.title, who: name, use: input.uses.trim(), by }));
130
+ // What gave one more, spent from the sheet that counts it (TRN-5).
131
+ if (done.spends !== undefined) {
132
+ spendOne(root, context, world, { name, copy: copy !== undefined, page }, done.spends, by ?? "");
133
+ }
134
+ // One who cannot act, as Stunned, is said so: the game's rule, which the master applies (pp. 91, 358); by its name in the campaign's language too (D-403).
135
+ const words = campaignSystemWords(root, context);
136
+ const inactive = effectsOf(page).map((effect) => effect.name).filter((effect) => systemNamed(system?.combat?.inactive ?? [], effect, words) !== undefined);
137
+ const warned = inactive.length === 0 ? "" : ` ${name} is ${inactive.join(", ")}: read what it may still do.`;
138
+ return { action: "use", line: `${done.line}${warned}` };
139
+ }
140
+ /** One of a counter spent, on a page as it writes it or on a copy in the scene, with its line in the log. */
141
+ function spendOne(root, context, world, who, spends, why) {
142
+ const after = spends.before - 1;
143
+ const value = spends.max === undefined ? after : `${after}/${spends.max}`;
144
+ if (who.copy) {
145
+ updateScene(root, [[["copies", who.name, spends.field], value]]);
146
+ }
147
+ else {
148
+ writePage(world, who.page.name, undefined, { set: { [spends.field]: value } });
149
+ }
150
+ // Seen where the player sees the page, as change writes it: never a foe's count.
151
+ const visibility = who.copy || !concernsPlayer(world, who.page) ? "hidden" : "public";
152
+ appendLogEntry(root, newDatedLogEntry(root, context, "counter-changed", visibility, { page: who.name, field: spends.field, before: String(spends.before), after: String(after), why }));
153
+ }
154
+ export function passTurn(root, world, context, current) {
155
+ if (current.order === undefined) {
156
+ throw new Error("The scene has no order of turns: set it with scene order, after rolling for it if the game does.");
157
+ }
158
+ const { turn, round } = nextTurn(current.order, current.turn, current.round ?? 1);
159
+ updateScene(root, [[["round"], round], [["turn"], turn]]);
160
+ appendLogEntry(root, newDatedLogEntry(root, context, "scene-changed", "hidden", { title: current.title, round, turn }));
161
+ const order = current.order;
162
+ const ended = endEffects(root, context, world, current, (effect) => endedByTurn(effect, round, turn, order), "turn");
163
+ return { action: "next", order, round, turn, player: isPlayerTurn(world, turn), ...severalPlayers(world), noTurn: [], ended };
164
+ }
165
+ /**
166
+ * The result of a change of turn, with the effects on who ends the turn and on who starts the next (EFF-15), read after the effects that the turn ends have
167
+ * ended; nothing when the turn stays where it was.
168
+ */
169
+ export function withActing(root, context, before, result) {
170
+ if (result.action !== "leave" && result.action !== "order" && result.action !== "next") {
171
+ return result;
172
+ }
173
+ const turns = result.action === "leave" ? result.turns : result;
174
+ if (turns === undefined || (turns.turn === before.turn && turns.round === (before.round ?? 1))) {
175
+ return result;
176
+ }
177
+ // A turn that begins gives back what its one used, and every turn what lasts only a turn (TRN-4).
178
+ const used = readOpenScene(root).scene?.used;
179
+ if (used !== undefined) {
180
+ updateScene(root, [[["used"], usesAtTurn(campaignSystem(root, context), used, turns.turn)]]);
181
+ }
182
+ const world = campaignWorld(root, context);
183
+ const system = campaignSystem(root, context);
184
+ const scene = readOpenScene(root).scene;
185
+ const effects = turnEffectsNote(world, scene, before.turn, turns.turn);
186
+ // The player character's turn reminds what to mark of it, which the player sees on the dashboard (TRN-1); a companion's counts went right without (playtest
187
+ // 08); dying, the death save it starts with (DIE-5).
188
+ const member = findPage(world, turns.turn);
189
+ const turn = packagesTurnStarted(root, context, turns.turn);
190
+ const dying = turn.lines.join(" ");
191
+ // Who cannot act, as one stable but still Unconscious, marks nothing.
192
+ const words = campaignSystemWords(root, context);
193
+ const inactive = member !== undefined && effectsOf(member).some((effect) => systemNamed(system?.combat?.inactive ?? [], effect.name, words) !== undefined);
194
+ const pc = member !== undefined && isPlayerCharacter(member);
195
+ const uses = !pc || dying !== "" || inactive ? [] : turnUsesOf(system);
196
+ const mark = uses.length > 0 ? `Mark with scene use what ${turns.turn} uses of the turn, as it happens: ${uses.join(", ")}.` : "";
197
+ // Notes written between the calls of another's turn reached the player (playtests 06, 08, 09, 11).
198
+ const quiet = pc ? "" : "Write nothing until the round is told: what you work out stays in your thinking.";
199
+ // What cannot be true together, once in a chat, after the system's code had its say (CHK-3).
200
+ const checks = newStateChecks(root, context).join(" ");
201
+ // The extensions' lines come after the engine's reminder, which only the system's take the place of (D-514).
202
+ const acting = [effects, dying, mark, ...turn.added, offTheMap(world, scene, turns.turn), turn.problem ?? "", checks, quiet].filter((line) => line !== "").join(" ");
203
+ return acting === "" ? result : { ...result, acting };
204
+ }
205
+ /** Who acts and stands on no square of the scene's map, when its place has one (GRD-3, playtest 07): where it stands decides reach, cover and the way. */
206
+ function offTheMap(world, scene, name) {
207
+ const place = scenePlace(world, scene);
208
+ if (place === undefined || placeGrid(place) === undefined || standing(world, place, scene).some((one) => sameName([one.name], name) !== undefined && one.square !== undefined)) {
209
+ return "";
210
+ }
211
+ return `${name} is not on the map of ${place.name}: put it on its square with move ${name} --at, such as E4, before telling its turn.`;
212
+ }
213
+ /** "Round 2 · now Lena (then Annegato 2).", and on the player's character's turn, to stop there (D-139). */
214
+ export function turnText(result) {
215
+ const then = result.order.length > 1 ? nextTurn(result.order, result.turn, 1).turn : undefined;
216
+ const now = !result.player ? result.turn : result.several === true ? `${result.turn}, a player character` : `${result.turn}, the player's character`;
217
+ // With more than one, a message that already said what this one does goes on (D-480 (5)).
218
+ const stop = !result.player ? "." : result.several === true ? `: stop here and hand ${result.turn} the turn, by name, unless the player already said what ${result.turn} does.` : ": stop here and hand them the turn.";
219
+ return `Round ${result.round} · now ${now}${then === undefined ? "" : ` (then ${then})`}${stop}`;
220
+ }
221
+ /** Whether more than one player character is alive, each handed their turn by name (D-480 (5)). */
222
+ function severalPlayers(world) {
223
+ return playerCharacters(world).filter((page) => page.fields.status !== "dead").length > 1 ? { several: true } : {};
224
+ }
225
+ /** Whether the turn is the player's character's, which only the player plays; a dead one's is no one's. */
226
+ function isPlayerTurn(world, name) {
227
+ const page = findPage(world, name);
228
+ return page !== undefined && isPlayerCharacter(page) && page.fields.status !== "dead";
229
+ }
@@ -1,6 +1,6 @@
1
- import { type AdventureFiles, type AdventureManifest } from "../../adventures/index.ts";
2
- import type { Context } from "../../core/context.ts";
3
- import { type LogEntry } from "../../core/log.ts";
1
+ import { type AdventureFiles, type AdventureManifest } from "../../../adventures/index.ts";
2
+ import type { Context } from "../../../core/context.ts";
3
+ import { type LogEntry } from "../../../core/log.ts";
4
4
  /** An adventure the campaign has installed and not taken out (ADV-6). */
5
5
  export interface InstalledAdventure {
6
6
  title: string;
@@ -40,9 +40,11 @@ export interface AdventureExported {
40
40
  file: string;
41
41
  from: string;
42
42
  pages: number;
43
+ /** The player characters, the adventures installed, and the pages of the game system the campaign's layers change (SYS-11), which an adventure does not carry. */
43
44
  leftOut: {
44
45
  characters: string[];
45
46
  adventures: string[];
47
+ layers: string[];
46
48
  };
47
49
  opening?: string;
48
50
  /** The pages written from the player's documents (source:), when no license was given: the zip keeps them to the player. */
@@ -2,25 +2,25 @@
2
2
  // they were at the start (ADV-1–ADV-7).
3
3
  import { basename, join, relative, resolve, sep } from "node:path";
4
4
  import { parse, parseDocument, stringify, visit } from "yaml";
5
- import { adventureFolderName, adventureTarget, isAdventureFolder, largestAdventure, manifestLine, packAdventure, readAdventureFolder, readAdventureZip } from "../../adventures/index.js";
6
- import { houseRulesFolderName, readSettings } from "../../campaign/index.js";
7
- import { appendLogEntry, readLog } from "../../core/log.js";
8
- import { Refusal } from "../../core/refusal.js";
9
- import { files } from "../../core/store.js";
10
- import { comparableText, linkTargetName } from "../../core/text.js";
11
- import { isNewerVersion } from "../../core/version.js";
12
- import { shortName } from "../../extensions/index.js";
13
- import { findImage, imageFileName, largestImage } from "../../images/index.js";
14
- import { locate, pageNamed, pageNamedQuietly, readFields, splitPageFile, textsIn, worldFolderName } from "../../pages/index.js";
15
- import { readRuleBook, ruleSections } from "../../rules/index.js";
16
- import { unpackFiles } from "../../saves/index.js";
17
- import { formatGameDate, readGameDate } from "../../time/index.js";
18
- import { campaignMode } from "./mode.js";
19
- import { listedExtensions } from "./packages/extensions.js";
5
+ import { adventureFolderName, adventureTarget, isAdventureFolder, largestAdventure, manifestLine, packAdventure, readAdventureFolder, readAdventureZip } from "../../../adventures/index.js";
6
+ import { houseRulesFolderName, readSettings } from "../../../campaign/index.js";
7
+ import { appendLogEntry, readLog } from "../../../core/log.js";
8
+ import { Refusal } from "../../../core/refusal.js";
9
+ import { files } from "../../../core/store.js";
10
+ import { comparableText, linkTargetName } from "../../../core/text.js";
11
+ import { isNewerVersion } from "../../../core/version.js";
12
+ import { shortName } from "../../../extensions/index.js";
13
+ import { findImage, imageFileName, largestImage } from "../../../images/index.js";
14
+ import { layersFolderName, locate, pageNamed, pageNamedQuietly, readFields, splitPageFile, textsIn, worldFolderName } from "../../../pages/index.js";
15
+ import { readRuleBook, ruleSections } from "../../../rules/index.js";
16
+ import { unpackFiles } from "../../../saves/index.js";
17
+ import { formatGameDate, readGameDate } from "../../../time/index.js";
18
+ import { campaignMode } from "../campaign/mode.js";
19
+ import { campaignSaves, exportsFolderName, resetSave, savesFolderName, savesWhy } from "../campaign/saves.js";
20
+ import { campaignSystem, campaignWorld } from "../campaign/world.js";
21
+ import { listedExtensions } from "../packages/extensions.js";
22
+ import { newDatedLogEntry, readPresent } from "../time/time.js";
20
23
  import { houseRules, systemRuleBook } from "./rules.js";
21
- import { campaignSaves, exportsFolderName, resetSave, savesFolderName, savesWhy } from "./saves.js";
22
- import { newDatedLogEntry, readPresent } from "./time.js";
23
- import { campaignSystem, campaignWorld } from "./world.js";
24
24
  // The mark of an install under way, with its title and the days it moves dates by: while it is there, installing the same adventure finishes it (ADV-5).
25
25
  const installMarkName = ".adventure-install.yaml";
26
26
  // The documents a master imports, never a package: their pages are written by the master (D-483 (10)).
@@ -160,7 +160,11 @@ export function exportAdventure(root, context, credits) {
160
160
  file,
161
161
  from,
162
162
  pages: Object.keys(kept).filter((path) => path.startsWith(`${worldFolderName}/`)).length,
163
- leftOut: { characters: players.map((page) => basename(page.path, ".md")), adventures },
163
+ leftOut: {
164
+ characters: players.map((page) => basename(page.path, ".md")),
165
+ adventures,
166
+ layers: Object.keys(held).filter((path) => path.startsWith(`${layersFolderName}/`) && path.endsWith(".md")).map((path) => basename(path, ".md")),
167
+ },
164
168
  ...(sourced.length > 0 && credits.license === undefined ? { sourced } : {}),
165
169
  ...(opening === undefined ? {} : { opening: basename(opening.path, ".md") }),
166
170
  };