Value pickers list the values columns save
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
03bc168756
commit
0e45ea7abc
2 changed files with 8 additions and 0 deletions
|
|
@ -415,6 +415,10 @@ static func known_values(board: TowerBoard) -> Array[Dictionary]:
|
||||||
var reads: Array = []
|
var reads: Array = []
|
||||||
var chain := {}
|
var chain := {}
|
||||||
for t in board.tables:
|
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:
|
match t.kind:
|
||||||
RollTable.KIND_CHOICE:
|
RollTable.KIND_CHOICE:
|
||||||
if t.choice != "pick":
|
if t.choice != "pick":
|
||||||
|
|
|
||||||
|
|
@ -224,6 +224,10 @@ func _test_lint() -> void:
|
||||||
b.tables.append(s)
|
b.tables.append(s)
|
||||||
msgs = Roller.lint_pipes(b).map(func(i: Dictionary) -> String: return str(i["message"]))
|
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")
|
_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("3d10+70"), "", "plain dice roll")
|
||||||
_eq(Dice.roll_problem("2d6 + @luck"), "", "a rule with dice rolls")
|
_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")
|
_eq(Dice.roll_problem("bogus"), "it doesn't roll any dice", "a word isn't dice")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue