84 lines
5.8 KiB
GDScript3
84 lines
5.8 KiB
GDScript3
|
|
class_name SampleBoard
|
||
|
|
extends RefCounted
|
||
|
|
## The example board: road encounters, loot chains, a d100 ranged travel table
|
||
|
|
## and a d100 table of 100 unique trinkets.
|
||
|
|
|
||
|
|
const TRINKETS := [
|
||
|
|
"A brass key that's warm to the touch", "A glass eye that follows movement", "A tin whistle only dogs can hear", "A pressed flower that never wilts",
|
||
|
|
"A tiny portrait of a stranger", "A compass that points to the nearest well", "A wooden die with seven sides", "A silver spoon bent into a ring",
|
||
|
|
"A sealed letter addressed to you", "A bell with no clapper that still rings", "A jar of buttons from a hundred coats", "A dragon scale the size of a coin",
|
||
|
|
"A candle that burns cold", "A deck of cards missing every queen", "A bird skull painted gold", "A map of a city that doesn't exist",
|
||
|
|
"A thimble of sand that never spills", "A ribbon embroidered with your name", "A clockwork beetle that wants winding", "A pebble that is always wet",
|
||
|
|
"A fishhook carved from bone", "A coin from a kingdom that fell", "A lock of silver hair tied with string", "A broken hourglass, sand still falling",
|
||
|
|
"A soup recipe written in blood", "A doll with one button eye", "A chess piece shaped like a crow", "A vial of fog",
|
||
|
|
"A tooth with a tiny keyhole", "A feather that falls upward", "An empty locket that hums", "A spool of thread that never runs out",
|
||
|
|
"A ring too small for any finger", "A wax seal of a three-eyed owl", "A shell that whispers in a strange tongue", "A rusted crown sized for a cat",
|
||
|
|
"A knot no blade can cut", "A page torn from a spellbook", "A marble with a storm inside", "A tiny saddle for a mouse",
|
||
|
|
"A mirror shard that shows yesterday", "A reed flute that plays by itself", "A holed stone that shows stars at noon", "A child's drawing of you",
|
||
|
|
"A spice tin of dried fireflies", "A wooden sword notched for every win", "A pair of dice that always roll the same", "An acorn that grows back each night",
|
||
|
|
"A tarnished medal for bravery", "A bottle with a ship of bones inside", "A glove that's always warm", "A bookmark from a library that burned",
|
||
|
|
"A walnut that rattles", "A copper ring stamped with a moon", "A lantern wick that relights itself", "A painted egg that is far too heavy",
|
||
|
|
"A bag of salt from a distant sea", "A wanted poster with no face", "A spinning top that never falls", "A snuff box full of teeth",
|
||
|
|
"A crystal that glows near goblins", "A riddle carved into a spoon handle", "A scarf that smells of summer rain", "A key with no teeth",
|
||
|
|
"A thumb-sized statue of a sleeping god", "A bone flute with one hole", "An inkwell that refills with black water", "A quill that writes only in red",
|
||
|
|
"A pocket watch running backwards", "A wedding ring with both names scratched out", "An eggshell painted with a map", "A pouch of mismatched dice",
|
||
|
|
"A tinderbox that sparks blue", "A prayer bead from an unknown faith", "A playing card with your face on it", "A cracked monocle",
|
||
|
|
"A tiny cage with the door open", "A pressed four-leaf clover", "A seashell found far inland", "A gold tooth",
|
||
|
|
"A badge from the city watch", "A charm bracelet with one charm missing", "A bundle of letters tied with twine", "A chip of a giant's fingernail",
|
||
|
|
"A rope that ties itself", "A stone that floats", "A song trapped in a bottle", "A carved wooden fish",
|
||
|
|
"A toy soldier missing an arm", "A coin that always lands on its edge", "A candle stub that smells of home", "A brooch shaped like a spider",
|
||
|
|
"A sliver of moonlight in a vial", "An arrowhead made of glass", "A dried rose from a grave", "A bone die marked with runes",
|
||
|
|
"A tiny shield with an unknown crest", "A horseshoe for a six-legged horse", "A note: “Don't trust the innkeeper”", "An egg that is warm and ticking",
|
||
|
|
]
|
||
|
|
|
||
|
|
|
||
|
|
static func create() -> TowerBoard:
|
||
|
|
var trinket_rows: Array = []
|
||
|
|
for s in TRINKETS:
|
||
|
|
trinket_rows.append([s])
|
||
|
|
# [id, name, position, entries: [text, pipes?, range?], options?]
|
||
|
|
var spec: Array = [
|
||
|
|
["wilderness", "Wilderness Travel", Vector2(40, 180), [
|
||
|
|
["Travelers on the road", ["road"], [1, 30]],
|
||
|
|
["Beasts on the hunt", ["monsters"], [31, 50]],
|
||
|
|
["A peddler's cart", ["wares"], [51, 65]],
|
||
|
|
["Something glints in the grass", ["loot"], [66, 80]],
|
||
|
|
["A stranger at the campfire", ["names"], [81, 95]],
|
||
|
|
["An odd find", ["trinkets"], [96, 100]],
|
||
|
|
], {"die": 100}],
|
||
|
|
["road", "Road Encounter", Vector2(390, 40), [
|
||
|
|
["Bandits ambush the party", ["loot"]], ["A merchant caravan", ["wares"]],
|
||
|
|
["Something big in the trees", ["monsters"]], ["A quiet stretch of road"],
|
||
|
|
["A sudden storm rolls in"], ["A lost traveler", ["names"]],
|
||
|
|
]],
|
||
|
|
["trinkets", "Curious Trinkets", Vector2(390, 420), trinket_rows, {"collapsed": true}],
|
||
|
|
["monsters", "Monsters", Vector2(740, 20), [["Owlbear", ["loot"]], ["Giant spider"], ["Troll", ["loot"]], ["Wyvern"]]],
|
||
|
|
["wares", "Merchant Wares", Vector2(740, 300), [["Bolts of silk"], ["Rare spices"], ["Lamp oil"], ["A crate of strange eggs"]]],
|
||
|
|
["loot", "Loot", Vector2(1090, 60), [
|
||
|
|
["A pouch of gold"], ["A weapon", ["weapons"]], ["A healing potion"],
|
||
|
|
["A torn map"], ["A gemstone"], ["Nothing but lint"],
|
||
|
|
]],
|
||
|
|
["names", "Traveler Names", Vector2(1090, 400), [["Aldric"], ["Brenna"], ["Corvin"], ["Dagny"], ["Elowen"], ["Fenn"]]],
|
||
|
|
["weapons", "Weapons", Vector2(1440, 60), [["Dagger"], ["Sword", ["quality"]], ["Hand axe"], ["Shortbow"]]],
|
||
|
|
["quality", "Sword Quality", Vector2(1790, 130), [["Rusty"], ["Notched"], ["Fine"], ["Elven-forged"]]],
|
||
|
|
]
|
||
|
|
var board := TowerBoard.new()
|
||
|
|
for s in spec:
|
||
|
|
var t := RollTable.new(s[0], s[1])
|
||
|
|
t.position = s[2]
|
||
|
|
var opts: Dictionary = s[4] if s.size() > 4 else {}
|
||
|
|
t.die = int(opts.get("die", 0))
|
||
|
|
t.collapsed = bool(opts.get("collapsed", false))
|
||
|
|
for row in s[3]:
|
||
|
|
var e := TableEntry.new(TowerBoard.new_id("e"), row[0])
|
||
|
|
if row.size() > 1:
|
||
|
|
for p in row[1]:
|
||
|
|
e.pipes.append(p)
|
||
|
|
if row.size() > 2:
|
||
|
|
e.has_range = true
|
||
|
|
e.range_lo = row[2][0]
|
||
|
|
e.range_hi = row[2][1]
|
||
|
|
t.entries.append(e)
|
||
|
|
board.tables.append(t)
|
||
|
|
return board
|