use crate::rules::ability_scores::AbilityScore; use serde::Deserialize; use serde_yaml; use std::collections::HashMap; // use std::fmt; use lazy_static::lazy_static; use std::string::String; #[derive(Deserialize)] pub struct Class { pub name: String, pub prime_requisites: Vec, #[serde(default)] pub npc_ability_score_modifiers: HashMap, pub chances_for_magic: HashMap, } lazy_static! { pub static ref CLASSES: HashMap = load_classes(); } // TODO: Is this actually needed? Is there a real race condition this is avoiding? fn load_classes() -> HashMap { let yaml_data = include_str!("../data/rules/classes.yaml"); serde_yaml::from_str(yaml_data).expect("Failed to parse classes YAML") } // // impl fmt::Display for Class { // fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { // write!(f, "{}", self.name) // } // }