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
@@ -0,0 +1,235 @@
1
+ // The scope a system formula reads on a page's fields, item formulas included
2
+ import { chosenDice, contributingReads, listItems, numberOf, parseRollFormula, workOut } from "../../../core/formula.js";
3
+ import { comparableText } from "../../../core/text.js";
4
+ import { readEffects } from "../../../effects/index.js";
5
+ import { declaredKind, isEmptyField, pagesWithName, systemPageNamed } from "../../../pages/index.js";
6
+ import { carriedKey, withEffectValues } from "./effect-values.js";
7
+ import { progressionOf, progressionValue } from "./progression.js";
8
+ import { isSystemCounter, itemList, keepsSheet, keyOf } from "./system-fields.js";
9
+ import { signedText } from "./worked-text.js";
10
+ /** The scope a formula reads on these fields: computed fields by their formulas, each worked out once; a bonus field the page lacks as 0 (FOR-4, FOR-5). */
11
+ export function formulaScope(world, fields) {
12
+ const formulas = world.system?.formulas;
13
+ const index = formulas === undefined ? undefined : formulaIndex(formulas);
14
+ const keys = new Map();
15
+ const done = new Map();
16
+ let progressed;
17
+ // What the classes give, worked out once and only when a formula reads a field it may give (PRO-2).
18
+ const progression = () => (progressed ??= { progression: progressionOf(world, fields) }).progression;
19
+ for (const key of Object.keys(fields)) {
20
+ if (!keys.has(comparableText(key))) {
21
+ keys.set(comparableText(key), key);
22
+ }
23
+ }
24
+ const computed = (name) => {
25
+ const entry = index?.computed.get(comparableText(name));
26
+ if (entry === undefined) {
27
+ return undefined;
28
+ }
29
+ const key = comparableText(entry[0]);
30
+ const worked = done.get(key) ?? workOut(entry[1], scope);
31
+ done.set(key, worked);
32
+ return worked;
33
+ };
34
+ // What the items' pages give a field, worked out once; a formula that reads itself, round and round, has no value (PRO-5).
35
+ const itemsDone = new Map();
36
+ const working = new Set();
37
+ const items = (field, explained) => {
38
+ const key = `${comparableText(field)}|${explained}`;
39
+ if (itemsDone.has(key) || working.has(comparableText(field))) {
40
+ return itemsDone.get(key) ?? [];
41
+ }
42
+ working.add(comparableText(field));
43
+ const found = itemValues(world, full, field, explained);
44
+ working.delete(comparableText(field));
45
+ itemsDone.set(key, found);
46
+ return found;
47
+ };
48
+ const each = (field, explained) => eachItem(world, field, items(field, explained));
49
+ const scope = {
50
+ field: (name) => {
51
+ const worked = computed(name);
52
+ if (worked?.value !== undefined) {
53
+ return worked.value;
54
+ }
55
+ // A formula of the items' pages counts in another as the number of the first item that gives it, as the Unarmored Defense of the first class
56
+ // that has it (p. 57); with none, the page's own value, as a witch's written DC.
57
+ if (itemList(world, name) !== undefined) {
58
+ const [first] = items(name, false);
59
+ if (first !== undefined) {
60
+ return typeof first.value === "number" ? first.value : undefined;
61
+ }
62
+ }
63
+ const given = isSystemCounter(world, name) ? undefined : progressionValue(progression(), name);
64
+ if (given !== undefined) {
65
+ return given;
66
+ }
67
+ const key = keys.get(comparableText(name));
68
+ const value = key === undefined ? undefined : fields[key];
69
+ // The effects read by their names, as has(effects, Grappled) (FOR-2); one named in the campaign's language by the system's English, Afferrato as Grappled (D-403).
70
+ if (comparableText(name) === "effects") {
71
+ const read = readEffects(value);
72
+ return "effects" in read ? read.effects.map((effect) => systemName(world.words, effect.name)) : [];
73
+ }
74
+ return value === undefined ? missingValue(world, fields, name) : withAlwaysIn(world, fields, name, value);
75
+ },
76
+ table: (name) => index?.tables.get(comparableText(name)),
77
+ // The page an item names, of the campaign or of the system, with its effects, as a class with its hit die (D-215) or a weapon under Magic Weapon.
78
+ page: (name) => {
79
+ const [named] = pagesWithName(world, name);
80
+ const page = named ?? systemPageNamed(world, name);
81
+ return page === undefined ? undefined : withEffectValues(world, page);
82
+ },
83
+ };
84
+ const full = { ...scope, computed, progression, each, page: (name) => scope.page?.(name) };
85
+ return full;
86
+ }
87
+ /**
88
+ * What a formula reads for a field the page lacks (FOR-2, FOR-4, FOR-5): a bonus as 0, a factor as 1, the effects by their names, the campaign's rigor; the
89
+ * page's own value, as always-in lists give it, for anything else.
90
+ */
91
+ function missingValue(world, fields, name) {
92
+ const kind = declaredKind(world, name);
93
+ if (kind === "bonus" || kind === "factor") {
94
+ return kind === "bonus" ? 0 : 1;
95
+ }
96
+ if (comparableText(name) === "rigor") {
97
+ return world.rigor;
98
+ }
99
+ // What a character carries weighs, and its limit by the system's formula (LOAD-1, LOAD-4).
100
+ if (comparableText(name) === "load") {
101
+ return fields[carriedKey];
102
+ }
103
+ if (comparableText(name) === "load-limit" && world.system?.load !== undefined) {
104
+ return formulaValue(world, fields, world.system.load.limit);
105
+ }
106
+ return withAlwaysIn(world, fields, name, undefined);
107
+ }
108
+ /**
109
+ * A list as the formulas read it (DAT-13, D-235): what the page writes, then what the system puts in it for who keeps the sheet, as the unarmed strike among what a
110
+ * character has equipped, so that the attacks show it.
111
+ */
112
+ function withAlwaysIn(world, fields, list, value) {
113
+ const added = Object.entries(world.system?.alwaysIn ?? {}).find(([name]) => comparableText(name) === comparableText(list))?.[1];
114
+ if (added === undefined || !keepsSheet(world, fields)) {
115
+ return value;
116
+ }
117
+ const written = value === undefined || value === null || value === "" ? [] : Array.isArray(value) ? value : [value];
118
+ const names = new Set(listItems(written).map((item) => comparableText(item.name)));
119
+ return [...written, ...added.filter((name) => !names.has(comparableText(name)))];
120
+ }
121
+ /** A system's computed fields and tables by the name as it is compared, built once for each system: a formula reads many names (D-194). */
122
+ export function formulaIndex(formulas) {
123
+ const known = indexes.get(formulas);
124
+ if (known !== undefined) {
125
+ return known;
126
+ }
127
+ const computed = new Map();
128
+ const tables = new Map();
129
+ for (const entry of formulas.computed) {
130
+ computed.set(comparableText(entry[0]), entry);
131
+ }
132
+ for (const [name, table] of Object.entries(formulas.tables)) {
133
+ tables.set(comparableText(name), table);
134
+ }
135
+ const index = { computed, tables };
136
+ indexes.set(formulas, index);
137
+ return index;
138
+ }
139
+ const indexes = new WeakMap();
140
+ /** The English name the system's words give a name written in the campaign's language, Grappled for Afferrato (D-403); the name itself when they give none. */
141
+ function systemName(words, name) {
142
+ const written = comparableText(name.trim());
143
+ return Object.entries(words ?? {}).find(([, word]) => comparableText(word) === written)?.[0] ?? name;
144
+ }
145
+ /** A formula of the system worked out on these fields, as a recipe's regain is; undefined when it has no value (FOR-4). */
146
+ export function formulaValue(world, fields, formula) {
147
+ return workOut(formula, formulaScope(world, fields)).value;
148
+ }
149
+ /**
150
+ * What a field gives for each item of its list whose page gives it (PRO-5): a number, or a roll as text, as "1d8+3 slashing". The formula reads first the
151
+ * item's own fields, as a magic weapon's bonus, then those of who lists it.
152
+ */
153
+ export function itemValues(world, scope, field, explained) {
154
+ const list = itemList(world, field);
155
+ if (list === undefined) {
156
+ return [];
157
+ }
158
+ return listItems(scope.field(list)).flatMap((item) => {
159
+ const page = scope.page(item.name);
160
+ const given = itemFormula(page, field);
161
+ if (page === undefined || given === undefined) {
162
+ return [];
163
+ }
164
+ const own = itemScope(world, scope, page, list);
165
+ const worked = given.formula === undefined ? undefined : workOut(given.formula, own);
166
+ // The dice it takes, as the Martial Arts die of a monk when it is larger (D-235); none of its choices with a value, no value.
167
+ const dice = given.dice === undefined ? undefined : chosenDice(given.dice, own);
168
+ if ((given.formula !== undefined && worked?.value === undefined) || (given.dice !== undefined && dice === undefined)) {
169
+ return [];
170
+ }
171
+ const reads = worked === undefined || given.formula === undefined ? [] : explained ? contributingReads(given.formula, own, worked) : worked.reads;
172
+ return [{ name: item.name, value: rollValue(given, dice, worked?.value), reads: [...(dice?.reads ?? []), ...reads] }];
173
+ });
174
+ }
175
+ /**
176
+ * A formula that each item of its list gives on its page, such as a class's spell-save-dc or a weapon's attack, worked out on who lists them for each item that
177
+ * gives one (PRO-5): a number, or a roll as text, for one; "Cleric 13, Wizard 12" for several. Undefined when none gives it.
178
+ */
179
+ function eachItem(world, field, items) {
180
+ if (items.length === 0) {
181
+ return undefined;
182
+ }
183
+ const [first] = items;
184
+ return items.length === 1
185
+ ? { field, value: first.value, reads: first.reads }
186
+ : { field, value: items.map((item) => `${item.name} ${signedText(world, field, item.value)}`).join(", "), reads: items.flatMap((item) => item.reads) };
187
+ }
188
+ /**
189
+ * The scope of an item's formula: the item's own fields first, as a magic weapon's bonus, written 1 or +1, then those of who lists it (PRO-5). The formulas
190
+ * the item gives for its list are worked out on who lists it: a monk's Unarmored Defense reads the armor-class-bonus of the shield it has equipped.
191
+ */
192
+ function itemScope(world, scope, page, list) {
193
+ const given = world.system?.itemFormulas?.[list] ?? [];
194
+ return {
195
+ ...scope,
196
+ field: (name) => {
197
+ const key = keyOf(page, name);
198
+ if (key === undefined || isEmptyField(page[key]) || given.some((field) => comparableText(field) === comparableText(name))) {
199
+ return scope.field(name);
200
+ }
201
+ return numberOf(page[key]) ?? page[key];
202
+ },
203
+ };
204
+ }
205
+ /** The formula an item's page gives in a field, read once for each text; undefined when it gives none, or one that does not read, which validate reports (PRO-5). */
206
+ export function itemFormula(fields, field) {
207
+ const text = fields === undefined ? undefined : fields[keyOf(fields, field) ?? ""];
208
+ if (typeof text !== "string" && typeof text !== "number") {
209
+ return undefined;
210
+ }
211
+ const key = String(text);
212
+ if (!itemFormulas.has(key)) {
213
+ try {
214
+ itemFormulas.set(key, parseRollFormula(key));
215
+ }
216
+ catch {
217
+ itemFormulas.set(key, undefined);
218
+ }
219
+ }
220
+ return itemFormulas.get(key);
221
+ }
222
+ const itemFormulas = new Map();
223
+ /**
224
+ * "1d8+3 slashing": a roll's dice, the number its formula works out, unless 0, and its words; the number alone for a plain formula. Dice that are a number, as an
225
+ * unarmed strike's 1, add to it: "4 bludgeoning" (D-235).
226
+ */
227
+ function rollValue(given, dice, value) {
228
+ const rolled = dice?.dice;
229
+ const total = dice?.number === undefined ? value : (value ?? 0) + dice.number;
230
+ if (rolled === undefined && given.words === undefined && total !== undefined) {
231
+ return total;
232
+ }
233
+ const number = total === undefined || (total === 0 && rolled !== undefined) ? "" : rolled === undefined ? String(total) : total > 0 ? `+${total}` : String(total);
234
+ return `${rolled ?? ""}${number}${given.words === undefined ? "" : ` ${given.words}`}`;
235
+ }
@@ -1,6 +1,6 @@
1
- import type { Problem } from "../../core/problem.ts";
2
- import { type FieldChange, type Page, type World } from "../../pages/index.ts";
3
- import type { GameSystem } from "../../systems/index.ts";
1
+ import type { Problem } from "../../../core/problem.ts";
2
+ import { type FieldChange, type Page, type World } from "../../../pages/index.ts";
3
+ import type { GameSystem } from "../../../systems/index.ts";
4
4
  /** Refuses a change of a sheet that writes a number above its most, or makes a list longer than its most (LIM-1); before anything is written. */
5
5
  export declare function checkLimits(world: World, system: GameSystem | undefined, page: Page | undefined, name: string, change: FieldChange): void;
6
6
  /** Sheets written by hand above their most (LIM-2). */
@@ -1,10 +1,11 @@
1
1
  // The most a sheet holds (D-449, LIM-1, LIM-2): a number written no higher than the system's formula, as an ability score of 20, and a list no longer, as
2
2
  // the spells prepared; what an item or an effect raises is no part of it.
3
- import { numberOf } from "../../core/formula.js";
4
- import { comparableText, valueNamed } from "../../core/text.js";
5
- import { textsIn } from "../../pages/index.js";
3
+ import { numberOf } from "../../../core/formula.js";
4
+ import { comparableText, valueNamed } from "../../../core/text.js";
5
+ import { textsIn } from "../../../pages/index.js";
6
6
  import { effectiveFields } from "./effect-layer.js";
7
- import { formulaValue, hasSheet, keepsSheet } from "./worked-out.js";
7
+ import { formulaValue } from "./formula-scope.js";
8
+ import { hasSheet, keepsSheet } from "./system-fields.js";
8
9
  /** Refuses a change of a sheet that writes a number above its most, or makes a list longer than its most (LIM-1); before anything is written. */
9
10
  export function checkLimits(world, system, page, name, change) {
10
11
  // The most reads what effects give, as a manual that raises a score's most; the number checked is the one written.
@@ -1,5 +1,5 @@
1
- import type { Problem } from "../../core/problem.ts";
2
- import { type Page, type World } from "../../pages/index.ts";
1
+ import type { Problem } from "../../../core/problem.ts";
2
+ import { type Page, type World } from "../../../pages/index.ts";
3
3
  /** A field the rows give, with its value and the items it comes from, such as rage-damage +2 from Barbarian 3 (PRO-2). */
4
4
  export interface ProgressionValue {
5
5
  field: string;
@@ -1,9 +1,9 @@
1
1
  // What the classes of a character give (D-201, D-219, PRO-1–PRO-4): the row of each class's table at its level, and the features gained so far, with those its
2
2
  // subclasses add. The tables are the pages' own; this is where the system's progression meets the pages of a world.
3
- import { listItems } from "../../core/formula.js";
4
- import { comparableText, valueNamed } from "../../core/text.js";
5
- import { pagesWithName, sectionTitles, systemPageNamed } from "../../pages/index.js";
6
- import { featureParts, fieldName, gainedFeatures, levelledFeatures, levelTable, mergedFeatures, rowFields } from "../../progression/index.js";
3
+ import { listItems } from "../../../core/formula.js";
4
+ import { comparableText, valueNamed } from "../../../core/text.js";
5
+ import { pagesWithName, sectionTitles, systemPageNamed } from "../../../pages/index.js";
6
+ import { featureParts, fieldName, gainedFeatures, levelledFeatures, levelTable, mergedFeatures, rowFields } from "../../../progression/index.js";
7
7
  /** What the classes in these fields give, by the system's progression; undefined when the system has none or the fields name no class (PRO-1). */
8
8
  export function progressionOf(world, fields) {
9
9
  const rule = world.system?.progression;
@@ -1,8 +1,8 @@
1
- import type { Context } from "../../core/context.ts";
2
- import type { Problem } from "../../core/problem.ts";
3
- import { type Counter } from "../../counters/index.ts";
4
- import { type Page, type World } from "../../pages/index.ts";
5
- import type { GameSystem, SystemWords } from "../../systems/index.ts";
1
+ import type { Context } from "../../../core/context.ts";
2
+ import type { Problem } from "../../../core/problem.ts";
3
+ import { type Counter } from "../../../counters/index.ts";
4
+ import { type Page, type World } from "../../../pages/index.ts";
5
+ import type { GameSystem, SystemWords } from "../../../systems/index.ts";
6
6
  import { type LevelNeed } from "./experience.ts";
7
7
  /** What status says of the sheet before there is a player character (DAT-2): what is written, what only when it applies, what the system works out, and the lists it names. */
8
8
  export interface SheetSummary {
@@ -1,13 +1,17 @@
1
- import { listItemNames, numberOf } from "../../core/formula.js";
2
- import { comparableText, valueNamed } from "../../core/text.js";
3
- import { readCounter } from "../../counters/index.js";
4
- import { baseChain, carriedWeight, containerFieldOf, declaredKind, entryKind, entryPage, inheritedFields, isEmptyField, isStandardField, linksIn, readEntry, stackName, stacksOf, textsIn, validHoldersOf, weightUnit, } from "../../pages/index.js";
5
- import { fieldName } from "../../progression/index.js";
1
+ import { listItemNames, numberOf } from "../../../core/formula.js";
2
+ import { comparableText, valueNamed } from "../../../core/text.js";
3
+ import { readCounter } from "../../../counters/index.js";
4
+ import { baseChain, carriedWeight, containerFieldOf, declaredKind, entryKind, entryPage, inheritedFields, isEmptyField, isStandardField, linksIn, readEntry, stackName, stacksOf, textsIn, validHoldersOf, weightUnit, } from "../../../pages/index.js";
5
+ import { fieldName } from "../../../progression/index.js";
6
+ import { firstInChat } from "../campaign/parts.js";
6
7
  import { effectiveFields } from "./effect-layer.js";
8
+ import { carriedIn } from "./effect-values.js";
7
9
  import { experienceOf, experienceText, levelNeed } from "./experience.js";
8
- import { firstInChat } from "./parts.js";
10
+ import { formulaValue } from "./formula-scope.js";
9
11
  import { givenItems, progressionOf } from "./progression.js";
10
- import { carriedIn, counterLimits, formulaValue, hasSheet, isUse, itemLines, itemList, signedText, workedFields, workedLine, workedMaximum, workedParts } from "./worked-out.js";
12
+ import { hasSheet, isUse, itemList } from "./system-fields.js";
13
+ import { counterLimits, itemLines, workedFields, workedMaximum } from "./worked-out.js";
14
+ import { signedText, workedLine, workedParts } from "./worked-text.js";
11
15
  /** The sheet of the game system as status gives it before there is a player character (DAT-2); undefined when the system has none. */
12
16
  export function sheetSummary(system) {
13
17
  if (system.sheet.length === 0) {
@@ -1,5 +1,5 @@
1
- import type { Context } from "../../core/context.ts";
2
- import { type HeldStack, type MovePlan, type Page, type World } from "../../pages/index.ts";
1
+ import type { Context } from "../../../core/context.ts";
2
+ import { type HeldStack, type MovePlan, type Page, type World } from "../../../pages/index.ts";
3
3
  /** A stack that changes: in which container, of which kind, from how many to how many, written with which label (STK-12). */
4
4
  export interface StackStep {
5
5
  container: Page;
@@ -1,7 +1,7 @@
1
- import { appendLogEntry } from "../../core/log.js";
2
- import { comparableText } from "../../core/text.js";
3
- import { applyMove, carriesKind, concernsPlayer, containerFieldOf, entryPage, heldStacks, links, locate, MoveStopped, ownStack, stackName } from "../../pages/index.js";
4
- import { newDatedLogEntry } from "./time.js";
1
+ import { appendLogEntry } from "../../../core/log.js";
2
+ import { comparableText } from "../../../core/text.js";
3
+ import { applyMove, carriesKind, concernsPlayer, containerFieldOf, entryPage, heldStacks, links, locate, MoveStopped, ownStack, stackName } from "../../../pages/index.js";
4
+ import { newDatedLogEntry } from "../time/time.js";
5
5
  /**
6
6
  * The stack of a kind that a holder means (STK-4): its own, else the one inside the items it holds. Refused when it has none, or keeps it in more than one of them; `call`
7
7
  * says how to name the container instead, one inside the holder or, when the holder has none, the place or item it is in that has some, as the shop a merchant is in.
@@ -0,0 +1,21 @@
1
+ import { type Page, type World } from "../../../pages/index.ts";
2
+ /** The name under which the fields hold a field, in any case. */
3
+ export declare function keyOf(fields: Record<string, unknown>, field: string): string | undefined;
4
+ /** Whether the system gives the limits of a counter by this name (FOR-1). */
5
+ export declare function isSystemCounter(world: World, field: string): boolean;
6
+ /** The list whose items' pages give a field as a formula, as classes for spell-save-dc (PRO-5); undefined when none does. */
7
+ export declare function itemList(world: World, field: string): string | undefined;
8
+ /** Whether a counter of the system comes back with a rest (DAT-9): who keeps the sheet has it full until it spends it. */
9
+ export declare function isUse(world: World, field: string): boolean;
10
+ /**
11
+ * The name, as the game system declares it, of a counter that starts at 0 where a page does not hold it yet, as temporary hit points or experience points:
12
+ * declared a counter, with no maximum and not a use that comes back with a rest (CNT-8, D-266). Undefined for any other.
13
+ */
14
+ export declare function startingAtZero(world: World, field: string): string | undefined;
15
+ /**
16
+ * Whether a page keeps the sheet of the system (DAT-2, D-225): the player character, and a companion with a level, written or given by its classes, or that
17
+ * derives from no creature. A fighter who derives from her race does, a wolf with its stat block does not; nor does any other page.
18
+ */
19
+ export declare function hasSheet(world: World, page: Page): boolean;
20
+ /** Whether a character with these fields keeps the sheet (DAT-2): the player character, and a companion with a level or classes, or that derives from no creature. */
21
+ export declare function keepsSheet(world: World, fields: Record<string, unknown>): boolean;
@@ -0,0 +1,45 @@
1
+ // What the system says of a page's fields: their key, counters, uses, item lists, who keeps the sheet
2
+ import { comparableText, sameName } from "../../../core/text.js";
3
+ import { declaredKind, inheritedFields, isEmptyField } from "../../../pages/index.js";
4
+ /** The name under which the fields hold a field, in any case. */
5
+ export function keyOf(fields, field) {
6
+ return sameName(Object.keys(fields), field);
7
+ }
8
+ /** Whether the system gives the limits of a counter by this name (FOR-1). */
9
+ export function isSystemCounter(world, field) {
10
+ return Object.keys(world.system?.formulas?.counters ?? {}).some((name) => comparableText(name) === comparableText(field));
11
+ }
12
+ /** The list whose items' pages give a field as a formula, as classes for spell-save-dc (PRO-5); undefined when none does. */
13
+ export function itemList(world, field) {
14
+ return Object.entries(world.system?.itemFormulas ?? {}).find(([, names]) => names.some((name) => comparableText(name) === comparableText(field.trim())))?.[0];
15
+ }
16
+ /** Whether a counter of the system comes back with a rest (DAT-9): who keeps the sheet has it full until it spends it. */
17
+ export function isUse(world, field) {
18
+ return (world.system?.uses ?? []).some((name) => name.endsWith("*") ? comparableText(field).startsWith(comparableText(name.slice(0, -1))) : comparableText(name) === comparableText(field));
19
+ }
20
+ /**
21
+ * The name, as the game system declares it, of a counter that starts at 0 where a page does not hold it yet, as temporary hit points or experience points:
22
+ * declared a counter, with no maximum and not a use that comes back with a rest (CNT-8, D-266). Undefined for any other.
23
+ */
24
+ export function startingAtZero(world, field) {
25
+ const declared = Object.keys(world.system?.fields ?? {}).find((name) => comparableText(name) === comparableText(field.trim()));
26
+ const limits = Object.entries(world.system?.formulas?.counters ?? {}).find(([counter]) => comparableText(counter) === comparableText(field.trim()))?.[1];
27
+ return declared !== undefined && declaredKind(world, declared) === "counter" && limits?.max === undefined && limits?.refill === undefined ? declared : undefined;
28
+ }
29
+ /**
30
+ * Whether a page keeps the sheet of the system (DAT-2, D-225): the player character, and a companion with a level, written or given by its classes, or that
31
+ * derives from no creature. A fighter who derives from her race does, a wolf with its stat block does not; nor does any other page.
32
+ */
33
+ export function hasSheet(world, page) {
34
+ // A level or classes the page inherits count too, as a companion deriving from a creature with classes.
35
+ return page.type === "character" && keepsSheet(world, page.fields.role === "companion" ? inheritedFields(world, page) : page.fields);
36
+ }
37
+ /** Whether a character with these fields keeps the sheet (DAT-2): the player character, and a companion with a level or classes, or that derives from no creature. */
38
+ export function keepsSheet(world, fields) {
39
+ // The level's field is the game's, as its list is: a game without levels has none (review of 17 October).
40
+ const progression = world.system?.progression;
41
+ const list = progression === undefined ? undefined : keyOf(fields, progression.list);
42
+ const level = progression?.level === undefined ? undefined : (keyOf(fields, progression.level) ?? progression.level);
43
+ const levelled = (level !== undefined && !isEmptyField(fields[level])) || (list !== undefined && !isEmptyField(fields[list]));
44
+ return fields.role === "pc" || (fields.role === "companion" && (isEmptyField(fields.creature) || levelled));
45
+ }
@@ -1,4 +1,4 @@
1
- import type { GameSystem } from "../../systems/index.ts";
1
+ import type { GameSystem } from "../../../systems/index.ts";
2
2
  /**
3
3
  * The notes of the thresholds that a change of a field touches: it reaches the value, even going beyond it, takes more while at it, leaves it, or goes past it,
4
4
  * as in "hp is at 0, 7 beyond: read rules "Dropping to 0 Hit Points"."; a value an effect gives says so. A threshold without a value gives its rule's text at
@@ -1,8 +1,8 @@
1
1
  // The thresholds of a game system (D-184, DAT-3): the rule that a counter of the player character or of a companion touches when it changes.
2
- import { readTextSetting } from "../../campaign/index.js";
3
- import { comparableText } from "../../core/text.js";
4
- import { readCounterText } from "../../counters/index.js";
5
- import { houseRules, ruleBlock, ruleTitled } from "./rules.js";
2
+ import { readTextSetting } from "../../../campaign/index.js";
3
+ import { comparableText } from "../../../core/text.js";
4
+ import { readCounterText } from "../../../counters/index.js";
5
+ import { houseRules, ruleBlock, ruleTitled } from "../books/rules.js";
6
6
  /**
7
7
  * The notes of the thresholds that a change of a field touches: it reaches the value, even going beyond it, takes more while at it, leaves it, or goes past it,
8
8
  * as in "hp is at 0, 7 beyond: read rules "Dropping to 0 Hit Points"."; a value an effect gives says so. A threshold without a value gives its rule's text at
@@ -1,6 +1,6 @@
1
- import type { Page, World } from "../../pages/index.ts";
2
- import type { Scene } from "../../scene/index.ts";
3
- import type { GameSystem } from "../../systems/index.ts";
1
+ import type { Page, World } from "../../../pages/index.ts";
2
+ import type { Scene } from "../../../scene/index.ts";
3
+ import type { GameSystem } from "../../../systems/index.ts";
4
4
  /** What a use did: the uses of the one who used it, as the scene keeps them, the line that says it, and the counter of the sheet it spends (TRN-5). */
5
5
  export interface UsedInTurn {
6
6
  used: string[];
@@ -1,9 +1,10 @@
1
1
  // What one does in a turn (D-453, TRN-1–TRN-4): the uses the system names, as an action, a bonus action, a reaction, the attacks of an action and what a
2
2
  // feature gives once a turn, each at most so many until it comes back.
3
- import { comparableText, sameWord, valueNamed } from "../../core/text.js";
4
- import { readCounter } from "../../counters/index.js";
3
+ import { comparableText, sameWord, valueNamed } from "../../../core/text.js";
4
+ import { readCounter } from "../../../counters/index.js";
5
5
  import { effectiveFields } from "./effect-layer.js";
6
- import { formulaValue, workedMaximum } from "./worked-out.js";
6
+ import { formulaValue } from "./formula-scope.js";
7
+ import { workedMaximum } from "./worked-out.js";
7
8
  /**
8
9
  * One use of a turn (TRN-1, TRN-2): refused past its most, or in another's turn when it goes only in one's own, unless the master names what gives one more
9
10
  * (`by`, as Action Surge); a use within another, as an attack within the action, takes that one first, and counts within it (TRN-3).
@@ -1,12 +1,6 @@
1
- import { type Formula, type FormulaRead } from "../../core/formula.ts";
2
- import type { Problem } from "../../core/problem.ts";
3
- import { type Page, type World } from "../../pages/index.ts";
4
- /** A computed field that has a value, and the values it came from (FOR-8); a field the rows of the classes give may hold text, such as martial-arts 1d6 (PRO-2). */
5
- export interface WorkedField {
6
- field: string;
7
- value: number | string;
8
- reads: FormulaRead[];
9
- }
1
+ import { type World } from "../../../pages/index.ts";
2
+ import { formulaScope } from "./formula-scope.ts";
3
+ import { type WorkedField } from "./worked-text.ts";
10
4
  /**
11
5
  * The computed fields of the game system that have a value with these fields (FOR-4), in the order the system gives them; `explained`, each with only the
12
6
  * values that changed it (FOR-8).
@@ -17,22 +11,6 @@ export declare function workedFields(world: World, fields: Record<string, unknow
17
11
  * takes the maximum the system works out, and a current above it reads as the maximum (FOR-6). With `sheeted`, the uses it does not write read full (DAT-9).
18
12
  */
19
13
  export declare function withWorkedOut(world: World, fields: Record<string, unknown>, sheeted: boolean): Record<string, unknown>;
20
- /**
21
- * Whether a page keeps the sheet of the system (DAT-2, D-225): the player character, and a companion with a level, written or given by its classes, or that
22
- * derives from no creature. A fighter who derives from her race does, a wolf with its stat block does not; nor does any other page.
23
- */
24
- export declare function hasSheet(world: World, page: Page): boolean;
25
- /** Whether a character with these fields keeps the sheet (DAT-2): the player character, and a companion with a level or classes, or that derives from no creature. */
26
- export declare function keepsSheet(world: World, fields: Record<string, unknown>): boolean;
27
- /**
28
- * A page's fields with the values its effects give over them (EFF-3): from the newest effect that gives a field, then the page, then its bases; a bonus field
29
- * adds up the effects that give it (FOR-5). Before what the system works out, as an item's formulas read it: a weapon under Magic Weapon (PRO-5).
30
- */
31
- export declare function withEffectValues(world: World, page: Page): Record<string, unknown>;
32
- /** What a character carries weighs, as its effective fields keep it (LOAD-1): worked out once with them; undefined for fields that do not keep it. */
33
- export declare function carriedIn(fields: Record<string, unknown>): number | undefined;
34
- /** Whether a counter of the system comes back with a rest (DAT-9): who keeps the sheet has it full until it spends it. */
35
- export declare function isUse(world: World, field: string): boolean;
36
14
  /** The uses the system gives a page with these fields that it does not write, each with its maximum (DAT-9): what write puts, full, on who keeps the sheet. */
37
15
  export declare function missingUses(world: World, fields: Record<string, unknown>): {
38
16
  field: string;
@@ -43,10 +21,6 @@ export declare function missingUses(world: World, fields: Record<string, unknown
43
21
  * it names none of them.
44
22
  */
45
23
  export declare function refillAmount(world: World, fields: Record<string, unknown>, field: string, occasions: string[], max: number): number | undefined;
46
- /** A formula of the system worked out on these fields, as a recipe's regain is; undefined when it has no value (FOR-4). */
47
- export declare function formulaValue(world: World, fields: Record<string, unknown>, formula: Formula): number | undefined;
48
- /** The list whose items' pages give a field as a formula, as classes for spell-save-dc (PRO-5); undefined when none does. */
49
- export declare function itemList(world: World, field: string): string | undefined;
50
24
  /**
51
25
  * Each item of a list with what the formulas of its page give, field by field, in the order of the list, for a sheet that shows them item by item, as the
52
26
  * attacks of the weapons a character has equipped (PRO-5).
@@ -60,11 +34,6 @@ export declare function counterLimits(world: World, fields: Record<string, unkno
60
34
  min?: number;
61
35
  max?: number;
62
36
  };
63
- /**
64
- * The name, as the game system declares it, of a counter that starts at 0 where a page does not hold it yet, as temporary hit points or experience points:
65
- * declared a counter, with no maximum and not a use that comes back with a rest (CNT-8, D-266). Undefined for any other.
66
- */
67
- export declare function startingAtZero(world: World, field: string): string | undefined;
68
37
  /**
69
38
  * The game system's computed field with this name, in any case, and the fields it comes from, when its formula has a value with these fields (FOR-7):
70
39
  * where it has none, as on a creature without a level, the field is written like any other.
@@ -111,17 +80,13 @@ export declare function itemSource(world: World, fields: Record<string, unknown>
111
80
  list: string;
112
81
  own: string[];
113
82
  } | undefined;
114
- /** A value of a field as the outputs show it: with its sign when the system declares the field a modifier or a bonus (FOR-8). */
115
- export declare function signedText(world: World, field: string, value: number | string): string;
116
- /** "insight +5: wis-mod +3, proficiency +2, Insight in skill-proficiencies": a computed field and what it came from, leaving out what adds nothing (FOR-8). */
117
- export declare function workedLine(world: World, worked: WorkedField): string;
118
- /** "wis-mod +3, proficiency +2, Insight in skill-proficiencies": the values a result came from, leaving out what adds nothing (FOR-8). */
119
- export declare function workedParts(world: World, reads: FormulaRead[]): string;
120
83
  /** The maximum the game system works out for a counter with these fields, with only the values that changed it (FOR-6, FOR-8); undefined where it has none. */
121
84
  export declare function workedMaximum(world: World, fields: Record<string, unknown>, field: string): WorkedField | undefined;
122
- /**
123
- * What validate says of the pages of the campaign about what the game system works out (FOR-7): a computed field written on a page, where the system works it
124
- * out and the page's value is never read; a written maximum that is not the one the system works out from the page without its effects; what the classes of a
125
- * page cannot give (PRO-1, PRO-4). Found once for each world.
126
- */
127
- export declare function workedOutProblems(world: World): Problem[];
85
+ /** What the lists of a page give as computed fields: what its classes give (PRO-2, PRO-3), then what the formulas of its items' pages work out (PRO-5). */
86
+ export declare function givenFields(world: World, scope: ReturnType<typeof formulaScope>, explained?: boolean): WorkedField[];
87
+ /** A field the classes give, as a computed field that cannot be written, with the lists it comes from (PRO-2, FOR-7); undefined for any other field. */
88
+ export declare function progressedField(world: World, scope: ReturnType<typeof formulaScope>, field: string): {
89
+ name: string;
90
+ value: number | string;
91
+ from: string[];
92
+ } | undefined;