BillySheet-Rust/src/sheet.rs

119 lines
2.0 KiB
Rust

#[derive(Debug)]
pub enum Classe {
Warrior,
Cautious,
Farmer,
Resourceful,
}
#[derive(Debug)]
enum CharacteristicType {
Address,
Stamina,
Luck,
Skill,
}
#[derive(Debug)]
pub struct CharacterSheet {
character_class: Classe,
/// Field to write the personality/
pub character: String,
address: Characteristic,
stamina: Characteristic,
luck: Characteristic,
skill: Characteristic,
health: u32,
armor: u32,
damage: u32,
glory: u32,
money: u32,
}
impl CharacterSheet {
pub fn character_class(&self) -> &Classe {
&self.character_class
}
pub fn character(&self) -> &str {
&self.character
}
pub fn address(&self) -> &Characteristic {
&self.address
}
pub fn stamina(&self) -> &Characteristic {
&self.stamina
}
pub fn luck(&self) -> &Characteristic {
&self.luck
}
pub fn skill(&self) -> &Characteristic {
&self.skill
}
pub fn health(&self) -> u32 {
self.health
}
pub fn armor(&self) -> u32 {
self.armor
}
pub fn damage(&self) -> u32 {
self.damage
}
pub fn glory(&self) -> u32 {
self.glory
}
pub fn money(&self) -> u32 {
self.money
}
}
#[derive(Debug)]
pub struct Characteristic {
characteristic_type: CharacteristicType,
pub base: u32,
pub carac: u32,
pub materiel: u32,
pub additional: u32,
}
impl Default for CharacterSheet {
fn default() -> Self {
Self {
character_class: Classe::Warrior,
character: "Billy".to_string(),
address: Characteristic {
characteristic_type: CharacteristicType::Address,
base: 0,
carac: 0,
materiel: 0,
additional: 1,
},
stamina: Characteristic {
characteristic_type: CharacteristicType::Stamina,
base: 2,
carac: 0,
materiel: 0,
additional: 0,
},
luck: Characteristic {
characteristic_type: CharacteristicType::Luck,
base: 3,
carac: 0,
materiel: 0,
additional: 0,
},
skill: Characteristic {
characteristic_type: CharacteristicType::Skill,
base: 2,
carac: 0,
materiel: 0,
additional: 0,
},
health: 0,
armor: 0,
damage: 0,
glory: 0,
money: 0,
}
}
}