// Workspace: weaponry // File: weaponry/src/weaponry_structs/equipement_structs.rs //! Base equipement structures use struct_field_names_as_array::FieldNamesAsArray; use super::{DamageType, NatureTarget, SpecialCategory, WeaponCategory}; /// The final equipement list /// /// This list is initialized with the base part and updated by succesive combinaisons #[derive(Clone)] #[cfg_attr(test, derive(PartialEq, Debug))] pub struct FinalEquipementList { /// Inner List of final equipements pub(super) inner: Vec, } /// A parallel Implementation of the final equipement list /// /// This list only serve for benchmark purposes #[derive(Clone)] #[cfg_attr(test, derive(PartialEq, Debug))] pub struct FinalEquipementListPar { /// Inner List of final equipements pub(super) inner: Vec, } /// The final equipement, obtained by combining all parts #[derive(Clone, Default)] #[cfg_attr(test, derive(PartialEq, Debug))] pub struct Equipement { /// The inner stats used by the equipement pub(super) stats: InnerStats, } /// The inner statistics of the equipement, used across all parts and final weapon #[allow(clippy::missing_docs_in_private_items, missing_docs)] #[derive(Clone, Default, FieldNamesAsArray)] #[cfg_attr(test, derive(Debug, PartialEq))] pub struct InnerStats { pub id: u8, pub name: String, pub(super) rarity: u8, pub(super) cost: u8, pub(super) difficulty: u8, pub(super) tier: u8, pub(super) damage: u8, pub(super) p_damage: u8, pub(super) precision: u8, pub(super) rmax: u8, pub(super) armor_break: u8, pub(super) armor_pierce: u8, pub(super) antimaterial: u8, pub(super) damage_type: Option, pub(super) protection: u8, pub(super) integrity: u8, pub(super) torque_two_handed: u8, pub(super) torque_one_handed: u8, pub(super) dodge: u8, pub(super) parry: u8, pub(super) speed: u8, pub(super) stealth: u8, pub(super) category: Option, pub(super) special: SpecialCategory, pub(super) action_cost: u8, pub(super) reload_cost: Option, pub(super) range: u8, pub(super) agility_bonus: u8, } /// Shape of the equipement, first mandatory part of an equipement pub struct EqShape { /// The inner stats of the part pub(super) stats: InnerStats, } /// Material used for the equipement, all equipements are crafted with 1-2 materials pub struct EqMaterial { /// The inner stats of the part pub(super) stats: InnerStats, } /// Nature of the equipement, some natures are reserved and some can be chained /// /// Deciding on the combinaison can be tricky an will need an extra field pub struct EqNature { /// The inner stats of the part pub(super) stats: InnerStats, /// Which kind of target this nature applies to pub(super) target: NatureTarget, } /// Finishing touches, since all of them have a cost, they are treated in a special fashion pub struct EqFinishing { /// The inner stats of the part pub(super) stats: InnerStats, } #[cfg(test)] mod test { // use super::*; use super::{Equipement, InnerStats}; fn list_equip() -> Vec { (0..10) .map(|_| Equipement { ..Default::default() }) .collect::>() } #[test] fn test_struct_creation() { let stats = InnerStats::default(); let eq1 = Equipement { ..Default::default() }; let list_eq = list_equip(); assert_eq!(stats, eq1.stats); assert_eq!(list_eq[0], eq1); } #[ignore] #[test] fn test_default_behaviour() { unimplemented!() } }