summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Gay <eapoems@riseup.net>2023-10-02 03:34:44 -0400
committerDavid Gay <eapoems@riseup.net>2023-10-02 03:34:44 -0400
commit958dbb4919bd51b9d34a94eab1c7cbe741a502d5 (patch)
tree69a799b3d229da63e847a82ab958bfe59bbbe02b /src
parent7040967f59325ea38e336efd6046ca3725fb35c5 (diff)
Magic maps and random magic command
Diffstat (limited to 'src')
-rw-r--r--src/cli.rs4
-rw-r--r--src/data/random_tables/magic_items.yaml17
-rw-r--r--src/data/random_tables/ua_magic_items.yaml14
-rw-r--r--src/main.rs4
4 files changed, 36 insertions, 3 deletions
diff --git a/src/cli.rs b/src/cli.rs
index 005786b..05256f3 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -12,7 +12,9 @@ pub fn cli() -> Command {
.about("Generates a random something")
.args_conflicts_with_subcommands(true)
.subcommand(Command::new("henchman")
- .about("Generates a random henchman")),
+ .about("Generates a random henchman"))
+ .subcommand(Command::new("magic")
+ .about("Generates a magic item")),
)
.subcommand(Command::new("roll")
.about("Rolls dice based on a given formula")
diff --git a/src/data/random_tables/magic_items.yaml b/src/data/random_tables/magic_items.yaml
index c5fa2ae..7ed6ddc 100644
--- a/src/data/random_tables/magic_items.yaml
+++ b/src/data/random_tables/magic_items.yaml
@@ -1,3 +1,20 @@
+magic_maps:
+ formula: d100
+ rows:
+ - roll: 1-5
+ steps:
+ - text: "Map (false)"
+ - roll: 6-70
+ steps:
+ - text: "Map (monetary treasure)"
+ - roll: 71-90
+ steps:
+ - text: "Map (magic treasure)"
+ - roll: 91-100
+ steps:
+ - text: "Map (combined horde)"
+
+
sword_intelligence:
formula: d100
rows:
diff --git a/src/data/random_tables/ua_magic_items.yaml b/src/data/random_tables/ua_magic_items.yaml
index 50909ef..3fa8e5b 100644
--- a/src/data/random_tables/ua_magic_items.yaml
+++ b/src/data/random_tables/ua_magic_items.yaml
@@ -1,3 +1,13 @@
+ua_magic:
+ formula: d100
+ rows:
+ - roll: 1-10
+ steps:
+ - table: magic_maps
+ - roll: 11-100
+ steps:
+ - table: ua_magic_items
+
ua_magic_items:
formula: d100
rows:
@@ -115,13 +125,13 @@ ua_swords:
- roll: 1-95
steps:
- text: "Table 1"
- - table: sword_intelligence
- table: sword_type
+ - table: sword_intelligence
- roll: 96-100
steps:
- text: "Table 2"
- - table: sword_intelligence
- table: sword_type
+ - table: sword_intelligence
ua_misc_weapons:
formula: d100
diff --git a/src/main.rs b/src/main.rs
index cb170b1..b63d799 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -18,6 +18,10 @@ fn main() {
let alignment = random_tables.roll_table("npc_alignment");
println!("{} {}", alignment, race);
}
+ ("magic", _) => {
+ let magic = random_tables.roll_table("ua_magic");
+ println!("{}", magic);
+ }
_ => unreachable!()
}
}