rpg-engine 0.15.0 → 0.17.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 (503) hide show
  1. package/dist/adventures/source.d.ts +3 -1
  2. package/dist/adventures/source.js +31 -1
  3. package/dist/campaign/find-campaign.js +8 -4
  4. package/dist/campaign/index.d.ts +1 -1
  5. package/dist/campaign/index.js +1 -1
  6. package/dist/campaign/settings.d.ts +6 -0
  7. package/dist/campaign/settings.js +22 -1
  8. package/dist/cli/cli.js +1 -1
  9. package/dist/cli/command-line.js +1 -1
  10. package/dist/commands/advance.d.ts +1 -1
  11. package/dist/commands/advance.js +6 -6
  12. package/dist/commands/ask.js +7 -7
  13. package/dist/commands/change/amounts.d.ts +32 -0
  14. package/dist/commands/change/amounts.js +150 -0
  15. package/dist/commands/change/change.d.ts +4 -54
  16. package/dist/commands/change/change.js +19 -749
  17. package/dist/commands/change/damage.d.ts +30 -0
  18. package/dist/commands/change/damage.js +73 -2
  19. package/dist/commands/change/dice.d.ts +34 -0
  20. package/dist/commands/change/dice.js +59 -0
  21. package/dist/commands/change/fields.d.ts +37 -0
  22. package/dist/commands/change/fields.js +156 -0
  23. package/dist/commands/change/holder.d.ts +48 -0
  24. package/dist/commands/change/holder.js +162 -0
  25. package/dist/commands/change/recipe-pace.js +1 -1
  26. package/dist/commands/change/recipe.d.ts +58 -0
  27. package/dist/commands/change/recipe.js +179 -0
  28. package/dist/commands/choices.js +3 -3
  29. package/dist/commands/config/config.d.ts +15 -0
  30. package/dist/commands/config/config.js +355 -0
  31. package/dist/commands/config/custom-levels.d.ts +7 -0
  32. package/dist/commands/config/custom-levels.js +32 -0
  33. package/dist/commands/{config.d.ts → config/dashboard.d.ts} +2 -24
  34. package/dist/commands/config/dashboard.js +171 -0
  35. package/dist/commands/config/entries.d.ts +17 -0
  36. package/dist/commands/config/entries.js +76 -0
  37. package/dist/commands/config/news.d.ts +7 -0
  38. package/dist/commands/config/news.js +88 -0
  39. package/dist/commands/config/shown.d.ts +9 -0
  40. package/dist/commands/config/shown.js +80 -0
  41. package/dist/commands/config/words.d.ts +27 -0
  42. package/dist/commands/config/words.js +204 -0
  43. package/dist/commands/effect.js +9 -9
  44. package/dist/commands/find.js +1 -1
  45. package/dist/commands/image.js +6 -6
  46. package/dist/commands/import/import.d.ts +0 -2
  47. package/dist/commands/import/import.js +68 -45
  48. package/dist/commands/import/run.js +1 -1
  49. package/dist/commands/index.js +3 -3
  50. package/dist/commands/init.js +2 -2
  51. package/dist/commands/install.js +1 -1
  52. package/dist/commands/instructions.js +6 -6
  53. package/dist/commands/mode.d.ts +2 -2
  54. package/dist/commands/mode.js +8 -8
  55. package/dist/commands/mood.js +4 -4
  56. package/dist/commands/move.js +10 -10
  57. package/dist/commands/package/consent.d.ts +11 -0
  58. package/dist/commands/package/consent.js +52 -0
  59. package/dist/commands/package/here.d.ts +51 -0
  60. package/dist/commands/package/here.js +128 -0
  61. package/dist/commands/package/install.d.ts +10 -0
  62. package/dist/commands/package/install.js +337 -0
  63. package/dist/commands/package/package.d.ts +18 -0
  64. package/dist/commands/package/package.js +270 -0
  65. package/dist/commands/package/result.d.ts +89 -0
  66. package/dist/commands/package/result.js +1 -0
  67. package/dist/commands/package/uninstall.d.ts +6 -0
  68. package/dist/commands/package/uninstall.js +70 -0
  69. package/dist/commands/rename.js +3 -3
  70. package/dist/commands/reveal.js +5 -5
  71. package/dist/commands/roll/roll.js +11 -9
  72. package/dist/commands/roll/tables.js +1 -1
  73. package/dist/commands/rules.d.ts +2 -2
  74. package/dist/commands/rules.js +3 -3
  75. package/dist/commands/save.d.ts +2 -2
  76. package/dist/commands/save.js +2 -2
  77. package/dist/commands/scene/close.d.ts +18 -0
  78. package/dist/commands/scene/close.js +179 -0
  79. package/dist/commands/scene/members.d.ts +14 -0
  80. package/dist/commands/scene/members.js +32 -0
  81. package/dist/commands/scene/open.d.ts +6 -0
  82. package/dist/commands/scene/open.js +298 -0
  83. package/dist/commands/scene/result.d.ts +98 -0
  84. package/dist/commands/scene/result.js +2 -0
  85. package/dist/commands/{scene.d.ts → scene/scene.d.ts} +10 -36
  86. package/dist/commands/scene/scene.js +210 -0
  87. package/dist/commands/scene/turns.d.ts +18 -0
  88. package/dist/commands/scene/turns.js +229 -0
  89. package/dist/commands/shared/books/adventure-layers.d.ts +89 -0
  90. package/dist/commands/shared/books/adventure-layers.js +201 -0
  91. package/dist/commands/shared/{adventures.d.ts → books/adventures.d.ts} +28 -9
  92. package/dist/commands/shared/{adventures.js → books/adventures.js} +77 -35
  93. package/dist/commands/shared/{library-reader.js → books/library-reader.js} +3 -3
  94. package/dist/commands/shared/{library.d.ts → books/library.d.ts} +2 -2
  95. package/dist/commands/shared/{library.js → books/library.js} +9 -9
  96. package/dist/commands/shared/{rules.d.ts → books/rules.d.ts} +2 -2
  97. package/dist/commands/shared/{rules.js → books/rules.js} +5 -5
  98. package/dist/commands/shared/{system-texts.d.ts → books/system-texts.d.ts} +2 -2
  99. package/dist/commands/shared/{system-texts.js → books/system-texts.js} +9 -8
  100. package/dist/commands/shared/{page-words.d.ts → books/words.d.ts} +2 -2
  101. package/dist/commands/shared/{page-words.js → books/words.js} +4 -4
  102. package/dist/commands/shared/{checks.d.ts → campaign/checks.d.ts} +3 -3
  103. package/dist/commands/shared/{checks.js → campaign/checks.js} +7 -7
  104. package/dist/commands/shared/{images.d.ts → campaign/images.d.ts} +3 -3
  105. package/dist/commands/shared/{images.js → campaign/images.js} +5 -5
  106. package/dist/commands/shared/{mode.d.ts → campaign/mode.d.ts} +4 -4
  107. package/dist/commands/shared/{mode.js → campaign/mode.js} +24 -13
  108. package/dist/commands/shared/{money.d.ts → campaign/money.d.ts} +3 -3
  109. package/dist/commands/shared/{money.js → campaign/money.js} +2 -2
  110. package/dist/commands/shared/{offers.d.ts → campaign/offers.d.ts} +3 -3
  111. package/dist/commands/shared/{offers.js → campaign/offers.js} +3 -3
  112. package/dist/commands/shared/{outside.d.ts → campaign/outside.d.ts} +3 -3
  113. package/dist/commands/shared/{outside.js → campaign/outside.js} +7 -7
  114. package/dist/commands/shared/{parts.d.ts → campaign/parts.d.ts} +3 -3
  115. package/dist/commands/shared/{parts.js → campaign/parts.js} +3 -3
  116. package/dist/commands/shared/{problems.d.ts → campaign/problems.d.ts} +3 -3
  117. package/dist/commands/shared/{problems.js → campaign/problems.js} +17 -17
  118. package/dist/commands/shared/{quests.d.ts → campaign/quests.d.ts} +4 -4
  119. package/dist/commands/shared/{quests.js → campaign/quests.js} +6 -6
  120. package/dist/commands/shared/{saves.d.ts → campaign/saves.d.ts} +4 -4
  121. package/dist/commands/shared/{saves.js → campaign/saves.js} +10 -10
  122. package/dist/commands/shared/{theme.d.ts → campaign/theme.d.ts} +3 -3
  123. package/dist/commands/shared/{theme.js → campaign/theme.js} +1 -1
  124. package/dist/commands/shared/{world.d.ts → campaign/world.d.ts} +5 -5
  125. package/dist/commands/shared/{world.js → campaign/world.js} +17 -14
  126. package/dist/commands/shared/{knowledge.d.ts → characters/knowledge.d.ts} +3 -3
  127. package/dist/commands/shared/{knowledge.js → characters/knowledge.js} +4 -4
  128. package/dist/commands/shared/{moods.d.ts → characters/moods.d.ts} +3 -3
  129. package/dist/commands/shared/{moods.js → characters/moods.js} +3 -3
  130. package/dist/commands/shared/characters/orders.d.ts +4 -0
  131. package/dist/commands/shared/characters/orders.js +10 -0
  132. package/dist/commands/shared/{thoughts.d.ts → characters/thoughts.d.ts} +9 -6
  133. package/dist/commands/shared/{thoughts.js → characters/thoughts.js} +17 -7
  134. package/dist/commands/shared/{voices.d.ts → characters/voices.d.ts} +1 -1
  135. package/dist/commands/shared/{voices.js → characters/voices.js} +2 -2
  136. package/dist/commands/shared/examples.js +2 -2
  137. package/dist/commands/shared/packages/catalog.js +2 -2
  138. package/dist/commands/shared/packages/code.d.ts +1 -1
  139. package/dist/commands/shared/packages/code.js +8 -8
  140. package/dist/commands/shared/packages/extensions.d.ts +1 -1
  141. package/dist/commands/shared/packages/extensions.js +1 -1
  142. package/dist/commands/shared/packages/hooks.d.ts +1 -1
  143. package/dist/commands/shared/packages/hooks.js +1 -1
  144. package/dist/commands/shared/packages/widgets.d.ts +3 -3
  145. package/dist/commands/shared/packages/widgets.js +3 -3
  146. package/dist/commands/shared/{environment.d.ts → places/environment.d.ts} +1 -1
  147. package/dist/commands/shared/{environment.js → places/environment.js} +4 -4
  148. package/dist/commands/shared/{grid-moves.d.ts → places/grid-moves.d.ts} +4 -4
  149. package/dist/commands/shared/{grid-moves.js → places/grid-moves.js} +8 -7
  150. package/dist/commands/shared/{grids.d.ts → places/grids.d.ts} +4 -4
  151. package/dist/commands/shared/{grids.js → places/grids.js} +6 -6
  152. package/dist/commands/shared/{journey.d.ts → places/journey.d.ts} +3 -3
  153. package/dist/commands/shared/{journey.js → places/journey.js} +6 -6
  154. package/dist/commands/shared/{moves.d.ts → places/moves.d.ts} +2 -2
  155. package/dist/commands/shared/{moves.js → places/moves.js} +4 -4
  156. package/dist/commands/shared/{positions.d.ts → places/positions.d.ts} +2 -2
  157. package/dist/commands/shared/{positions.js → places/positions.js} +4 -4
  158. package/dist/commands/shared/{roads.d.ts → places/roads.d.ts} +5 -5
  159. package/dist/commands/shared/{roads.js → places/roads.js} +6 -6
  160. package/dist/commands/shared/{effects.d.ts → scene/effects.d.ts} +7 -7
  161. package/dist/commands/shared/{effects.js → scene/effects.js} +10 -10
  162. package/dist/commands/shared/{loot.d.ts → scene/loot.d.ts} +2 -2
  163. package/dist/commands/shared/{loot.js → scene/loot.js} +3 -3
  164. package/dist/commands/shared/{master-rolls.d.ts → scene/master-rolls.d.ts} +2 -2
  165. package/dist/commands/shared/{master-rolls.js → scene/master-rolls.js} +5 -5
  166. package/dist/commands/shared/{reminders.d.ts → scene/reminders.d.ts} +4 -4
  167. package/dist/commands/shared/{reminders.js → scene/reminders.js} +4 -4
  168. package/dist/commands/shared/{scene.d.ts → scene/scene.d.ts} +3 -3
  169. package/dist/commands/shared/{scene.js → scene/scene.js} +10 -8
  170. package/dist/commands/shared/{bonds.d.ts → sheet/bonds.d.ts} +3 -3
  171. package/dist/commands/shared/{bonds.js → sheet/bonds.js} +2 -2
  172. package/dist/commands/shared/{page-counters.d.ts → sheet/counters.d.ts} +3 -3
  173. package/dist/commands/shared/{page-counters.js → sheet/counters.js} +5 -5
  174. package/dist/commands/shared/{effect-layer.d.ts → sheet/effect-layer.d.ts} +2 -2
  175. package/dist/commands/shared/{effect-layer.js → sheet/effect-layer.js} +9 -6
  176. package/dist/commands/shared/sheet/effect-values.d.ts +9 -0
  177. package/dist/commands/shared/sheet/effect-values.js +69 -0
  178. package/dist/commands/shared/{experience.d.ts → sheet/experience.d.ts} +3 -3
  179. package/dist/commands/shared/{experience.js → sheet/experience.js} +5 -5
  180. package/dist/commands/shared/sheet/formula-problems.d.ts +8 -0
  181. package/dist/commands/shared/sheet/formula-problems.js +140 -0
  182. package/dist/commands/shared/sheet/formula-scope.d.ts +32 -0
  183. package/dist/commands/shared/sheet/formula-scope.js +235 -0
  184. package/dist/commands/shared/{limits.d.ts → sheet/limits.d.ts} +3 -3
  185. package/dist/commands/shared/{limits.js → sheet/limits.js} +5 -4
  186. package/dist/commands/shared/{progression.d.ts → sheet/progression.d.ts} +2 -2
  187. package/dist/commands/shared/{progression.js → sheet/progression.js} +4 -4
  188. package/dist/commands/shared/{sheet.d.ts → sheet/sheet.d.ts} +7 -5
  189. package/dist/commands/shared/{sheet.js → sheet/sheet.js} +11 -7
  190. package/dist/commands/shared/{stacks.d.ts → sheet/stacks.d.ts} +2 -2
  191. package/dist/commands/shared/{stacks.js → sheet/stacks.js} +4 -4
  192. package/dist/commands/shared/sheet/system-fields.d.ts +21 -0
  193. package/dist/commands/shared/sheet/system-fields.js +45 -0
  194. package/dist/commands/shared/{thresholds.d.ts → sheet/thresholds.d.ts} +1 -1
  195. package/dist/commands/shared/{thresholds.js → sheet/thresholds.js} +4 -4
  196. package/dist/commands/shared/{turn-uses.d.ts → sheet/turn-uses.d.ts} +3 -3
  197. package/dist/commands/shared/{turn-uses.js → sheet/turn-uses.js} +4 -3
  198. package/dist/commands/shared/{worked-out.d.ts → sheet/worked-out.d.ts} +11 -46
  199. package/dist/commands/shared/sheet/worked-out.js +291 -0
  200. package/dist/commands/shared/sheet/worked-text.d.ts +14 -0
  201. package/dist/commands/shared/sheet/worked-text.js +55 -0
  202. package/dist/commands/shared/{advance.d.ts → time/advance.d.ts} +3 -3
  203. package/dist/commands/shared/{advance.js → time/advance.js} +11 -11
  204. package/dist/commands/shared/{dice-pool.d.ts → time/dice-pool.d.ts} +3 -3
  205. package/dist/commands/shared/{dice-pool.js → time/dice-pool.js} +11 -11
  206. package/dist/commands/shared/{events.d.ts → time/events.d.ts} +5 -5
  207. package/dist/commands/shared/{events.js → time/events.js} +10 -13
  208. package/dist/commands/shared/{recipes.d.ts → time/recipes.d.ts} +3 -3
  209. package/dist/commands/shared/{recipes.js → time/recipes.js} +6 -5
  210. package/dist/commands/shared/{time.d.ts → time/time.d.ts} +4 -4
  211. package/dist/commands/shared/{time.js → time/time.js} +6 -6
  212. package/dist/commands/shared/{upkeep.d.ts → time/upkeep.d.ts} +3 -3
  213. package/dist/commands/shared/{upkeep.js → time/upkeep.js} +14 -13
  214. package/dist/commands/show.d.ts +9 -0
  215. package/dist/commands/show.js +43 -10
  216. package/dist/commands/status.d.ts +2 -1
  217. package/dist/commands/status.js +28 -22
  218. package/dist/commands/thoughts.d.ts +1 -0
  219. package/dist/commands/thoughts.js +26 -18
  220. package/dist/commands/trade.js +8 -8
  221. package/dist/commands/translate.d.ts +1 -1
  222. package/dist/commands/translate.js +3 -3
  223. package/dist/commands/travel/open.d.ts +1 -1
  224. package/dist/commands/travel/open.js +2 -2
  225. package/dist/commands/travel/route.js +7 -6
  226. package/dist/commands/travel/travel.d.ts +1 -1
  227. package/dist/commands/travel/travel.js +8 -8
  228. package/dist/commands/validate.js +3 -3
  229. package/dist/commands/view/journal.d.ts +2 -2
  230. package/dist/commands/view/journal.js +2 -2
  231. package/dist/commands/view/layers.d.ts +34 -0
  232. package/dist/commands/view/layers.js +44 -0
  233. package/dist/commands/view/map.d.ts +1 -1
  234. package/dist/commands/view/map.js +6 -6
  235. package/dist/commands/view/memory.d.ts +16 -0
  236. package/dist/commands/view/memory.js +96 -0
  237. package/dist/commands/view/page.d.ts +32 -0
  238. package/dist/commands/view/page.js +166 -0
  239. package/dist/commands/view/place.d.ts +7 -2
  240. package/dist/commands/view/place.js +30 -12
  241. package/dist/commands/view/result.d.ts +252 -0
  242. package/dist/commands/view/result.js +1 -0
  243. package/dist/commands/view/saves.d.ts +6 -0
  244. package/dist/commands/view/saves.js +53 -0
  245. package/dist/commands/view/story.d.ts +32 -0
  246. package/dist/commands/view/story.js +227 -0
  247. package/dist/commands/view/view.d.ts +29 -292
  248. package/dist/commands/view/view.js +31 -536
  249. package/dist/commands/view/world.d.ts +1 -1
  250. package/dist/commands/view/world.js +3 -3
  251. package/dist/commands/write/checks.d.ts +42 -0
  252. package/dist/commands/write/checks.js +291 -0
  253. package/dist/commands/write/here.d.ts +1 -1
  254. package/dist/commands/write/here.js +5 -5
  255. package/dist/commands/write/inheritance.d.ts +40 -0
  256. package/dist/commands/write/inheritance.js +185 -0
  257. package/dist/commands/write/input.d.ts +29 -0
  258. package/dist/commands/write/input.js +124 -0
  259. package/dist/commands/write/layer.d.ts +44 -0
  260. package/dist/commands/write/layer.js +68 -0
  261. package/dist/commands/write/notes.d.ts +22 -0
  262. package/dist/commands/write/notes.js +76 -0
  263. package/dist/commands/write/progression.d.ts +27 -0
  264. package/dist/commands/write/progression.js +175 -0
  265. package/dist/commands/write/write.d.ts +2 -0
  266. package/dist/commands/write/write.js +36 -816
  267. package/dist/core/files.d.ts +2 -0
  268. package/dist/core/files.js +7 -0
  269. package/dist/core/{package-declarations.d.ts → packages/declarations.d.ts} +1 -1
  270. package/dist/core/{package-declarations.js → packages/declarations.js} +1 -1
  271. package/dist/core/session-store.js +3 -3
  272. package/dist/core/store.d.ts +2 -2
  273. package/dist/core/store.js +18 -4
  274. package/dist/core/text.d.ts +2 -0
  275. package/dist/core/text.js +4 -0
  276. package/dist/dashboard/acts/acts.js +1 -1
  277. package/dist/dashboard/acts/sending.js +110 -0
  278. package/dist/dashboard/acts/sheet.js +2 -2
  279. package/dist/dashboard/acts/strip.js +1 -1
  280. package/dist/dashboard/address.js +6 -0
  281. package/dist/dashboard/api.js +19 -1
  282. package/dist/dashboard/app.js +51 -171
  283. package/dist/dashboard/dice/roller.js +1 -1
  284. package/dist/dashboard/dice/sets.js +2 -2
  285. package/dist/dashboard/dice/stage.js +1 -1
  286. package/dist/dashboard/dice/tray.js +6 -6
  287. package/dist/dashboard/guide/ar.md +7 -3
  288. package/dist/dashboard/guide/cs.md +9 -5
  289. package/dist/dashboard/guide/da.md +9 -5
  290. package/dist/dashboard/guide/de.md +7 -3
  291. package/dist/dashboard/guide/el.md +9 -5
  292. package/dist/dashboard/guide/en.md +4 -0
  293. package/dist/dashboard/guide/es.md +8 -4
  294. package/dist/dashboard/guide/fi.md +9 -5
  295. package/dist/dashboard/guide/fr.md +8 -4
  296. package/dist/dashboard/guide/he.md +7 -3
  297. package/dist/dashboard/guide/hi.md +10 -6
  298. package/dist/dashboard/guide/hu.md +8 -4
  299. package/dist/dashboard/guide/is.md +9 -5
  300. package/dist/dashboard/guide/it.md +5 -1
  301. package/dist/dashboard/guide/ja.md +9 -5
  302. package/dist/dashboard/guide/ko.md +8 -4
  303. package/dist/dashboard/guide/nb.md +8 -4
  304. package/dist/dashboard/guide/nl.md +8 -4
  305. package/dist/dashboard/guide/pl.md +8 -4
  306. package/dist/dashboard/guide/pt.md +7 -3
  307. package/dist/dashboard/guide/ro.md +9 -5
  308. package/dist/dashboard/guide/ru.md +8 -4
  309. package/dist/dashboard/guide/sv.md +9 -5
  310. package/dist/dashboard/guide/tr.md +9 -5
  311. package/dist/dashboard/guide/uk.md +8 -4
  312. package/dist/dashboard/guide/zh.md +8 -4
  313. package/dist/dashboard/help/help.js +3 -3
  314. package/dist/dashboard/i18n/ar.json +29 -0
  315. package/dist/dashboard/i18n/cs.json +29 -0
  316. package/dist/dashboard/i18n/da.json +29 -0
  317. package/dist/dashboard/i18n/de.json +29 -0
  318. package/dist/dashboard/i18n/el.json +29 -0
  319. package/dist/dashboard/i18n/es.json +29 -0
  320. package/dist/dashboard/i18n/fi.json +29 -0
  321. package/dist/dashboard/i18n/fr.json +29 -0
  322. package/dist/dashboard/i18n/he.json +29 -0
  323. package/dist/dashboard/i18n/hi.json +29 -0
  324. package/dist/dashboard/i18n/hu.json +29 -0
  325. package/dist/dashboard/i18n/is.json +29 -0
  326. package/dist/dashboard/i18n/it.json +29 -0
  327. package/dist/dashboard/i18n/ja.json +30 -1
  328. package/dist/dashboard/i18n/ko.json +29 -0
  329. package/dist/dashboard/i18n/nb.json +29 -0
  330. package/dist/dashboard/i18n/nl.json +29 -0
  331. package/dist/dashboard/i18n/pl.json +29 -0
  332. package/dist/dashboard/i18n/pt.json +29 -0
  333. package/dist/dashboard/i18n/ro.json +29 -0
  334. package/dist/dashboard/i18n/ru.json +29 -0
  335. package/dist/dashboard/i18n/sv.json +29 -0
  336. package/dist/dashboard/i18n/tr.json +29 -0
  337. package/dist/dashboard/i18n/uk.json +29 -0
  338. package/dist/dashboard/i18n/zh.json +29 -0
  339. package/dist/dashboard/{journal.js → journal/journal.js} +16 -16
  340. package/dist/dashboard/{notes.js → journal/notes.js} +4 -4
  341. package/dist/dashboard/kit.js +3 -3
  342. package/dist/dashboard/packages/ask-card.js +3 -3
  343. package/dist/dashboard/packages/catalog.js +196 -0
  344. package/dist/dashboard/packages/changes.js +111 -0
  345. package/dist/dashboard/packages/engine.js +87 -0
  346. package/dist/dashboard/packages/installed.js +53 -0
  347. package/dist/dashboard/packages/library.js +97 -0
  348. package/dist/dashboard/packages/outcomes.js +45 -0
  349. package/dist/dashboard/packages/packages.js +27 -578
  350. package/dist/dashboard/packages/page-code.js +15 -2
  351. package/dist/dashboard/packages/{package-page.js → page.js} +12 -5
  352. package/dist/dashboard/packages/rows.js +84 -0
  353. package/dist/dashboard/packages/share.js +44 -0
  354. package/dist/dashboard/packages/widgets.js +3 -3
  355. package/dist/dashboard/{card.js → parts/card.js} +1 -1
  356. package/dist/dashboard/parts/changed.js +37 -0
  357. package/dist/dashboard/{faces.js → parts/faces.js} +5 -5
  358. package/dist/dashboard/{game-words.js → parts/game-words.js} +1 -1
  359. package/dist/dashboard/{icons.js → parts/icons.js} +1 -1
  360. package/dist/dashboard/{labels.js → parts/labels.js} +2 -1
  361. package/dist/dashboard/{map-symbols.js → parts/map-symbols.js} +1 -1
  362. package/dist/dashboard/{markdown.js → parts/markdown.js} +2 -2
  363. package/dist/dashboard/{mood.js → parts/mood.js} +1 -1
  364. package/dist/dashboard/{refusals.js → parts/refusals.js} +5 -1
  365. package/dist/dashboard/{status.js → parts/status.js} +4 -4
  366. package/dist/dashboard/{widgets.js → parts/widgets.js} +5 -3
  367. package/dist/dashboard/place/key.js +24 -0
  368. package/dist/dashboard/place/paper.js +67 -0
  369. package/dist/dashboard/place/{map-sheet.js → sheet.js} +2 -2
  370. package/dist/dashboard/place/things.js +129 -0
  371. package/dist/dashboard/place/tokens.js +93 -0
  372. package/dist/dashboard/place/view.js +124 -0
  373. package/dist/dashboard/{asked-dice.js → play/asked-dice.js} +3 -3
  374. package/dist/dashboard/{asked.js → play/asked.js} +10 -10
  375. package/dist/dashboard/{choices.js → play/choices.js} +11 -10
  376. package/dist/dashboard/{requested.js → play/requested.js} +1 -1
  377. package/dist/dashboard/{rolls.js → play/rolls.js} +9 -9
  378. package/dist/dashboard/{scene.js → play/scene.js} +14 -14
  379. package/dist/dashboard/{turns.js → play/turns.js} +12 -12
  380. package/dist/dashboard/{language-choice.js → settings/language-choice.js} +1 -1
  381. package/dist/dashboard/{languages.js → settings/languages.js} +1 -1
  382. package/dist/dashboard/{saves.js → settings/saves.js} +8 -8
  383. package/dist/dashboard/{settings.js → settings/settings.js} +17 -15
  384. package/dist/dashboard/{setup.js → settings/setup.js} +5 -5
  385. package/dist/dashboard/{party.js → sheet/party.js} +8 -8
  386. package/dist/dashboard/{person-panel.js → sheet/person-panel.js} +4 -4
  387. package/dist/dashboard/{sheet.js → sheet/sheet.js} +27 -24
  388. package/dist/dashboard/{story.js → sheet/story.js} +3 -3
  389. package/dist/dashboard/{columns.js → shell/columns.js} +1 -1
  390. package/dist/dashboard/{footer.js → shell/footer.js} +3 -3
  391. package/dist/dashboard/{master.js → shell/master.js} +2 -2
  392. package/dist/dashboard/{notices.js → shell/notices.js} +3 -3
  393. package/dist/dashboard/{pages.js → shell/pages.js} +5 -5
  394. package/dist/dashboard/shell/shown.js +38 -0
  395. package/dist/dashboard/{table.js → shell/table.js} +2 -2
  396. package/dist/dashboard/{tabs.js → shell/tabs.js} +2 -2
  397. package/dist/dashboard/{top.js → shell/top.js} +7 -7
  398. package/dist/dashboard/style.css +288 -4
  399. package/dist/dashboard/world/calendar.js +4 -4
  400. package/dist/dashboard/world/drawing.js +92 -0
  401. package/dist/dashboard/world/key.js +21 -0
  402. package/dist/dashboard/world/lore.js +10 -6
  403. package/dist/dashboard/world/map-card.js +186 -0
  404. package/dist/dashboard/world/place-card.js +39 -0
  405. package/dist/dashboard/world/places.js +29 -0
  406. package/dist/dashboard/world/world.js +9 -341
  407. package/dist/extensions/extension.d.ts +1 -1
  408. package/dist/extensions/extension.js +1 -1
  409. package/dist/images/images.js +12 -9
  410. package/dist/index.d.ts +1 -1
  411. package/dist/languages/index.d.ts +1 -1
  412. package/dist/languages/index.js +1 -1
  413. package/dist/packages/npm.js +1 -1
  414. package/dist/page.d.ts +2 -2
  415. package/dist/page.js +1 -1
  416. package/dist/pages/check.js +23 -1
  417. package/dist/pages/containers.d.ts +1 -1
  418. package/dist/pages/containers.js +1 -1
  419. package/dist/pages/index.d.ts +4 -2
  420. package/dist/pages/index.js +4 -2
  421. package/dist/pages/inheritance.d.ts +2 -2
  422. package/dist/pages/layers.d.ts +52 -0
  423. package/dist/pages/layers.js +105 -0
  424. package/dist/pages/markdown.d.ts +5 -1
  425. package/dist/pages/markdown.js +13 -1
  426. package/dist/pages/rename-page.js +1 -1
  427. package/dist/pages/stacks/writes.js +48 -22
  428. package/dist/pages/standard-fields.d.ts +1 -1
  429. package/dist/pages/system-pages.d.ts +5 -3
  430. package/dist/pages/system-pages.js +16 -7
  431. package/dist/pages/world.d.ts +8 -1
  432. package/dist/pages/world.js +16 -4
  433. package/dist/pages/write-layer.d.ts +23 -0
  434. package/dist/pages/write-layer.js +162 -0
  435. package/dist/pages/write-page.d.ts +2 -2
  436. package/dist/pages/write-page.js +2 -2
  437. package/dist/rules/index.d.ts +1 -1
  438. package/dist/rules/index.js +1 -1
  439. package/dist/rules/search.d.ts +1 -1
  440. package/dist/rules/shown.d.ts +1 -1
  441. package/dist/server/dashboard/choices.d.ts +2 -0
  442. package/dist/server/dashboard/choices.js +6 -4
  443. package/dist/server/dashboard/files.js +5 -5
  444. package/dist/server/dashboard/index.d.ts +2 -2
  445. package/dist/server/dashboard/index.js +7 -3
  446. package/dist/server/dashboard/news.js +4 -3
  447. package/dist/server/dashboard/player.js +1 -1
  448. package/dist/server/dashboard/writes.d.ts +7 -0
  449. package/dist/server/dashboard/writes.js +48 -7
  450. package/dist/server/mcp.js +28 -13
  451. package/dist/systems/campaign-data.d.ts +15 -0
  452. package/dist/systems/campaign-data.js +85 -0
  453. package/dist/systems/{system-code.d.ts → code.d.ts} +1 -1
  454. package/dist/systems/{system-code.js → code.js} +2 -2
  455. package/dist/systems/game-system.d.ts +7 -61
  456. package/dist/systems/game-system.js +1 -984
  457. package/dist/systems/index.d.ts +6 -3
  458. package/dist/systems/index.js +6 -3
  459. package/dist/systems/installed.d.ts +31 -0
  460. package/dist/systems/installed.js +89 -0
  461. package/dist/systems/maps.d.ts +3 -0
  462. package/dist/systems/maps.js +9 -0
  463. package/dist/systems/read.d.ts +3 -0
  464. package/dist/systems/read.js +471 -0
  465. package/dist/systems/schema.d.ts +289 -0
  466. package/dist/systems/schema.js +243 -0
  467. package/dist/systems/settings.d.ts +19 -0
  468. package/dist/systems/settings.js +78 -0
  469. package/dist/systems/versions.d.ts +12 -0
  470. package/dist/systems/versions.js +52 -0
  471. package/dist/testing/index.js +1 -1
  472. package/instructions/import.md +1 -1
  473. package/instructions/play.md +1 -1
  474. package/instructions/voices.md +1 -1
  475. package/package.json +1 -1
  476. package/dist/commands/config.js +0 -948
  477. package/dist/commands/package.d.ts +0 -143
  478. package/dist/commands/package.js +0 -785
  479. package/dist/commands/scene.js +0 -894
  480. package/dist/commands/shared/worked-out.js +0 -805
  481. package/dist/dashboard/place/map-view.js +0 -417
  482. /package/dist/commands/shared/{library-reader.d.ts → books/library-reader.d.ts} +0 -0
  483. /package/dist/core/{package-api.d.ts → packages/api.d.ts} +0 -0
  484. /package/dist/core/{package-api.js → packages/api.js} +0 -0
  485. /package/dist/dashboard/{coins.js → parts/coins.js} +0 -0
  486. /package/dist/dashboard/{glass.js → parts/glass.js} +0 -0
  487. /package/dist/dashboard/{layout.js → parts/layout.js} +0 -0
  488. /package/dist/dashboard/{mood-faces.js → parts/mood-faces.js} +0 -0
  489. /package/dist/dashboard/{free-rolls.js → play/free-rolls.js} +0 -0
  490. /package/dist/dashboard/{reactions.js → play/reactions.js} +0 -0
  491. /package/dist/dashboard/{prefs.js → shell/prefs.js} +0 -0
  492. /package/dist/dashboard/{system-style.js → shell/system-style.js} +0 -0
  493. /package/dist/dashboard/{theme.js → shell/theme.js} +0 -0
  494. /package/dist/languages/{language-pack.d.ts → pack.d.ts} +0 -0
  495. /package/dist/languages/{language-pack.js → pack.js} +0 -0
  496. /package/dist/pages/{page-file.d.ts → file.d.ts} +0 -0
  497. /package/dist/pages/{page-file.js → file.js} +0 -0
  498. /package/dist/pages/{page-types.d.ts → types.d.ts} +0 -0
  499. /package/dist/pages/{page-types.js → types.js} +0 -0
  500. /package/dist/rules/{rule-book.d.ts → book.d.ts} +0 -0
  501. /package/dist/rules/{rule-book.js → book.js} +0 -0
  502. /package/dist/systems/{system-folders.d.ts → folders.d.ts} +0 -0
  503. /package/dist/systems/{system-folders.js → folders.js} +0 -0
@@ -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 {
@@ -112,6 +112,8 @@ export interface SheetItem {
112
112
  equipped?: boolean;
113
113
  /** The lists of bonds it is in, as attuned (BND-1). */
114
114
  bonds?: string[];
115
+ /** Its page, or one it derives from, is a page of the game system the campaign changed with a layer (SYS-11): the view says so. */
116
+ layered?: true;
115
117
  }
116
118
  /**
117
119
  * The sheet of a player character or a companion as data, a group for each that has a value, as the character reads it, effects and formulas included (DAT-2).
@@ -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;
@@ -0,0 +1,291 @@
1
+ // What the game system works out from the fields of a page (D-199, FOR-3–FOR-8): its computed fields, each with the values it came from, and the limits of// its counters. The formulas are the system's data; this is where they meet the pages and the counters.
2
+ import { contributingReads, diceFields, fieldsRead, listItems, numberOf, workOut } from "../../../core/formula.js";
3
+ import { comparableText } from "../../../core/text.js";
4
+ import { formatCounter, readCounter } from "../../../counters/index.js";
5
+ import { declaredKind, pagesWithName } from "../../../pages/index.js";
6
+ import { formulaIndex, formulaScope, itemFormula, itemValues } from "./formula-scope.js";
7
+ import { progressionValue } from "./progression.js";
8
+ import { isSystemCounter, isUse, itemList, keyOf } from "./system-fields.js";
9
+ import { signedText, workedParts } from "./worked-text.js";
10
+ /**
11
+ * 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
+ * values that changed it (FOR-8).
13
+ */
14
+ export function workedFields(world, fields, explained = false) {
15
+ const scope = formulaScope(world, fields);
16
+ const computed = (world.system?.formulas?.computed ?? []).flatMap(([field, formula]) => {
17
+ const worked = scope.computed(field);
18
+ return worked?.value === undefined ? [] : [{ field, value: worked.value, reads: explained ? contributingReads(formula, scope, worked) : worked.reads }];
19
+ });
20
+ return [...computed, ...givenFields(world, scope, explained)];
21
+ }
22
+ /**
23
+ * The fields with what the game system works out over them: each computed field that has a value takes it, over what the page writes (FOR-4); a counter
24
+ * 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).
25
+ */
26
+ export function withWorkedOut(world, fields, sheeted) {
27
+ const formulas = world.system?.formulas;
28
+ if (formulas === undefined) {
29
+ return fields;
30
+ }
31
+ const result = { ...fields };
32
+ const scope = formulaScope(world, fields);
33
+ const progression = scope.progression();
34
+ // What the classes give, then what the formulas work out over it (PRO-2, FOR-3); a column named as a counter is that counter's maximum (DAT-9).
35
+ for (const worked of givenFields(world, scope)) {
36
+ result[keyOf(result, worked.field) ?? worked.field] = progressionValue(progression, worked.field) ?? worked.value;
37
+ }
38
+ for (const [field] of formulas.computed) {
39
+ const worked = scope.computed(field);
40
+ if (worked?.value !== undefined) {
41
+ result[keyOf(result, field) ?? field] = worked.value;
42
+ }
43
+ }
44
+ for (const field of Object.keys(formulas.counters)) {
45
+ const key = keyOf(result, field);
46
+ const counter = key === undefined ? undefined : readCounter(result[key]);
47
+ const { max } = limitsIn(scope, formulas.counters[field], field);
48
+ if (key !== undefined && counter !== undefined && max !== undefined) {
49
+ result[key] = formatCounter({ value: Math.min(counter.value, max), max });
50
+ }
51
+ // A use the page does not write is full, for who keeps the sheet (DAT-9, D-225).
52
+ if (sheeted && key === undefined && max !== undefined && max > 0 && isUse(world, field)) {
53
+ result[field] = formatCounter({ value: max, max });
54
+ }
55
+ }
56
+ return result;
57
+ }
58
+ /** 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. */
59
+ export function missingUses(world, fields) {
60
+ return Object.keys(world.system?.formulas?.counters ?? {}).flatMap((field) => {
61
+ const { max } = keyOf(fields, field) === undefined && isUse(world, field) ? counterLimits(world, fields, field) : {};
62
+ return max === undefined || max <= 0 ? [] : [{ field, max }];
63
+ });
64
+ }
65
+ /**
66
+ * How much of a counter comes back with these occasions (DAT-9): the sum of what its refill gives for each, where max is the counter's maximum; undefined when
67
+ * it names none of them.
68
+ */
69
+ export function refillAmount(world, fields, field, occasions, max) {
70
+ const refill = Object.entries(world.system?.formulas?.counters ?? {}).find(([name]) => comparableText(name) === comparableText(field))?.[1].refill;
71
+ const named = Object.entries(refill ?? {}).filter(([occasion]) => occasions.some((other) => comparableText(other) === comparableText(occasion)));
72
+ if (named.length === 0) {
73
+ return undefined;
74
+ }
75
+ const scope = formulaScope(world, fields);
76
+ const withMax = { ...scope, field: (name) => (comparableText(name) === "max" ? max : scope.field(name)) };
77
+ return named.reduce((total, [, formula]) => total + Math.max(0, Math.floor(workOut(formula, withMax).value ?? 0)), 0);
78
+ }
79
+ /**
80
+ * 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
81
+ * attacks of the weapons a character has equipped (PRO-5).
82
+ */
83
+ export function itemLines(world, fields, list, names, explained = false) {
84
+ const scope = formulaScope(world, fields);
85
+ const items = listItems(scope.field(list)).map((item) => item.name);
86
+ const byField = names.map((field) => ({ field, values: itemValues(world, scope, field, explained) }));
87
+ return items.flatMap((item) => {
88
+ const values = byField.flatMap(({ field, values }) => values.filter((value) => value.name === item).map((value) => ({ field, value: value.value, reads: value.reads })));
89
+ return values.length === 0 ? [] : [{ item, values }];
90
+ });
91
+ }
92
+ /** The minimum and maximum the game system works out for a counter with these fields, where they have a whole value (FOR-6). */
93
+ export function counterLimits(world, fields, field) {
94
+ const limits = Object.entries(world.system?.formulas?.counters ?? {}).find(([name]) => comparableText(name) === comparableText(field.trim()))?.[1];
95
+ if (limits === undefined) {
96
+ return {};
97
+ }
98
+ return limitsIn(formulaScope(world, fields), limits, field);
99
+ }
100
+ /**
101
+ * 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):
102
+ * where it has none, as on a creature without a level, the field is written like any other.
103
+ */
104
+ export function computedField(world, field, fields) {
105
+ const entry = world.system?.formulas?.computed.find(([name]) => comparableText(name) === comparableText(field.trim()));
106
+ const scope = formulaScope(world, fields);
107
+ const value = entry === undefined ? undefined : scope.computed(entry[0])?.value;
108
+ if (entry === undefined || value === undefined) {
109
+ return progressedField(world, scope, field);
110
+ }
111
+ // Of several formulas, the one that gave the value says what it comes from (D-210).
112
+ const used = entry[1].kind === "first" ? (entry[1].options.find((option) => workOut(option, scope).value !== undefined) ?? entry[1]) : entry[1];
113
+ return { name: entry[0], value, from: writtenSources(world, used, scope), direct: fieldsRead(used) };
114
+ }
115
+ /** The written fields the maximum of a counter comes from with these fields, as hp-base, level and con for hp (FOR-6); none when the system works out no maximum. */
116
+ export function maximumSources(world, field, fields) {
117
+ const max = Object.entries(world.system?.formulas?.counters ?? {}).find(([name]) => comparableText(name) === comparableText(field.trim()))?.[1].max;
118
+ return max === undefined ? [] : writtenSources(world, max, formulaScope(world, fields));
119
+ }
120
+ /**
121
+ * How the maximum the game system works out for a counter is made, "38, from hp-base 28, level 11, con-mod +1", and the written field to raise it with, as at a
122
+ * new level (FOR-6, D-226); undefined where the system works out none.
123
+ */
124
+ export function maximumHint(world, fields, field) {
125
+ const worked = workedMaximum(world, fields, field);
126
+ if (worked === undefined) {
127
+ return undefined;
128
+ }
129
+ const parts = workedParts(world, worked.reads);
130
+ // A maximum of 0 says the character lacks what gives it: no field raises it.
131
+ const [raise] = worked.value === 0 ? [] : maximumSources(world, field, fields).filter((name) => declaredKind(world, name) !== "list");
132
+ return { made: `${worked.value}${parts === "" ? "" : `, from ${parts}`}`, ...(raise === undefined ? {} : { raise }) };
133
+ }
134
+ /** Why a computed field is not written or changed, and what to change instead: the fields it comes from, or an effect on a bonus among them (FOR-7). */
135
+ export function computedMessage(world, computed, page) {
136
+ const bonuses = directBonuses(world, computed);
137
+ const instead = bonuses.length === 0 ? "change one of those" : `change one of those, or give ${bonuses.join(" or ")} with an effect${aloneNote(world, computed.name, bonuses)}`;
138
+ return `${computed.name} on ${page} is ${signedText(world, computed.name, computed.value)}, worked out by the system ${world.system?.name ?? ""} from ${computed.from.join(", ")}: ${instead}`;
139
+ }
140
+ /**
141
+ * "; bonus-skills also changes the other fields that read it…": of these bonuses, those other computed fields read too, as bonus-skills for every skill, which
142
+ * are no bonus to one alone (playtest 14); nothing when none is.
143
+ */
144
+ export function aloneNote(world, field, bonuses) {
145
+ const readers = (bonus) => (world.system?.formulas?.computed ?? []).filter(([, formula]) => fieldsRead(formula).some((name) => comparableText(name) === comparableText(bonus))).length;
146
+ const shared = bonuses.filter((bonus) => readers(bonus) > 1);
147
+ const one = shared.length === 1;
148
+ return shared.length === 0 ? "" : `; ${shared.join(" and ")} also ${one ? "changes" : "change"} the other fields that read ${one ? "it" : "them"}, so for ${field} alone add the number to its roll`;
149
+ }
150
+ /** The bonus fields an effect gives to change a computed field that its formula reads itself, as bonus-skills for insight, not bonus-proficiency through proficiency. */
151
+ export function directBonuses(world, computed) {
152
+ return effectBonuses(world, computed.from).filter((field) => computed.direct?.some((name) => comparableText(name) === comparableText(field)) === true);
153
+ }
154
+ /**
155
+ * The first item of its list whose page gives a field, with the fields of its own that its formula reads, as a shield's bonus (PRO-5): a page of the campaign,
156
+ * which an effect can change, not one of the system, as the unarmed strike (D-235).
157
+ */
158
+ export function itemSource(world, fields, field) {
159
+ const list = itemList(world, field);
160
+ const scope = formulaScope(world, fields);
161
+ for (const item of list === undefined ? [] : listItems(scope.field(list))) {
162
+ const page = scope.page(item.name);
163
+ const given = itemFormula(page, field);
164
+ if (list !== undefined && page !== undefined && given?.formula !== undefined && pagesWithName(world, item.name).length > 0) {
165
+ return { item: item.name, list, own: fieldsRead(given.formula).filter((name) => keyOf(page, name) !== undefined) };
166
+ }
167
+ }
168
+ return undefined;
169
+ }
170
+ /** 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. */
171
+ export function workedMaximum(world, fields, field) {
172
+ const entry = Object.entries(world.system?.formulas?.counters ?? {}).find(([name]) => comparableText(name) === comparableText(field.trim()));
173
+ const formula = entry?.[1].max;
174
+ const scope = formulaScope(world, fields);
175
+ if (entry === undefined) {
176
+ return undefined;
177
+ }
178
+ // Without a formula, the maximum a class's row gives, from the classes it comes from (DAT-9).
179
+ if (formula === undefined) {
180
+ const row = scope.progression()?.values.find((value) => comparableText(value.field) === comparableText(entry[0]));
181
+ const max = numberOf(row?.value);
182
+ return row === undefined || max === undefined ? undefined : { field: entry[0], value: max, reads: row.from.map((from) => ({ list: scope.progression()?.lists[0] ?? "", item: from.name, value: from.level })) };
183
+ }
184
+ const worked = workOut(formula, scope);
185
+ return worked.value === undefined ? undefined : { field: entry[0], value: atLeastZero(worked.value), reads: contributingReads(formula, scope, worked) };
186
+ }
187
+ /** 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). */
188
+ export function givenFields(world, scope, explained = false) {
189
+ return [...progressionFields(world, scope), ...itemFields(world, scope, explained)];
190
+ }
191
+ /**
192
+ * The fields the classes give as computed fields, each with the items it comes from (PRO-2, FOR-8): the values of their rows, then the features. A column named
193
+ * as a counter of the system is not one: it is that counter's maximum (DAT-9).
194
+ */
195
+ function progressionFields(world, scope) {
196
+ const progression = scope.progression();
197
+ if (progression === undefined) {
198
+ return [];
199
+ }
200
+ const values = progression.values.filter((value) => !isSystemCounter(world, value.field)).map((value) => ({
201
+ field: value.field,
202
+ value: value.value,
203
+ reads: value.from.map((from) => ({ list: progression.lists[0], item: from.name, value: from.level })),
204
+ }));
205
+ const features = progression.features.length + progression.written.length === 0 ? [] : [{
206
+ field: progression.featuresField,
207
+ value: [...progression.features.map((feature) => feature.name), ...progression.written].join(", "),
208
+ reads: progression.from.map((from) => ({ list: from.list, item: from.name, value: from.level ?? 1 })),
209
+ }];
210
+ return [...values, ...features];
211
+ }
212
+ /** The fields the formulas of the items' pages give, one value for each item, for every list the system names (PRO-5). */
213
+ function itemFields(world, scope, explained) {
214
+ return Object.values(world.system?.itemFormulas ?? {}).flat().flatMap((field) => {
215
+ const worked = scope.each(field, explained);
216
+ // A bonus an item gives as nothing, as the speed a heavy armor takes from who has its Strength, says nothing (FOR-8).
217
+ return worked === undefined || (worked.value === 0 && declaredKind(world, field) === "bonus") ? [] : [worked];
218
+ });
219
+ }
220
+ /** 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. */
221
+ export function progressedField(world, scope, field) {
222
+ const found = givenFields(world, scope).find((worked) => comparableText(worked.field) === comparableText(field.trim()));
223
+ const list = found === undefined ? undefined : itemList(world, found.field);
224
+ // The features are written too, beside those the rows give (PRO-3).
225
+ if (found === undefined || comparableText(found.field) === comparableText(scope.progression()?.featuresField ?? "")) {
226
+ return undefined;
227
+ }
228
+ // A formula of the items' pages comes from what it reads, as the bonus an item gives, and from its list (PRO-5); the rows, from the lists alone.
229
+ if (list !== undefined) {
230
+ const read = listItems(scope.field(list)).flatMap((item) => {
231
+ const page = scope.page(item.name);
232
+ const given = itemFormula(page, found.field);
233
+ // What the item holds itself, as a weapon's bonus, comes from it, not from who lists it.
234
+ // Only the dice a field gives count, as a monk's martial-arts: one no one has is no source.
235
+ const dice = (given === undefined ? [] : diceFields(given)).filter((name) => scope.field(name) !== undefined).flatMap((name) => writtenSources(world, { kind: "field", name }, scope));
236
+ const formula = given?.formula === undefined ? [] : writtenSources(world, given.formula, scope);
237
+ return [...formula, ...dice].filter((name) => page === undefined || keyOf(page, name) === undefined);
238
+ });
239
+ return { name: found.field, value: found.value, from: [...new Set([...read, list])] };
240
+ }
241
+ return { name: found.field, value: found.value, from: scope.progression()?.lists ?? [] };
242
+ }
243
+ /** The limits of a counter worked out in a scope, where they have a whole value (FOR-6); without a max formula, the column of a class's row (DAT-9). */
244
+ function limitsIn(scope, limits, field) {
245
+ const whole = (worked) => (worked?.value !== undefined && Number.isSafeInteger(worked.value) ? worked.value : undefined);
246
+ const min = whole(limits.min === undefined ? undefined : workOut(limits.min, scope));
247
+ const row = limits.max === undefined ? numberOf(progressionValue(scope.progression(), field)) : undefined;
248
+ const max = limits.max === undefined ? (row !== undefined && Number.isSafeInteger(row) ? row : undefined) : whole(workOut(limits.max, scope));
249
+ return { ...(min === undefined ? {} : { min }), ...(max === undefined ? {} : { max: atLeastZero(max) }) };
250
+ }
251
+ /** A maximum worked out below 0, as 1 + cha-mod with Charisma 7, is 0: a counter is never written with a maximum below 0 (FOR-6). */
252
+ function atLeastZero(max) {
253
+ return Math.max(0, max);
254
+ }
255
+ /**
256
+ * The written fields a formula comes from, through the computed fields it reads that have a value: what can be changed, as wis for passive-perception, and
257
+ * level where the page writes it, having no classes (FOR-7).
258
+ */
259
+ function writtenSources(world, formula, scope, seen = new Set()) {
260
+ const formulas = world.system?.formulas;
261
+ const index = formulas === undefined ? undefined : formulaIndex(formulas);
262
+ const sources = fieldsRead(formula).flatMap((name) => {
263
+ const entry = index?.computed.get(comparableText(name));
264
+ // What the classes give comes from the lists that name them (PRO-3); what the items' pages give, from their list, as armor-class from equipped (PRO-5).
265
+ // Whether the classes or the items give it, without asking where they come from, which may read this field again.
266
+ if (entry === undefined && givenFields(world, scope).some((worked) => comparableText(worked.field) === comparableText(name))) {
267
+ const list = itemList(world, name);
268
+ return list === undefined ? (scope.progression()?.lists ?? [name]) : [list];
269
+ }
270
+ // What the engine gives a formula, as the campaign's rigor or a character's load, is no field anyone writes (FOR-2).
271
+ if (["rigor", "effects", "load", "load-limit"].includes(comparableText(name))) {
272
+ return [];
273
+ }
274
+ if (entry === undefined || scope.computed(name)?.value === undefined) {
275
+ return [name];
276
+ }
277
+ if (seen.has(comparableText(name))) {
278
+ return [];
279
+ }
280
+ seen.add(comparableText(name));
281
+ return writtenSources(world, entry[1], scope, seen);
282
+ });
283
+ return sources.filter((name, position) => sources.findIndex((other) => comparableText(other) === comparableText(name)) === position);
284
+ }
285
+ /**
286
+ * The bonus fields among those a computed field comes from, which an effect on the page gives to change it, as bonus-ac for ac (FOR-5); not those the items of a
287
+ * list give, as a shield's armor-class-bonus, which change on the item (PRO-5).
288
+ */
289
+ function effectBonuses(world, from) {
290
+ return from.filter((field) => declaredKind(world, field) === "bonus" && itemList(world, field) === undefined);
291
+ }
@@ -0,0 +1,14 @@
1
+ import type { FormulaRead } from "../../../core/formula.ts";
2
+ import { type World } from "../../../pages/index.ts";
3
+ /** 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). */
4
+ export interface WorkedField {
5
+ field: string;
6
+ value: number | string;
7
+ reads: FormulaRead[];
8
+ }
9
+ /** 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). */
10
+ export declare function signedText(world: World, field: string, value: number | string): string;
11
+ /** "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). */
12
+ export declare function workedLine(world: World, worked: WorkedField): string;
13
+ /** "wis-mod +3, proficiency +2, Insight in skill-proficiencies": the values a result came from, leaving out what adds nothing (FOR-8). */
14
+ export declare function workedParts(world: World, reads: FormulaRead[]): string;