diff --git a/core/builder.gd b/core/builder.gd index 7cf0810..1e74181 100644 --- a/core/builder.gd +++ b/core/builder.gd @@ -415,6 +415,10 @@ static func known_values(board: TowerBoard) -> Array[Dictionary]: var reads: Array = [] var chain := {} for t in board.tables: + for col: Dictionary in t.columns: + if str(col.get("save_as", "")) != "": + add.call(_value_name(str(col["save_as"])), "text", "save_as", t.id) + reads.append([str(col.get("when", "")), t.id]) match t.kind: RollTable.KIND_CHOICE: if t.choice != "pick": diff --git a/tests/test_book_tables.gd b/tests/test_book_tables.gd index 411e53d..b83e752 100644 --- a/tests/test_book_tables.gd +++ b/tests/test_book_tables.gd @@ -224,6 +224,10 @@ func _test_lint() -> void: b.tables.append(s) msgs = Roller.lint_pipes(b).map(func(i: Dictionary) -> String: return str(i["message"])) _check(msgs.any(func(m: String) -> bool: return m.contains("two steps")), "lint: a one-step scale") + var b2 := TowerBoard.new() + b2.tables.append(_type_card(RollTable.COLUMNS_EACH)) + var names := Builder.known_values(b2).map(func(v: Dictionary) -> String: return str(v["name"])) + _check(names.has("@water") and names.has("@life"), "column save names are known values: %s" % str(names)) _eq(Dice.roll_problem("3d10+70"), "", "plain dice roll") _eq(Dice.roll_problem("2d6 + @luck"), "", "a rule with dice rolls") _eq(Dice.roll_problem("bogus"), "it doesn't roll any dice", "a word isn't dice")