Pick choice cards can take their options from variables (options_from:
@prefix_* or a @list, filtered by options_where with option, option_label
and option_value bound). A Chosen entry runs for whichever dynamic option
is picked; fixed entries stay as extras, listed first. Random weighs each
dynamic option as the Chosen entry and fixed ones by weight. Any pick
option can have show_if, which hides it from the pop-up and from Random;
with nothing offered the node stops with "No options available".
@[expr] reads or writes the variable named by expr in expressions,
effects (including reset) and text ({@[expr]}); bad computed names are
effect errors. JSON round trip, lint_options in lint_pipes, choice
pop-up value badges and previews, card and settings UI, docs, demo board
(Spend a find) and tests/test_options.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
172 lines
5.4 KiB
JSON
172 lines
5.4 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": ["climb"] }
|
|
]
|
|
},
|
|
{
|
|
"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 += if(1d6 <= 3, \"gem\", if(1d6 <= 3, \"silver idol\", \"old map\"))", "range": [10, 12] }
|
|
]
|
|
},
|
|
{
|
|
"id": "climb",
|
|
"name": "On the way up",
|
|
"kind": "router",
|
|
"x": 680,
|
|
"y": 330,
|
|
"details": "Checks the delver's state once, top to bottom: the first case that's true is the one that happens.",
|
|
"entries": [
|
|
{ "id": "e1", "text": "Carried up by a passing patrol", "when": "@hp <= 0", "effects": "@hp = 1", "pipes": ["report"] },
|
|
{ "id": "e2", "text": "Pockets heavy with gold", "when": "@gold >= 12", "details": "The guard at the top has noticed.", "pipes": ["way_out"] },
|
|
{ "id": "e3", "text": "Up the stairs", "pipes": [{ "table": "spend_find", "when": "@loot != \"\"" }, { "table": "way_out", "otherwise": true }] }
|
|
]
|
|
},
|
|
{
|
|
"id": "spend_find",
|
|
"name": "Spend a find",
|
|
"kind": "choice",
|
|
"prompt": "A shrine at the foot of the stairs. Leave one of your finds for luck?",
|
|
"options_from": "@loot",
|
|
"x": 1320,
|
|
"y": 640,
|
|
"details": "One option per item in Loot, plus two fixed ones. The last is only offered to a wounded delver.",
|
|
"entries": [
|
|
{ "id": "e1", "text": "Left the {option} at the shrine", "details": "Luck grows by one.", "effects": "@loot -= option\n@luck += 1", "pipes": ["way_out"] },
|
|
{ "id": "e2", "text": "Keep everything", "pipes": ["way_out"] },
|
|
{ "id": "e3", "text": "Trade it all for a healing draught", "show_if": "@hp <= 6", "details": "Only offered when HP is 6 or less.", "effects": "reset @loot\n@hp += 4", "pipes": ["way_out"] }
|
|
]
|
|
},
|
|
{
|
|
"id": "way_out",
|
|
"name": "Way out",
|
|
"kind": "choice",
|
|
"prompt": "{@name} has {@gold} gold and {@hp} HP left. How do they leave?",
|
|
"x": 1000,
|
|
"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": 1320,
|
|
"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}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|