summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gay <eapoems@riseup.net>2023-10-01 23:23:39 -0400
committerDavid Gay <eapoems@riseup.net>2023-10-01 23:23:39 -0400
commit0f3c03ceace46deab3097c99e82284c617cc9277 (patch)
tree92b6eb4e7b1707a4ec8910c165c91ff8cd1079c5
parentb0d5fa74b616e5144be8e92653084bbfa73bc8a3 (diff)
Add a table step to the ua_magic_items
-rw-r--r--src/data/random_tables/ua_magic_items.yaml11
-rw-r--r--src/random_tables.rs2
2 files changed, 13 insertions, 0 deletions
diff --git a/src/data/random_tables/ua_magic_items.yaml b/src/data/random_tables/ua_magic_items.yaml
index f0f9030..1ec9468 100644
--- a/src/data/random_tables/ua_magic_items.yaml
+++ b/src/data/random_tables/ua_magic_items.yaml
@@ -4,6 +4,7 @@ ua_magic_items:
- roll: 1-20
steps:
- text: "Potion"
+ table: ua_potions
- roll: 21-35
steps:
- text: "Scroll"
@@ -22,3 +23,13 @@ ua_magic_items:
- roll: 87-100
steps:
- text: "Miscellaneous Weapons"
+
+ua_potions:
+ formula: d100
+ rows:
+ - roll: 1-65
+ steps:
+ - text: "Table 1"
+ - roll: 66-100
+ steps:
+ - text: "Table 2"
diff --git a/src/random_tables.rs b/src/random_tables.rs
index c1ffdcb..1d9df02 100644
--- a/src/random_tables.rs
+++ b/src/random_tables.rs
@@ -65,6 +65,8 @@ impl RandomTables {
String::new()
}
+ // TODO: Add validator somewhere that ensures all possible rolls are
+ // covered by the YAML, and that none overlap.
fn parse_roll(roll: &str) -> Option<(u32, u32)> {
let parts: Vec<&str> = roll.split('-').collect();
match parts.len() {