- ChoiceDialog: card-styled pop-up for pick (option rows with details, Random,
1-9 / R keys), number (spin box with min/max/default, Enter) and text.
Cancel, Esc, freeing the dialog, a new roll or a collection switch all
answer null through a separate Reply object, so a roll never hangs.
- Main: real prompt hook; the steps so far light on the board and in the
tray before each question; a roll with questions shows the rest at once;
a new roll cancels an open question cleanly; refresh_live() re-renders
variable, sheet and question text only after rolls and edits.
- TableCard: "?" badge and question for choice cards, loop icon, rule chip
and Each time / Afterwards rows, compact live variable cards (reset in
Build), live sheet cards with one outlet, expression-dice subtitles,
effect chips in Play and a validated effects editor in Build.
- Build: "+ Table" menu for every kind; kind-specific settings (choice type,
question, save as, min/max; loop mode and rule; variable name, type,
starting value; sheet template) checked with Expr.check; expression pipe
counts in the pipe popover and on pipe labels.
- Tray: effect lines under chips, last 12 steps behind "+N earlier steps",
sheet headline, Cancelled / action-limit pill, capped indents and Earlier
rows; Variables tab lists every board variable with Reset all.
- RichText: error markers in red; previews show {@x_*} and {= expr}.
- examples/logic_demo.json and tests/test_logic_ui.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
144 lines
3.8 KiB
JSON
144 lines
3.8 KiB
JSON
{
|
|
"format_version": 2,
|
|
"id": "logic-demo",
|
|
"name": "Logic demo",
|
|
"tables": [
|
|
{
|
|
"id": "start",
|
|
"name": "Start a delve",
|
|
"x": 40,
|
|
"y": 40,
|
|
"details": "Click the die to send a new delver down the stairs. It resets the variables, then asks two questions.",
|
|
"entries": [
|
|
{
|
|
"id": "e1",
|
|
"text": "A new delver steps up",
|
|
"effects": "reset @hp; reset @gold; reset @luck; reset @loot",
|
|
"pipes": ["name_q"]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "v_hp",
|
|
"name": "Hit points",
|
|
"kind": "variable",
|
|
"x": 40,
|
|
"y": 640,
|
|
"details": "Traps and fights take these away.",
|
|
"var_name": "hp",
|
|
"initial": "10",
|
|
"entries": []
|
|
},
|
|
{
|
|
"id": "v_gold",
|
|
"name": "Gold",
|
|
"kind": "variable",
|
|
"x": 360,
|
|
"y": 640,
|
|
"var_name": "gold",
|
|
"initial": "0",
|
|
"entries": []
|
|
},
|
|
{
|
|
"id": "v_luck",
|
|
"name": "Luck",
|
|
"kind": "variable",
|
|
"x": 680,
|
|
"y": 640,
|
|
"details": "Added to every room check.",
|
|
"var_name": "luck",
|
|
"initial": "0",
|
|
"entries": []
|
|
},
|
|
{
|
|
"id": "v_loot",
|
|
"name": "Loot",
|
|
"kind": "variable",
|
|
"x": 1000,
|
|
"y": 640,
|
|
"var_name": "loot",
|
|
"var_type": "list",
|
|
"entries": []
|
|
},
|
|
{
|
|
"id": "name_q",
|
|
"name": "Name your delver",
|
|
"kind": "choice",
|
|
"choice": "text",
|
|
"prompt": "Who goes down the stairs?",
|
|
"save_as": "@name",
|
|
"x": 360,
|
|
"y": 40,
|
|
"entries": [
|
|
{ "id": "e1", "text": "Answer", "pipes": ["rooms_q"] }
|
|
]
|
|
},
|
|
{
|
|
"id": "rooms_q",
|
|
"name": "How many rooms?",
|
|
"kind": "choice",
|
|
"choice": "number",
|
|
"prompt": "[b]{@name}[/b] studies the map. How many rooms will they try?",
|
|
"save_as": "@rooms",
|
|
"min": "1",
|
|
"max": "5",
|
|
"x": 360,
|
|
"y": 270,
|
|
"entries": [
|
|
{ "id": "e1", "text": "Answer", "pipes": ["explore"] }
|
|
]
|
|
},
|
|
{
|
|
"id": "explore",
|
|
"name": "Explore",
|
|
"kind": "loop",
|
|
"loop_expr": "@rooms",
|
|
"x": 680,
|
|
"y": 40,
|
|
"details": "One room check per room the player chose, then the way out.",
|
|
"entries": [
|
|
{ "id": "e1", "text": "Room {i}", "pipes": ["room_check"] },
|
|
{ "id": "e2", "text": "Head back up", "pipes": ["way_out"] }
|
|
]
|
|
},
|
|
{
|
|
"id": "room_check",
|
|
"name": "Room check",
|
|
"x": 1000,
|
|
"y": 40,
|
|
"dice": "2d6 + @luck",
|
|
"details": "2d6 plus Luck. Low rolls hurt, high rolls pay.",
|
|
"entries": [
|
|
{ "id": "e1", "text": "A trap snaps shut", "effects": "@hp -= 2", "range": [2, 6] },
|
|
{ "id": "e2", "text": "Dust and echoes", "range": [7, 9] },
|
|
{ "id": "e3", "text": "A glinting cache", "effects": "@gold += 2d6\n@loot += \"gem\"", "range": [10, 12] }
|
|
]
|
|
},
|
|
{
|
|
"id": "way_out",
|
|
"name": "Way out",
|
|
"kind": "choice",
|
|
"prompt": "{@name} has {@gold} gold and {@hp} HP left. How do they leave?",
|
|
"x": 680,
|
|
"y": 330,
|
|
"entries": [
|
|
{ "id": "e1", "text": "Sneak past the guard", "details": "Quiet and slow. Luck grows.", "effects": "@luck += 1", "pipes": ["report"] },
|
|
{ "id": "e2", "text": "Fight through", "details": "Costs some blood.", "effects": "@hp -= 1d3", "pipes": ["report"] },
|
|
{ "id": "e3", "text": "Pay the toll", "details": "Ten gold, if they have it.", "effects": "@gold -= min(@gold, 10)", "pipes": ["report"] }
|
|
]
|
|
},
|
|
{
|
|
"id": "report",
|
|
"name": "Delve report",
|
|
"kind": "sheet",
|
|
"x": 1000,
|
|
"y": 330,
|
|
"entries": [
|
|
{
|
|
"id": "e1",
|
|
"text": "[b]{@name}[/b] the delver\nRooms tried: {@rooms}\nHP {@hp} · Gold {@gold} · Luck {@luck}\nLoot: {@loot}\nScore: {= @gold + @hp * 5}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|