rpg-engine 0.15.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adventures/source.d.ts +3 -1
- package/dist/adventures/source.js +31 -1
- package/dist/campaign/find-campaign.js +8 -4
- package/dist/campaign/index.d.ts +1 -1
- package/dist/campaign/index.js +1 -1
- package/dist/campaign/settings.d.ts +6 -0
- package/dist/campaign/settings.js +22 -1
- package/dist/cli/cli.js +1 -1
- package/dist/cli/command-line.js +1 -1
- package/dist/commands/advance.d.ts +1 -1
- package/dist/commands/advance.js +6 -6
- package/dist/commands/ask.js +7 -7
- package/dist/commands/change/amounts.d.ts +32 -0
- package/dist/commands/change/amounts.js +150 -0
- package/dist/commands/change/change.d.ts +4 -54
- package/dist/commands/change/change.js +19 -749
- package/dist/commands/change/damage.d.ts +30 -0
- package/dist/commands/change/damage.js +73 -2
- package/dist/commands/change/dice.d.ts +34 -0
- package/dist/commands/change/dice.js +59 -0
- package/dist/commands/change/fields.d.ts +37 -0
- package/dist/commands/change/fields.js +156 -0
- package/dist/commands/change/holder.d.ts +48 -0
- package/dist/commands/change/holder.js +162 -0
- package/dist/commands/change/recipe-pace.js +1 -1
- package/dist/commands/change/recipe.d.ts +58 -0
- package/dist/commands/change/recipe.js +179 -0
- package/dist/commands/choices.js +3 -3
- package/dist/commands/config/config.d.ts +15 -0
- package/dist/commands/config/config.js +355 -0
- package/dist/commands/config/custom-levels.d.ts +7 -0
- package/dist/commands/config/custom-levels.js +32 -0
- package/dist/commands/{config.d.ts → config/dashboard.d.ts} +2 -24
- package/dist/commands/config/dashboard.js +171 -0
- package/dist/commands/config/entries.d.ts +17 -0
- package/dist/commands/config/entries.js +76 -0
- package/dist/commands/config/news.d.ts +7 -0
- package/dist/commands/config/news.js +88 -0
- package/dist/commands/config/shown.d.ts +9 -0
- package/dist/commands/config/shown.js +80 -0
- package/dist/commands/config/words.d.ts +27 -0
- package/dist/commands/config/words.js +204 -0
- package/dist/commands/effect.js +9 -9
- package/dist/commands/find.js +1 -1
- package/dist/commands/image.js +6 -6
- package/dist/commands/import/import.d.ts +0 -2
- package/dist/commands/import/import.js +68 -45
- package/dist/commands/import/run.js +1 -1
- package/dist/commands/index.js +3 -3
- package/dist/commands/init.js +2 -2
- package/dist/commands/install.js +1 -1
- package/dist/commands/instructions.js +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 +10 -10
- package/dist/commands/package/consent.d.ts +11 -0
- package/dist/commands/package/consent.js +52 -0
- package/dist/commands/package/here.d.ts +51 -0
- package/dist/commands/package/here.js +128 -0
- package/dist/commands/package/install.d.ts +10 -0
- package/dist/commands/package/install.js +337 -0
- package/dist/commands/package/package.d.ts +18 -0
- package/dist/commands/package/package.js +270 -0
- package/dist/commands/package/result.d.ts +89 -0
- package/dist/commands/package/result.js +1 -0
- package/dist/commands/package/uninstall.d.ts +6 -0
- package/dist/commands/package/uninstall.js +70 -0
- package/dist/commands/rename.js +3 -3
- package/dist/commands/reveal.js +5 -5
- package/dist/commands/roll/roll.js +11 -9
- package/dist/commands/roll/tables.js +1 -1
- package/dist/commands/rules.d.ts +2 -2
- package/dist/commands/rules.js +3 -3
- package/dist/commands/save.d.ts +2 -2
- package/dist/commands/save.js +2 -2
- package/dist/commands/scene/close.d.ts +18 -0
- package/dist/commands/scene/close.js +179 -0
- package/dist/commands/scene/members.d.ts +14 -0
- package/dist/commands/scene/members.js +32 -0
- package/dist/commands/scene/open.d.ts +6 -0
- package/dist/commands/scene/open.js +298 -0
- package/dist/commands/scene/result.d.ts +98 -0
- package/dist/commands/scene/result.js +2 -0
- package/dist/commands/{scene.d.ts → scene/scene.d.ts} +10 -36
- package/dist/commands/scene/scene.js +210 -0
- package/dist/commands/scene/turns.d.ts +18 -0
- package/dist/commands/scene/turns.js +229 -0
- package/dist/commands/shared/books/adventure-layers.d.ts +89 -0
- package/dist/commands/shared/books/adventure-layers.js +201 -0
- package/dist/commands/shared/{adventures.d.ts → books/adventures.d.ts} +28 -9
- package/dist/commands/shared/{adventures.js → books/adventures.js} +77 -35
- package/dist/commands/shared/{library-reader.js → books/library-reader.js} +3 -3
- package/dist/commands/shared/{library.d.ts → books/library.d.ts} +2 -2
- package/dist/commands/shared/{library.js → books/library.js} +9 -9
- package/dist/commands/shared/{rules.d.ts → books/rules.d.ts} +2 -2
- package/dist/commands/shared/{rules.js → books/rules.js} +5 -5
- package/dist/commands/shared/{system-texts.d.ts → books/system-texts.d.ts} +2 -2
- package/dist/commands/shared/{system-texts.js → books/system-texts.js} +9 -8
- package/dist/commands/shared/{page-words.d.ts → books/words.d.ts} +2 -2
- package/dist/commands/shared/{page-words.js → books/words.js} +4 -4
- package/dist/commands/shared/{checks.d.ts → campaign/checks.d.ts} +3 -3
- package/dist/commands/shared/{checks.js → campaign/checks.js} +7 -7
- package/dist/commands/shared/{images.d.ts → campaign/images.d.ts} +3 -3
- package/dist/commands/shared/{images.js → campaign/images.js} +5 -5
- package/dist/commands/shared/{mode.d.ts → campaign/mode.d.ts} +4 -4
- package/dist/commands/shared/{mode.js → campaign/mode.js} +24 -13
- package/dist/commands/shared/{money.d.ts → campaign/money.d.ts} +3 -3
- package/dist/commands/shared/{money.js → campaign/money.js} +2 -2
- package/dist/commands/shared/{offers.d.ts → campaign/offers.d.ts} +3 -3
- package/dist/commands/shared/{offers.js → campaign/offers.js} +3 -3
- package/dist/commands/shared/{outside.d.ts → campaign/outside.d.ts} +3 -3
- package/dist/commands/shared/{outside.js → campaign/outside.js} +7 -7
- package/dist/commands/shared/{parts.d.ts → campaign/parts.d.ts} +3 -3
- package/dist/commands/shared/{parts.js → campaign/parts.js} +3 -3
- package/dist/commands/shared/{problems.d.ts → campaign/problems.d.ts} +3 -3
- package/dist/commands/shared/{problems.js → campaign/problems.js} +17 -17
- package/dist/commands/shared/{quests.d.ts → campaign/quests.d.ts} +4 -4
- package/dist/commands/shared/{quests.js → campaign/quests.js} +6 -6
- package/dist/commands/shared/{saves.d.ts → campaign/saves.d.ts} +4 -4
- package/dist/commands/shared/{saves.js → campaign/saves.js} +10 -10
- package/dist/commands/shared/{theme.d.ts → campaign/theme.d.ts} +3 -3
- package/dist/commands/shared/{theme.js → campaign/theme.js} +1 -1
- package/dist/commands/shared/{world.d.ts → campaign/world.d.ts} +5 -5
- package/dist/commands/shared/{world.js → campaign/world.js} +17 -14
- package/dist/commands/shared/{knowledge.d.ts → characters/knowledge.d.ts} +3 -3
- package/dist/commands/shared/{knowledge.js → characters/knowledge.js} +4 -4
- package/dist/commands/shared/{moods.d.ts → characters/moods.d.ts} +3 -3
- package/dist/commands/shared/{moods.js → characters/moods.js} +3 -3
- package/dist/commands/shared/characters/orders.d.ts +4 -0
- package/dist/commands/shared/characters/orders.js +10 -0
- package/dist/commands/shared/{thoughts.d.ts → characters/thoughts.d.ts} +9 -6
- package/dist/commands/shared/{thoughts.js → characters/thoughts.js} +17 -7
- package/dist/commands/shared/{voices.d.ts → characters/voices.d.ts} +1 -1
- package/dist/commands/shared/{voices.js → characters/voices.js} +2 -2
- package/dist/commands/shared/examples.js +2 -2
- package/dist/commands/shared/packages/catalog.js +2 -2
- package/dist/commands/shared/packages/code.d.ts +1 -1
- package/dist/commands/shared/packages/code.js +8 -8
- package/dist/commands/shared/packages/extensions.d.ts +1 -1
- package/dist/commands/shared/packages/extensions.js +1 -1
- package/dist/commands/shared/packages/hooks.d.ts +1 -1
- package/dist/commands/shared/packages/hooks.js +1 -1
- package/dist/commands/shared/packages/widgets.d.ts +3 -3
- package/dist/commands/shared/packages/widgets.js +3 -3
- package/dist/commands/shared/{environment.d.ts → places/environment.d.ts} +1 -1
- package/dist/commands/shared/{environment.js → places/environment.js} +4 -4
- package/dist/commands/shared/{grid-moves.d.ts → places/grid-moves.d.ts} +4 -4
- package/dist/commands/shared/{grid-moves.js → places/grid-moves.js} +8 -7
- package/dist/commands/shared/{grids.d.ts → places/grids.d.ts} +4 -4
- package/dist/commands/shared/{grids.js → places/grids.js} +6 -6
- package/dist/commands/shared/{journey.d.ts → places/journey.d.ts} +3 -3
- package/dist/commands/shared/{journey.js → places/journey.js} +6 -6
- package/dist/commands/shared/{moves.d.ts → places/moves.d.ts} +2 -2
- package/dist/commands/shared/{moves.js → places/moves.js} +4 -4
- package/dist/commands/shared/{positions.d.ts → places/positions.d.ts} +2 -2
- package/dist/commands/shared/{positions.js → places/positions.js} +4 -4
- package/dist/commands/shared/{roads.d.ts → places/roads.d.ts} +5 -5
- package/dist/commands/shared/{roads.js → places/roads.js} +6 -6
- package/dist/commands/shared/{effects.d.ts → scene/effects.d.ts} +7 -7
- package/dist/commands/shared/{effects.js → scene/effects.js} +10 -10
- package/dist/commands/shared/{loot.d.ts → scene/loot.d.ts} +2 -2
- package/dist/commands/shared/{loot.js → scene/loot.js} +3 -3
- package/dist/commands/shared/{master-rolls.d.ts → scene/master-rolls.d.ts} +2 -2
- package/dist/commands/shared/{master-rolls.js → scene/master-rolls.js} +5 -5
- package/dist/commands/shared/{reminders.d.ts → scene/reminders.d.ts} +4 -4
- package/dist/commands/shared/{reminders.js → scene/reminders.js} +4 -4
- package/dist/commands/shared/{scene.d.ts → scene/scene.d.ts} +3 -3
- package/dist/commands/shared/{scene.js → scene/scene.js} +10 -8
- package/dist/commands/shared/{bonds.d.ts → sheet/bonds.d.ts} +3 -3
- package/dist/commands/shared/{bonds.js → sheet/bonds.js} +2 -2
- package/dist/commands/shared/{page-counters.d.ts → sheet/counters.d.ts} +3 -3
- package/dist/commands/shared/{page-counters.js → sheet/counters.js} +5 -5
- package/dist/commands/shared/{effect-layer.d.ts → sheet/effect-layer.d.ts} +2 -2
- package/dist/commands/shared/{effect-layer.js → sheet/effect-layer.js} +9 -6
- package/dist/commands/shared/sheet/effect-values.d.ts +9 -0
- package/dist/commands/shared/sheet/effect-values.js +69 -0
- package/dist/commands/shared/{experience.d.ts → sheet/experience.d.ts} +3 -3
- package/dist/commands/shared/{experience.js → sheet/experience.js} +5 -5
- package/dist/commands/shared/sheet/formula-problems.d.ts +8 -0
- package/dist/commands/shared/sheet/formula-problems.js +140 -0
- package/dist/commands/shared/sheet/formula-scope.d.ts +32 -0
- package/dist/commands/shared/sheet/formula-scope.js +235 -0
- package/dist/commands/shared/{limits.d.ts → sheet/limits.d.ts} +3 -3
- package/dist/commands/shared/{limits.js → sheet/limits.js} +5 -4
- package/dist/commands/shared/{progression.d.ts → sheet/progression.d.ts} +2 -2
- package/dist/commands/shared/{progression.js → sheet/progression.js} +4 -4
- package/dist/commands/shared/{sheet.d.ts → sheet/sheet.d.ts} +7 -5
- package/dist/commands/shared/{sheet.js → sheet/sheet.js} +11 -7
- package/dist/commands/shared/{stacks.d.ts → sheet/stacks.d.ts} +2 -2
- package/dist/commands/shared/{stacks.js → sheet/stacks.js} +4 -4
- package/dist/commands/shared/sheet/system-fields.d.ts +21 -0
- package/dist/commands/shared/sheet/system-fields.js +45 -0
- package/dist/commands/shared/{thresholds.d.ts → sheet/thresholds.d.ts} +1 -1
- package/dist/commands/shared/{thresholds.js → sheet/thresholds.js} +4 -4
- package/dist/commands/shared/{turn-uses.d.ts → sheet/turn-uses.d.ts} +3 -3
- package/dist/commands/shared/{turn-uses.js → sheet/turn-uses.js} +4 -3
- package/dist/commands/shared/{worked-out.d.ts → sheet/worked-out.d.ts} +11 -46
- package/dist/commands/shared/sheet/worked-out.js +291 -0
- package/dist/commands/shared/sheet/worked-text.d.ts +14 -0
- package/dist/commands/shared/sheet/worked-text.js +55 -0
- package/dist/commands/shared/{advance.d.ts → time/advance.d.ts} +3 -3
- package/dist/commands/shared/{advance.js → time/advance.js} +11 -11
- package/dist/commands/shared/{dice-pool.d.ts → time/dice-pool.d.ts} +3 -3
- package/dist/commands/shared/{dice-pool.js → time/dice-pool.js} +11 -11
- package/dist/commands/shared/{events.d.ts → time/events.d.ts} +5 -5
- package/dist/commands/shared/{events.js → time/events.js} +10 -13
- package/dist/commands/shared/{recipes.d.ts → time/recipes.d.ts} +3 -3
- package/dist/commands/shared/{recipes.js → time/recipes.js} +6 -5
- package/dist/commands/shared/{time.d.ts → time/time.d.ts} +4 -4
- package/dist/commands/shared/{time.js → time/time.js} +6 -6
- package/dist/commands/shared/{upkeep.d.ts → time/upkeep.d.ts} +3 -3
- package/dist/commands/shared/{upkeep.js → time/upkeep.js} +14 -13
- package/dist/commands/show.d.ts +9 -0
- package/dist/commands/show.js +43 -10
- package/dist/commands/status.d.ts +2 -1
- package/dist/commands/status.js +28 -22
- package/dist/commands/thoughts.d.ts +1 -0
- package/dist/commands/thoughts.js +26 -18
- package/dist/commands/trade.js +8 -8
- package/dist/commands/translate.d.ts +1 -1
- package/dist/commands/translate.js +3 -3
- package/dist/commands/travel/open.d.ts +1 -1
- package/dist/commands/travel/open.js +2 -2
- package/dist/commands/travel/route.js +7 -6
- package/dist/commands/travel/travel.d.ts +1 -1
- package/dist/commands/travel/travel.js +8 -8
- package/dist/commands/validate.js +3 -3
- package/dist/commands/view/journal.d.ts +2 -2
- package/dist/commands/view/journal.js +2 -2
- package/dist/commands/view/layers.d.ts +34 -0
- package/dist/commands/view/layers.js +44 -0
- package/dist/commands/view/map.d.ts +1 -1
- package/dist/commands/view/map.js +6 -6
- package/dist/commands/view/memory.d.ts +16 -0
- package/dist/commands/view/memory.js +96 -0
- package/dist/commands/view/page.d.ts +32 -0
- package/dist/commands/view/page.js +166 -0
- package/dist/commands/view/place.d.ts +7 -2
- package/dist/commands/view/place.js +30 -12
- package/dist/commands/view/result.d.ts +252 -0
- package/dist/commands/view/result.js +1 -0
- package/dist/commands/view/saves.d.ts +6 -0
- package/dist/commands/view/saves.js +53 -0
- package/dist/commands/view/story.d.ts +32 -0
- package/dist/commands/view/story.js +227 -0
- package/dist/commands/view/view.d.ts +29 -292
- package/dist/commands/view/view.js +31 -536
- package/dist/commands/view/world.d.ts +1 -1
- package/dist/commands/view/world.js +3 -3
- package/dist/commands/write/checks.d.ts +42 -0
- package/dist/commands/write/checks.js +291 -0
- package/dist/commands/write/here.d.ts +1 -1
- package/dist/commands/write/here.js +5 -5
- package/dist/commands/write/inheritance.d.ts +40 -0
- package/dist/commands/write/inheritance.js +185 -0
- package/dist/commands/write/input.d.ts +29 -0
- package/dist/commands/write/input.js +124 -0
- package/dist/commands/write/layer.d.ts +44 -0
- package/dist/commands/write/layer.js +68 -0
- package/dist/commands/write/notes.d.ts +22 -0
- package/dist/commands/write/notes.js +76 -0
- package/dist/commands/write/progression.d.ts +27 -0
- package/dist/commands/write/progression.js +175 -0
- package/dist/commands/write/write.d.ts +2 -0
- package/dist/commands/write/write.js +36 -816
- package/dist/core/files.d.ts +2 -0
- package/dist/core/files.js +7 -0
- package/dist/core/{package-declarations.d.ts → packages/declarations.d.ts} +1 -1
- package/dist/core/{package-declarations.js → packages/declarations.js} +1 -1
- package/dist/core/session-store.js +3 -3
- package/dist/core/store.d.ts +2 -2
- package/dist/core/store.js +18 -4
- package/dist/core/text.d.ts +2 -0
- package/dist/core/text.js +4 -0
- package/dist/dashboard/acts/acts.js +1 -1
- package/dist/dashboard/acts/sending.js +110 -0
- package/dist/dashboard/acts/sheet.js +2 -2
- package/dist/dashboard/acts/strip.js +1 -1
- package/dist/dashboard/address.js +6 -0
- package/dist/dashboard/api.js +19 -1
- package/dist/dashboard/app.js +51 -171
- package/dist/dashboard/dice/roller.js +1 -1
- package/dist/dashboard/dice/sets.js +2 -2
- package/dist/dashboard/dice/stage.js +1 -1
- package/dist/dashboard/dice/tray.js +6 -6
- package/dist/dashboard/guide/ar.md +7 -3
- package/dist/dashboard/guide/cs.md +9 -5
- package/dist/dashboard/guide/da.md +9 -5
- package/dist/dashboard/guide/de.md +7 -3
- package/dist/dashboard/guide/el.md +9 -5
- package/dist/dashboard/guide/en.md +4 -0
- package/dist/dashboard/guide/es.md +8 -4
- package/dist/dashboard/guide/fi.md +9 -5
- package/dist/dashboard/guide/fr.md +8 -4
- package/dist/dashboard/guide/he.md +7 -3
- package/dist/dashboard/guide/hi.md +10 -6
- package/dist/dashboard/guide/hu.md +8 -4
- package/dist/dashboard/guide/is.md +9 -5
- package/dist/dashboard/guide/it.md +5 -1
- package/dist/dashboard/guide/ja.md +9 -5
- package/dist/dashboard/guide/ko.md +8 -4
- package/dist/dashboard/guide/nb.md +8 -4
- package/dist/dashboard/guide/nl.md +8 -4
- package/dist/dashboard/guide/pl.md +8 -4
- package/dist/dashboard/guide/pt.md +7 -3
- package/dist/dashboard/guide/ro.md +9 -5
- package/dist/dashboard/guide/ru.md +8 -4
- package/dist/dashboard/guide/sv.md +9 -5
- package/dist/dashboard/guide/tr.md +9 -5
- package/dist/dashboard/guide/uk.md +8 -4
- package/dist/dashboard/guide/zh.md +8 -4
- package/dist/dashboard/help/help.js +3 -3
- package/dist/dashboard/i18n/ar.json +29 -0
- package/dist/dashboard/i18n/cs.json +29 -0
- package/dist/dashboard/i18n/da.json +29 -0
- package/dist/dashboard/i18n/de.json +29 -0
- package/dist/dashboard/i18n/el.json +29 -0
- package/dist/dashboard/i18n/es.json +29 -0
- package/dist/dashboard/i18n/fi.json +29 -0
- package/dist/dashboard/i18n/fr.json +29 -0
- package/dist/dashboard/i18n/he.json +29 -0
- package/dist/dashboard/i18n/hi.json +29 -0
- package/dist/dashboard/i18n/hu.json +29 -0
- package/dist/dashboard/i18n/is.json +29 -0
- package/dist/dashboard/i18n/it.json +29 -0
- package/dist/dashboard/i18n/ja.json +30 -1
- package/dist/dashboard/i18n/ko.json +29 -0
- package/dist/dashboard/i18n/nb.json +29 -0
- package/dist/dashboard/i18n/nl.json +29 -0
- package/dist/dashboard/i18n/pl.json +29 -0
- package/dist/dashboard/i18n/pt.json +29 -0
- package/dist/dashboard/i18n/ro.json +29 -0
- package/dist/dashboard/i18n/ru.json +29 -0
- package/dist/dashboard/i18n/sv.json +29 -0
- package/dist/dashboard/i18n/tr.json +29 -0
- package/dist/dashboard/i18n/uk.json +29 -0
- package/dist/dashboard/i18n/zh.json +29 -0
- package/dist/dashboard/{journal.js → journal/journal.js} +16 -16
- package/dist/dashboard/{notes.js → journal/notes.js} +4 -4
- package/dist/dashboard/kit.js +3 -3
- package/dist/dashboard/packages/ask-card.js +3 -3
- package/dist/dashboard/packages/catalog.js +196 -0
- package/dist/dashboard/packages/changes.js +111 -0
- package/dist/dashboard/packages/engine.js +87 -0
- package/dist/dashboard/packages/installed.js +53 -0
- package/dist/dashboard/packages/library.js +97 -0
- package/dist/dashboard/packages/outcomes.js +45 -0
- package/dist/dashboard/packages/packages.js +27 -578
- package/dist/dashboard/packages/page-code.js +15 -2
- package/dist/dashboard/packages/{package-page.js → page.js} +12 -5
- package/dist/dashboard/packages/rows.js +84 -0
- package/dist/dashboard/packages/share.js +44 -0
- package/dist/dashboard/packages/widgets.js +3 -3
- package/dist/dashboard/{card.js → parts/card.js} +1 -1
- package/dist/dashboard/parts/changed.js +37 -0
- package/dist/dashboard/{faces.js → parts/faces.js} +5 -5
- package/dist/dashboard/{game-words.js → parts/game-words.js} +1 -1
- package/dist/dashboard/{icons.js → parts/icons.js} +1 -1
- package/dist/dashboard/{labels.js → parts/labels.js} +2 -1
- package/dist/dashboard/{map-symbols.js → parts/map-symbols.js} +1 -1
- package/dist/dashboard/{markdown.js → parts/markdown.js} +2 -2
- package/dist/dashboard/{mood.js → parts/mood.js} +1 -1
- package/dist/dashboard/{refusals.js → parts/refusals.js} +5 -1
- package/dist/dashboard/{status.js → parts/status.js} +4 -4
- package/dist/dashboard/{widgets.js → parts/widgets.js} +5 -3
- package/dist/dashboard/place/key.js +24 -0
- package/dist/dashboard/place/paper.js +67 -0
- package/dist/dashboard/place/{map-sheet.js → sheet.js} +2 -2
- package/dist/dashboard/place/things.js +129 -0
- package/dist/dashboard/place/tokens.js +93 -0
- package/dist/dashboard/place/view.js +124 -0
- package/dist/dashboard/{asked-dice.js → play/asked-dice.js} +3 -3
- package/dist/dashboard/{asked.js → play/asked.js} +10 -10
- package/dist/dashboard/{choices.js → play/choices.js} +11 -10
- package/dist/dashboard/{requested.js → play/requested.js} +1 -1
- package/dist/dashboard/{rolls.js → play/rolls.js} +9 -9
- package/dist/dashboard/{scene.js → play/scene.js} +14 -14
- package/dist/dashboard/{turns.js → play/turns.js} +12 -12
- package/dist/dashboard/{language-choice.js → settings/language-choice.js} +1 -1
- package/dist/dashboard/{languages.js → settings/languages.js} +1 -1
- package/dist/dashboard/{saves.js → settings/saves.js} +8 -8
- package/dist/dashboard/{settings.js → settings/settings.js} +17 -15
- package/dist/dashboard/{setup.js → settings/setup.js} +5 -5
- package/dist/dashboard/{party.js → sheet/party.js} +8 -8
- package/dist/dashboard/{person-panel.js → sheet/person-panel.js} +4 -4
- package/dist/dashboard/{sheet.js → sheet/sheet.js} +27 -24
- package/dist/dashboard/{story.js → sheet/story.js} +3 -3
- package/dist/dashboard/{columns.js → shell/columns.js} +1 -1
- package/dist/dashboard/{footer.js → shell/footer.js} +3 -3
- package/dist/dashboard/{master.js → shell/master.js} +2 -2
- package/dist/dashboard/{notices.js → shell/notices.js} +3 -3
- package/dist/dashboard/{pages.js → shell/pages.js} +5 -5
- package/dist/dashboard/shell/shown.js +38 -0
- package/dist/dashboard/{table.js → shell/table.js} +2 -2
- package/dist/dashboard/{tabs.js → shell/tabs.js} +2 -2
- package/dist/dashboard/{top.js → shell/top.js} +7 -7
- package/dist/dashboard/style.css +288 -4
- package/dist/dashboard/world/calendar.js +4 -4
- package/dist/dashboard/world/drawing.js +92 -0
- package/dist/dashboard/world/key.js +21 -0
- package/dist/dashboard/world/lore.js +10 -6
- package/dist/dashboard/world/map-card.js +186 -0
- package/dist/dashboard/world/place-card.js +39 -0
- package/dist/dashboard/world/places.js +29 -0
- package/dist/dashboard/world/world.js +9 -341
- package/dist/extensions/extension.d.ts +1 -1
- package/dist/extensions/extension.js +1 -1
- package/dist/images/images.js +12 -9
- package/dist/index.d.ts +1 -1
- package/dist/languages/index.d.ts +1 -1
- package/dist/languages/index.js +1 -1
- package/dist/packages/npm.js +1 -1
- package/dist/page.d.ts +2 -2
- package/dist/page.js +1 -1
- package/dist/pages/check.js +23 -1
- package/dist/pages/containers.d.ts +1 -1
- package/dist/pages/containers.js +1 -1
- package/dist/pages/index.d.ts +4 -2
- package/dist/pages/index.js +4 -2
- package/dist/pages/inheritance.d.ts +2 -2
- package/dist/pages/layers.d.ts +52 -0
- package/dist/pages/layers.js +105 -0
- package/dist/pages/markdown.d.ts +5 -1
- package/dist/pages/markdown.js +13 -1
- package/dist/pages/rename-page.js +1 -1
- package/dist/pages/stacks/writes.js +48 -22
- package/dist/pages/standard-fields.d.ts +1 -1
- package/dist/pages/system-pages.d.ts +5 -3
- package/dist/pages/system-pages.js +16 -7
- package/dist/pages/world.d.ts +8 -1
- package/dist/pages/world.js +16 -4
- package/dist/pages/write-layer.d.ts +23 -0
- package/dist/pages/write-layer.js +162 -0
- package/dist/pages/write-page.d.ts +2 -2
- package/dist/pages/write-page.js +2 -2
- package/dist/rules/index.d.ts +1 -1
- package/dist/rules/index.js +1 -1
- package/dist/rules/search.d.ts +1 -1
- package/dist/rules/shown.d.ts +1 -1
- package/dist/server/dashboard/choices.d.ts +2 -0
- package/dist/server/dashboard/choices.js +6 -4
- package/dist/server/dashboard/files.js +5 -5
- package/dist/server/dashboard/index.d.ts +2 -2
- package/dist/server/dashboard/index.js +7 -3
- package/dist/server/dashboard/news.js +4 -3
- package/dist/server/dashboard/player.js +1 -1
- package/dist/server/dashboard/writes.d.ts +7 -0
- package/dist/server/dashboard/writes.js +48 -7
- package/dist/server/mcp.js +28 -13
- package/dist/systems/campaign-data.d.ts +15 -0
- package/dist/systems/campaign-data.js +85 -0
- package/dist/systems/{system-code.d.ts → code.d.ts} +1 -1
- package/dist/systems/{system-code.js → code.js} +2 -2
- package/dist/systems/game-system.d.ts +7 -61
- package/dist/systems/game-system.js +1 -984
- package/dist/systems/index.d.ts +6 -3
- package/dist/systems/index.js +6 -3
- package/dist/systems/installed.d.ts +31 -0
- package/dist/systems/installed.js +89 -0
- package/dist/systems/maps.d.ts +3 -0
- package/dist/systems/maps.js +9 -0
- package/dist/systems/read.d.ts +3 -0
- package/dist/systems/read.js +471 -0
- package/dist/systems/schema.d.ts +289 -0
- package/dist/systems/schema.js +243 -0
- package/dist/systems/settings.d.ts +19 -0
- package/dist/systems/settings.js +78 -0
- package/dist/systems/versions.d.ts +12 -0
- package/dist/systems/versions.js +52 -0
- package/dist/testing/index.js +1 -1
- package/instructions/import.md +1 -1
- package/instructions/play.md +1 -1
- package/instructions/voices.md +1 -1
- package/package.json +1 -1
- package/dist/commands/config.js +0 -948
- package/dist/commands/package.d.ts +0 -143
- package/dist/commands/package.js +0 -785
- package/dist/commands/scene.js +0 -894
- package/dist/commands/shared/worked-out.js +0 -805
- package/dist/dashboard/place/map-view.js +0 -417
- /package/dist/commands/shared/{library-reader.d.ts → books/library-reader.d.ts} +0 -0
- /package/dist/core/{package-api.d.ts → packages/api.d.ts} +0 -0
- /package/dist/core/{package-api.js → packages/api.js} +0 -0
- /package/dist/dashboard/{coins.js → parts/coins.js} +0 -0
- /package/dist/dashboard/{glass.js → parts/glass.js} +0 -0
- /package/dist/dashboard/{layout.js → parts/layout.js} +0 -0
- /package/dist/dashboard/{mood-faces.js → parts/mood-faces.js} +0 -0
- /package/dist/dashboard/{free-rolls.js → play/free-rolls.js} +0 -0
- /package/dist/dashboard/{reactions.js → play/reactions.js} +0 -0
- /package/dist/dashboard/{prefs.js → shell/prefs.js} +0 -0
- /package/dist/dashboard/{system-style.js → shell/system-style.js} +0 -0
- /package/dist/dashboard/{theme.js → shell/theme.js} +0 -0
- /package/dist/languages/{language-pack.d.ts → pack.d.ts} +0 -0
- /package/dist/languages/{language-pack.js → pack.js} +0 -0
- /package/dist/pages/{page-file.d.ts → file.d.ts} +0 -0
- /package/dist/pages/{page-file.js → file.js} +0 -0
- /package/dist/pages/{page-types.d.ts → types.d.ts} +0 -0
- /package/dist/pages/{page-types.js → types.js} +0 -0
- /package/dist/rules/{rule-book.d.ts → book.d.ts} +0 -0
- /package/dist/rules/{rule-book.js → book.js} +0 -0
- /package/dist/systems/{system-folders.d.ts → folders.d.ts} +0 -0
- /package/dist/systems/{system-folders.js → folders.js} +0 -0
|
@@ -1,31 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
order: string[];
|
|
5
|
-
round: number;
|
|
6
|
-
turn: string;
|
|
7
|
-
player: boolean;
|
|
8
|
-
/** More than one living player character, each handed their turn by name (D-480 (5)). */
|
|
9
|
-
several?: true;
|
|
10
|
-
}
|
|
11
|
-
/** Someone in the scene, with their counters. */
|
|
12
|
-
interface Member {
|
|
13
|
-
name: string;
|
|
14
|
-
counters: Record<string, unknown>;
|
|
15
|
-
/** A character's effects with their end, such as "Poisoned until day 1, 19:00". */
|
|
16
|
-
effects?: string[];
|
|
17
|
-
}
|
|
18
|
-
/** Who of the party a scene brought into its place, and what that set off (CON-6). */
|
|
19
|
-
interface Brought {
|
|
20
|
-
moved: string[];
|
|
21
|
-
notes: string[];
|
|
22
|
-
}
|
|
23
|
-
/** The save the end of a scene made, or why it made none (SAV-3). */
|
|
24
|
-
interface Saved {
|
|
25
|
-
saved?: string;
|
|
26
|
-
unsaved?: string;
|
|
27
|
-
}
|
|
28
|
-
export declare const scene: import("../core/registry.ts").Command<z.ZodObject<{
|
|
2
|
+
import { type Brought } from "./result.ts";
|
|
3
|
+
export declare const scene: import("../../core/registry.ts").Command<z.ZodObject<{
|
|
29
4
|
action: z.ZodEnum<{
|
|
30
5
|
next: "next";
|
|
31
6
|
open: "open";
|
|
@@ -64,20 +39,20 @@ export declare const scene: import("../core/registry.ts").Command<z.ZodObject<{
|
|
|
64
39
|
type: string;
|
|
65
40
|
opened?: string;
|
|
66
41
|
place?: string;
|
|
67
|
-
members: Member[];
|
|
42
|
+
members: import("./result.ts").Member[];
|
|
68
43
|
around: string;
|
|
69
44
|
part: string;
|
|
70
45
|
} & Brought) | ({
|
|
71
46
|
action: "add";
|
|
72
47
|
title: string;
|
|
73
48
|
place?: string;
|
|
74
|
-
members: Member[];
|
|
49
|
+
members: import("./result.ts").Member[];
|
|
75
50
|
ordered: boolean;
|
|
76
51
|
seen?: Record<string, string>;
|
|
77
52
|
} & Brought) | {
|
|
78
53
|
action: "leave";
|
|
79
|
-
left: Member[];
|
|
80
|
-
turns?: Turns;
|
|
54
|
+
left: import("./result.ts").Member[];
|
|
55
|
+
turns?: import("./result.ts").Turns;
|
|
81
56
|
noTurns: boolean;
|
|
82
57
|
ended: string[];
|
|
83
58
|
acting?: string;
|
|
@@ -86,7 +61,7 @@ export declare const scene: import("../core/registry.ts").Command<z.ZodObject<{
|
|
|
86
61
|
noTurn: string[];
|
|
87
62
|
ended: string[];
|
|
88
63
|
acting?: string;
|
|
89
|
-
} & Turns) | {
|
|
64
|
+
} & import("./result.ts").Turns) | {
|
|
90
65
|
action: "now";
|
|
91
66
|
title: string;
|
|
92
67
|
now: string;
|
|
@@ -103,8 +78,8 @@ export declare const scene: import("../core/registry.ts").Command<z.ZodObject<{
|
|
|
103
78
|
action: "close";
|
|
104
79
|
title?: string;
|
|
105
80
|
rounds?: number;
|
|
106
|
-
copies: Member[];
|
|
107
|
-
gone?: Member[];
|
|
81
|
+
copies: import("./result.ts").Member[];
|
|
82
|
+
gone?: import("./result.ts").Member[];
|
|
108
83
|
unreadable?: string;
|
|
109
84
|
ended: string[];
|
|
110
85
|
endless: string[];
|
|
@@ -112,5 +87,4 @@ export declare const scene: import("../core/registry.ts").Command<z.ZodObject<{
|
|
|
112
87
|
fallen?: string;
|
|
113
88
|
afterPeak?: string;
|
|
114
89
|
quests: string[];
|
|
115
|
-
} & Saved)>;
|
|
116
|
-
export {};
|
|
90
|
+
} & import("./result.ts").Saved)>;
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
// The scene command: input check, actions dispatched, results formatted; now, hostile and calm
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { requireCampaign } from "../../campaign/index.js";
|
|
4
|
+
import { appendLogEntry } from "../../core/log.js";
|
|
5
|
+
import { defineCommand } from "../../core/registry.js";
|
|
6
|
+
import { sameName } from "../../core/text.js";
|
|
7
|
+
import { isEmptyField, linkListItems, parsePageReference } from "../../pages/index.js";
|
|
8
|
+
import { sceneTypes } from "../../scene/index.js";
|
|
9
|
+
import { campaignWorld } from "../shared/campaign/world.js";
|
|
10
|
+
import { textList } from "../shared/inputs.js";
|
|
11
|
+
import { openScene, updateScene } from "../shared/scene/scene.js";
|
|
12
|
+
import { countersText } from "../shared/sheet/counters.js";
|
|
13
|
+
import { newDatedLogEntry } from "../shared/time/time.js";
|
|
14
|
+
import { close, closedText } from "./close.js";
|
|
15
|
+
import { memberNames, membersText } from "./members.js";
|
|
16
|
+
import { addTo, openNew } from "./open.js";
|
|
17
|
+
import { actions } from "./result.js";
|
|
18
|
+
import { leave, passTurn, setOrder, turnText, useOfTurn, withActing } from "./turns.js";
|
|
19
|
+
// The parameters each action takes; any other is refused, so that nothing given is silently ignored.
|
|
20
|
+
const actionParameters = {
|
|
21
|
+
open: ["title", "type", "place", "with", "creatures", "now", "seen"],
|
|
22
|
+
add: ["with", "creatures", "seen"],
|
|
23
|
+
leave: ["who"],
|
|
24
|
+
order: ["order"],
|
|
25
|
+
next: [],
|
|
26
|
+
use: ["who", "uses", "by"],
|
|
27
|
+
now: ["now"],
|
|
28
|
+
hostile: ["who"],
|
|
29
|
+
calm: ["who"],
|
|
30
|
+
close: ["summary"],
|
|
31
|
+
};
|
|
32
|
+
export const scene = defineCommand({
|
|
33
|
+
name: "scene",
|
|
34
|
+
description: "Open, run and close a scene of the story. "
|
|
35
|
+
+ "Creatures come as numbered copies, such as Annegato 1: a copy holds only what changes, the rest is read from the creature. "
|
|
36
|
+
+ "At open, whoever of the party is elsewhere moves to the scene's place, except in a travel scene. "
|
|
37
|
+
+ "order sets who takes turns, after rolling for it if the game does; next passes the turn; use marks what one uses of a turn: the engine counts the uses the game declares and refuses one too many. "
|
|
38
|
+
+ "now is the line the player's dashboard shows: give it at open too, and change it as the scene turns. "
|
|
39
|
+
+ "hostile marks who attacks the party, calm takes the mark off; seen gives what the character sees of those it does not know by name; the player's dashboard shows both. "
|
|
40
|
+
+ "close ends the scene with a summary the player may read. Change a copy's counters with change, as for a page. "
|
|
41
|
+
+ 'Example: action open, title "Scontro all\'ossario", type combat, creatures {"Annegato": 2}.',
|
|
42
|
+
group: "game",
|
|
43
|
+
positionals: ["action"],
|
|
44
|
+
input: z.object({
|
|
45
|
+
action: z.enum(actions).describe("open, add, leave, order, next, use, now, hostile, calm or close"),
|
|
46
|
+
title: z.string().optional().describe("open: the scene's title"),
|
|
47
|
+
type: z.enum(sceneTypes).optional().describe(`open: ${sceneTypes.join(", ")}`),
|
|
48
|
+
place: z.string().optional().describe("open: the place, such as [[Ossario]]; the character's if left out"),
|
|
49
|
+
with: textList.optional().describe("open, add: the characters in the scene, the player character included, such as [[Lena]]; at open, the character and the companions with them if left out"),
|
|
50
|
+
creatures: z.union([textList, z.record(z.string(), z.number().int())]).optional().describe('open, add: creatures as numbered copies: Annegato=2 (Annegato alone is one), or through MCP an object such as {"Annegato": 2}'),
|
|
51
|
+
who: textList.optional().describe("leave: who leaves the scene; hostile, calm: who attacks the party, or stops; use: who uses it; characters or copies, such as Annegato 2"),
|
|
52
|
+
uses: z.string().optional().describe("use: what of a turn, by the game's names, such as {{uses}}"),
|
|
53
|
+
by: z.string().optional().describe("use: what gives one more, or lets it in another's turn, such as a feature"),
|
|
54
|
+
order: textList.optional().describe("order: who takes turns, in order; those left out (fallen, fled) take none"),
|
|
55
|
+
now: z.string().optional().describe('open, now: what is happening now, in one line as the player sees it, such as "The bandits overturn the tables"; never what they cannot see'),
|
|
56
|
+
summary: z.string().optional().describe("close: what happened, in one or two sentences, as the player saw it"),
|
|
57
|
+
seen: z.union([textList, z.record(z.string(), z.string())]).optional().describe("open, add: what the character sees of one it does not know by name, by its page or creature, in two or three words, never its kind when that is a secret: "
|
|
58
|
+
+ 'Bandito=brigante incappucciato, or through MCP an object such as {"Varro": "il mugnaio"}'),
|
|
59
|
+
}),
|
|
60
|
+
run(given, context) {
|
|
61
|
+
const root = requireCampaign(context.folder);
|
|
62
|
+
const input = asLists(given);
|
|
63
|
+
checkParameters(input);
|
|
64
|
+
const world = campaignWorld(root, context);
|
|
65
|
+
if (input.action === "close") {
|
|
66
|
+
return close(root, world, input.summary ?? "", context);
|
|
67
|
+
}
|
|
68
|
+
const current = openScene(root);
|
|
69
|
+
if (input.action === "open") {
|
|
70
|
+
return openNew(root, world, input, context, current);
|
|
71
|
+
}
|
|
72
|
+
if (current === undefined) {
|
|
73
|
+
throw new Error("No scene is open: open one with scene open, giving its title and type.");
|
|
74
|
+
}
|
|
75
|
+
switch (input.action) {
|
|
76
|
+
case "now":
|
|
77
|
+
return tellNow(root, input.now ?? "", context, current);
|
|
78
|
+
case "add":
|
|
79
|
+
return addTo(root, world, input, context, current);
|
|
80
|
+
case "leave":
|
|
81
|
+
return withActing(root, context, current, leave(root, world, input.who ?? [], context, current));
|
|
82
|
+
case "hostile":
|
|
83
|
+
case "calm":
|
|
84
|
+
return markHostile(root, input.who ?? [], input.action === "hostile", context, current);
|
|
85
|
+
case "order":
|
|
86
|
+
return withActing(root, context, current, setOrder(root, world, input.order ?? [], context, current));
|
|
87
|
+
case "use":
|
|
88
|
+
return useOfTurn(root, world, input, context, current);
|
|
89
|
+
default:
|
|
90
|
+
return withActing(root, context, current, passTurn(root, world, context, current));
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
format(result) {
|
|
94
|
+
switch (result.action) {
|
|
95
|
+
case "open": {
|
|
96
|
+
const when = result.opened === undefined ? "" : `, ${result.opened}`;
|
|
97
|
+
const where = result.place === undefined ? "" : ` at ${result.place}`;
|
|
98
|
+
const members = result.members.length === 0 ? "No one in it yet: add who is there with scene add." : `In it: ${membersText(result.members)}.`;
|
|
99
|
+
const around = result.around === "" ? undefined : `Here: ${result.around}.`;
|
|
100
|
+
const part = result.part === "" ? undefined : result.part;
|
|
101
|
+
return `Scene opened${when}: ${result.title} (${result.type})${where}. ${members}${broughtText(result, result.place)}${lineOf(around)}${lineOf(part)}`;
|
|
102
|
+
}
|
|
103
|
+
case "add": {
|
|
104
|
+
const last = result.ordered ? " They take their turns last: change the order with scene order if needed." : "";
|
|
105
|
+
const added = result.members.length === 0 ? "" : `Added to ${result.title}: ${membersText(result.members)}.${last}`;
|
|
106
|
+
const seen = result.seen === undefined ? "" : `Seen: ${Object.entries(result.seen).map(([name, said]) => `${name} as ${said}`).join(", ")}.`;
|
|
107
|
+
return `${[added, seen].filter((line) => line !== "").join(" ")}${broughtText(result, result.place)}`;
|
|
108
|
+
}
|
|
109
|
+
case "leave": {
|
|
110
|
+
const turns = result.turns === undefined ? (result.noTurns ? "\nNo one takes turns now." : "") : `\n${turnText(result.turns)}`;
|
|
111
|
+
const left = result.left.map((member) => (Object.keys(member.counters).length === 0 ? member.name : `${member.name} (${countersText(member.counters)})`));
|
|
112
|
+
return `${left.join(", ")} left the scene.${turns}${actingText(result.acting)}${endedText(result.ended)}`;
|
|
113
|
+
}
|
|
114
|
+
case "order":
|
|
115
|
+
return `Order: ${result.order.join(" · ")}.${result.noTurn.length === 0 ? "" : ` No turn: ${result.noTurn.join(", ")}.`}\n${turnText(result)}${actingText(result.acting)}${endedText(result.ended)}`;
|
|
116
|
+
case "next":
|
|
117
|
+
return `${turnText(result)}${actingText(result.acting)}${endedText(result.ended)}`;
|
|
118
|
+
// Who is in it, so that the master sees a scene the story has left (playtest 19): another place or other people make a new one.
|
|
119
|
+
case "now":
|
|
120
|
+
return `${result.title}, with ${result.members.length === 0 ? "no one" : result.members.join(", ")}: the player's dashboard now shows "${result.now}". `
|
|
121
|
+
+ "If the story has moved elsewhere or to other people, close this scene and open the next.";
|
|
122
|
+
case "use":
|
|
123
|
+
return result.line;
|
|
124
|
+
case "hostile":
|
|
125
|
+
case "calm":
|
|
126
|
+
return markedText(result);
|
|
127
|
+
default:
|
|
128
|
+
return closedText(result);
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
/** Lists as lists: one text is a list of one, or of its links when it gives them separated by commas; an empty text, list or object counts as left out (SCN-8). */
|
|
133
|
+
function asLists(given) {
|
|
134
|
+
const items = (texts) => texts.flatMap((text) => linkListItems(text) ?? [text]);
|
|
135
|
+
const list = (value) => {
|
|
136
|
+
if (isEmptyField(value) || (typeof value === "object" && Object.keys(value).length === 0)) {
|
|
137
|
+
return undefined;
|
|
138
|
+
}
|
|
139
|
+
return typeof value === "string" ? items([value]) : Array.isArray(value) ? items(value) : value;
|
|
140
|
+
};
|
|
141
|
+
return { ...given, with: list(given.with), creatures: list(given.creatures), who: list(given.who), order: list(given.order), seen: list(given.seen) };
|
|
142
|
+
}
|
|
143
|
+
function checkParameters(input) {
|
|
144
|
+
const allowed = actionParameters[input.action];
|
|
145
|
+
const given = (name) => {
|
|
146
|
+
const value = input[name];
|
|
147
|
+
return !isEmptyField(value) && !(Array.isArray(value) && value.length === 0) && !(typeof value === "object" && Object.keys(value).length === 0);
|
|
148
|
+
};
|
|
149
|
+
const extra = Object.keys(input).filter((name) => name !== "action" && given(name) && !allowed.includes(name));
|
|
150
|
+
if (extra.length > 0) {
|
|
151
|
+
throw new Error(`scene ${input.action} does not take ${extra.join(", ")}: it takes ${allowed.length === 0 ? "nothing else" : allowed.join(", ")}.`);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
/** The line of what is happening now, which the player's dashboard shows (SCN-11): a public line of the log, out of the diary. */
|
|
155
|
+
function tellNow(root, now, context, current) {
|
|
156
|
+
if (now.trim() === "") {
|
|
157
|
+
throw new Error('Give now: what is happening, in one line as the player sees it, such as "The bandits overturn the tables".');
|
|
158
|
+
}
|
|
159
|
+
updateScene(root, [[["now"], now.trim()]]);
|
|
160
|
+
appendLogEntry(root, newDatedLogEntry(root, context, "scene-now", "public", { title: current.title, now: now.trim() }));
|
|
161
|
+
return { action: "now", title: current.title, now: now.trim(), members: memberNames(current) };
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Marks who attacks the party, or takes the mark off (D-415): only in a fight, and only who is in the scene. The player's dashboard shows it, so that a token
|
|
165
|
+
* changes only when the master says so.
|
|
166
|
+
*/
|
|
167
|
+
function markHostile(root, who, hostile, context, current) {
|
|
168
|
+
if (current.type !== "combat") {
|
|
169
|
+
throw new Error(`${current.title} is a ${current.type} scene: hostile and calm mark who fights in a combat scene. When a fight breaks out, close this one and open one of type combat.`);
|
|
170
|
+
}
|
|
171
|
+
if (who.length === 0) {
|
|
172
|
+
throw new Error(`Give who ${hostile ? "attacks the party" : "stops attacking"}, such as who "Annegato 2".`);
|
|
173
|
+
}
|
|
174
|
+
const members = memberNames(current);
|
|
175
|
+
const marked = [
|
|
176
|
+
...new Set(who.map((name) => {
|
|
177
|
+
const member = sameName(members, parsePageReference(name).name);
|
|
178
|
+
if (member === undefined) {
|
|
179
|
+
throw new Error(`${name} is not in the scene. In it: ${members.length === 0 ? "no one" : members.join(", ")}.`);
|
|
180
|
+
}
|
|
181
|
+
return member;
|
|
182
|
+
})),
|
|
183
|
+
];
|
|
184
|
+
const before = current.hostile ?? [];
|
|
185
|
+
const now = hostile ? [...before, ...marked.filter((name) => !before.includes(name))] : before.filter((name) => !marked.includes(name));
|
|
186
|
+
updateScene(root, [[["hostile"], now.length === 0 ? undefined : now]]);
|
|
187
|
+
appendLogEntry(root, newDatedLogEntry(root, context, "scene-changed", "hidden", { title: current.title, [hostile ? "hostile" : "calm"]: marked }));
|
|
188
|
+
return { action: hostile ? "hostile" : "calm", title: current.title, marked, hostile: now };
|
|
189
|
+
}
|
|
190
|
+
/** "Marked hostile: Annegato 1. Hostile now: Annegato 1, Annegato 2." (D-415). */
|
|
191
|
+
function markedText(result) {
|
|
192
|
+
const now = result.hostile.length === 0 ? "No one is hostile now." : `Hostile now: ${result.hostile.join(", ")}.`;
|
|
193
|
+
return `${result.action === "hostile" ? "Marked hostile" : "Calm"}: ${result.marked.join(", ")}. ${now}`;
|
|
194
|
+
}
|
|
195
|
+
/** "\nMoved into Ossario: Ennio, Lena.", with what that set off, or nothing when no one moved (CON-6). */
|
|
196
|
+
function broughtText(result, place) {
|
|
197
|
+
const moved = result.moved.length === 0 ? [] : [`Moved into ${place ?? "the scene's place"}: ${result.moved.join(", ")}.`];
|
|
198
|
+
return [...moved, ...result.notes].map((line) => `\n${line}`).join("");
|
|
199
|
+
}
|
|
200
|
+
function actingText(acting) {
|
|
201
|
+
return acting === undefined ? "" : `\n${acting}`;
|
|
202
|
+
}
|
|
203
|
+
/** "\nEnded: Spaventato on Annegato 2.", or nothing when no effect ended. */
|
|
204
|
+
function endedText(ended) {
|
|
205
|
+
return ended.length === 0 ? "" : `\nEnded: ${ended.join(" · ")}.`;
|
|
206
|
+
}
|
|
207
|
+
/** A note on a line of its own, or nothing. */
|
|
208
|
+
function lineOf(note) {
|
|
209
|
+
return note === undefined ? "" : `\n${note}`;
|
|
210
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Context } from "../../core/context.ts";
|
|
2
|
+
import { type World } from "../../pages/index.ts";
|
|
3
|
+
import { type Scene } from "../../scene/index.ts";
|
|
4
|
+
import type { SceneInput, SceneResult, Turns } from "./result.ts";
|
|
5
|
+
/** Takes out who goes (D-114): a copy vanishes with its numbers, a character leaves the scene without changing place. The turn of who leaves passes on. */
|
|
6
|
+
export declare function leave(root: string, world: World, who: string[], context: Context, current: Scene): SceneResult;
|
|
7
|
+
/** Who takes turns, in order; those left out take none. A new order in a running scene keeps the round, and the turn if its owner is still in it. */
|
|
8
|
+
export declare function setOrder(root: string, world: World, order: string[], context: Context, current: Scene): SceneResult;
|
|
9
|
+
/** One use of a turn by one in the scene (TRN-1–TRN-3), kept in the scene, with its line in the log. */
|
|
10
|
+
export declare function useOfTurn(root: string, world: World, input: SceneInput, context: Context, current: Scene): SceneResult;
|
|
11
|
+
export declare function passTurn(root: string, world: World, context: Context, current: Scene): SceneResult;
|
|
12
|
+
/**
|
|
13
|
+
* The result of a change of turn, with the effects on who ends the turn and on who starts the next (EFF-15), read after the effects that the turn ends have
|
|
14
|
+
* ended; nothing when the turn stays where it was.
|
|
15
|
+
*/
|
|
16
|
+
export declare function withActing(root: string, context: Context, before: Scene, result: SceneResult): SceneResult;
|
|
17
|
+
/** "Round 2 · now Lena (then Annegato 2).", and on the player's character's turn, to stop there (D-139). */
|
|
18
|
+
export declare function turnText(result: Turns): string;
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { appendLogEntry } from "../../core/log.js";
|
|
2
|
+
import { comparableText, sameName } from "../../core/text.js";
|
|
3
|
+
import { concernsPlayer, findPage, isPlayerCharacter, parsePageReference, playerCharacters, writePage } from "../../pages/index.js";
|
|
4
|
+
import { nextTurn } from "../../scene/index.js";
|
|
5
|
+
import { newStateChecks } from "../shared/campaign/checks.js";
|
|
6
|
+
import { campaignSystem, campaignSystemWords, campaignWorld } from "../shared/campaign/world.js";
|
|
7
|
+
import { packagesTurnStarted } from "../shared/packages/hooks.js";
|
|
8
|
+
import { clearCopies, placeGrid, standing } from "../shared/places/grids.js";
|
|
9
|
+
import { endedByTurn, endEffects, keptBy, systemNamed } from "../shared/scene/effects.js";
|
|
10
|
+
import { turnEffectsNote } from "../shared/scene/reminders.js";
|
|
11
|
+
import { copyCounters, copyPage, readOpenScene, scenePlace, updateScene } from "../shared/scene/scene.js";
|
|
12
|
+
import { effectsOf } from "../shared/sheet/effect-layer.js";
|
|
13
|
+
import { turnUsesOf, useInTurn, usesAtTurn } from "../shared/sheet/turn-uses.js";
|
|
14
|
+
import { newDatedLogEntry } from "../shared/time/time.js";
|
|
15
|
+
import { memberNames } from "./members.js";
|
|
16
|
+
/** Takes out who goes (D-114): a copy vanishes with its numbers, a character leaves the scene without changing place. The turn of who leaves passes on. */
|
|
17
|
+
export function leave(root, world, who, context, current) {
|
|
18
|
+
if (who.length === 0) {
|
|
19
|
+
throw new Error('Give who leaves the scene, such as who "Annegato 2".');
|
|
20
|
+
}
|
|
21
|
+
const members = memberNames(current);
|
|
22
|
+
const leaving = who.map((name) => {
|
|
23
|
+
const member = sameName(members, parsePageReference(name).name);
|
|
24
|
+
if (member === undefined) {
|
|
25
|
+
throw new Error(`${name} is not in the scene. In it: ${members.length === 0 ? "no one" : members.join(", ")}.`);
|
|
26
|
+
}
|
|
27
|
+
return member;
|
|
28
|
+
}).filter((name, index, all) => all.indexOf(name) === index);
|
|
29
|
+
const copies = Object.fromEntries(Object.entries(current.copies).filter(([name]) => leaving.includes(name)));
|
|
30
|
+
const staying = Object.keys(current.copies).filter((name) => !leaving.includes(name));
|
|
31
|
+
const changes = [[["with"], current.with.filter((link) => !leaving.includes(parsePageReference(link).name))]];
|
|
32
|
+
changes.push(...(staying.length === 0 ? [[["copies"], undefined]] : Object.keys(copies).map((name) => [["copies", name], undefined])));
|
|
33
|
+
const order = current.order?.filter((name) => !leaving.includes(name));
|
|
34
|
+
const kept = order === undefined || order.length === 0 ? undefined : keptTurn(current, order);
|
|
35
|
+
const turns = order === undefined || kept === undefined ? undefined : { order, ...kept, player: isPlayerTurn(world, kept.turn), ...severalPlayers(world) };
|
|
36
|
+
if (current.order !== undefined) {
|
|
37
|
+
changes.push([["order"], turns?.order], [["turn"], turns?.turn]);
|
|
38
|
+
if (turns !== undefined) {
|
|
39
|
+
changes.push([["round"], turns.round]);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
changes.push([["left"], [...(current.left ?? []), ...leaving]]);
|
|
43
|
+
// Who leaves is hostile no more (D-415).
|
|
44
|
+
const hostile = current.hostile?.filter((name) => !leaving.includes(name));
|
|
45
|
+
if (current.hostile !== undefined) {
|
|
46
|
+
changes.push([["hostile"], hostile === undefined || hostile.length === 0 ? undefined : hostile]);
|
|
47
|
+
}
|
|
48
|
+
// A copy that leaves, fallen or fled, is kept as it left, without its effects, which go with it (D-145): closing the scene counts what overcoming it gives (DAT-11).
|
|
49
|
+
changes.push(...Object.entries(copies).map(([name, copy]) => [["gone", name], Object.fromEntries(Object.entries(copy).filter(([field]) => field !== "effects"))]));
|
|
50
|
+
updateScene(root, changes);
|
|
51
|
+
clearCopies(world, current, Object.keys(copies));
|
|
52
|
+
// The turn it moves to, as next logs it, so that the open scene's log reads the round (SCN-10).
|
|
53
|
+
const moved = turns === undefined || (turns.turn === current.turn && turns.round === (current.round ?? 1)) ? {} : { round: turns.round, turn: turns.turn };
|
|
54
|
+
appendLogEntry(root, newDatedLogEntry(root, context, "scene-changed", "hidden", { title: current.title, left: leaving, copies: Object.keys(copies).length === 0 ? undefined : copies, ...moved }));
|
|
55
|
+
const left = leaving.map((name) => (name in copies ? { name, counters: copyCounters(world, copies[name]) } : { name, counters: {} }));
|
|
56
|
+
// The copies that left are gone with their effects, and with those they kept alive (D-145); the turn may have passed, and with it the end of some effects.
|
|
57
|
+
const remaining = { ...current, copies: Object.fromEntries(Object.entries(current.copies).filter(([name]) => !leaving.includes(name))) };
|
|
58
|
+
const keptByGone = (effect) => Object.keys(copies).some((name) => keptBy(effect, name));
|
|
59
|
+
const byTurn = (effect) => turns !== undefined && endedByTurn(effect, turns.round, turns.turn, turns.order);
|
|
60
|
+
const ended = endEffects(root, context, world, remaining, (effect) => keptByGone(effect) || byTurn(effect), (effect) => (keptByGone(effect) ? "who kept it left" : "turn"));
|
|
61
|
+
return { action: "leave", left, turns, noTurns: current.order !== undefined && turns === undefined, ended };
|
|
62
|
+
}
|
|
63
|
+
/** Who takes turns, in order; those left out take none. A new order in a running scene keeps the round, and the turn if its owner is still in it. */
|
|
64
|
+
export function setOrder(root, world, order, context, current) {
|
|
65
|
+
const members = memberNames(current);
|
|
66
|
+
const inScene = members.length === 0 ? "no one yet" : members.join(", ");
|
|
67
|
+
const named = order.map((name) => {
|
|
68
|
+
const member = sameName(members, parsePageReference(name).name);
|
|
69
|
+
if (member === undefined) {
|
|
70
|
+
throw new Error(`${name} is not in the scene. In it: ${inScene}.`);
|
|
71
|
+
}
|
|
72
|
+
return member;
|
|
73
|
+
});
|
|
74
|
+
const repeated = named.find((name, index) => named.indexOf(name) !== index);
|
|
75
|
+
if (repeated !== undefined) {
|
|
76
|
+
throw new Error(`${repeated} is in the order twice: give each one once.`);
|
|
77
|
+
}
|
|
78
|
+
if (named.length === 0) {
|
|
79
|
+
throw new Error(`Give who takes turns, in order. In the scene: ${inScene}.`);
|
|
80
|
+
}
|
|
81
|
+
const { round, turn } = keptTurn(current, named);
|
|
82
|
+
updateScene(root, [[["order"], named], [["round"], round], [["turn"], turn]]);
|
|
83
|
+
appendLogEntry(root, newDatedLogEntry(root, context, "scene-changed", "hidden", { title: current.title, order: named }));
|
|
84
|
+
const ended = endEffects(root, context, world, current, (effect) => endedByTurn(effect, round, turn, named), "turn");
|
|
85
|
+
return { action: "order", order: named, round, turn, player: isPlayerTurn(world, turn), ...severalPlayers(world), noTurn: members.filter((name) => !named.includes(name)), ended };
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The round and turn after a new order. A first order starts round 1. In a running scene the round goes on: the turn stays with its owner,
|
|
89
|
+
* or, if they left the order, passes to the next of the old order still in it, or to a new round when no one after them is.
|
|
90
|
+
*/
|
|
91
|
+
function keptTurn(current, named) {
|
|
92
|
+
const round = current.round ?? 1;
|
|
93
|
+
if (current.order === undefined || current.turn === undefined) {
|
|
94
|
+
return { round: 1, turn: named[0] };
|
|
95
|
+
}
|
|
96
|
+
if (named.includes(current.turn)) {
|
|
97
|
+
return { round, turn: current.turn };
|
|
98
|
+
}
|
|
99
|
+
const after = current.order.slice(current.order.indexOf(current.turn) + 1).find((name) => named.includes(name));
|
|
100
|
+
return after === undefined ? { round: round + 1, turn: named[0] } : { round, turn: after };
|
|
101
|
+
}
|
|
102
|
+
/** One use of a turn by one in the scene (TRN-1–TRN-3), kept in the scene, with its line in the log. */
|
|
103
|
+
export function useOfTurn(root, world, input, context, current) {
|
|
104
|
+
const [who, ...others] = input.who ?? [];
|
|
105
|
+
if (who === undefined || input.uses === undefined || input.uses.trim() === "") {
|
|
106
|
+
// The example by the game's own names: a game without uses of a turn has none to give.
|
|
107
|
+
const uses = turnUsesOf(campaignSystem(root, context));
|
|
108
|
+
throw new Error(`Give who and what they use of the turn${uses.length === 0 ? "" : `, one of ${uses.join(", ")}`}.`);
|
|
109
|
+
}
|
|
110
|
+
if (others.length > 0) {
|
|
111
|
+
throw new Error(`One at a time: give who as one name, then use again for ${others.join(", ")}. Nothing changed.`);
|
|
112
|
+
}
|
|
113
|
+
if (current.order === undefined) {
|
|
114
|
+
throw new Error("The scene has no order of turns, so no turn to use: set it with scene order first, after rolling for it if the game does.");
|
|
115
|
+
}
|
|
116
|
+
const name = memberNames(current).find((member) => comparableText(member) === comparableText(parsePageReference(who).name));
|
|
117
|
+
if (name === undefined) {
|
|
118
|
+
throw new Error(`${who} is not in the scene ${current.title}: bring them in with scene add, or give one of ${memberNames(current).join(", ")}.`);
|
|
119
|
+
}
|
|
120
|
+
const copy = current.copies[name];
|
|
121
|
+
const page = copy === undefined ? findPage(world, name) : copyPage(name, copy);
|
|
122
|
+
if (page === undefined) {
|
|
123
|
+
throw new Error(`There is no page named ${name}. Look for it with the find command.`);
|
|
124
|
+
}
|
|
125
|
+
const by = input.by?.trim() === "" ? undefined : input.by?.trim();
|
|
126
|
+
const system = campaignSystem(root, context);
|
|
127
|
+
const done = useInTurn(world, system, current, { name, page }, input.uses.trim(), by);
|
|
128
|
+
updateScene(root, [[["used", name], done.used]]);
|
|
129
|
+
appendLogEntry(root, newDatedLogEntry(root, context, "turn-used", "hidden", { title: current.title, who: name, use: input.uses.trim(), by }));
|
|
130
|
+
// What gave one more, spent from the sheet that counts it (TRN-5).
|
|
131
|
+
if (done.spends !== undefined) {
|
|
132
|
+
spendOne(root, context, world, { name, copy: copy !== undefined, page }, done.spends, by ?? "");
|
|
133
|
+
}
|
|
134
|
+
// One who cannot act, as Stunned, is said so: the game's rule, which the master applies (pp. 91, 358); by its name in the campaign's language too (D-403).
|
|
135
|
+
const words = campaignSystemWords(root, context);
|
|
136
|
+
const inactive = effectsOf(page).map((effect) => effect.name).filter((effect) => systemNamed(system?.combat?.inactive ?? [], effect, words) !== undefined);
|
|
137
|
+
const warned = inactive.length === 0 ? "" : ` ${name} is ${inactive.join(", ")}: read what it may still do.`;
|
|
138
|
+
return { action: "use", line: `${done.line}${warned}` };
|
|
139
|
+
}
|
|
140
|
+
/** One of a counter spent, on a page as it writes it or on a copy in the scene, with its line in the log. */
|
|
141
|
+
function spendOne(root, context, world, who, spends, why) {
|
|
142
|
+
const after = spends.before - 1;
|
|
143
|
+
const value = spends.max === undefined ? after : `${after}/${spends.max}`;
|
|
144
|
+
if (who.copy) {
|
|
145
|
+
updateScene(root, [[["copies", who.name, spends.field], value]]);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
writePage(world, who.page.name, undefined, { set: { [spends.field]: value } });
|
|
149
|
+
}
|
|
150
|
+
// Seen where the player sees the page, as change writes it: never a foe's count.
|
|
151
|
+
const visibility = who.copy || !concernsPlayer(world, who.page) ? "hidden" : "public";
|
|
152
|
+
appendLogEntry(root, newDatedLogEntry(root, context, "counter-changed", visibility, { page: who.name, field: spends.field, before: String(spends.before), after: String(after), why }));
|
|
153
|
+
}
|
|
154
|
+
export function passTurn(root, world, context, current) {
|
|
155
|
+
if (current.order === undefined) {
|
|
156
|
+
throw new Error("The scene has no order of turns: set it with scene order, after rolling for it if the game does.");
|
|
157
|
+
}
|
|
158
|
+
const { turn, round } = nextTurn(current.order, current.turn, current.round ?? 1);
|
|
159
|
+
updateScene(root, [[["round"], round], [["turn"], turn]]);
|
|
160
|
+
appendLogEntry(root, newDatedLogEntry(root, context, "scene-changed", "hidden", { title: current.title, round, turn }));
|
|
161
|
+
const order = current.order;
|
|
162
|
+
const ended = endEffects(root, context, world, current, (effect) => endedByTurn(effect, round, turn, order), "turn");
|
|
163
|
+
return { action: "next", order, round, turn, player: isPlayerTurn(world, turn), ...severalPlayers(world), noTurn: [], ended };
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* The result of a change of turn, with the effects on who ends the turn and on who starts the next (EFF-15), read after the effects that the turn ends have
|
|
167
|
+
* ended; nothing when the turn stays where it was.
|
|
168
|
+
*/
|
|
169
|
+
export function withActing(root, context, before, result) {
|
|
170
|
+
if (result.action !== "leave" && result.action !== "order" && result.action !== "next") {
|
|
171
|
+
return result;
|
|
172
|
+
}
|
|
173
|
+
const turns = result.action === "leave" ? result.turns : result;
|
|
174
|
+
if (turns === undefined || (turns.turn === before.turn && turns.round === (before.round ?? 1))) {
|
|
175
|
+
return result;
|
|
176
|
+
}
|
|
177
|
+
// A turn that begins gives back what its one used, and every turn what lasts only a turn (TRN-4).
|
|
178
|
+
const used = readOpenScene(root).scene?.used;
|
|
179
|
+
if (used !== undefined) {
|
|
180
|
+
updateScene(root, [[["used"], usesAtTurn(campaignSystem(root, context), used, turns.turn)]]);
|
|
181
|
+
}
|
|
182
|
+
const world = campaignWorld(root, context);
|
|
183
|
+
const system = campaignSystem(root, context);
|
|
184
|
+
const scene = readOpenScene(root).scene;
|
|
185
|
+
const effects = turnEffectsNote(world, scene, before.turn, turns.turn);
|
|
186
|
+
// The player character's turn reminds what to mark of it, which the player sees on the dashboard (TRN-1); a companion's counts went right without (playtest
|
|
187
|
+
// 08); dying, the death save it starts with (DIE-5).
|
|
188
|
+
const member = findPage(world, turns.turn);
|
|
189
|
+
const turn = packagesTurnStarted(root, context, turns.turn);
|
|
190
|
+
const dying = turn.lines.join(" ");
|
|
191
|
+
// Who cannot act, as one stable but still Unconscious, marks nothing.
|
|
192
|
+
const words = campaignSystemWords(root, context);
|
|
193
|
+
const inactive = member !== undefined && effectsOf(member).some((effect) => systemNamed(system?.combat?.inactive ?? [], effect.name, words) !== undefined);
|
|
194
|
+
const pc = member !== undefined && isPlayerCharacter(member);
|
|
195
|
+
const uses = !pc || dying !== "" || inactive ? [] : turnUsesOf(system);
|
|
196
|
+
const mark = uses.length > 0 ? `Mark with scene use what ${turns.turn} uses of the turn, as it happens: ${uses.join(", ")}.` : "";
|
|
197
|
+
// Notes written between the calls of another's turn reached the player (playtests 06, 08, 09, 11).
|
|
198
|
+
const quiet = pc ? "" : "Write nothing until the round is told: what you work out stays in your thinking.";
|
|
199
|
+
// What cannot be true together, once in a chat, after the system's code had its say (CHK-3).
|
|
200
|
+
const checks = newStateChecks(root, context).join(" ");
|
|
201
|
+
// The extensions' lines come after the engine's reminder, which only the system's take the place of (D-514).
|
|
202
|
+
const acting = [effects, dying, mark, ...turn.added, offTheMap(world, scene, turns.turn), turn.problem ?? "", checks, quiet].filter((line) => line !== "").join(" ");
|
|
203
|
+
return acting === "" ? result : { ...result, acting };
|
|
204
|
+
}
|
|
205
|
+
/** Who acts and stands on no square of the scene's map, when its place has one (GRD-3, playtest 07): where it stands decides reach, cover and the way. */
|
|
206
|
+
function offTheMap(world, scene, name) {
|
|
207
|
+
const place = scenePlace(world, scene);
|
|
208
|
+
if (place === undefined || placeGrid(place) === undefined || standing(world, place, scene).some((one) => sameName([one.name], name) !== undefined && one.square !== undefined)) {
|
|
209
|
+
return "";
|
|
210
|
+
}
|
|
211
|
+
return `${name} is not on the map of ${place.name}: put it on its square with move ${name} --at, such as E4, before telling its turn.`;
|
|
212
|
+
}
|
|
213
|
+
/** "Round 2 · now Lena (then Annegato 2).", and on the player's character's turn, to stop there (D-139). */
|
|
214
|
+
export function turnText(result) {
|
|
215
|
+
const then = result.order.length > 1 ? nextTurn(result.order, result.turn, 1).turn : undefined;
|
|
216
|
+
const now = !result.player ? result.turn : result.several === true ? `${result.turn}, a player character` : `${result.turn}, the player's character`;
|
|
217
|
+
// With more than one, a message that already said what this one does goes on (D-480 (5)).
|
|
218
|
+
const stop = !result.player ? "." : result.several === true ? `: stop here and hand ${result.turn} the turn, by name, unless the player already said what ${result.turn} does.` : ": stop here and hand them the turn.";
|
|
219
|
+
return `Round ${result.round} · now ${now}${then === undefined ? "" : ` (then ${then})`}${stop}`;
|
|
220
|
+
}
|
|
221
|
+
/** Whether more than one player character is alive, each handed their turn by name (D-480 (5)). */
|
|
222
|
+
function severalPlayers(world) {
|
|
223
|
+
return playerCharacters(world).filter((page) => page.fields.status !== "dead").length > 1 ? { several: true } : {};
|
|
224
|
+
}
|
|
225
|
+
/** Whether the turn is the player's character's, which only the player plays; a dead one's is no one's. */
|
|
226
|
+
function isPlayerTurn(world, name) {
|
|
227
|
+
const page = findPage(world, name);
|
|
228
|
+
return page !== undefined && isPlayerCharacter(page) && page.fields.status !== "dead";
|
|
229
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { AdventureFiles } from "../../../adventures/index.ts";
|
|
2
|
+
import type { Context } from "../../../core/context.ts";
|
|
3
|
+
import { type Page, type PageType, type World } from "../../../pages/index.ts";
|
|
4
|
+
/** A page of the game system a layer changed, or changes no more, as the master hears it. */
|
|
5
|
+
export interface LayeredPage {
|
|
6
|
+
page: string;
|
|
7
|
+
type?: PageType;
|
|
8
|
+
}
|
|
9
|
+
/** A layer of the adventure that did not come in, since the campaign has its own over the page: the fields it gave, each with its value, and the text it wrote. */
|
|
10
|
+
export interface LayerKept {
|
|
11
|
+
page: string;
|
|
12
|
+
fields: Record<string, string>;
|
|
13
|
+
sections: string[];
|
|
14
|
+
introduction: boolean;
|
|
15
|
+
}
|
|
16
|
+
/** What an adventure's layers did in the campaign (ADV-8). */
|
|
17
|
+
export interface LayersInstalled {
|
|
18
|
+
/** The pages of the game system they change now. */
|
|
19
|
+
changed: LayeredPage[];
|
|
20
|
+
/** Those left out, over a page the campaign has its own layer on. */
|
|
21
|
+
kept: LayerKept[];
|
|
22
|
+
/** Those left out, over no page of the system in the rules the campaign plays, by the name of the page each is for. */
|
|
23
|
+
stray: string[];
|
|
24
|
+
}
|
|
25
|
+
/** Why a layer of the campaign stays out of an export: over no page, not read, writing what a layer never changes, or brought by an adventure and not changed since. */
|
|
26
|
+
export interface LayerLeftOut {
|
|
27
|
+
name: string;
|
|
28
|
+
why: "no-page" | "unread" | "forbidden" | "adventure";
|
|
29
|
+
}
|
|
30
|
+
/** The campaign's layers an export carries, by their path in the .zip, with the pages they change, those from the player's documents, and those that stay out. */
|
|
31
|
+
export interface LayersExported {
|
|
32
|
+
carried: Record<string, Uint8Array>;
|
|
33
|
+
pages: LayeredPage[];
|
|
34
|
+
sourced: string[];
|
|
35
|
+
leftOut: LayerLeftOut[];
|
|
36
|
+
}
|
|
37
|
+
/** The layers of an install worked out before a file is written. */
|
|
38
|
+
export interface LayersPlan {
|
|
39
|
+
writes: {
|
|
40
|
+
path: string;
|
|
41
|
+
bytes: Uint8Array;
|
|
42
|
+
}[];
|
|
43
|
+
/** Every layer the adventure has in the campaign, written now or already there the same, by its file, with the print of its text: what taking it out compares. */
|
|
44
|
+
prints: Record<string, string>;
|
|
45
|
+
/** The pages of the system the layers written now change, as they were, each with the fields its layer gives. */
|
|
46
|
+
changed: {
|
|
47
|
+
page: Page;
|
|
48
|
+
fields: string[];
|
|
49
|
+
}[];
|
|
50
|
+
kept: LayerKept[];
|
|
51
|
+
stray: string[];
|
|
52
|
+
problems: string[];
|
|
53
|
+
}
|
|
54
|
+
/** The layers that go with an adventure taken out, the pages of the system they lay over as they were, and those changed since, which stay. */
|
|
55
|
+
export interface LayersRemoval {
|
|
56
|
+
paths: string[];
|
|
57
|
+
changed: Page[];
|
|
58
|
+
kept: string[];
|
|
59
|
+
}
|
|
60
|
+
/** The layers a line of the log says an adventure brought, by their file, each with the print of its text. */
|
|
61
|
+
export declare function layerPrints(value: unknown): Record<string, string>;
|
|
62
|
+
/**
|
|
63
|
+
* The campaign's layers as they are now, for an export (ADV-8): each over a page of the system goes, at the page's path; one over no page, one that does not read or
|
|
64
|
+
* writes what a layer never changes, and one an installed adventure brought and no one changed since stay out, by name. `brought` are the layers of the adventures installed.
|
|
65
|
+
*/
|
|
66
|
+
export declare function layersToExport(root: string, world: World, system: string, brought: Record<string, string>[]): LayersExported;
|
|
67
|
+
/**
|
|
68
|
+
* Where each layer of an adventure goes (ADV-8): at its page's path in the campaign's layers. One over a page the campaign has its own layer on stays out, with what it
|
|
69
|
+
* would have given, unless the two are the same; one over no page of the rules the campaign plays stays out; one that does not read, or writes what a layer never
|
|
70
|
+
* changes, is a problem.
|
|
71
|
+
*/
|
|
72
|
+
export declare function planLayers(root: string, world: World, adventure: AdventureFiles): LayersPlan;
|
|
73
|
+
/**
|
|
74
|
+
* The layers that go with an adventure taken out (ADV-8): those still as it wrote them. One changed since, with write or by hand, stays the campaign's, by the name of
|
|
75
|
+
* its page; one already gone is skipped; one another adventure of the campaign brought the same stays with that one. `others` are the layers of the other adventures.
|
|
76
|
+
*/
|
|
77
|
+
export declare function layersToRemove(root: string, world: World, brought: Record<string, string>, others: Record<string, string>[]): LayersRemoval;
|
|
78
|
+
/**
|
|
79
|
+
* Refuses to bring an adventure in, or take it out, while the open scene holds copies of a page whose fields its layers change (INH-10), as write with layer does.
|
|
80
|
+
* Said without the page and its copies: the player reads it too, adding an adventure on the dashboard, and the remedy is the same.
|
|
81
|
+
*/
|
|
82
|
+
export declare function checkLayersNotCopied(root: string, world: World, title: string, doing: "installed" | "taken out", pages: Page[]): void;
|
|
83
|
+
/**
|
|
84
|
+
* One public line for each counter of the player's party that changed with the pages of the system an adventure's layers came over, or went from (INH-11), as write
|
|
85
|
+
* with layer writes them. `before` is the world as it was, and `pages` those pages in it; a page that was not there then, as one the adventure brings, changed nothing.
|
|
86
|
+
*/
|
|
87
|
+
export declare function logLayerCounters(root: string, context: Context, before: World, pages: Page[]): void;
|
|
88
|
+
/** The pages of the system as the master hears them changed: each by its name, with its type. */
|
|
89
|
+
export declare function changedPages(pages: Page[]): LayeredPage[];
|