From dd9e4ac40e6611b21442184ed95a2c7c1211630e Mon Sep 17 00:00:00 2001 From: David Gay Date: Wed, 31 Jan 2024 02:15:12 -0500 Subject: Fix usage of magic item enum --- src/data/rules/magic_items.yaml | 22 +++++++++++----------- src/rules/magic_items.rs | 1 + src/rules/npcs.rs | 2 ++ 3 files changed, 14 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/data/rules/magic_items.yaml b/src/data/rules/magic_items.yaml index 3108e7c..d45bfdd 100644 --- a/src/data/rules/magic_items.yaml +++ b/src/data/rules/magic_items.yaml @@ -5,35 +5,35 @@ potion: name: "Potion" - kind: potion + kind: Potion scroll: name: "Scroll" - kind: scroll + kind: Scroll ring: name: "Ring" - kind: ring + kind: Ring rod_staff_wand: name: "Rod/Staff/Wand" - kind: rod_staff_wand + kind: RodStaffWand misc: name: "Misc" - kind: misc + kind: Misc armor_shield: name: "Armor/Shield" - kind: armor_shield + kind: ArmorShield sword: name: "Sword" - kind: sword + kind: Sword protection: name: "Protection" - kind: ring # Not actually, but this is fine for now. + kind: Ring # Not actually, but this is fine for now. ##### # Remainder of file is actual data. @@ -41,12 +41,12 @@ protection: sword_plus_one: name: "Sword +1" - kind: sword + kind: Sword ring_of_animal_friendship: name: "Ring of Animal Friendship" - kind: ring + kind: Ring rod_of_absorption: name: "Rod of Absorption (C, M)" - kind: rod_staff_wand + kind: RodStaffWand diff --git a/src/rules/magic_items.rs b/src/rules/magic_items.rs index 6806a60..d074b0b 100644 --- a/src/rules/magic_items.rs +++ b/src/rules/magic_items.rs @@ -12,6 +12,7 @@ pub struct MagicItem { #[derive(Debug, Deserialize, Eq, Hash, PartialEq, Clone, Copy)] pub enum MagicItemKind { + Sword, Potion, Scroll, Ring, diff --git a/src/rules/npcs.rs b/src/rules/npcs.rs index b228454..7489b0a 100644 --- a/src/rules/npcs.rs +++ b/src/rules/npcs.rs @@ -146,6 +146,8 @@ impl Npc { .unwrap_or(0) <= rng.gen_range(1..=100) { + // For now, just get a dummy item named after the item type. + // Later, we'll add the actual magic items. self.magic_items.push( MAGIC_ITEMS .get(kind_string) -- cgit v1.2.3