rpg-engine 0.7.0 → 0.9.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 +17 -9
- 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} +56 -44
- 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} +13 -5
- package/dist/commands/shared/rules.js +66 -0
- 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 +4 -1
- package/dist/commands/show.js +36 -18
- 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} +41 -36
- 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 +8 -1
- package/dist/core/files.js +53 -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/game-words.js +4 -4
- 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 +4 -4
- package/dist/dashboard/text.js +6 -0
- 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.d.ts +4 -0
- package/dist/pages/world.js +52 -20
- 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/commands/game-rules.js +0 -36
- 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,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
|
/**
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { parseFormula } from "
|
|
2
|
-
import { appendLogEntry } from "
|
|
3
|
-
import { comparableText, valueNamed, withArticle } from "
|
|
4
|
-
import { formatCounter, readCounter } from "
|
|
5
|
-
import { formatAmount, payCoins, readAmount, totalOf } from "
|
|
6
|
-
import { baseChain, heldStacksOfKind, kindNamed, locate, writePage } from "
|
|
1
|
+
import { parseFormula } from "../../core/formula.js";
|
|
2
|
+
import { appendLogEntry } from "../../core/log.js";
|
|
3
|
+
import { comparableText, valueNamed, withArticle } from "../../core/text.js";
|
|
4
|
+
import { formatCounter, readCounter } from "../../counters/index.js";
|
|
5
|
+
import { formatAmount, payCoins, readAmount, totalOf } from "../../money/index.js";
|
|
6
|
+
import { baseChain, heldStacksOfKind, kindNamed, locate, writePage } from "../../pages/index.js";
|
|
7
7
|
import { effectiveFields } from "./effect-layer.js";
|
|
8
|
-
import { campaignCoins } from "./
|
|
9
|
-
import { playedEngineSetting } from "./
|
|
10
|
-
import { partyPages } from "./game-recipes.js";
|
|
11
|
-
import { writeStacks } from "./game-stacks.js";
|
|
12
|
-
import { newDatedLogEntry } from "./game-time.js";
|
|
13
|
-
import { campaignWorld } from "./game-world.js";
|
|
8
|
+
import { campaignCoins } from "./money.js";
|
|
9
|
+
import { playedEngineSetting } from "./offers.js";
|
|
14
10
|
import { firstInChat } from "./parts.js";
|
|
11
|
+
import { partyPages } from "./recipes.js";
|
|
12
|
+
import { writeStacks } from "./stacks.js";
|
|
13
|
+
import { newDatedLogEntry } from "./time.js";
|
|
15
14
|
import { formulaValue, hasSheet } from "./worked-out.js";
|
|
15
|
+
import { campaignWorld } from "./world.js";
|
|
16
16
|
// Where a day's meals come from the lifestyle, not from what one carries: a place of these kinds, or one inside it (UPK-1).
|
|
17
17
|
const settlementKinds = ["city", "town", "village", "inn"];
|
|
18
18
|
/** 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. */
|
|
@@ -31,8 +31,63 @@ export function dailyUpkeep(root, context, system, days) {
|
|
|
31
31
|
thirsty ||= members.some((member) => !inSettlement(world, member));
|
|
32
32
|
lines.push(...members.map((member) => safeUpkeep(root, context, member.name, upkeep)).filter((line) => line !== ""));
|
|
33
33
|
}
|
|
34
|
-
// Water once, however many midnights passed outside a settlement
|
|
35
|
-
return [...
|
|
34
|
+
// Water once, however many midnights passed outside a settlement.
|
|
35
|
+
return [...alikeOnce(lines), ...(thirsty && upkeep.water !== undefined ? [`Water: ${upkeep.water}. Read ${upkeep.rules}.`] : [])];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* What an effect named after something that burns asks (UPK-3), as Torch: the kind it spends, its own or its fuel, such as Oil for a lantern, and how long it lasts;
|
|
39
|
+
* refused when the holder carries none. Undefined for any other effect.
|
|
40
|
+
*/
|
|
41
|
+
export function burning(system, world, holder, name) {
|
|
42
|
+
const entry = burningEntry(system, world, holder, name);
|
|
43
|
+
if (entry === undefined) {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
const [burns, { lasts, spends }] = entry;
|
|
47
|
+
const kind = kindNamed(world, holder, spends ?? burns);
|
|
48
|
+
if (kind === undefined || heldStacksOfKind(world, holder, kind).length === 0) {
|
|
49
|
+
throw new Error(`${holder.name} carries no ${spends ?? burns}, in what it holds, to light ${burns}. If the story gives some, add it to what ${holder.name} carries first. Nothing changed.`);
|
|
50
|
+
}
|
|
51
|
+
return { kind, lasts };
|
|
52
|
+
}
|
|
53
|
+
/** For an effect named after something that burns (UPK-3), what it spends, by the holder's name for it, as Torcia, and how many of it the holder still carries. */
|
|
54
|
+
export function fuelLeft(system, world, holder, name) {
|
|
55
|
+
if (Object.keys(system?.burning ?? {}).length === 0) {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
// Only to show: a name two pages share, which a command would refuse, burns nothing here.
|
|
59
|
+
try {
|
|
60
|
+
const entry = burningEntry(system, world, holder, name);
|
|
61
|
+
const kind = entry === undefined ? undefined : kindNamed(world, holder, entry[1].spends ?? entry[0]);
|
|
62
|
+
return kind === undefined ? undefined : { fuel: kind.name, left: heldStacksOfKind(world, holder, kind).reduce((total, held) => total + held.stack.count, 0) };
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/** Spends one of what burns from what the holder carries (UPK-3), with its line in the log; the line that says it. */
|
|
69
|
+
export function burnOne(root, context, holderName, kind) {
|
|
70
|
+
const world = campaignWorld(root, context);
|
|
71
|
+
const holder = world.pages.find((page) => page.name === holderName);
|
|
72
|
+
const held = holder === undefined ? [] : heldStacksOfKind(world, holder, kind);
|
|
73
|
+
if (held.length === 0) {
|
|
74
|
+
return "";
|
|
75
|
+
}
|
|
76
|
+
const { container, stack } = held[0];
|
|
77
|
+
const step = { container, kind: stack.kind, before: stack.count, after: stack.count - 1, ...(stack.label === undefined ? {} : { label: stack.label }) };
|
|
78
|
+
return writeStacks(root, context, world, [step], "lit").notes.join(" ");
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The days' lines with those alike said once, the last of them, which holds the counts as they are now, and how many days said it: a long advance is a few
|
|
82
|
+
* lines for each member, never one a day; each day's writes and log lines stay as they were.
|
|
83
|
+
*/
|
|
84
|
+
function alikeOnce(lines) {
|
|
85
|
+
const alike = new Map();
|
|
86
|
+
for (const line of lines) {
|
|
87
|
+
const shape = line.replace(/\d+/g, "#");
|
|
88
|
+
alike.set(shape, { line, days: (alike.get(shape)?.days ?? 0) + 1 });
|
|
89
|
+
}
|
|
90
|
+
return [...alike.values()].map(({ line, days }) => (days === 1 ? line : `${line} (${days} days alike; the last shown)`));
|
|
36
91
|
}
|
|
37
92
|
/** One member's day, which never stops the time that has passed: a page that cannot be written becomes a line with what to do (UPK-1). */
|
|
38
93
|
function safeUpkeep(root, context, name, upkeep) {
|
|
@@ -146,49 +201,6 @@ function raise(root, context, world, name, field) {
|
|
|
146
201
|
appendLogEntry(root, newDatedLogEntry(root, context, "counter-changed", "public", { page: page.name, field, before: String(read.value), after: String(after), why: "days without food", upkeep: true }));
|
|
147
202
|
return `${read.value} → ${after}`;
|
|
148
203
|
}
|
|
149
|
-
/**
|
|
150
|
-
* What an effect named after something that burns asks (UPK-3), as Torch: the kind it spends, its own or its fuel, such as Oil for a lantern, and how long it lasts;
|
|
151
|
-
* refused when the holder carries none. Undefined for any other effect.
|
|
152
|
-
*/
|
|
153
|
-
export function burning(system, world, holder, name) {
|
|
154
|
-
const entry = burningEntry(system, world, holder, name);
|
|
155
|
-
if (entry === undefined) {
|
|
156
|
-
return undefined;
|
|
157
|
-
}
|
|
158
|
-
const [burns, { lasts, spends }] = entry;
|
|
159
|
-
const kind = kindNamed(world, holder, spends ?? burns);
|
|
160
|
-
if (kind === undefined || heldStacksOfKind(world, holder, kind).length === 0) {
|
|
161
|
-
throw new Error(`${holder.name} carries no ${spends ?? burns}, in what it holds, to light ${burns}. If the story gives some, add it to what ${holder.name} carries first. Nothing changed.`);
|
|
162
|
-
}
|
|
163
|
-
return { kind, lasts };
|
|
164
|
-
}
|
|
165
|
-
/** For an effect named after something that burns (UPK-3), what it spends, by the holder's name for it, as Torcia, and how many of it the holder still carries. */
|
|
166
|
-
export function fuelLeft(system, world, holder, name) {
|
|
167
|
-
if (Object.keys(system?.burning ?? {}).length === 0) {
|
|
168
|
-
return undefined;
|
|
169
|
-
}
|
|
170
|
-
// Only to show: a name two pages share, which a command would refuse, burns nothing here.
|
|
171
|
-
try {
|
|
172
|
-
const entry = burningEntry(system, world, holder, name);
|
|
173
|
-
const kind = entry === undefined ? undefined : kindNamed(world, holder, entry[1].spends ?? entry[0]);
|
|
174
|
-
return kind === undefined ? undefined : { fuel: kind.name, left: heldStacksOfKind(world, holder, kind).reduce((total, held) => total + held.stack.count, 0) };
|
|
175
|
-
}
|
|
176
|
-
catch {
|
|
177
|
-
return undefined;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
/** Spends one of what burns from what the holder carries (UPK-3), with its line in the log; the line that says it. */
|
|
181
|
-
export function burnOne(root, context, holderName, kind) {
|
|
182
|
-
const world = campaignWorld(root, context);
|
|
183
|
-
const holder = world.pages.find((page) => page.name === holderName);
|
|
184
|
-
const held = holder === undefined ? [] : heldStacksOfKind(world, holder, kind);
|
|
185
|
-
if (held.length === 0) {
|
|
186
|
-
return "";
|
|
187
|
-
}
|
|
188
|
-
const { container, stack } = held[0];
|
|
189
|
-
const step = { container, kind: stack.kind, before: stack.count, after: stack.count - 1, ...(stack.label === undefined ? {} : { label: stack.label }) };
|
|
190
|
-
return writeStacks(root, context, world, [step], "lit").notes.join(" ");
|
|
191
|
-
}
|
|
192
204
|
/** The system's entry of what burns that an effect is named after (UPK-3): by its name, or by a kind of the campaign that derives from it, as Torcia from Torch. */
|
|
193
205
|
function burningEntry(system, world, holder, name) {
|
|
194
206
|
const named = kindNamed(world, holder, name);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Context } from "
|
|
1
|
+
import type { Context } from "../../core/context.ts";
|
|
2
2
|
/** Whether the character agent voices the characters (D-490): in Claude Code, in a chat that has it, unless the master voices every character. */
|
|
3
3
|
export declare function agentVoices(root: string, context: Context): boolean;
|
|
4
4
|
/** The part Voices, when and how to call the character agent, for a campaign in play; none where the agent does not voice the characters. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Who voices the characters (D-490): the character agent, where the chat has it, or the master.
|
|
2
|
-
import { readSettings } from "
|
|
3
|
-
import { voicesInstructions } from "
|
|
2
|
+
import { readSettings } from "../../campaign/index.js";
|
|
3
|
+
import { voicesInstructions } from "../../instructions/index.js";
|
|
4
4
|
// The name Claude Code gives itself to the MCP server: the host whose campaign has the character agent as an agent (D-490).
|
|
5
5
|
const claudeCode = "claude-code";
|
|
6
6
|
/** Whether the character agent voices the characters (D-490): in Claude Code, in a chat that has it, unless the master voices every character. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type Formula, type FormulaRead } from "
|
|
2
|
-
import type { Problem } from "
|
|
3
|
-
import { type Page, type World } from "
|
|
1
|
+
import { type Formula, type FormulaRead } from "../../core/formula.ts";
|
|
2
|
+
import type { Problem } from "../../core/problem.ts";
|
|
3
|
+
import { type Page, type World } from "../../pages/index.ts";
|
|
4
4
|
/** A computed field that has a value, and the values it came from (FOR-8); a field the rows of the classes give may hold text, such as martial-arts 1d6 (PRO-2). */
|
|
5
5
|
export interface WorkedField {
|
|
6
6
|
field: string;
|
|
@@ -97,11 +97,6 @@ export declare function computedMessage(world: World, computed: {
|
|
|
97
97
|
* are no bonus to one alone (playtest 14); nothing when none is.
|
|
98
98
|
*/
|
|
99
99
|
export declare function aloneNote(world: World, field: string, bonuses: string[]): string;
|
|
100
|
-
/**
|
|
101
|
-
* The bonus fields among those a computed field comes from, which an effect on the page gives to change it, as bonus-ac for ac (FOR-5); not those the items of a
|
|
102
|
-
* list give, as a shield's armor-class-bonus, which change on the item (PRO-5).
|
|
103
|
-
*/
|
|
104
|
-
export declare function effectBonuses(world: World, from: string[]): string[];
|
|
105
100
|
/** The bonus fields an effect gives to change a computed field that its formula reads itself, as bonus-skills for insight, not bonus-proficiency through proficiency. */
|
|
106
101
|
export declare function directBonuses(world: World, computed: {
|
|
107
102
|
from: string[];
|