rpg-engine 0.7.0 → 0.8.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/adventures/index.d.ts +1 -1
- package/dist/adventures/index.js +1 -1
- package/dist/adventures/source.js +13 -13
- package/dist/campaign/create-campaign.js +10 -1
- package/dist/campaign/host-files.d.ts +2 -1
- package/dist/campaign/host-files.js +11 -11
- package/dist/campaign/index.d.ts +1 -1
- package/dist/campaign/index.js +1 -1
- package/dist/campaign/settings.d.ts +55 -64
- package/dist/campaign/settings.js +171 -174
- package/dist/{cli.js → cli/cli.js} +3 -3
- package/dist/{command-line.d.ts → cli/command-line.d.ts} +1 -1
- package/dist/{command-line.js → cli/command-line.js} +21 -20
- package/dist/commands/advance.d.ts +1 -1
- package/dist/commands/advance.js +7 -7
- package/dist/commands/ask.d.ts +1 -8
- package/dist/commands/ask.js +16 -29
- package/dist/commands/{change.d.ts → change/change.d.ts} +2 -2
- package/dist/commands/{change.js → change/change.js} +46 -52
- package/dist/commands/{game-damage.d.ts → change/damage.d.ts} +2 -2
- package/dist/commands/{game-damage.js → change/damage.js} +3 -3
- package/dist/commands/{game-recipe-pace.d.ts → change/recipe-pace.d.ts} +2 -2
- package/dist/commands/{game-recipe-pace.js → change/recipe-pace.js} +4 -4
- package/dist/commands/config.d.ts +4 -4
- package/dist/commands/config.js +142 -138
- package/dist/commands/effect.d.ts +1 -1
- package/dist/commands/effect.js +11 -12
- package/dist/commands/find.d.ts +4 -4
- package/dist/commands/find.js +2 -2
- package/dist/commands/image.js +6 -6
- package/dist/commands/{import.d.ts → import/import.d.ts} +2 -2
- package/dist/commands/{import.js → import/import.js} +101 -101
- package/dist/commands/{game-import.d.ts → import/run.d.ts} +3 -3
- package/dist/commands/{game-import.js → import/run.js} +13 -12
- package/dist/commands/index.js +7 -7
- package/dist/commands/init.js +3 -3
- package/dist/commands/install.js +1 -1
- package/dist/commands/instructions.js +6 -6
- package/dist/commands/mode.d.ts +2 -2
- package/dist/commands/mode.js +8 -8
- package/dist/commands/mood.js +4 -4
- package/dist/commands/move.js +13 -20
- package/dist/commands/package.d.ts +2 -2
- package/dist/commands/package.js +138 -93
- package/dist/commands/rename.js +3 -3
- package/dist/commands/reveal.js +29 -18
- package/dist/commands/{roll.d.ts → roll/roll.d.ts} +4 -4
- package/dist/commands/{roll.js → roll/roll.js} +69 -69
- package/dist/commands/{game-tables.d.ts → roll/tables.d.ts} +2 -2
- package/dist/commands/{game-tables.js → roll/tables.js} +4 -4
- 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 +18 -18
- package/dist/commands/scene.d.ts +4 -4
- package/dist/commands/scene.js +31 -28
- package/dist/commands/{game-advance.d.ts → shared/advance.d.ts} +4 -4
- package/dist/commands/{game-advance.js → shared/advance.js} +27 -27
- package/dist/commands/{game-adventures.d.ts → shared/adventures.d.ts} +3 -3
- package/dist/commands/{game-adventures.js → shared/adventures.js} +20 -27
- package/dist/commands/{game-bonds.d.ts → shared/bonds.d.ts} +3 -3
- package/dist/commands/{game-bonds.js → shared/bonds.js} +2 -2
- package/dist/commands/{game-checks.d.ts → shared/checks.d.ts} +3 -3
- package/dist/commands/{game-checks.js → shared/checks.js} +7 -7
- package/dist/commands/{game-dice-pool.d.ts → shared/dice-pool.d.ts} +3 -3
- package/dist/commands/{game-dice-pool.js → shared/dice-pool.js} +19 -12
- package/dist/commands/{effect-layer.d.ts → shared/effect-layer.d.ts} +2 -2
- package/dist/commands/{effect-layer.js → shared/effect-layer.js} +12 -12
- package/dist/commands/{game-effects.d.ts → shared/effects.d.ts} +7 -7
- package/dist/commands/{game-effects.js → shared/effects.js} +19 -19
- package/dist/commands/{game-environment.d.ts → shared/environment.d.ts} +1 -1
- package/dist/commands/{game-environment.js → shared/environment.js} +3 -3
- package/dist/commands/{game-events.d.ts → shared/events.d.ts} +5 -5
- package/dist/commands/{game-events.js → shared/events.js} +20 -22
- package/dist/commands/{game-examples.d.ts → shared/examples.d.ts} +4 -8
- package/dist/commands/{game-examples.js → shared/examples.js} +23 -23
- package/dist/commands/{game-experience.d.ts → shared/experience.d.ts} +2 -2
- package/dist/commands/{game-experience.js → shared/experience.js} +8 -11
- package/dist/commands/{game-grid-moves.d.ts → shared/grid-moves.d.ts} +6 -6
- package/dist/commands/{game-grid-moves.js → shared/grid-moves.js} +5 -5
- package/dist/commands/{game-grids.d.ts → shared/grids.d.ts} +4 -9
- package/dist/commands/{game-grids.js → shared/grids.js} +20 -19
- package/dist/commands/{game-images.d.ts → shared/images.d.ts} +3 -3
- package/dist/commands/{game-images.js → shared/images.js} +7 -6
- package/dist/commands/shared/inputs.d.ts +9 -0
- package/dist/commands/shared/inputs.js +12 -0
- package/dist/commands/{game-journey.d.ts → shared/journey.d.ts} +4 -6
- package/dist/commands/{game-journey.js → shared/journey.js} +13 -15
- package/dist/commands/{game-knowledge.d.ts → shared/knowledge.d.ts} +15 -8
- package/dist/commands/{game-knowledge.js → shared/knowledge.js} +42 -42
- package/dist/{library-reader.js → commands/shared/library-reader.js} +4 -4
- package/dist/commands/{game-library.d.ts → shared/library.d.ts} +7 -4
- package/dist/commands/{game-library.js → shared/library.js} +70 -50
- package/dist/commands/{game-limits.d.ts → shared/limits.d.ts} +3 -3
- package/dist/commands/{game-limits.js → shared/limits.js} +3 -3
- package/dist/commands/{game-loot.d.ts → shared/loot.d.ts} +2 -2
- package/dist/commands/{game-loot.js → shared/loot.js} +3 -3
- package/dist/commands/{game-master-rolls.d.ts → shared/master-rolls.d.ts} +2 -2
- package/dist/commands/{game-master-rolls.js → shared/master-rolls.js} +6 -6
- package/dist/commands/{game-mode.d.ts → shared/mode.d.ts} +4 -6
- package/dist/commands/{game-mode.js → shared/mode.js} +10 -10
- package/dist/commands/{game-money.d.ts → shared/money.d.ts} +3 -3
- package/dist/commands/{game-money.js → shared/money.js} +4 -4
- package/dist/commands/{game-moods.d.ts → shared/moods.d.ts} +3 -3
- package/dist/commands/{game-moods.js → shared/moods.js} +3 -3
- package/dist/commands/{game-moves.d.ts → shared/moves.d.ts} +2 -2
- package/dist/commands/{game-moves.js → shared/moves.js} +5 -5
- package/dist/commands/{game-offers.d.ts → shared/offers.d.ts} +3 -3
- package/dist/commands/{game-offers.js → shared/offers.js} +9 -12
- package/dist/commands/{game-outside.d.ts → shared/outside.d.ts} +3 -3
- package/dist/commands/{game-outside.js → shared/outside.js} +9 -9
- package/dist/commands/{game-catalog.d.ts → shared/packages/catalog.d.ts} +1 -3
- package/dist/commands/{game-catalog.js → shared/packages/catalog.js} +17 -22
- package/dist/commands/{game-package-code.d.ts → shared/packages/code.d.ts} +10 -14
- package/dist/commands/{game-package-code.js → shared/packages/code.js} +156 -59
- package/dist/commands/{game-extension-list.d.ts → shared/packages/extensions.d.ts} +6 -6
- package/dist/commands/{game-extension-list.js → shared/packages/extensions.js} +43 -22
- package/dist/commands/{game-package-hooks.d.ts → shared/packages/hooks.d.ts} +3 -3
- package/dist/commands/{game-package-hooks.js → shared/packages/hooks.js} +3 -3
- package/dist/commands/{game-widgets.d.ts → shared/packages/widgets.d.ts} +6 -10
- package/dist/commands/{game-widgets.js → shared/packages/widgets.js} +57 -57
- package/dist/commands/{page-counters.d.ts → shared/page-counters.d.ts} +3 -3
- package/dist/commands/{page-counters.js → shared/page-counters.js} +5 -5
- package/dist/{page-words.d.ts → commands/shared/page-words.d.ts} +2 -2
- package/dist/{page-words.js → commands/shared/page-words.js} +5 -4
- package/dist/commands/{parts.d.ts → shared/parts.d.ts} +3 -3
- package/dist/commands/{parts.js → shared/parts.js} +4 -4
- package/dist/commands/{game-positions.d.ts → shared/positions.d.ts} +3 -5
- package/dist/commands/{game-positions.js → shared/positions.js} +6 -7
- package/dist/commands/{problems.d.ts → shared/problems.d.ts} +3 -3
- package/dist/commands/{problems.js → shared/problems.js} +21 -22
- package/dist/commands/{progression.d.ts → shared/progression.d.ts} +2 -2
- package/dist/commands/{progression.js → shared/progression.js} +4 -4
- package/dist/commands/{game-quests.d.ts → shared/quests.d.ts} +4 -4
- package/dist/commands/{game-quests.js → shared/quests.js} +6 -6
- package/dist/commands/{game-recipes.d.ts → shared/recipes.d.ts} +3 -3
- package/dist/commands/{game-recipes.js → shared/recipes.js} +3 -3
- package/dist/commands/{game-reminders.d.ts → shared/reminders.d.ts} +4 -4
- package/dist/commands/{game-reminders.js → shared/reminders.js} +4 -4
- package/dist/commands/{game-roads.d.ts → shared/roads.d.ts} +5 -5
- package/dist/commands/{game-roads.js → shared/roads.js} +43 -44
- package/dist/commands/{game-rules.d.ts → shared/rules.d.ts} +2 -2
- package/dist/commands/{game-rules.js → shared/rules.js} +4 -4
- package/dist/commands/{game-saves.d.ts → shared/saves.d.ts} +4 -4
- package/dist/commands/{game-saves.js → shared/saves.js} +51 -51
- package/dist/commands/{game-scene.d.ts → shared/scene.d.ts} +13 -3
- package/dist/commands/{game-scene.js → shared/scene.js} +41 -13
- package/dist/commands/{sheet.d.ts → shared/sheet.d.ts} +5 -5
- package/dist/commands/{sheet.js → shared/sheet.js} +76 -76
- package/dist/commands/{game-stacks.d.ts → shared/stacks.d.ts} +2 -9
- package/dist/commands/{game-stacks.js → shared/stacks.js} +22 -22
- package/dist/commands/{game-theme.d.ts → shared/theme.d.ts} +3 -3
- package/dist/commands/{game-theme.js → shared/theme.js} +2 -2
- package/dist/commands/{game-thoughts.d.ts → shared/thoughts.d.ts} +2 -4
- package/dist/commands/{game-thoughts.js → shared/thoughts.js} +6 -8
- package/dist/commands/{game-thresholds.d.ts → shared/thresholds.d.ts} +1 -1
- package/dist/commands/{game-thresholds.js → shared/thresholds.js} +4 -4
- package/dist/commands/{game-time.d.ts → shared/time.d.ts} +4 -4
- package/dist/commands/{game-time.js → shared/time.js} +6 -6
- package/dist/commands/{game-turn-uses.d.ts → shared/turn-uses.d.ts} +3 -3
- package/dist/commands/{game-turn-uses.js → shared/turn-uses.js} +12 -15
- package/dist/commands/{game-upkeep.d.ts → shared/upkeep.d.ts} +3 -3
- package/dist/commands/{game-upkeep.js → shared/upkeep.js} +69 -57
- package/dist/commands/{game-voices.d.ts → shared/voices.d.ts} +1 -1
- package/dist/commands/{game-voices.js → shared/voices.js} +2 -2
- package/dist/commands/{worked-out.d.ts → shared/worked-out.d.ts} +3 -8
- package/dist/commands/{worked-out.js → shared/worked-out.js} +238 -238
- package/dist/commands/{game-world.d.ts → shared/world.d.ts} +5 -14
- package/dist/commands/{game-world.js → shared/world.js} +72 -76
- package/dist/commands/show.d.ts +1 -1
- package/dist/commands/show.js +32 -17
- package/dist/commands/status.d.ts +1 -1
- package/dist/commands/status.js +28 -28
- package/dist/commands/thoughts.js +3 -3
- package/dist/commands/trade.js +9 -10
- package/dist/commands/translate.d.ts +1 -1
- package/dist/commands/translate.js +3 -3
- package/dist/commands/{game-open.d.ts → travel/open.d.ts} +3 -3
- package/dist/commands/{game-open.js → travel/open.js} +4 -5
- package/dist/commands/{route.d.ts → travel/route.d.ts} +1 -1
- package/dist/commands/{route.js → travel/route.js} +9 -10
- package/dist/commands/{travel.d.ts → travel/travel.d.ts} +2 -2
- package/dist/commands/{travel.js → travel/travel.js} +19 -21
- package/dist/commands/validate.js +5 -5
- package/dist/commands/{game-view-journal.d.ts → view/journal.d.ts} +5 -5
- package/dist/commands/{game-view-journal.js → view/journal.js} +5 -5
- package/dist/commands/{game-view-map.d.ts → view/map.d.ts} +3 -3
- package/dist/commands/{game-view-map.js → view/map.js} +15 -16
- package/dist/commands/{game-view-place.d.ts → view/place.d.ts} +6 -6
- package/dist/commands/{game-view-place.js → view/place.js} +108 -108
- package/dist/commands/{view.d.ts → view/view.d.ts} +16 -16
- package/dist/commands/{view.js → view/view.js} +35 -35
- package/dist/commands/{game-view-world.d.ts → view/world.d.ts} +4 -4
- package/dist/commands/{game-view-world.js → view/world.js} +7 -7
- package/dist/commands/{game-here.d.ts → write/here.d.ts} +5 -3
- package/dist/commands/{game-here.js → write/here.js} +18 -12
- package/dist/commands/{write.d.ts → write/write.d.ts} +6 -6
- package/dist/commands/{write.js → write/write.js} +44 -41
- package/dist/confirm/confirm.d.ts +2 -0
- package/dist/confirm/confirm.js +15 -5
- package/dist/core/consents.d.ts +3 -2
- package/dist/core/consents.js +43 -4
- package/dist/core/context.d.ts +8 -6
- package/dist/core/context.js +4 -2
- package/dist/core/download.js +16 -5
- package/dist/core/files.d.ts +6 -1
- package/dist/core/files.js +47 -21
- package/dist/core/formula.d.ts +7 -2
- package/dist/core/formula.js +63 -66
- package/dist/core/instruction-parts.js +1 -1
- package/dist/core/mood.d.ts +0 -1
- package/dist/core/mood.js +3 -3
- package/dist/core/package-api.d.ts +11 -0
- package/dist/core/package-api.js +2 -1
- package/dist/core/package-declarations.d.ts +9 -9
- package/dist/core/package-declarations.js +3 -3
- package/dist/core/process-mark.d.ts +8 -0
- package/dist/core/process-mark.js +72 -0
- package/dist/core/registry.d.ts +5 -0
- package/dist/core/registry.js +10 -0
- package/dist/core/session-store.d.ts +0 -1
- package/dist/core/session-store.js +11 -14
- package/dist/core/store.d.ts +4 -0
- package/dist/core/store.js +29 -8
- package/dist/core/text.d.ts +4 -0
- package/dist/core/text.js +11 -2
- package/dist/core/yaml-file.js +2 -2
- package/dist/dashboard/{acts.js → acts/acts.js} +2 -2
- package/dist/dashboard/{act-names.js → acts/names.js} +1 -1
- package/dist/dashboard/{act-sheet.js → acts/sheet.js} +3 -3
- package/dist/dashboard/{act-strip.js → acts/strip.js} +2 -2
- package/dist/dashboard/app.js +13 -13
- package/dist/dashboard/asked.js +1 -1
- package/dist/dashboard/dice/burn.js +1 -1
- package/dist/dashboard/dice/stage.js +1 -1
- package/dist/dashboard/{guide-blocks.js → help/blocks.js} +1 -1
- package/dist/dashboard/{help.js → help/help.js} +6 -6
- package/dist/dashboard/journal.js +1 -1
- package/dist/dashboard/kit.js +6 -5
- package/dist/dashboard/labels.js +7 -3
- package/dist/dashboard/markdown.js +1 -1
- package/dist/dashboard/{ask-card.js → packages/ask-card.js} +6 -6
- package/dist/dashboard/{package-page.js → packages/package-page.js} +3 -3
- package/dist/dashboard/{packages.js → packages/packages.js} +12 -12
- package/dist/dashboard/{page-code.js → packages/page-code.js} +4 -4
- package/dist/dashboard/{extension-widgets.js → packages/widgets.js} +5 -5
- package/dist/dashboard/party.js +1 -1
- package/dist/dashboard/person-panel.js +2 -13
- package/dist/dashboard/{map-sheet.js → place/map-sheet.js} +4 -4
- package/dist/dashboard/{place-map-view.js → place/map-view.js} +11 -11
- package/dist/dashboard/scene.js +4 -4
- package/dist/dashboard/settings.js +1 -1
- package/dist/dashboard/sheet.js +3 -3
- package/dist/dashboard/top.js +2 -2
- package/dist/dashboard/turns.js +2 -2
- package/dist/dashboard/widgets.js +1 -1
- package/dist/dashboard/{world-calendar.js → world/calendar.js} +7 -7
- package/dist/dashboard/{lore.js → world/known.js} +1 -1
- package/dist/dashboard/{world-lore.js → world/lore.js} +9 -9
- package/dist/dashboard/{world-map.js → world/map.js} +1 -1
- package/dist/dashboard/{world.js → world/world.js} +14 -14
- package/dist/dice/evaluate.js +1 -1
- package/dist/dice/index.d.ts +2 -2
- package/dist/dice/index.js +2 -2
- package/dist/dice/notation.d.ts +2 -0
- package/dist/dice/notation.js +22 -4
- package/dist/documents/markup.js +2 -2
- package/dist/documents/read.js +29 -13
- package/dist/effects/effect.js +2 -5
- package/dist/extensions/extension.js +6 -8
- package/dist/extensions/index.d.ts +1 -4
- package/dist/extensions/index.js +1 -4
- package/dist/extensions/words.js +2 -1
- package/dist/{pictures → helpers}/briefs.js +17 -14
- package/dist/{pictures → helpers}/claude.js +8 -18
- package/dist/{pictures → helpers}/codex.js +3 -15
- package/dist/helpers/index.d.ts +7 -0
- package/dist/helpers/index.js +9 -0
- package/dist/{pictures/helpers.d.ts → helpers/programs.d.ts} +6 -1
- package/dist/{pictures/helpers.js → helpers/programs.js} +16 -2
- package/dist/images/images.js +7 -5
- package/dist/images/index.d.ts +1 -1
- package/dist/images/index.js +1 -1
- package/dist/importer/index.d.ts +1 -1
- package/dist/importer/index.js +1 -1
- package/dist/importer/work.d.ts +0 -2
- package/dist/importer/work.js +9 -30
- package/dist/instructions/index.d.ts +2 -0
- package/dist/instructions/index.js +10 -0
- package/dist/languages/index.d.ts +1 -1
- package/dist/languages/index.js +1 -1
- package/dist/languages/language-pack.js +15 -3
- package/dist/library/books.js +29 -83
- package/dist/{extensions → packages}/engine.d.ts +1 -1
- package/dist/{extensions → packages}/engine.js +1 -1
- package/dist/packages/index.d.ts +3 -0
- package/dist/packages/index.js +4 -0
- package/dist/{extensions/packages.d.ts → packages/npm.d.ts} +2 -0
- package/dist/{extensions/packages.js → packages/npm.js} +74 -45
- package/dist/page.d.ts +9 -11
- package/dist/page.js +1 -2
- package/dist/pages/check.js +31 -40
- package/dist/pages/containers.js +20 -20
- package/dist/pages/environment.js +15 -15
- package/dist/pages/index.d.ts +9 -9
- package/dist/pages/index.js +9 -9
- package/dist/pages/inheritance.d.ts +2 -1
- package/dist/pages/inheritance.js +24 -24
- package/dist/pages/load.js +7 -7
- package/dist/pages/maps.d.ts +20 -0
- package/dist/pages/maps.js +51 -1
- package/dist/pages/markdown.d.ts +2 -0
- package/dist/pages/markdown.js +110 -79
- package/dist/pages/page-file.d.ts +2 -1
- package/dist/pages/page-file.js +31 -29
- package/dist/pages/rename-page.d.ts +4 -1
- package/dist/pages/rename-page.js +7 -3
- package/dist/pages/{stack-entry.d.ts → stacks/entry.d.ts} +0 -2
- package/dist/pages/{stack-entry.js → stacks/entry.js} +2 -6
- package/dist/pages/{stacks.d.ts → stacks/kinds.d.ts} +8 -1
- package/dist/pages/{stacks.js → stacks/kinds.js} +36 -41
- package/dist/pages/{stack-writes.d.ts → stacks/writes.d.ts} +2 -2
- package/dist/pages/{stack-writes.js → stacks/writes.js} +32 -32
- package/dist/pages/system-pages.js +15 -15
- package/dist/pages/world.js +25 -19
- package/dist/pages/write-page.js +35 -34
- package/dist/player-notes/index.d.ts +1 -1
- package/dist/player-notes/index.js +1 -1
- package/dist/rules/page-search.js +3 -4
- package/dist/rules/rule-book.js +1 -1
- package/dist/rules/search.js +21 -21
- package/dist/rules/shown.js +1 -3
- package/dist/saves/saves.d.ts +2 -2
- package/dist/saves/saves.js +15 -3
- package/dist/{bell-listener.js → server/bell-listener.js} +3 -3
- package/dist/server/dashboard/files.d.ts +59 -0
- package/dist/server/dashboard/files.js +326 -0
- package/dist/server/dashboard/index.d.ts +114 -0
- package/dist/server/dashboard/index.js +419 -0
- package/dist/server/dashboard/news.d.ts +39 -0
- package/dist/server/dashboard/news.js +390 -0
- package/dist/server/dashboard/player.d.ts +48 -0
- package/dist/server/dashboard/player.js +242 -0
- package/dist/server/dashboard/ports.d.ts +10 -0
- package/dist/server/dashboard/ports.js +15 -0
- package/dist/server/dashboard/writes.d.ts +58 -0
- package/dist/server/dashboard/writes.js +492 -0
- package/dist/{mcp-server.d.ts → server/mcp.d.ts} +2 -2
- package/dist/{mcp-server.js → server/mcp.js} +57 -42
- package/dist/systems/game-system.d.ts +5 -3
- package/dist/systems/game-system.js +178 -149
- package/dist/systems/index.d.ts +1 -1
- package/dist/systems/index.js +1 -1
- package/dist/{testing.d.ts → testing/index.d.ts} +6 -6
- package/dist/{testing.js → testing/index.js} +32 -18
- package/dist/{system-checks.js → testing/system-checks.js} +18 -12
- package/dist/themes/theme.d.ts +3 -3
- package/dist/themes/theme.js +14 -14
- package/dist/time/calendar.js +5 -2
- package/dist/triggers/trigger.js +5 -8
- package/instructions/dashboard-guide.md +2 -1
- package/instructions/play.md +1 -1
- package/package.json +5 -5
- package/dist/commands/game-maps.d.ts +0 -20
- package/dist/commands/game-maps.js +0 -51
- package/dist/dashboard-server.d.ts +0 -47
- package/dist/dashboard-server.js +0 -1830
- package/dist/pictures/index.d.ts +0 -7
- package/dist/pictures/index.js +0 -9
- /package/dist/{cli.d.ts → cli/cli.d.ts} +0 -0
- /package/dist/{library-reader.d.ts → commands/shared/library-reader.d.ts} +0 -0
- /package/dist/commands/{notes.d.ts → shared/notes.d.ts} +0 -0
- /package/dist/commands/{notes.js → shared/notes.js} +0 -0
- /package/dist/dashboard/{guide-markdown.js → help/markdown.js} +0 -0
- /package/dist/dashboard/{pack-card.js → packages/card.js} +0 -0
- /package/dist/dashboard/{people.js → packages/people.js} +0 -0
- /package/dist/dashboard/{place-map.js → place/map.js} +0 -0
- /package/dist/dashboard/{calendar.js → world/days.js} +0 -0
- /package/dist/{pictures → helpers}/briefs.d.ts +0 -0
- /package/dist/{pictures → helpers}/chosen.d.ts +0 -0
- /package/dist/{pictures → helpers}/chosen.js +0 -0
- /package/dist/{pictures → helpers}/claude.d.ts +0 -0
- /package/dist/{pictures → helpers}/codex.d.ts +0 -0
- /package/dist/{pictures → helpers}/stop.d.ts +0 -0
- /package/dist/{pictures → helpers}/stop.js +0 -0
- /package/dist/{pictures → helpers}/svg.d.ts +0 -0
- /package/dist/{pictures → helpers}/svg.js +0 -0
- /package/dist/{extensions → packages}/tarball.d.ts +0 -0
- /package/dist/{extensions → packages}/tarball.js +0 -0
- /package/dist/{bell-listener.d.ts → server/bell-listener.d.ts} +0 -0
- /package/dist/{player-acts.d.ts → server/player-acts.d.ts} +0 -0
- /package/dist/{player-acts.js → server/player-acts.js} +0 -0
- /package/dist/{system-checks.d.ts → testing/system-checks.d.ts} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// The character sheet of the game system (D-204, D-207, DAT-2): its groups as show gives them, the fields a character still lacks, and the names a list takes (SYS-8).
|
|
2
|
-
import { listItemNames, numberOf } from "
|
|
3
|
-
import { comparableText, valueNamed } from "
|
|
4
|
-
import { readCounter } from "
|
|
5
|
-
import { baseChain, carriedWeight, containerFieldOf, declaredKind, entryKind, entryPage, inheritedFields, isEmptyField, isStandardField, linksIn, readEntry, stackName, stacksOf, textsIn, validHoldersOf, weightUnit, } from "
|
|
6
|
-
import { fieldName } from "
|
|
2
|
+
import { listItemNames, numberOf } from "../../core/formula.js";
|
|
3
|
+
import { comparableText, valueNamed } from "../../core/text.js";
|
|
4
|
+
import { readCounter } from "../../counters/index.js";
|
|
5
|
+
import { baseChain, carriedWeight, containerFieldOf, declaredKind, entryKind, entryPage, inheritedFields, isEmptyField, isStandardField, linksIn, readEntry, stackName, stacksOf, textsIn, validHoldersOf, weightUnit, } from "../../pages/index.js";
|
|
6
|
+
import { fieldName } from "../../progression/index.js";
|
|
7
7
|
import { effectiveFields } from "./effect-layer.js";
|
|
8
|
-
import { experienceOf, experienceText, levelNeed } from "./
|
|
8
|
+
import { experienceOf, experienceText, levelNeed } from "./experience.js";
|
|
9
9
|
import { givenItems, progressionOf } from "./progression.js";
|
|
10
10
|
import { carriedIn, counterLimits, formulaValue, hasSheet, isUse, itemLines, itemList, signedText, workedFields, workedLine, workedMaximum, workedParts } from "./worked-out.js";
|
|
11
11
|
/** The sheet of the game system as status gives it before there is a player character (DAT-2); undefined when the system has none. */
|
|
@@ -112,10 +112,6 @@ export function sheetData(world, system, page) {
|
|
|
112
112
|
return values.length === 0 ? [] : [{ name: group.name, ...iconOf(group), values }];
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
|
-
/** A group's icon, as the data of the sheet carries it: none when the system gives none. */
|
|
116
|
-
function iconOf(group) {
|
|
117
|
-
return group.icon === undefined ? {} : { icon: group.icon };
|
|
118
|
-
}
|
|
119
115
|
/**
|
|
120
116
|
* The icon on the token of one of the party (D-414): the system's for the first item of its field that has one, by its name or by a page it derives from, as a
|
|
121
117
|
* class of the campaign built on the system's; none when the system gives none.
|
|
@@ -280,18 +276,6 @@ export function checkListValues(system, lists, onSheet = false) {
|
|
|
280
276
|
}
|
|
281
277
|
}
|
|
282
278
|
}
|
|
283
|
-
/** Text with commas outside links and parentheses, as "simple weapons, martial weapons": several names that a list holds apart. */
|
|
284
|
-
function isCommaText(value) {
|
|
285
|
-
return typeof value === "string" && value.replace(/\[\[[^\]]*\]\]/g, "").replace(/\([^)]*\)/g, "").includes(",");
|
|
286
|
-
}
|
|
287
|
-
/** A field the system declares as a list, such as classes. */
|
|
288
|
-
function isListField(system, field) {
|
|
289
|
-
return Object.entries(system.fields).some(([name, kind]) => kind === "list" && comparableText(name) === comparableText(field));
|
|
290
|
-
}
|
|
291
|
-
/** A list the system declares without the names it takes, which are checked by name, as weapon-proficiencies (SYS-8). */
|
|
292
|
-
function isOpenList(system, field) {
|
|
293
|
-
return allowedValues(system, field, false) === undefined && Object.entries(system.fields).some(([name, kind]) => kind === "list" && comparableText(name) === comparableText(field));
|
|
294
|
-
}
|
|
295
279
|
/**
|
|
296
280
|
* The lists written on the campaign's pages with names the game system does not take, or as text with commas, which reads as one name (SYS-8), such as one
|
|
297
281
|
* written by hand.
|
|
@@ -311,6 +295,76 @@ export function listValueProblems(world, system) {
|
|
|
311
295
|
});
|
|
312
296
|
});
|
|
313
297
|
}
|
|
298
|
+
/** A character's load when it is over its limit, as status says it under the rigor «rules» or «simulation» (LOAD-3): "load 230 / 210 lb, over the limit"; undefined otherwise. */
|
|
299
|
+
export function overLoad(world, system, page) {
|
|
300
|
+
if (system?.load === undefined || !hasSheet(world, page)) {
|
|
301
|
+
return undefined;
|
|
302
|
+
}
|
|
303
|
+
const fields = effectiveFields(world, page);
|
|
304
|
+
const load = carriedIn(fields) ?? carriedWeight(world, system.load, page);
|
|
305
|
+
const limit = formulaValue(world, fields, system.load.limit);
|
|
306
|
+
const value = loadValue(world, system, page, fields);
|
|
307
|
+
return limit === undefined || load <= limit || value === undefined ? undefined : `load ${value.text}, over the limit`;
|
|
308
|
+
}
|
|
309
|
+
/** For an item created without a weight, its own or its base's, when the system counts loads: the AI estimates one (LOAD-1). */
|
|
310
|
+
export function weightlessNote(system, world, page) {
|
|
311
|
+
if (system?.load === undefined || page.type !== "item" || valueNamed(inheritedFields(world, page), system.load.field) !== undefined) {
|
|
312
|
+
return [];
|
|
313
|
+
}
|
|
314
|
+
const unit = weightUnit(world, system.load.field) ?? "lb";
|
|
315
|
+
return [`${page.name} has no ${system.load.field}, so it adds nothing to a load: if it weighs, estimate it from things like it, such as set ${system.load.field}="2 ${unit}".`];
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* A field's value as a counter, with the limits the field writes or the system works out (FOR-6): 18/24, or momentum 4 from -6; undefined for a number that is
|
|
319
|
+
* no counter, such as str 14, and for any other value.
|
|
320
|
+
*/
|
|
321
|
+
export function counterOf(world, fields, field, value) {
|
|
322
|
+
const kind = declaredKind(world, field);
|
|
323
|
+
const read = readCounter(value);
|
|
324
|
+
const limits = counterLimits(world, fields, field);
|
|
325
|
+
// A field the system declares as anything else is never one, as a challenge rating of 1/4.
|
|
326
|
+
const counted = kind === "counter" || (kind === undefined && (read?.max !== undefined || limits.min !== undefined || limits.max !== undefined));
|
|
327
|
+
return read === undefined || !counted ? undefined : { ...limits, ...read };
|
|
328
|
+
}
|
|
329
|
+
/** The experience between the points of the character's level and those of the next, for the field that counts it (PRO-6); none at the last level. */
|
|
330
|
+
export function experienceProgress(world, fields, field) {
|
|
331
|
+
if (comparableText(field) !== comparableText(world.system?.progression?.experience?.field ?? "")) {
|
|
332
|
+
return undefined;
|
|
333
|
+
}
|
|
334
|
+
const experience = experienceOf(world, fields);
|
|
335
|
+
return experience?.next === undefined ? undefined : { value: experience.points, from: experience.least ?? 0, to: experience.next.points };
|
|
336
|
+
}
|
|
337
|
+
/** What the points of the field that counts the experience say of the levels (PRO-6); none for another field, or at the last level. */
|
|
338
|
+
export function experienceNeed(world, fields, field) {
|
|
339
|
+
const experience = comparableText(field) === comparableText(world.system?.progression?.experience?.field ?? "") ? experienceOf(world, fields) : undefined;
|
|
340
|
+
return experience === undefined ? undefined : levelNeed(experience);
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* What the master is told as a roll of the player character recalls what they know, as History, by the fields the system declares (sheet-knowledge): its
|
|
344
|
+
* outcome said as knowledge, never as an episode of their past the player did not tell (Elena's tests of 28 October, where a high roll brought one).
|
|
345
|
+
*/
|
|
346
|
+
export function knowledgeNote(system, fields) {
|
|
347
|
+
const knowledge = new Set((system?.sheetKnowledge ?? []).map(comparableText));
|
|
348
|
+
return fields.some((field) => knowledge.has(comparableText(field)))
|
|
349
|
+
? "What it reveals is what the world shows or their trade knows, said as knowledge: an episode of their past the player has not told is a question to them."
|
|
350
|
+
: undefined;
|
|
351
|
+
}
|
|
352
|
+
/** A group's icon, as the data of the sheet carries it: none when the system gives none. */
|
|
353
|
+
function iconOf(group) {
|
|
354
|
+
return group.icon === undefined ? {} : { icon: group.icon };
|
|
355
|
+
}
|
|
356
|
+
/** Text with commas outside links and parentheses, as "simple weapons, martial weapons": several names that a list holds apart. */
|
|
357
|
+
function isCommaText(value) {
|
|
358
|
+
return typeof value === "string" && value.replace(/\[\[[^\]]*\]\]/g, "").replace(/\([^)]*\)/g, "").includes(",");
|
|
359
|
+
}
|
|
360
|
+
/** A field the system declares as a list, such as classes. */
|
|
361
|
+
function isListField(system, field) {
|
|
362
|
+
return Object.entries(system.fields).some(([name, kind]) => kind === "list" && comparableText(name) === comparableText(field));
|
|
363
|
+
}
|
|
364
|
+
/** A list the system declares without the names it takes, which are checked by name, as weapon-proficiencies (SYS-8). */
|
|
365
|
+
function isOpenList(system, field) {
|
|
366
|
+
return allowedValues(system, field, false) === undefined && Object.entries(system.fields).some(([name, kind]) => kind === "list" && comparableText(name) === comparableText(field));
|
|
367
|
+
}
|
|
314
368
|
/** How many marks each computed field earns (D-217, DAT-2): one for each list of the system's marks that it reads with its item, where that item changes it. */
|
|
315
369
|
function markCounts(world, system, fields) {
|
|
316
370
|
const marking = new Set(system.marks.map(comparableText));
|
|
@@ -391,25 +445,6 @@ function carriedRows(world, holder, marks, depth = 0, seen = new Set()) {
|
|
|
391
445
|
return [row(page.name, "", page), ...carriedRows(world, page, marks, depth + 1, seen)];
|
|
392
446
|
});
|
|
393
447
|
}
|
|
394
|
-
/** A character's load when it is over its limit, as status says it under the rigor «rules» or «simulation» (LOAD-3): "load 230 / 210 lb, over the limit"; undefined otherwise. */
|
|
395
|
-
export function overLoad(world, system, page) {
|
|
396
|
-
if (system?.load === undefined || !hasSheet(world, page)) {
|
|
397
|
-
return undefined;
|
|
398
|
-
}
|
|
399
|
-
const fields = effectiveFields(world, page);
|
|
400
|
-
const load = carriedIn(fields) ?? carriedWeight(world, system.load, page);
|
|
401
|
-
const limit = formulaValue(world, fields, system.load.limit);
|
|
402
|
-
const value = loadValue(world, system, page, fields);
|
|
403
|
-
return limit === undefined || load <= limit || value === undefined ? undefined : `load ${value.text}, over the limit`;
|
|
404
|
-
}
|
|
405
|
-
/** For an item created without a weight, its own or its base's, when the system counts loads: the AI estimates one (LOAD-1). */
|
|
406
|
-
export function weightlessNote(system, world, page) {
|
|
407
|
-
if (system?.load === undefined || page.type !== "item" || valueNamed(inheritedFields(world, page), system.load.field) !== undefined) {
|
|
408
|
-
return [];
|
|
409
|
-
}
|
|
410
|
-
const unit = weightUnit(world, system.load.field) ?? "lb";
|
|
411
|
-
return [`${page.name} has no ${system.load.field}, so it adds nothing to a load: if it weighs, estimate it from things like it, such as set ${system.load.field}="2 ${unit}".`];
|
|
412
|
-
}
|
|
413
448
|
/** What a character carries weighs, against its limit, as the sheet shows it (D-432, LOAD-2): "23 / 210 lb", in the system's unit; none when the system counts no load. */
|
|
414
449
|
function loadValue(world, system, page, fields) {
|
|
415
450
|
if (system.load === undefined) {
|
|
@@ -465,18 +500,6 @@ function sheetFields(system) {
|
|
|
465
500
|
function entryFields(entries) {
|
|
466
501
|
return entries.flatMap((entry) => (entry.beside === undefined ? [entry.field] : [entry.field, entry.beside]));
|
|
467
502
|
}
|
|
468
|
-
/**
|
|
469
|
-
* A field's value as a counter, with the limits the field writes or the system works out (FOR-6): 18/24, or momentum 4 from -6; undefined for a number that is
|
|
470
|
-
* no counter, such as str 14, and for any other value.
|
|
471
|
-
*/
|
|
472
|
-
export function counterOf(world, fields, field, value) {
|
|
473
|
-
const kind = declaredKind(world, field);
|
|
474
|
-
const read = readCounter(value);
|
|
475
|
-
const limits = counterLimits(world, fields, field);
|
|
476
|
-
// A field the system declares as anything else is never one, as a challenge rating of 1/4.
|
|
477
|
-
const counted = kind === "counter" || (kind === undefined && (read?.max !== undefined || limits.min !== undefined || limits.max !== undefined));
|
|
478
|
-
return read === undefined || !counted ? undefined : { ...limits, ...read };
|
|
479
|
-
}
|
|
480
503
|
/** A value of the sheet as data, without marks or what is beside it: its kind, its text, a counter with its limits and the names of a list. */
|
|
481
504
|
function sheetValue(world, fields, field, value) {
|
|
482
505
|
const kind = declaredKind(world, field);
|
|
@@ -484,19 +507,6 @@ function sheetValue(world, fields, field, value) {
|
|
|
484
507
|
const items = Array.isArray(value) ? value.map((item) => linkText(String(item).trim())) : undefined;
|
|
485
508
|
return { field, ...(kind === undefined ? {} : { kind }), text: valueText(world, field, value), ...(counter === undefined ? {} : { counter }), ...(items === undefined ? {} : { items }), marks: 0 };
|
|
486
509
|
}
|
|
487
|
-
/** The experience between the points of the character's level and those of the next, for the field that counts it (PRO-6); none at the last level. */
|
|
488
|
-
export function experienceProgress(world, fields, field) {
|
|
489
|
-
if (comparableText(field) !== comparableText(world.system?.progression?.experience?.field ?? "")) {
|
|
490
|
-
return undefined;
|
|
491
|
-
}
|
|
492
|
-
const experience = experienceOf(world, fields);
|
|
493
|
-
return experience?.next === undefined ? undefined : { value: experience.points, from: experience.least ?? 0, to: experience.next.points };
|
|
494
|
-
}
|
|
495
|
-
/** What the points of the field that counts the experience say of the levels (PRO-6); none for another field, or at the last level. */
|
|
496
|
-
export function experienceNeed(world, fields, field) {
|
|
497
|
-
const experience = comparableText(field) === comparableText(world.system?.progression?.experience?.field ?? "") ? experienceOf(world, fields) : undefined;
|
|
498
|
-
return experience === undefined ? undefined : levelNeed(experience);
|
|
499
|
-
}
|
|
500
510
|
/**
|
|
501
511
|
* The free roll of an entry of the sheet (D-280): the dice the system rolls its number with, or the number beside it, as str-mod by str; none for a text. Other
|
|
502
512
|
* dice when the system's formula says so, as Stealth with disadvantage in heavy armor (D-445).
|
|
@@ -604,13 +614,3 @@ function wrongText(system, field, wrong, onSheet) {
|
|
|
604
614
|
const names = wrong.map((name) => `"${name}"`).join(", ");
|
|
605
615
|
return `${names} ${wrong.length === 1 ? "is not one of the names" : "are not names"} ${field} takes in the system ${system.name}: ${allowed.join(", ")}.${list}${own}`;
|
|
606
616
|
}
|
|
607
|
-
/**
|
|
608
|
-
* What the master is told as a roll of the player character recalls what they know, as History, by the fields the system declares (sheet-knowledge): its
|
|
609
|
-
* outcome said as knowledge, never as an episode of their past the player did not tell (Elena's tests of 28 October, where a high roll brought one).
|
|
610
|
-
*/
|
|
611
|
-
export function knowledgeNote(system, fields) {
|
|
612
|
-
const knowledge = new Set((system?.sheetKnowledge ?? []).map(comparableText));
|
|
613
|
-
return fields.some((field) => knowledge.has(comparableText(field)))
|
|
614
|
-
? "What it reveals is what the world shows or their trade knows, said as knowledge: an episode of their past the player has not told is a question to them."
|
|
615
|
-
: undefined;
|
|
616
|
-
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Context } from "
|
|
2
|
-
import { type HeldStack, type MovePlan, type Page, type World } from "
|
|
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;
|
|
@@ -33,11 +33,6 @@ export declare function writeStacks(root: string, context: Context, world: World
|
|
|
33
33
|
world: World;
|
|
34
34
|
notes: string[];
|
|
35
35
|
};
|
|
36
|
-
/**
|
|
37
|
-
* Writes a plan with stack steps in it, and their lines in the log (STK-12): stopped halfway, the lines of the stacks already written are still logged, then the stop is
|
|
38
|
-
* said (STK-9).
|
|
39
|
-
*/
|
|
40
|
-
export declare function applyLogged(root: string, context: Context, world: World, plan: MovePlan, steps: StackStep[], why?: string, asked?: Record<string, unknown>): World;
|
|
41
36
|
/** One line in the log for each stack that changed (STK-12): public when its container concerns the player, as a counter's (CNT-10); `asked` is how, as spend 1. */
|
|
42
37
|
export declare function logStackSteps(root: string, context: Context, world: World, steps: StackStep[], why: string | undefined, asked?: Record<string, unknown>): void;
|
|
43
38
|
/**
|
|
@@ -74,5 +69,3 @@ export declare function changeStack(root: string, context: Context, world: World
|
|
|
74
69
|
to?: number | string;
|
|
75
70
|
why?: string;
|
|
76
71
|
}): StackChange;
|
|
77
|
-
/** Whether two pages are the same one, as read in two worlds. */
|
|
78
|
-
export declare function samePage(first: Page, second: Page): boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { appendLogEntry } from "
|
|
2
|
-
import { comparableText } from "
|
|
3
|
-
import { applyMove, carriesKind, concernsPlayer, containerFieldOf, entryPage, heldStacks, links, locate, MoveStopped, ownStack, stackName } from "
|
|
4
|
-
import { newDatedLogEntry } from "./
|
|
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";
|
|
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.
|
|
@@ -77,23 +77,6 @@ export function writeStacks(root, context, world, steps, why, asked = {}) {
|
|
|
77
77
|
const unequipped = gone.length === 0 ? { world: written, notes: [] } : unequipKinds(written, gone);
|
|
78
78
|
return { world: unequipped.world, notes: [changed.map(stackStepText).join("; ") + ".", ...unequipped.notes] };
|
|
79
79
|
}
|
|
80
|
-
/**
|
|
81
|
-
* Writes a plan with stack steps in it, and their lines in the log (STK-12): stopped halfway, the lines of the stacks already written are still logged, then the stop is
|
|
82
|
-
* said (STK-9).
|
|
83
|
-
*/
|
|
84
|
-
export function applyLogged(root, context, world, plan, steps, why, asked = {}) {
|
|
85
|
-
try {
|
|
86
|
-
const after = applyMove(world, plan);
|
|
87
|
-
logStackSteps(root, context, world, steps, why, asked);
|
|
88
|
-
return after;
|
|
89
|
-
}
|
|
90
|
-
catch (error) {
|
|
91
|
-
if (error instanceof MoveStopped) {
|
|
92
|
-
logStackSteps(root, context, world, steps.filter((step) => error.written.includes(step.container.path)), why, asked);
|
|
93
|
-
}
|
|
94
|
-
throw error;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
80
|
/** One line in the log for each stack that changed (STK-12): public when its container concerns the player, as a counter's (CNT-10); `asked` is how, as spend 1. */
|
|
98
81
|
export function logStackSteps(root, context, world, steps, why, asked = {}) {
|
|
99
82
|
for (const step of steps.filter((candidate) => candidate.before !== candidate.after)) {
|
|
@@ -182,6 +165,23 @@ export function changeStack(root, context, world, holder, kind, input) {
|
|
|
182
165
|
reminders: unequipped,
|
|
183
166
|
};
|
|
184
167
|
}
|
|
168
|
+
/**
|
|
169
|
+
* Writes a plan with stack steps in it, and their lines in the log (STK-12): stopped halfway, the lines of the stacks already written are still logged, then the stop is
|
|
170
|
+
* said (STK-9).
|
|
171
|
+
*/
|
|
172
|
+
function applyLogged(root, context, world, plan, steps, why, asked = {}) {
|
|
173
|
+
try {
|
|
174
|
+
const after = applyMove(world, plan);
|
|
175
|
+
logStackSteps(root, context, world, steps, why, asked);
|
|
176
|
+
return after;
|
|
177
|
+
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
if (error instanceof MoveStopped) {
|
|
180
|
+
logStackSteps(root, context, world, steps.filter((step) => error.written.includes(step.container.path)), why, asked);
|
|
181
|
+
}
|
|
182
|
+
throw error;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
185
|
/** A number of pieces as change takes it: a whole number, above 0 to spend, from 0 up to set; by may be below 0. */
|
|
186
186
|
function piecesOf(value, parameter, holder, kind) {
|
|
187
187
|
const number = typeof value === "number" ? value : /^\s*[+-]?\d+\s*$/.test(String(value)) ? Number(value) : Number.NaN;
|
|
@@ -193,6 +193,6 @@ function piecesOf(value, parameter, holder, kind) {
|
|
|
193
193
|
return number;
|
|
194
194
|
}
|
|
195
195
|
/** Whether two pages are the same one, as read in two worlds. */
|
|
196
|
-
|
|
196
|
+
function samePage(first, second) {
|
|
197
197
|
return first.path === second.path && first.system === second.system;
|
|
198
198
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Context } from "
|
|
2
|
-
import type { Problem } from "
|
|
3
|
-
import { type ThemeReading } from "
|
|
1
|
+
import type { Context } from "../../core/context.ts";
|
|
2
|
+
import type { Problem } from "../../core/problem.ts";
|
|
3
|
+
import { type ThemeReading } from "../../themes/index.ts";
|
|
4
4
|
/** The theme of the campaign's game system, read and checked, with the system's name; undefined when it names none. */
|
|
5
5
|
export declare function campaignTheme(root: string, context: Context): (ThemeReading & {
|
|
6
6
|
system: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// The theme of the dashboard the campaign's game system names (D-528): read and checked as the system is, for validate and for the dashboard.
|
|
2
2
|
import { relative } from "node:path";
|
|
3
|
-
import { readTheme, themeFileName } from "
|
|
4
|
-
import { campaignSystem } from "./
|
|
3
|
+
import { readTheme, themeFileName } from "../../themes/index.js";
|
|
4
|
+
import { campaignSystem } from "./world.js";
|
|
5
5
|
/** The theme of the campaign's game system, read and checked, with the system's name; undefined when it names none. */
|
|
6
6
|
export function campaignTheme(root, context) {
|
|
7
7
|
const system = campaignSystem(root, context);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Context } from "
|
|
2
|
-
import { type Page, type World } from "
|
|
1
|
+
import type { Context } from "../../core/context.ts";
|
|
2
|
+
import { type Page, type World } from "../../pages/index.ts";
|
|
3
3
|
/** The type of a diary's line in the log (DIA-1). */
|
|
4
4
|
export declare const thoughtsType = "thoughts";
|
|
5
5
|
/** How long a line of a diary may be, in characters (DIA-1). */
|
|
@@ -21,5 +21,3 @@ export declare function thoughtsIn(root: string, world: World, page?: Page): Tho
|
|
|
21
21
|
* agent or by the master. Empty when it is no one's.
|
|
22
22
|
*/
|
|
23
23
|
export declare function diaryDueLine(root: string, context: Context, world: World): string;
|
|
24
|
-
/** The companion whose diary is due (DIA-2), or none. */
|
|
25
|
-
export declare function diaryDue(root: string, world: World): Page | undefined;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { readLog } from "
|
|
2
|
-
import { isInParty, pagesWithNameOrAlias, parsePageReference } from "
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { readLog } from "../../core/log.js";
|
|
2
|
+
import { isInParty, pagesWithNameOrAlias, parsePageReference } from "../../pages/index.js";
|
|
3
|
+
import { textList } from "./knowledge.js";
|
|
4
|
+
import { readOpenScene } from "./scene.js";
|
|
5
|
+
import { agentVoices } from "./voices.js";
|
|
5
6
|
/** The type of a diary's line in the log (DIA-1). */
|
|
6
7
|
export const thoughtsType = "thoughts";
|
|
7
8
|
/** How long a line of a diary may be, in characters (DIA-1). */
|
|
@@ -30,7 +31,7 @@ export function diaryDueLine(root, context, world) {
|
|
|
30
31
|
return `Diary: ${page.name}'s is due: at this pause, before the story goes on, have them write a few lines on how they took what they lived: ${how}.`;
|
|
31
32
|
}
|
|
32
33
|
/** The companion whose diary is due (DIA-2), or none. */
|
|
33
|
-
|
|
34
|
+
function diaryDue(root, world) {
|
|
34
35
|
const log = readLog(root);
|
|
35
36
|
const { scene } = readOpenScene(root);
|
|
36
37
|
const opened = scene === undefined ? -1 : log.findLastIndex((entry) => entry.type === "scene-opened");
|
|
@@ -52,6 +53,3 @@ function thoughtOf(world, entry) {
|
|
|
52
53
|
function pageOf(world, name) {
|
|
53
54
|
return pagesWithNameOrAlias(world, parsePageReference(name).name)[0];
|
|
54
55
|
}
|
|
55
|
-
function textList(value) {
|
|
56
|
-
return (Array.isArray(value) ? value : [value]).filter((item) => typeof item === "string");
|
|
57
|
-
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GameSystem } from "
|
|
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 "
|
|
3
|
-
import { comparableText } from "
|
|
4
|
-
import { readCounterText } from "
|
|
5
|
-
import { houseRules, ruleBlock, ruleTitled } from "./
|
|
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";
|
|
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,7 +1,7 @@
|
|
|
1
|
-
import type { Context } from "
|
|
2
|
-
import { type LogEntry } from "
|
|
3
|
-
import type { Problem } from "
|
|
4
|
-
import { type Calendar, type CalendarDay, type CalendarStart, type GameDate } from "
|
|
1
|
+
import type { Context } from "../../core/context.ts";
|
|
2
|
+
import { type LogEntry } from "../../core/log.ts";
|
|
3
|
+
import type { Problem } from "../../core/problem.ts";
|
|
4
|
+
import { type Calendar, type CalendarDay, type CalendarStart, type GameDate } from "../../time/index.ts";
|
|
5
5
|
/** The campaign's calendar and the day of it that is day 1, if the story starts on one (TIM-8); what does not read is a problem, never a stop. */
|
|
6
6
|
export interface CampaignCalendar {
|
|
7
7
|
calendar: Calendar;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// The game time as several commands use it: the present date from state.yaml, the log lines stamped with it, and the calendar that shows it.
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
|
-
import { campaignFileName, readOneSetting, readState, readTextSetting } from "
|
|
4
|
-
import { newLogEntry } from "
|
|
5
|
-
import { files } from "
|
|
6
|
-
import { isEmptyField } from "
|
|
7
|
-
import { calendarDay, formatCalendarDay, formatGameDate, readCalendar, readCalendarStart, readGameDate, realCalendar } from "
|
|
8
|
-
import { campaignExtensions, extensionSources } from "./
|
|
3
|
+
import { campaignFileName, readOneSetting, readState, readTextSetting } from "../../campaign/index.js";
|
|
4
|
+
import { newLogEntry } from "../../core/log.js";
|
|
5
|
+
import { files } from "../../core/store.js";
|
|
6
|
+
import { isEmptyField } from "../../pages/index.js";
|
|
7
|
+
import { calendarDay, formatCalendarDay, formatGameDate, readCalendar, readCalendarStart, readGameDate, realCalendar } from "../../time/index.js";
|
|
8
|
+
import { campaignExtensions, extensionSources } from "./packages/extensions.js";
|
|
9
9
|
/** The present of the game: its date, or the problem that keeps state.yaml from giving one; neither before the game has a date. */
|
|
10
10
|
export function readPresent(root) {
|
|
11
11
|
let text;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Page, World } from "
|
|
2
|
-
import type { Scene } from "
|
|
3
|
-
import type { GameSystem } from "
|
|
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,7 +1,7 @@
|
|
|
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, valueNamed } from "
|
|
4
|
-
import { readCounter } from "
|
|
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
6
|
import { formulaValue, workedMaximum } from "./worked-out.js";
|
|
7
7
|
/**
|
|
@@ -39,7 +39,7 @@ export function useInTurn(world, system, scene, actor, asked, by) {
|
|
|
39
39
|
const most = (one) => (one.most === undefined ? 1 : formulaValue(world, fields, one.most));
|
|
40
40
|
const tagged = (entry, by) => (by === undefined ? entry : `${entry} by ${by}`);
|
|
41
41
|
if (rule.within === undefined) {
|
|
42
|
-
const count = list.filter((entry) =>
|
|
42
|
+
const count = list.filter((entry) => sameWord(baseOf(entry), use)).length;
|
|
43
43
|
const limit = most(rule);
|
|
44
44
|
if (limit !== undefined && count >= limit && by === undefined) {
|
|
45
45
|
throw new Error(`${name} has used ${limit === 1 ? `its ${use}` : `${count} ${use}`} until its next turn${giveMore(uses, use)}. Nothing changed.`);
|
|
@@ -47,23 +47,23 @@ export function useInTurn(world, system, scene, actor, asked, by) {
|
|
|
47
47
|
const noted = rule.note !== undefined && (rule.noteWhen === undefined || (formulaValue(world, fields, rule.noteWhen) ?? 0) > 0);
|
|
48
48
|
const note = noted ? ` ${rule.note}` : "";
|
|
49
49
|
// An action that holds more than one attack is marked by its attacks, each in turn (TRN-3).
|
|
50
|
-
const inner = Object.entries(uses).find(([, other]) => other.within !== undefined &&
|
|
50
|
+
const inner = Object.entries(uses).find(([, other]) => other.within !== undefined && sameWord(other.within, use) && (most(other) ?? 0) > 1);
|
|
51
51
|
const attacks = inner === undefined ? "" : ` If it is to attack, mark each ${inner[0]} instead, ${most(inner[1])} for ${name}, which takes the ${use}.`;
|
|
52
52
|
return { used: [...list, tagged(use, by)], line: `${name}: ${use} used${by === undefined ? "" : `, by ${by}`}${spent}.${note}${attacks}`, ...(spends === undefined ? {} : { spends }) };
|
|
53
53
|
}
|
|
54
54
|
// An attack counts within the action it took, until another action is used (TRN-3).
|
|
55
55
|
const within = rule.within;
|
|
56
56
|
const taken = `${within} for ${use}`;
|
|
57
|
-
const last = list.findLastIndex((entry) =>
|
|
57
|
+
const last = list.findLastIndex((entry) => sameWord(withoutBy(entry), taken));
|
|
58
58
|
const since = last < 0 ? [] : list.slice(last + 1);
|
|
59
|
-
const counted = since.filter((entry) =>
|
|
59
|
+
const counted = since.filter((entry) => sameWord(entry, use)).length;
|
|
60
60
|
const limit = most(rule);
|
|
61
61
|
const of = limit === undefined ? "" : ` of ${limit}`;
|
|
62
|
-
if (last >= 0 && !since.some((entry) =>
|
|
62
|
+
if (last >= 0 && !since.some((entry) => sameWord(baseOf(entry), within)) && (limit === undefined || counted < limit)) {
|
|
63
63
|
return { used: [...list, use], line: `${name}: ${use} ${counted + 1}${of}.` };
|
|
64
64
|
}
|
|
65
65
|
const withinRule = system.turnUses[within];
|
|
66
|
-
const withinCount = list.filter((entry) =>
|
|
66
|
+
const withinCount = list.filter((entry) => sameWord(baseOf(entry), within)).length;
|
|
67
67
|
const withinLimit = withinRule === undefined ? 1 : most(withinRule);
|
|
68
68
|
if (withinLimit !== undefined && withinCount >= withinLimit && by === undefined) {
|
|
69
69
|
const done = last < 0 ? "" : `, with ${counted} ${use}${of}`;
|
|
@@ -75,11 +75,11 @@ export function useInTurn(world, system, scene, actor, asked, by) {
|
|
|
75
75
|
export function usesAtTurn(system, used, turn) {
|
|
76
76
|
const uses = system?.turnUses ?? {};
|
|
77
77
|
const lasting = (entry) => {
|
|
78
|
-
const use = Object.keys(uses).find((name) =>
|
|
78
|
+
const use = Object.keys(uses).find((name) => sameWord(name, baseOf(entry)));
|
|
79
79
|
return use === undefined || uses[use].resets !== "each turn";
|
|
80
80
|
};
|
|
81
81
|
const left = Object.entries(used ?? {}).flatMap(([name, entries]) => {
|
|
82
|
-
const kept =
|
|
82
|
+
const kept = sameWord(name, turn) ? [] : entries.filter(lasting);
|
|
83
83
|
return kept.length === 0 ? [] : [[name, kept]];
|
|
84
84
|
});
|
|
85
85
|
return left.length === 0 ? undefined : Object.fromEntries(left);
|
|
@@ -96,7 +96,7 @@ export function turnMarks(system, scene, name) {
|
|
|
96
96
|
const list = scene.used?.[name] ?? [];
|
|
97
97
|
return Object.entries(system?.turnUses ?? {}).filter(([, rule]) => rule.within === undefined && rule.needs === undefined).map(([use]) => ({
|
|
98
98
|
use,
|
|
99
|
-
used: list.some((entry) =>
|
|
99
|
+
used: list.some((entry) => sameWord(baseOf(entry), use)),
|
|
100
100
|
}));
|
|
101
101
|
}
|
|
102
102
|
/** The counter of the sheet that `by` names, as action-surge for "Action Surge", with what it holds, a full one when not written yet; refused at 0. */
|
|
@@ -120,7 +120,7 @@ function spentCounter(world, system, fields, name, by) {
|
|
|
120
120
|
}
|
|
121
121
|
/** What a refusal adds (TRN-2): what another use makes is marked as that use, the game's own named; by only for what gives one more. */
|
|
122
122
|
function giveMore(uses, use) {
|
|
123
|
-
const others = Object.entries(uses).filter(([name, rule]) => !
|
|
123
|
+
const others = Object.entries(uses).filter(([name, rule]) => !sameWord(name, use) && rule.within === undefined && rule.needs === undefined).map(([name]) => name);
|
|
124
124
|
const as = others.length === 0 ? "" : `, as with ${others.join(" or ")},`;
|
|
125
125
|
return `: what another use makes${as} is marked as that use; add by and what only for what gives one more, as a feature by its name`;
|
|
126
126
|
}
|
|
@@ -132,6 +132,3 @@ function baseOf(entry) {
|
|
|
132
132
|
function withoutBy(entry) {
|
|
133
133
|
return entry.replace(/ by .*$/, "");
|
|
134
134
|
}
|
|
135
|
-
function same(one, other) {
|
|
136
|
-
return comparableText(one) === comparableText(other);
|
|
137
|
-
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Context } from "
|
|
2
|
-
import { type Page, type World } from "
|
|
3
|
-
import type { GameSystem } from "
|
|
1
|
+
import type { Context } from "../../core/context.ts";
|
|
2
|
+
import { type Page, type World } from "../../pages/index.ts";
|
|
3
|
+
import type { GameSystem } from "../../systems/index.ts";
|
|
4
4
|
/** The upkeep of each midnight passed (UPK-1–UPK-3), for the party members who keep a sheet, under the rigor «rules» or «simulation»; the lines that say it. */
|
|
5
5
|
export declare function dailyUpkeep(root: string, context: Context, system: GameSystem | undefined, days: number): string[];
|
|
6
6
|
/**
|