rpg-engine 0.14.1 → 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.
- package/dist/campaign/index.d.ts +1 -1
- package/dist/campaign/index.js +1 -1
- package/dist/campaign/last-choices.js +1 -1
- package/dist/campaign/settings.d.ts +25 -5
- package/dist/campaign/settings.js +38 -9
- package/dist/cli/cli.js +1 -1
- package/dist/cli/command-line.js +1 -1
- package/dist/commands/advance.d.ts +1 -1
- package/dist/commands/advance.js +6 -6
- package/dist/commands/ask.js +7 -7
- package/dist/commands/change/amounts.d.ts +32 -0
- package/dist/commands/change/amounts.js +150 -0
- package/dist/commands/change/change.d.ts +4 -54
- package/dist/commands/change/change.js +19 -749
- package/dist/commands/change/damage.d.ts +30 -0
- package/dist/commands/change/damage.js +73 -2
- package/dist/commands/change/dice.d.ts +34 -0
- package/dist/commands/change/dice.js +59 -0
- package/dist/commands/change/fields.d.ts +37 -0
- package/dist/commands/change/fields.js +156 -0
- package/dist/commands/change/holder.d.ts +48 -0
- package/dist/commands/change/holder.js +162 -0
- package/dist/commands/change/recipe-pace.js +1 -1
- package/dist/commands/change/recipe.d.ts +58 -0
- package/dist/commands/change/recipe.js +179 -0
- package/dist/commands/choices.js +3 -3
- package/dist/commands/config/config.d.ts +15 -0
- package/dist/commands/config/config.js +355 -0
- package/dist/commands/config/custom-levels.d.ts +7 -0
- package/dist/commands/config/custom-levels.js +32 -0
- package/dist/commands/{config.d.ts → config/dashboard.d.ts} +4 -26
- package/dist/commands/config/dashboard.js +171 -0
- package/dist/commands/config/entries.d.ts +17 -0
- package/dist/commands/config/entries.js +76 -0
- package/dist/commands/config/news.d.ts +7 -0
- package/dist/commands/config/news.js +88 -0
- package/dist/commands/config/shown.d.ts +9 -0
- package/dist/commands/config/shown.js +80 -0
- package/dist/commands/config/words.d.ts +27 -0
- package/dist/commands/config/words.js +204 -0
- package/dist/commands/effect.js +9 -9
- package/dist/commands/find.d.ts +4 -4
- package/dist/commands/find.js +1 -1
- package/dist/commands/image.js +6 -6
- package/dist/commands/import/import.d.ts +0 -2
- package/dist/commands/import/import.js +45 -44
- package/dist/commands/import/run.js +1 -1
- package/dist/commands/index.js +3 -3
- package/dist/commands/init.js +2 -2
- package/dist/commands/install.js +1 -1
- package/dist/commands/instructions.js +17 -6
- package/dist/commands/mode.d.ts +2 -2
- package/dist/commands/mode.js +17 -9
- package/dist/commands/mood.js +4 -4
- package/dist/commands/move.js +10 -10
- package/dist/commands/package/consent.d.ts +11 -0
- package/dist/commands/package/consent.js +52 -0
- package/dist/commands/package/here.d.ts +51 -0
- package/dist/commands/package/here.js +128 -0
- package/dist/commands/package/install.d.ts +10 -0
- package/dist/commands/package/install.js +337 -0
- package/dist/commands/package/package.d.ts +18 -0
- package/dist/commands/package/package.js +236 -0
- package/dist/commands/package/result.d.ts +90 -0
- package/dist/commands/package/result.js +1 -0
- package/dist/commands/package/uninstall.d.ts +6 -0
- package/dist/commands/package/uninstall.js +70 -0
- package/dist/commands/rename.js +3 -3
- package/dist/commands/reveal.js +5 -5
- package/dist/commands/roll/roll.js +11 -9
- package/dist/commands/roll/tables.js +1 -1
- package/dist/commands/rules.d.ts +2 -2
- package/dist/commands/rules.js +3 -3
- package/dist/commands/save.d.ts +1 -1
- package/dist/commands/save.js +2 -2
- package/dist/commands/scene/close.d.ts +18 -0
- package/dist/commands/scene/close.js +179 -0
- package/dist/commands/scene/members.d.ts +14 -0
- package/dist/commands/scene/members.js +32 -0
- package/dist/commands/scene/open.d.ts +6 -0
- package/dist/commands/scene/open.js +298 -0
- package/dist/commands/scene/result.d.ts +98 -0
- package/dist/commands/scene/result.js +2 -0
- package/dist/commands/{scene.d.ts → scene/scene.d.ts} +10 -36
- package/dist/commands/scene/scene.js +210 -0
- package/dist/commands/scene/turns.d.ts +18 -0
- package/dist/commands/scene/turns.js +229 -0
- package/dist/commands/shared/{adventures.d.ts → books/adventures.d.ts} +5 -3
- package/dist/commands/shared/{adventures.js → books/adventures.js} +23 -19
- package/dist/commands/shared/{library-reader.js → books/library-reader.js} +3 -3
- package/dist/commands/shared/{library.d.ts → books/library.d.ts} +2 -2
- package/dist/commands/shared/{library.js → books/library.js} +9 -9
- package/dist/commands/shared/{rules.d.ts → books/rules.d.ts} +2 -2
- package/dist/commands/shared/{rules.js → books/rules.js} +5 -5
- package/dist/commands/shared/{system-texts.d.ts → books/system-texts.d.ts} +2 -2
- package/dist/commands/shared/{system-texts.js → books/system-texts.js} +9 -8
- package/dist/commands/shared/{page-words.d.ts → books/words.d.ts} +2 -2
- package/dist/commands/shared/{page-words.js → books/words.js} +4 -4
- package/dist/commands/shared/{checks.d.ts → campaign/checks.d.ts} +3 -3
- package/dist/commands/shared/{checks.js → campaign/checks.js} +7 -7
- package/dist/commands/shared/{images.d.ts → campaign/images.d.ts} +3 -3
- package/dist/commands/shared/{images.js → campaign/images.js} +5 -5
- package/dist/commands/shared/{mode.d.ts → campaign/mode.d.ts} +4 -4
- package/dist/commands/shared/{mode.js → campaign/mode.js} +28 -13
- package/dist/commands/shared/{money.d.ts → campaign/money.d.ts} +3 -3
- package/dist/commands/shared/{money.js → campaign/money.js} +2 -2
- package/dist/commands/shared/{offers.d.ts → campaign/offers.d.ts} +3 -3
- package/dist/commands/shared/{offers.js → campaign/offers.js} +3 -3
- package/dist/commands/shared/{outside.d.ts → campaign/outside.d.ts} +3 -3
- package/dist/commands/shared/{outside.js → campaign/outside.js} +7 -7
- package/dist/commands/shared/{parts.d.ts → campaign/parts.d.ts} +10 -3
- package/dist/commands/shared/{parts.js → campaign/parts.js} +26 -3
- package/dist/commands/shared/{problems.d.ts → campaign/problems.d.ts} +3 -3
- package/dist/commands/shared/{problems.js → campaign/problems.js} +17 -17
- package/dist/commands/shared/{quests.d.ts → campaign/quests.d.ts} +4 -4
- package/dist/commands/shared/{quests.js → campaign/quests.js} +6 -6
- package/dist/commands/shared/{saves.d.ts → campaign/saves.d.ts} +4 -4
- package/dist/commands/shared/{saves.js → campaign/saves.js} +10 -10
- package/dist/commands/shared/{theme.d.ts → campaign/theme.d.ts} +3 -3
- package/dist/commands/shared/{theme.js → campaign/theme.js} +1 -1
- package/dist/commands/shared/{world.d.ts → campaign/world.d.ts} +5 -5
- package/dist/commands/shared/{world.js → campaign/world.js} +17 -14
- package/dist/commands/shared/{knowledge.d.ts → characters/knowledge.d.ts} +3 -3
- package/dist/commands/shared/{knowledge.js → characters/knowledge.js} +4 -4
- package/dist/commands/shared/{moods.d.ts → characters/moods.d.ts} +3 -3
- package/dist/commands/shared/{moods.js → characters/moods.js} +3 -3
- package/dist/commands/shared/characters/orders.d.ts +4 -0
- package/dist/commands/shared/characters/orders.js +10 -0
- package/dist/commands/shared/{thoughts.d.ts → characters/thoughts.d.ts} +2 -2
- package/dist/commands/shared/{thoughts.js → characters/thoughts.js} +3 -3
- package/dist/commands/shared/{voices.d.ts → characters/voices.d.ts} +1 -1
- package/dist/commands/shared/{voices.js → characters/voices.js} +2 -2
- package/dist/commands/shared/examples.js +2 -2
- package/dist/commands/shared/packages/catalog.js +2 -2
- package/dist/commands/shared/packages/code.d.ts +1 -1
- package/dist/commands/shared/packages/code.js +8 -8
- package/dist/commands/shared/packages/extensions.d.ts +1 -1
- package/dist/commands/shared/packages/extensions.js +1 -1
- package/dist/commands/shared/packages/hooks.d.ts +1 -1
- package/dist/commands/shared/packages/hooks.js +1 -1
- package/dist/commands/shared/packages/widgets.d.ts +3 -3
- package/dist/commands/shared/packages/widgets.js +3 -3
- package/dist/commands/shared/{environment.d.ts → places/environment.d.ts} +1 -1
- package/dist/commands/shared/{environment.js → places/environment.js} +4 -4
- package/dist/commands/shared/{grid-moves.d.ts → places/grid-moves.d.ts} +4 -4
- package/dist/commands/shared/{grid-moves.js → places/grid-moves.js} +8 -7
- package/dist/commands/shared/{grids.d.ts → places/grids.d.ts} +4 -4
- package/dist/commands/shared/{grids.js → places/grids.js} +6 -6
- package/dist/commands/shared/{journey.d.ts → places/journey.d.ts} +3 -3
- package/dist/commands/shared/{journey.js → places/journey.js} +6 -6
- package/dist/commands/shared/{moves.d.ts → places/moves.d.ts} +2 -2
- package/dist/commands/shared/{moves.js → places/moves.js} +4 -4
- package/dist/commands/shared/{positions.d.ts → places/positions.d.ts} +2 -2
- package/dist/commands/shared/{positions.js → places/positions.js} +4 -4
- package/dist/commands/shared/{roads.d.ts → places/roads.d.ts} +5 -5
- package/dist/commands/shared/{roads.js → places/roads.js} +6 -6
- package/dist/commands/shared/{effects.d.ts → scene/effects.d.ts} +7 -7
- package/dist/commands/shared/{effects.js → scene/effects.js} +10 -10
- package/dist/commands/shared/{loot.d.ts → scene/loot.d.ts} +2 -2
- package/dist/commands/shared/{loot.js → scene/loot.js} +3 -3
- package/dist/commands/shared/{master-rolls.d.ts → scene/master-rolls.d.ts} +2 -2
- package/dist/commands/shared/{master-rolls.js → scene/master-rolls.js} +5 -5
- package/dist/commands/shared/{reminders.d.ts → scene/reminders.d.ts} +4 -4
- package/dist/commands/shared/{reminders.js → scene/reminders.js} +4 -4
- package/dist/commands/shared/{scene.d.ts → scene/scene.d.ts} +3 -3
- package/dist/commands/shared/{scene.js → scene/scene.js} +7 -7
- package/dist/commands/shared/{bonds.d.ts → sheet/bonds.d.ts} +3 -3
- package/dist/commands/shared/{bonds.js → sheet/bonds.js} +2 -2
- package/dist/commands/shared/{page-counters.d.ts → sheet/counters.d.ts} +3 -3
- package/dist/commands/shared/{page-counters.js → sheet/counters.js} +5 -5
- package/dist/commands/shared/{effect-layer.d.ts → sheet/effect-layer.d.ts} +2 -2
- package/dist/commands/shared/{effect-layer.js → sheet/effect-layer.js} +9 -6
- package/dist/commands/shared/sheet/effect-values.d.ts +9 -0
- package/dist/commands/shared/sheet/effect-values.js +69 -0
- package/dist/commands/shared/{experience.d.ts → sheet/experience.d.ts} +3 -3
- package/dist/commands/shared/{experience.js → sheet/experience.js} +5 -5
- package/dist/commands/shared/sheet/formula-problems.d.ts +8 -0
- package/dist/commands/shared/sheet/formula-problems.js +140 -0
- package/dist/commands/shared/sheet/formula-scope.d.ts +32 -0
- package/dist/commands/shared/sheet/formula-scope.js +235 -0
- package/dist/commands/shared/{limits.d.ts → sheet/limits.d.ts} +3 -3
- package/dist/commands/shared/{limits.js → sheet/limits.js} +5 -4
- package/dist/commands/shared/{progression.d.ts → sheet/progression.d.ts} +2 -2
- package/dist/commands/shared/{progression.js → sheet/progression.js} +4 -4
- package/dist/commands/shared/{sheet.d.ts → sheet/sheet.d.ts} +5 -5
- package/dist/commands/shared/{sheet.js → sheet/sheet.js} +11 -7
- package/dist/commands/shared/{stacks.d.ts → sheet/stacks.d.ts} +2 -2
- package/dist/commands/shared/{stacks.js → sheet/stacks.js} +4 -4
- package/dist/commands/shared/sheet/system-fields.d.ts +21 -0
- package/dist/commands/shared/sheet/system-fields.js +45 -0
- package/dist/commands/shared/{thresholds.d.ts → sheet/thresholds.d.ts} +1 -1
- package/dist/commands/shared/{thresholds.js → sheet/thresholds.js} +4 -4
- package/dist/commands/shared/{turn-uses.d.ts → sheet/turn-uses.d.ts} +3 -3
- package/dist/commands/shared/{turn-uses.js → sheet/turn-uses.js} +4 -3
- package/dist/commands/shared/{worked-out.d.ts → sheet/worked-out.d.ts} +11 -46
- package/dist/commands/shared/sheet/worked-out.js +291 -0
- package/dist/commands/shared/sheet/worked-text.d.ts +14 -0
- package/dist/commands/shared/sheet/worked-text.js +55 -0
- package/dist/commands/shared/{advance.d.ts → time/advance.d.ts} +3 -3
- package/dist/commands/shared/{advance.js → time/advance.js} +11 -11
- package/dist/commands/shared/{dice-pool.d.ts → time/dice-pool.d.ts} +3 -3
- package/dist/commands/shared/{dice-pool.js → time/dice-pool.js} +11 -11
- package/dist/commands/shared/{events.d.ts → time/events.d.ts} +5 -5
- package/dist/commands/shared/{events.js → time/events.js} +10 -13
- package/dist/commands/shared/{recipes.d.ts → time/recipes.d.ts} +3 -3
- package/dist/commands/shared/{recipes.js → time/recipes.js} +6 -5
- package/dist/commands/shared/{time.d.ts → time/time.d.ts} +4 -4
- package/dist/commands/shared/{time.js → time/time.js} +6 -6
- package/dist/commands/shared/{upkeep.d.ts → time/upkeep.d.ts} +3 -3
- package/dist/commands/shared/{upkeep.js → time/upkeep.js} +14 -13
- package/dist/commands/show.d.ts +4 -1
- package/dist/commands/show.js +28 -9
- package/dist/commands/status.d.ts +2 -1
- package/dist/commands/status.js +34 -23
- package/dist/commands/thoughts.js +3 -3
- package/dist/commands/trade.js +8 -8
- package/dist/commands/translate.d.ts +1 -1
- package/dist/commands/translate.js +3 -3
- package/dist/commands/travel/open.d.ts +1 -1
- package/dist/commands/travel/open.js +2 -2
- package/dist/commands/travel/route.js +7 -6
- package/dist/commands/travel/travel.d.ts +1 -1
- package/dist/commands/travel/travel.js +8 -8
- package/dist/commands/validate.js +3 -3
- package/dist/commands/view/journal.d.ts +2 -2
- package/dist/commands/view/journal.js +2 -2
- package/dist/commands/view/map.d.ts +1 -1
- package/dist/commands/view/map.js +6 -6
- package/dist/commands/view/memory.d.ts +16 -0
- package/dist/commands/view/memory.js +90 -0
- package/dist/commands/view/page.d.ts +32 -0
- package/dist/commands/view/page.js +163 -0
- package/dist/commands/view/place.d.ts +7 -2
- package/dist/commands/view/place.js +30 -12
- package/dist/commands/view/result.d.ts +245 -0
- package/dist/commands/view/result.js +1 -0
- package/dist/commands/view/saves.d.ts +6 -0
- package/dist/commands/view/saves.js +53 -0
- package/dist/commands/view/story.d.ts +32 -0
- package/dist/commands/view/story.js +227 -0
- package/dist/commands/view/view.d.ts +26 -292
- package/dist/commands/view/view.js +26 -534
- package/dist/commands/view/world.d.ts +1 -1
- package/dist/commands/view/world.js +3 -3
- package/dist/commands/write/checks.d.ts +42 -0
- package/dist/commands/write/checks.js +291 -0
- package/dist/commands/write/here.d.ts +1 -1
- package/dist/commands/write/here.js +5 -5
- package/dist/commands/write/inheritance.d.ts +40 -0
- package/dist/commands/write/inheritance.js +189 -0
- package/dist/commands/write/input.d.ts +29 -0
- package/dist/commands/write/input.js +124 -0
- package/dist/commands/write/layer.d.ts +36 -0
- package/dist/commands/write/layer.js +48 -0
- package/dist/commands/write/notes.d.ts +22 -0
- package/dist/commands/write/notes.js +76 -0
- package/dist/commands/write/progression.d.ts +27 -0
- package/dist/commands/write/progression.js +175 -0
- package/dist/commands/write/write.d.ts +2 -1
- package/dist/commands/write/write.js +33 -817
- package/dist/core/files.d.ts +2 -0
- package/dist/core/files.js +7 -0
- package/dist/core/{package-declarations.d.ts → packages/declarations.d.ts} +1 -1
- package/dist/core/{package-declarations.js → packages/declarations.js} +1 -1
- package/dist/core/session-store.js +3 -3
- package/dist/core/store.d.ts +2 -2
- package/dist/core/store.js +18 -4
- package/dist/dashboard/acts/acts.js +1 -1
- package/dist/dashboard/acts/sending.js +110 -0
- package/dist/dashboard/acts/sheet.js +2 -2
- package/dist/dashboard/acts/strip.js +1 -1
- package/dist/dashboard/address.js +6 -0
- package/dist/dashboard/api.js +1 -1
- package/dist/dashboard/app.js +47 -171
- package/dist/dashboard/dice/roller.js +1 -1
- package/dist/dashboard/dice/sets.js +2 -2
- package/dist/dashboard/dice/stage.js +1 -1
- package/dist/dashboard/dice/tray.js +6 -6
- package/dist/dashboard/guide/ar.md +9 -4
- package/dist/dashboard/guide/cs.md +10 -5
- package/dist/dashboard/guide/da.md +9 -4
- package/dist/dashboard/guide/de.md +9 -4
- package/dist/dashboard/guide/el.md +10 -5
- package/dist/dashboard/guide/en.md +7 -2
- package/dist/dashboard/guide/es.md +9 -4
- package/dist/dashboard/guide/fi.md +9 -4
- package/dist/dashboard/guide/fr.md +9 -4
- package/dist/dashboard/guide/he.md +9 -4
- package/dist/dashboard/guide/hi.md +10 -5
- package/dist/dashboard/guide/hu.md +10 -5
- package/dist/dashboard/guide/is.md +9 -4
- package/dist/dashboard/guide/it.md +9 -4
- package/dist/dashboard/guide/ja.md +12 -7
- package/dist/dashboard/guide/ko.md +11 -6
- package/dist/dashboard/guide/nb.md +9 -4
- package/dist/dashboard/guide/nl.md +10 -5
- package/dist/dashboard/guide/pl.md +9 -4
- package/dist/dashboard/guide/pt.md +9 -4
- package/dist/dashboard/guide/ro.md +9 -4
- package/dist/dashboard/guide/ru.md +9 -4
- package/dist/dashboard/guide/sv.md +9 -4
- package/dist/dashboard/guide/tr.md +11 -6
- package/dist/dashboard/guide/uk.md +9 -4
- package/dist/dashboard/guide/zh.md +9 -4
- package/dist/dashboard/help/help.js +3 -3
- package/dist/dashboard/i18n/ar.json +20 -0
- package/dist/dashboard/i18n/cs.json +20 -0
- package/dist/dashboard/i18n/da.json +20 -0
- package/dist/dashboard/i18n/de.json +20 -0
- package/dist/dashboard/i18n/el.json +20 -0
- package/dist/dashboard/i18n/es.json +20 -0
- package/dist/dashboard/i18n/fi.json +20 -0
- package/dist/dashboard/i18n/fr.json +20 -0
- package/dist/dashboard/i18n/he.json +20 -0
- package/dist/dashboard/i18n/hi.json +20 -0
- package/dist/dashboard/i18n/hu.json +20 -0
- package/dist/dashboard/i18n/is.json +20 -0
- package/dist/dashboard/i18n/it.json +20 -0
- package/dist/dashboard/i18n/ja.json +21 -1
- package/dist/dashboard/i18n/ko.json +20 -0
- package/dist/dashboard/i18n/nb.json +20 -0
- package/dist/dashboard/i18n/nl.json +20 -0
- package/dist/dashboard/i18n/pl.json +20 -0
- package/dist/dashboard/i18n/pt.json +20 -0
- package/dist/dashboard/i18n/ro.json +20 -0
- package/dist/dashboard/i18n/ru.json +20 -0
- package/dist/dashboard/i18n/sv.json +20 -0
- package/dist/dashboard/i18n/tr.json +20 -0
- package/dist/dashboard/i18n/uk.json +20 -0
- package/dist/dashboard/i18n/zh.json +20 -0
- package/dist/dashboard/{journal.js → journal/journal.js} +16 -16
- package/dist/dashboard/{notes.js → journal/notes.js} +4 -4
- package/dist/dashboard/kit.js +3 -3
- package/dist/dashboard/packages/ask-card.js +3 -3
- package/dist/dashboard/packages/catalog.js +196 -0
- package/dist/dashboard/packages/engine.js +87 -0
- package/dist/dashboard/packages/installed.js +53 -0
- package/dist/dashboard/packages/library.js +97 -0
- package/dist/dashboard/packages/outcomes.js +45 -0
- package/dist/dashboard/packages/packages.js +20 -576
- package/dist/dashboard/packages/page-code.js +15 -2
- package/dist/dashboard/packages/{package-page.js → page.js} +12 -5
- package/dist/dashboard/packages/rows.js +84 -0
- package/dist/dashboard/packages/share.js +44 -0
- package/dist/dashboard/packages/widgets.js +3 -3
- package/dist/dashboard/{card.js → parts/card.js} +1 -1
- package/dist/dashboard/{faces.js → parts/faces.js} +5 -5
- package/dist/dashboard/{game-words.js → parts/game-words.js} +1 -1
- package/dist/dashboard/{icons.js → parts/icons.js} +1 -1
- package/dist/dashboard/{labels.js → parts/labels.js} +8 -1
- package/dist/dashboard/{map-symbols.js → parts/map-symbols.js} +1 -1
- package/dist/dashboard/{markdown.js → parts/markdown.js} +2 -2
- package/dist/dashboard/{mood.js → parts/mood.js} +1 -1
- package/dist/dashboard/{refusals.js → parts/refusals.js} +1 -1
- package/dist/dashboard/{status.js → parts/status.js} +4 -4
- package/dist/dashboard/{widgets.js → parts/widgets.js} +2 -2
- package/dist/dashboard/place/key.js +24 -0
- package/dist/dashboard/place/paper.js +67 -0
- package/dist/dashboard/place/{map-sheet.js → sheet.js} +2 -2
- package/dist/dashboard/place/things.js +129 -0
- package/dist/dashboard/place/tokens.js +93 -0
- package/dist/dashboard/place/view.js +124 -0
- package/dist/dashboard/{asked-dice.js → play/asked-dice.js} +3 -3
- package/dist/dashboard/{asked.js → play/asked.js} +10 -10
- package/dist/dashboard/{choices.js → play/choices.js} +9 -9
- package/dist/dashboard/{requested.js → play/requested.js} +1 -1
- package/dist/dashboard/{rolls.js → play/rolls.js} +9 -9
- package/dist/dashboard/{scene.js → play/scene.js} +14 -14
- package/dist/dashboard/{turns.js → play/turns.js} +12 -12
- package/dist/dashboard/{language-choice.js → settings/language-choice.js} +1 -1
- package/dist/dashboard/{languages.js → settings/languages.js} +1 -1
- package/dist/dashboard/{saves.js → settings/saves.js} +8 -8
- package/dist/dashboard/{settings.js → settings/settings.js} +17 -15
- package/dist/dashboard/{setup.js → settings/setup.js} +6 -6
- package/dist/dashboard/{party.js → sheet/party.js} +8 -8
- package/dist/dashboard/{person-panel.js → sheet/person-panel.js} +4 -4
- package/dist/dashboard/{sheet.js → sheet/sheet.js} +17 -17
- package/dist/dashboard/{story.js → sheet/story.js} +3 -3
- package/dist/dashboard/{columns.js → shell/columns.js} +1 -1
- package/dist/dashboard/{footer.js → shell/footer.js} +3 -3
- package/dist/dashboard/{master.js → shell/master.js} +2 -2
- package/dist/dashboard/{notices.js → shell/notices.js} +3 -3
- package/dist/dashboard/{pages.js → shell/pages.js} +5 -5
- package/dist/dashboard/shell/shown.js +37 -0
- package/dist/dashboard/{table.js → shell/table.js} +2 -2
- package/dist/dashboard/{tabs.js → shell/tabs.js} +2 -2
- package/dist/dashboard/{top.js → shell/top.js} +7 -7
- package/dist/dashboard/style.css +90 -9
- package/dist/dashboard/world/calendar.js +4 -4
- package/dist/dashboard/world/drawing.js +92 -0
- package/dist/dashboard/world/key.js +21 -0
- package/dist/dashboard/world/lore.js +5 -5
- package/dist/dashboard/world/map-card.js +186 -0
- package/dist/dashboard/world/place-card.js +39 -0
- package/dist/dashboard/world/places.js +29 -0
- package/dist/dashboard/world/world.js +9 -341
- package/dist/extensions/extension.d.ts +1 -1
- package/dist/extensions/extension.js +1 -1
- package/dist/images/images.js +12 -9
- package/dist/index.d.ts +1 -1
- package/dist/languages/index.d.ts +1 -1
- package/dist/languages/index.js +1 -1
- package/dist/library/books.js +2 -0
- package/dist/packages/npm.js +1 -1
- package/dist/page.d.ts +2 -2
- package/dist/page.js +1 -1
- package/dist/pages/check.js +23 -1
- package/dist/pages/containers.d.ts +1 -1
- package/dist/pages/containers.js +1 -1
- package/dist/pages/index.d.ts +4 -2
- package/dist/pages/index.js +4 -2
- package/dist/pages/inheritance.d.ts +2 -2
- package/dist/pages/layers.d.ts +50 -0
- package/dist/pages/layers.js +97 -0
- package/dist/pages/rename-page.js +1 -1
- package/dist/pages/stacks/writes.js +48 -22
- package/dist/pages/standard-fields.d.ts +1 -1
- package/dist/pages/system-pages.d.ts +5 -3
- package/dist/pages/system-pages.js +16 -7
- package/dist/pages/world.d.ts +8 -1
- package/dist/pages/world.js +16 -4
- package/dist/pages/write-layer.d.ts +18 -0
- package/dist/pages/write-layer.js +108 -0
- package/dist/pages/write-page.d.ts +2 -2
- package/dist/pages/write-page.js +2 -2
- package/dist/rules/index.d.ts +1 -1
- package/dist/rules/index.js +1 -1
- package/dist/rules/search.d.ts +1 -1
- package/dist/rules/shown.d.ts +1 -1
- package/dist/server/dashboard/choices.js +3 -3
- package/dist/server/dashboard/files.js +5 -5
- package/dist/server/dashboard/index.d.ts +2 -2
- package/dist/server/dashboard/index.js +2 -2
- package/dist/server/dashboard/news.js +4 -3
- package/dist/server/dashboard/player.js +1 -1
- package/dist/server/dashboard/writes.js +10 -8
- package/dist/server/mcp.js +28 -13
- package/dist/systems/campaign-data.d.ts +15 -0
- package/dist/systems/campaign-data.js +85 -0
- package/dist/systems/{system-code.d.ts → code.d.ts} +1 -1
- package/dist/systems/{system-code.js → code.js} +2 -2
- package/dist/systems/game-system.d.ts +7 -61
- package/dist/systems/game-system.js +1 -984
- package/dist/systems/index.d.ts +6 -3
- package/dist/systems/index.js +6 -3
- package/dist/systems/installed.d.ts +31 -0
- package/dist/systems/installed.js +89 -0
- package/dist/systems/maps.d.ts +3 -0
- package/dist/systems/maps.js +9 -0
- package/dist/systems/read.d.ts +3 -0
- package/dist/systems/read.js +471 -0
- package/dist/systems/schema.d.ts +289 -0
- package/dist/systems/schema.js +243 -0
- package/dist/systems/settings.d.ts +19 -0
- package/dist/systems/settings.js +78 -0
- package/dist/systems/versions.d.ts +12 -0
- package/dist/systems/versions.js +52 -0
- package/dist/testing/index.js +1 -1
- package/instructions/import.md +1 -1
- package/instructions/length-a-few-sessions.md +1 -0
- package/instructions/length-one-evening.md +1 -0
- package/instructions/play.md +1 -1
- package/instructions/session-zero.md +1 -1
- package/instructions/setup.md +1 -1
- package/package.json +1 -1
- package/dist/commands/config.js +0 -917
- package/dist/commands/package.d.ts +0 -143
- package/dist/commands/package.js +0 -785
- package/dist/commands/scene.js +0 -894
- package/dist/commands/shared/worked-out.js +0 -805
- package/dist/dashboard/place/map-view.js +0 -417
- /package/dist/commands/shared/{library-reader.d.ts → books/library-reader.d.ts} +0 -0
- /package/dist/core/{package-api.d.ts → packages/api.d.ts} +0 -0
- /package/dist/core/{package-api.js → packages/api.js} +0 -0
- /package/dist/dashboard/{coins.js → parts/coins.js} +0 -0
- /package/dist/dashboard/{glass.js → parts/glass.js} +0 -0
- /package/dist/dashboard/{layout.js → parts/layout.js} +0 -0
- /package/dist/dashboard/{mood-faces.js → parts/mood-faces.js} +0 -0
- /package/dist/dashboard/{free-rolls.js → play/free-rolls.js} +0 -0
- /package/dist/dashboard/{reactions.js → play/reactions.js} +0 -0
- /package/dist/dashboard/{prefs.js → shell/prefs.js} +0 -0
- /package/dist/dashboard/{system-style.js → shell/system-style.js} +0 -0
- /package/dist/dashboard/{theme.js → shell/theme.js} +0 -0
- /package/dist/languages/{language-pack.d.ts → pack.d.ts} +0 -0
- /package/dist/languages/{language-pack.js → pack.js} +0 -0
- /package/dist/pages/{page-file.d.ts → file.d.ts} +0 -0
- /package/dist/pages/{page-file.js → file.js} +0 -0
- /package/dist/pages/{page-types.d.ts → types.d.ts} +0 -0
- /package/dist/pages/{page-types.js → types.js} +0 -0
- /package/dist/rules/{rule-book.d.ts → book.d.ts} +0 -0
- /package/dist/rules/{rule-book.js → book.js} +0 -0
- /package/dist/systems/{system-folders.d.ts → folders.d.ts} +0 -0
- /package/dist/systems/{system-folders.js → folders.js} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// What the fallen carry and what a container holds is there to be found, and what is taken is the player's to say (D-530, Elena's tests of 27 and 28 October,
|
|
2
2
|
// where the master put a fallen foe's coins in the character's pocket): text for the master where they read it, show of the page or the close of the scene.
|
|
3
|
-
import { valueNamed } from "
|
|
4
|
-
import { readCounter } from "
|
|
5
|
-
import { inheritedFields, isEmptyField, isPartyMember } from "
|
|
3
|
+
import { valueNamed } from "../../../core/text.js";
|
|
4
|
+
import { readCounter } from "../../../counters/index.js";
|
|
5
|
+
import { inheritedFields, isEmptyField, isPartyMember } from "../../../pages/index.js";
|
|
6
6
|
/** What the master is told of what the fallen carry: there, for the player to take. */
|
|
7
7
|
export const lootAdvice = "tell what the party sees, and let the player say what is taken, and by whom.";
|
|
8
8
|
/** Whether a character or creature outside the party, a copy too, is dead or at the system's down value or below. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Context } from "
|
|
2
|
-
import type { LogEntry } from "
|
|
1
|
+
import type { Context } from "../../../core/context.ts";
|
|
2
|
+
import type { LogEntry } from "../../../core/log.ts";
|
|
3
3
|
/** What the master is told of a roll the setting hid. */
|
|
4
4
|
export declare const screenNote = "Behind the screen, as master-rolls says: tell only the outcome, in the story.";
|
|
5
5
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// The master's rolls for anyone outside the party (D-287): hidden behind the screen, as the master-rolls setting has them when unset too, or in view.
|
|
2
|
-
import { readTextSetting } from "
|
|
3
|
-
import { sameName } from "
|
|
4
|
-
import { createProof, fingerprint } from "
|
|
5
|
-
import { isPartyMember, pagesWithNameOrAlias } from "
|
|
2
|
+
import { readTextSetting } from "../../../campaign/index.js";
|
|
3
|
+
import { sameName } from "../../../core/text.js";
|
|
4
|
+
import { createProof, fingerprint } from "../../../dice/index.js";
|
|
5
|
+
import { isPartyMember, pagesWithNameOrAlias } from "../../../pages/index.js";
|
|
6
|
+
import { campaignWorld } from "../campaign/world.js";
|
|
6
7
|
import { readOpenScene } from "./scene.js";
|
|
7
|
-
import { campaignWorld } from "./world.js";
|
|
8
8
|
/** What the master is told of a roll the setting hid. */
|
|
9
9
|
export const screenNote = "Behind the screen, as master-rolls says: tell only the outcome, in the story.";
|
|
10
10
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type Effect } from "
|
|
2
|
-
import type { Page, World } from "
|
|
3
|
-
import type { Scene } from "
|
|
4
|
-
import type { GameSystem } from "
|
|
1
|
+
import { type Effect } from "../../../effects/index.ts";
|
|
2
|
+
import type { Page, World } from "../../../pages/index.ts";
|
|
3
|
+
import type { Scene } from "../../../scene/index.ts";
|
|
4
|
+
import type { GameSystem } from "../../../systems/index.ts";
|
|
5
5
|
/** "Viola keeps Eroismo (Corrado): lost 7 hp. Read rules Concentration.": what someone keeps alive, when the counter the game system names goes down by `lost` (EFF-14). */
|
|
6
6
|
export declare function keepingLossNote(world: World, scene: Scene | undefined, system: GameSystem | undefined, name: string, field: string, lost: number): string;
|
|
7
7
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// What a fight asks the master to keep by hand, said when it happens (D-266): what can break what someone keeps alive (EFF-14), the effects at a turn and at a rest
|
|
2
2
|
// (EFF-15), the counter that shields another (DAT-14). The engine only says it: it ends and changes nothing by itself.
|
|
3
|
-
import { comparableText } from "
|
|
4
|
-
import { readCounter } from "
|
|
5
|
-
import { keeperOf } from "
|
|
6
|
-
import { effectiveFields, effectsOf } from "
|
|
3
|
+
import { comparableText } from "../../../core/text.js";
|
|
4
|
+
import { readCounter } from "../../../counters/index.js";
|
|
5
|
+
import { keeperOf } from "../../../effects/index.js";
|
|
6
|
+
import { effectiveFields, effectsOf } from "../sheet/effect-layer.js";
|
|
7
7
|
import { effectsOn, keptEffectHolders, keptEffects, systemNamed } from "./effects.js";
|
|
8
8
|
/** "Viola keeps Eroismo (Corrado): lost 7 hp. Read rules Concentration.": what someone keeps alive, when the counter the game system names goes down by `lost` (EFF-14). */
|
|
9
9
|
export function keepingLossNote(world, scene, system, name, field, lost) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Problem } from "
|
|
2
|
-
import { type Page, type World } from "
|
|
3
|
-
import { type Scene, type SceneCopy } from "
|
|
1
|
+
import type { Problem } from "../../../core/problem.ts";
|
|
2
|
+
import { type Page, type World } from "../../../pages/index.ts";
|
|
3
|
+
import { type Scene, type SceneCopy } from "../../../scene/index.ts";
|
|
4
4
|
/** A scene that has been closed, as the log keeps it. */
|
|
5
5
|
export interface ClosedScene {
|
|
6
6
|
title: string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// The open scene as several commands use it: read from state.yaml, written back, and checked against the world.
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { changeStateAt, readStateValues } from "
|
|
4
|
-
import { readLog } from "
|
|
5
|
-
import { sameName } from "
|
|
6
|
-
import { baseChain, findPage, isEmptyField, isInParty, kindMessage, locate, pagesWithName, parsePageReference, readOnlyMessage, systemFirstFix, systemLabel, systemPageNamed } from "
|
|
7
|
-
import { readScene } from "
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
3
|
+
import { changeStateAt, readStateValues } from "../../../campaign/index.js";
|
|
4
|
+
import { readLog } from "../../../core/log.js";
|
|
5
|
+
import { sameName } from "../../../core/text.js";
|
|
6
|
+
import { baseChain, findPage, isEmptyField, isInParty, kindMessage, locate, pagesWithName, parsePageReference, readOnlyMessage, systemFirstFix, systemLabel, systemPageNamed } from "../../../pages/index.js";
|
|
7
|
+
import { readScene } from "../../../scene/index.js";
|
|
8
|
+
import { missingSystemHint } from "../campaign/world.js";
|
|
9
|
+
import { countersText, pageCounters } from "../sheet/counters.js";
|
|
10
10
|
const closedSceneSchema = z.looseObject({ title: z.string(), type: z.string(), summary: z.string() });
|
|
11
11
|
const loggedCopiesSchema = z.record(z.string(), z.looseObject({ creature: z.string() }));
|
|
12
12
|
/** The place where the open scene is, where its copies are (ENV-2); none when there is no scene, or it is in no place that exists. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Problem } from "
|
|
2
|
-
import { type FieldChange, type Page, type World } from "
|
|
3
|
-
import type { GameSystem } from "
|
|
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 that binds more items than the system allows, or an item that asks for no bond (BND-1, BND-2); before anything is written. */
|
|
5
5
|
export declare function checkBonds(world: World, system: GameSystem | undefined, page: Page | undefined, name: string, change: FieldChange): void;
|
|
6
6
|
/** What a write says of the items it bound (BND-3): how many of the most, and what an item asks, as by a paladin, which the master checks. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { comparableText, valueNamed } from "
|
|
2
|
-
import { findPage, inheritedFields, linksIn, textsIn } from "
|
|
1
|
+
import { comparableText, valueNamed } from "../../../core/text.js";
|
|
2
|
+
import { findPage, inheritedFields, linksIn, textsIn } from "../../../pages/index.js";
|
|
3
3
|
/** Refuses a change that binds more items than the system allows, or an item that asks for no bond (BND-1, BND-2); before anything is written. */
|
|
4
4
|
export function checkBonds(world, system, page, name, change) {
|
|
5
5
|
for (const [field, bond] of Object.entries(system?.bonds ?? {})) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type Coin } from "
|
|
2
|
-
import { type Page, type World } from "
|
|
3
|
-
import type { GameSystem } from "
|
|
1
|
+
import { type Coin } from "../../../money/index.ts";
|
|
2
|
+
import { type Page, type World } from "../../../pages/index.ts";
|
|
3
|
+
import type { GameSystem } from "../../../systems/index.ts";
|
|
4
4
|
/**
|
|
5
5
|
* The counters of a page as the outputs show them, such as hp 5/12: all those it holds, and those it inherits written as current/max (D-116, as for copies in D-110).
|
|
6
6
|
* A statistic it inherits, such as ac 13, is read from its base. With the campaign's coins, its money too, held or inherited (MON-7).
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { comparableText, sameName } from "
|
|
2
|
-
import { readCounter } from "
|
|
3
|
-
import { formatAmount, readAmount } from "
|
|
4
|
-
import { declaredKind, isDeclaredUncounted, isEmptyField, isStandardField } from "
|
|
1
|
+
import { comparableText, sameName } from "../../../core/text.js";
|
|
2
|
+
import { readCounter } from "../../../counters/index.js";
|
|
3
|
+
import { formatAmount, readAmount } from "../../../money/index.js";
|
|
4
|
+
import { declaredKind, isDeclaredUncounted, isEmptyField, isStandardField } from "../../../pages/index.js";
|
|
5
5
|
import { effectiveFields, effectsOf } from "./effect-layer.js";
|
|
6
6
|
import { experienceOf, experienceText } from "./experience.js";
|
|
7
7
|
import { counterOf } from "./sheet.js";
|
|
8
|
-
import { signedText } from "./worked-
|
|
8
|
+
import { signedText } from "./worked-text.js";
|
|
9
9
|
/**
|
|
10
10
|
* The counters of a page as the outputs show them, such as hp 5/12: all those it holds, and those it inherits written as current/max (D-116, as for copies in D-110).
|
|
11
11
|
* A statistic it inherits, such as ac 13, is read from its base. With the campaign's coins, its money too, held or inherited (MON-7).
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type Effect } from "
|
|
2
|
-
import { type Page, type World } from "
|
|
1
|
+
import { type Effect } from "../../../effects/index.ts";
|
|
2
|
+
import { type Page, type World } from "../../../pages/index.ts";
|
|
3
3
|
/** The effects field of a page or copy, written in any case (EFF-1). */
|
|
4
4
|
export declare function effectsField(page: Page): unknown;
|
|
5
5
|
/** The effects a page or copy holds; none when its field cannot be read, which validate reports and effect refuses to touch (EFF-12). */
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
// The values effects give for a while, as a layer over a page (D-123, EFF-3): read by every command that shows or changes a page's fields.
|
|
2
|
-
import { fieldsRead } from "
|
|
3
|
-
import { comparableText, valueNamed } from "
|
|
4
|
-
import { readCounter } from "
|
|
5
|
-
import { formatEffect, readEffects } from "
|
|
6
|
-
import { declaredKind } from "
|
|
7
|
-
import {
|
|
2
|
+
import { fieldsRead } from "../../../core/formula.js";
|
|
3
|
+
import { comparableText, valueNamed } from "../../../core/text.js";
|
|
4
|
+
import { readCounter } from "../../../counters/index.js";
|
|
5
|
+
import { formatEffect, readEffects } from "../../../effects/index.js";
|
|
6
|
+
import { declaredKind } from "../../../pages/index.js";
|
|
7
|
+
import { withEffectValues } from "./effect-values.js";
|
|
8
|
+
import { hasSheet } from "./system-fields.js";
|
|
9
|
+
import { withWorkedOut } from "./worked-out.js";
|
|
10
|
+
import { signedText } from "./worked-text.js";
|
|
8
11
|
/** The effects field of a page or copy, written in any case (EFF-1). */
|
|
9
12
|
export function effectsField(page) {
|
|
10
13
|
return Object.entries(page.fields).find(([field]) => comparableText(field) === "effects")?.[1];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Page, type World } from "../../../pages/index.ts";
|
|
2
|
+
/**
|
|
3
|
+
* 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
|
|
4
|
+
* 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).
|
|
5
|
+
*/
|
|
6
|
+
export declare function withEffectValues(world: World, page: Page): Record<string, unknown>;
|
|
7
|
+
export declare const carriedKey: unique symbol;
|
|
8
|
+
/** 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. */
|
|
9
|
+
export declare function carriedIn(fields: Record<string, unknown>): number | undefined;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// A page's fields with what its effects and bonus pages give, and what it carries (EFF-3, FOR-5, LOAD-1)
|
|
2
|
+
import { factorOf, numberOf } from "../../../core/formula.js";
|
|
3
|
+
import { comparableText } from "../../../core/text.js";
|
|
4
|
+
import { readEffects } from "../../../effects/index.js";
|
|
5
|
+
import { bonusPages, carriedWeight, declaredKind, inheritedFields, readFieldValue } from "../../../pages/index.js";
|
|
6
|
+
import { keyOf } from "./system-fields.js";
|
|
7
|
+
/**
|
|
8
|
+
* 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
|
|
9
|
+
* 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).
|
|
10
|
+
*/
|
|
11
|
+
export function withEffectValues(world, page) {
|
|
12
|
+
// A world and its pages never change: worked out once in each world, and each caller gets its own copy (D-194).
|
|
13
|
+
let byPage = layeredByWorld.get(world);
|
|
14
|
+
if (byPage === undefined) {
|
|
15
|
+
byPage = new WeakMap();
|
|
16
|
+
layeredByWorld.set(world, byPage);
|
|
17
|
+
}
|
|
18
|
+
const known = byPage.get(page) ?? effectValuesOver(world, page);
|
|
19
|
+
byPage.set(page, known);
|
|
20
|
+
return { ...known };
|
|
21
|
+
}
|
|
22
|
+
const layeredByWorld = new WeakMap();
|
|
23
|
+
// Where a character's fields keep what it carries weighs, for its formulas alone.
|
|
24
|
+
export const carriedKey = Symbol("carried weight");
|
|
25
|
+
/** 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. */
|
|
26
|
+
export function carriedIn(fields) {
|
|
27
|
+
const value = fields[carriedKey];
|
|
28
|
+
return typeof value === "number" ? value : undefined;
|
|
29
|
+
}
|
|
30
|
+
function effectValuesOver(world, page) {
|
|
31
|
+
const fields = { ...inheritedFields(world, page) };
|
|
32
|
+
const read = readEffects(Object.entries(page.fields).find(([field]) => comparableText(field) === "effects")?.[1]);
|
|
33
|
+
// What the pages of the system's bonus lists give, as a Ring of Protection one is attuned to or a feat, adds up as effects do (FOR-5, D-449); an at-least
|
|
34
|
+
// field rises to theirs, as Gauntlets of Ogre Power's str 19, and stays when higher.
|
|
35
|
+
for (const page of bonusPages(world, fields)) {
|
|
36
|
+
for (const [field, value] of Object.entries(inheritedFields(world, page))) {
|
|
37
|
+
const kind = declaredKind(world, field);
|
|
38
|
+
const amount = kind === "bonus" || kind === "at-least" ? numberOf(value) : undefined;
|
|
39
|
+
const key = keyOf(fields, field) ?? field;
|
|
40
|
+
const current = numberOf(fields[key]);
|
|
41
|
+
fields[key] = amount === undefined ? fields[key] : kind === "bonus" ? (current ?? 0) + amount : Math.max(current ?? amount, amount);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
for (const effect of "effects" in read ? read.effects : []) {
|
|
45
|
+
for (const [field, value] of effect.values) {
|
|
46
|
+
const key = keyOf(fields, field) ?? field;
|
|
47
|
+
const kind = declaredKind(world, field);
|
|
48
|
+
fields[key] = kind === "bonus"
|
|
49
|
+
? (numberOf(fields[key]) ?? 0) + (numberOf(effectValue(value)) ?? 0)
|
|
50
|
+
: kind === "factor"
|
|
51
|
+
? (factorOf(fields[key]) ?? 1) * (factorOf(value) ?? 1)
|
|
52
|
+
: effectValue(value);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// What a character carries weighs, for the formulas that read it as load, as a speed; under a key no list of fields shows (FOR-2, LOAD-1).
|
|
56
|
+
if (page.type === "character" && world.system?.load !== undefined) {
|
|
57
|
+
fields[carriedKey] = carriedWeight(world, world.system.load, page);
|
|
58
|
+
}
|
|
59
|
+
return fields;
|
|
60
|
+
}
|
|
61
|
+
/** A value of an effect as a page would hold it: a number, a link, a counter as text; text as it is when it does not read. */
|
|
62
|
+
function effectValue(value) {
|
|
63
|
+
try {
|
|
64
|
+
return readFieldValue(value);
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return value;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Context } from "
|
|
2
|
-
import type { Problem } from "
|
|
3
|
-
import { type World } from "
|
|
1
|
+
import type { Context } from "../../../core/context.ts";
|
|
2
|
+
import type { Problem } from "../../../core/problem.ts";
|
|
3
|
+
import { type World } from "../../../pages/index.ts";
|
|
4
4
|
/**
|
|
5
5
|
* A character's points as the system counts them: its level, the least its level needs, the next level and the points it needs, and the highest level the
|
|
6
6
|
* points reach beyond its own.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// The experience points of a character (D-205, D-233, PRO-6): how many it lacks for the next level, the least its level needs, and the level they reach that its
|
|
2
2
|
// classes have not.
|
|
3
|
-
import { readChoices, writeChoices } from "
|
|
4
|
-
import { listItems, numberOf } from "
|
|
5
|
-
import { comparableText, valueNamed } from "
|
|
6
|
-
import { readCounter } from "
|
|
7
|
-
import { isInParty } from "
|
|
3
|
+
import { readChoices, writeChoices } from "../../../campaign/index.js";
|
|
4
|
+
import { listItems, numberOf } from "../../../core/formula.js";
|
|
5
|
+
import { comparableText, valueNamed } from "../../../core/text.js";
|
|
6
|
+
import { readCounter } from "../../../counters/index.js";
|
|
7
|
+
import { isInParty } from "../../../pages/index.js";
|
|
8
8
|
import { effectiveFields } from "./effect-layer.js";
|
|
9
9
|
/**
|
|
10
10
|
* The experience of a character with these fields, when the system counts it (PRO-6): the level is the sum of the numbers of the progression's list. Undefined
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Problem } from "../../../core/problem.ts";
|
|
2
|
+
import { type World } from "../../../pages/index.ts";
|
|
3
|
+
/**
|
|
4
|
+
* 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
|
|
5
|
+
* 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
|
|
6
|
+
* page cannot give (PRO-1, PRO-4). Found once for each world.
|
|
7
|
+
*/
|
|
8
|
+
export declare function workedOutProblems(world: World): Problem[];
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
// What validate says of pages about what the system works out (FOR-7, PRO-5)
|
|
2
|
+
import { diceFields, fieldsRead, listItems, parseRollFormula, tablesRead } from "../../../core/formula.js";
|
|
3
|
+
import { comparableText } from "../../../core/text.js";
|
|
4
|
+
import { readCounter } from "../../../counters/index.js";
|
|
5
|
+
import { declaredKind, inheritedFields } from "../../../pages/index.js";
|
|
6
|
+
import { formulaScope } from "./formula-scope.js";
|
|
7
|
+
import { progressionProblems } from "./progression.js";
|
|
8
|
+
import { keyOf } from "./system-fields.js";
|
|
9
|
+
import { counterLimits, givenFields, progressedField } from "./worked-out.js";
|
|
10
|
+
import { signedText } from "./worked-text.js";
|
|
11
|
+
/**
|
|
12
|
+
* 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
|
|
13
|
+
* 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
|
|
14
|
+
* page cannot give (PRO-1, PRO-4). Found once for each world.
|
|
15
|
+
*/
|
|
16
|
+
export function workedOutProblems(world) {
|
|
17
|
+
const formulas = world.system?.formulas;
|
|
18
|
+
if (formulas === undefined) {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
const known = checkedWorlds.get(world);
|
|
22
|
+
if (known !== undefined) {
|
|
23
|
+
return known;
|
|
24
|
+
}
|
|
25
|
+
const computedNames = new Set(formulas.computed.map(([name]) => comparableText(name)));
|
|
26
|
+
const counterNames = new Set(Object.keys(formulas.counters).map(comparableText));
|
|
27
|
+
const lists = new Set([...(world.system?.progression === undefined ? [] : [world.system.progression.list]), ...Object.keys(world.system?.itemFormulas ?? {})].map(comparableText));
|
|
28
|
+
const relevant = (field) => computedNames.has(comparableText(field)) || counterNames.has(comparableText(field)) || lists.has(comparableText(field));
|
|
29
|
+
const problems = world.pages.filter((page) => Object.keys(page.fields).some(relevant)).flatMap((page) => {
|
|
30
|
+
const fields = inheritedFields(world, page);
|
|
31
|
+
const scope = formulaScope(world, fields);
|
|
32
|
+
const progressed = new Set(givenFields(world, scope).map((worked) => comparableText(worked.field)));
|
|
33
|
+
// Only the fields the page writes are worked out: a page holds few of them.
|
|
34
|
+
const written = Object.keys(page.fields).filter((key) => computedNames.has(comparableText(key)) || progressed.has(comparableText(key))).flatMap((key) => {
|
|
35
|
+
const value = scope.computed(key)?.value ?? progressedField(world, scope, key)?.value;
|
|
36
|
+
return value === undefined ? [] : [{
|
|
37
|
+
path: page.path,
|
|
38
|
+
message: `${key} is worked out by the system ${world.system?.name ?? ""} (${signedText(world, key, value)}): the value written on ${page.name} is never read.`,
|
|
39
|
+
fix: `write ${page.name}, unset ${key}`,
|
|
40
|
+
}];
|
|
41
|
+
});
|
|
42
|
+
const limits = Object.keys(page.fields).filter((key) => counterNames.has(comparableText(key))).flatMap((key) => {
|
|
43
|
+
const counter = readCounter(page.fields[key]);
|
|
44
|
+
const { max } = counterLimits(world, fields, key);
|
|
45
|
+
return counter === undefined || max === undefined || counter.max === max ? [] : [{
|
|
46
|
+
path: page.path,
|
|
47
|
+
message: `${key} on ${page.name} has ${counter.max === undefined ? "no maximum" : `the maximum ${counter.max}`} written, but the system ${world.system?.name ?? ""} works out ${max}.`,
|
|
48
|
+
fix: `change ${page.name}, field ${key}, to ${counter.value}/${max}`,
|
|
49
|
+
}];
|
|
50
|
+
});
|
|
51
|
+
return [...written, ...limits, ...progressionProblems(world, page, fields), ...itemFormulaProblems(world, page, fields)];
|
|
52
|
+
});
|
|
53
|
+
checkedWorlds.set(world, problems);
|
|
54
|
+
return problems;
|
|
55
|
+
}
|
|
56
|
+
const checkedWorlds = new WeakMap();
|
|
57
|
+
/**
|
|
58
|
+
* A formula an item's page gives that who lists it can have no value from (PRO-5): one that does not read, that reads itself, a table the system lacks or a name
|
|
59
|
+
* that neither the system, the item nor who lists it has.
|
|
60
|
+
*/
|
|
61
|
+
function itemFormulaProblems(world, page, fields) {
|
|
62
|
+
const system = world.system;
|
|
63
|
+
const scope = formulaScope(world, fields);
|
|
64
|
+
// What the system and the page have, once for the page: a formula of an item reads among these, or the item's own fields.
|
|
65
|
+
const known = new Set([
|
|
66
|
+
...Object.keys(system?.fields ?? {}),
|
|
67
|
+
...(system?.formulas?.computed ?? []).map(([name]) => name),
|
|
68
|
+
...Object.keys(system?.formulas?.counters ?? {}),
|
|
69
|
+
...Object.values(system?.itemFormulas ?? {}).flat(),
|
|
70
|
+
...(scope.progression()?.values.map((value) => value.field) ?? []),
|
|
71
|
+
...Object.keys(fields),
|
|
72
|
+
// What every formula reads besides the fields (FOR-2).
|
|
73
|
+
"effects",
|
|
74
|
+
"rigor",
|
|
75
|
+
...(system?.load === undefined ? [] : ["load", "load-limit"]),
|
|
76
|
+
].map(comparableText));
|
|
77
|
+
return Object.entries(system?.itemFormulas ?? {}).flatMap(([list, names]) => listItems(keyOf(fields, list) === undefined ? undefined : fields[keyOf(fields, list) ?? ""]).flatMap((item) => {
|
|
78
|
+
const holder = scope.page(item.name);
|
|
79
|
+
return holder === undefined ? [] : names.flatMap((field) => {
|
|
80
|
+
const key = keyOf(holder, field);
|
|
81
|
+
const text = key === undefined ? undefined : holder[key];
|
|
82
|
+
if (typeof text !== "string" && typeof text !== "number") {
|
|
83
|
+
return [];
|
|
84
|
+
}
|
|
85
|
+
let given;
|
|
86
|
+
try {
|
|
87
|
+
given = parseRollFormula(String(text));
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
const why = error instanceof Error ? error.message : String(error);
|
|
91
|
+
return [{ path: page.path, message: `${field} on ${item.name} does not read, so ${page.name} has none from it: ${why}`, fix: `write ${item.name}, set ${field} as a formula` }];
|
|
92
|
+
}
|
|
93
|
+
const why = given.formula === undefined ? undefined : formulaGap(world, known, holder, field, given.formula);
|
|
94
|
+
if (why !== undefined) {
|
|
95
|
+
return [{ path: page.path, message: `${field} on ${item.name} ${why}, so ${page.name} has none from it.`, fix: `write ${item.name}, set ${field} as a formula of what the system has` }];
|
|
96
|
+
}
|
|
97
|
+
// Dice from a field no one has never count, while the other dice still do (D-235).
|
|
98
|
+
const dice = diceFields(given).find((name) => comparableText(name) === comparableText(field) || (!known.has(comparableText(name)) && keyOf(holder, name) === undefined));
|
|
99
|
+
if (dice !== undefined) {
|
|
100
|
+
return [{
|
|
101
|
+
path: page.path,
|
|
102
|
+
message: `${field} on ${item.name} takes dice from ${dice}, which ${comparableText(dice) === comparableText(field) ? "is the field itself" : "neither the system nor the character has"}: they never count for ${page.name}.`,
|
|
103
|
+
fix: `write ${item.name}, set ${field}="${withoutDiceField(String(text), dice)}"`,
|
|
104
|
+
}];
|
|
105
|
+
}
|
|
106
|
+
// Words after a number another formula reads, as "12 + Dex modifier", make it text, which no formula counts.
|
|
107
|
+
return given.words === undefined || given.dice !== undefined || !isReadAsNumber(world, field) ? [] : [{
|
|
108
|
+
path: page.path,
|
|
109
|
+
message: `${field} on ${item.name} ends with "${given.words}", words no formula counts, so ${page.name} has it only as text.`,
|
|
110
|
+
fix: `write ${item.name}, set ${field} as a formula alone, without "${given.words}"`,
|
|
111
|
+
}];
|
|
112
|
+
});
|
|
113
|
+
}));
|
|
114
|
+
}
|
|
115
|
+
/** A roll formula without one of the fields its dice(…) names: "dice(1d6) + dex-mod bludgeoning" for ki-die in "dice(1d6, ki-die) + dex-mod bludgeoning". */
|
|
116
|
+
function withoutDiceField(text, field) {
|
|
117
|
+
return text.replace(/^(\s*dice\s*\()([^()]*)\)/i, (_whole, opening, inside) => {
|
|
118
|
+
const kept = inside.split(",").map((part) => part.trim()).filter((part) => comparableText(part) !== comparableText(field));
|
|
119
|
+
return kept.length === 0 ? "" : `${opening}${kept.join(", ")})`;
|
|
120
|
+
}).trim().replace(/^\+\s*/, "");
|
|
121
|
+
}
|
|
122
|
+
/** Whether a field is a number for the system: declared as one, or read by one of its computed fields, as an armor's armor-class by ac. */
|
|
123
|
+
function isReadAsNumber(world, field) {
|
|
124
|
+
return ["number", "at-least", "modifier", "bonus"].includes(declaredKind(world, field) ?? "")
|
|
125
|
+
|| (world.system?.formulas?.computed ?? []).some(([, formula]) => fieldsRead(formula).some((name) => comparableText(name) === comparableText(field)));
|
|
126
|
+
}
|
|
127
|
+
/** Why a formula of an item's page can give no value: it reads itself, a table the system lacks, or a name no one has; undefined when none of these. */
|
|
128
|
+
function formulaGap(world, known, item, field, formula) {
|
|
129
|
+
const system = world.system;
|
|
130
|
+
const read = fieldsRead(formula);
|
|
131
|
+
if (read.some((name) => comparableText(name) === comparableText(field))) {
|
|
132
|
+
return "reads itself";
|
|
133
|
+
}
|
|
134
|
+
const table = tablesRead(formula).find((name) => !Object.keys(system?.formulas?.tables ?? {}).some((other) => comparableText(other) === comparableText(name)));
|
|
135
|
+
if (table !== undefined) {
|
|
136
|
+
return `reads the table "${table}", which the system lacks`;
|
|
137
|
+
}
|
|
138
|
+
const unknown = read.find((name) => !known.has(comparableText(name)) && keyOf(item, name) === undefined);
|
|
139
|
+
return unknown === undefined ? undefined : `reads ${unknown}, which neither the system nor the character has`;
|
|
140
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type Formula, type FormulaRead, type FormulaScope, type RollFormula, type SystemFormulas, type Table, type WorkedOut } from "../../../core/formula.ts";
|
|
2
|
+
import { type World } from "../../../pages/index.ts";
|
|
3
|
+
import { type Progression } from "./progression.ts";
|
|
4
|
+
import { type WorkedField } from "./worked-text.ts";
|
|
5
|
+
/** 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). */
|
|
6
|
+
export declare function formulaScope(world: World, fields: Record<string, unknown>): FormulaScope & {
|
|
7
|
+
computed(name: string): WorkedOut | undefined;
|
|
8
|
+
progression(): Progression | undefined;
|
|
9
|
+
each(field: string, explained: boolean): WorkedField | undefined;
|
|
10
|
+
page(name: string): Record<string, unknown> | undefined;
|
|
11
|
+
};
|
|
12
|
+
/** 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). */
|
|
13
|
+
export declare function formulaIndex(formulas: SystemFormulas): {
|
|
14
|
+
computed: Map<string, [string, Formula]>;
|
|
15
|
+
tables: Map<string, Table>;
|
|
16
|
+
};
|
|
17
|
+
/** A formula of the system worked out on these fields, as a recipe's regain is; undefined when it has no value (FOR-4). */
|
|
18
|
+
export declare function formulaValue(world: World, fields: Record<string, unknown>, formula: Formula): number | undefined;
|
|
19
|
+
/** What an item of a list gives a field (PRO-5), with what it came from. */
|
|
20
|
+
interface ItemValue {
|
|
21
|
+
name: string;
|
|
22
|
+
value: number | string;
|
|
23
|
+
reads: FormulaRead[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 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
|
|
27
|
+
* item's own fields, as a magic weapon's bonus, then those of who lists it.
|
|
28
|
+
*/
|
|
29
|
+
export declare function itemValues(world: World, scope: ReturnType<typeof formulaScope>, field: string, explained: boolean): ItemValue[];
|
|
30
|
+
/** 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). */
|
|
31
|
+
export declare function itemFormula(fields: Record<string, unknown> | undefined, field: string): RollFormula | undefined;
|
|
32
|
+
export {};
|