summaryrefslogtreecommitdiff
path: root/src/rules/npcs.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/rules/npcs.rs')
-rw-r--r--src/rules/npcs.rs39
1 files changed, 37 insertions, 2 deletions
diff --git a/src/rules/npcs.rs b/src/rules/npcs.rs
index 67eeb47..c3fc86a 100644
--- a/src/rules/npcs.rs
+++ b/src/rules/npcs.rs
@@ -1,7 +1,42 @@
use crate::rules::ability_scores::AbilityScoreCollection;
use crate::rules::classes::Class;
+// use std::fmt;
pub struct Npc {
- pub class: Class,
- pub ability_score_collection: AbilityScoreCollection,
+ pub alignment: Option<String>,
+ pub race: Option<String>,
+ pub class: Option<&'static Class>,
+ pub ability_scores: Option<AbilityScoreCollection>,
}
+
+impl Npc {
+ pub fn new(
+ alignment: Option<String>,
+ race: Option<String>,
+ class: Option<&'static Class>,
+ ability_scores: Option<AbilityScoreCollection>,
+ ) -> Self {
+ Npc {
+ alignment,
+ race,
+ class,
+ ability_scores,
+ }
+ }
+}
+
+// impl fmt::Display for Npc {
+// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+// let values: Vec<&str> = vec![
+// self.alignment.as_deref().unwrap_or(""),
+// self.race.as_deref().unwrap_or(""),
+// self.class.as_ref().map_or("", |class| &class.name),
+// ]
+// .into_iter()
+// .filter(|&s| !s.is_empty())
+// .collect();
+//
+// let formatted_string = values.join(" ");
+// write!(f, "{}", formatted_string)
+// }
+// }