ravenous-tools/weaponry/src/weaponry_structs.rs

167 lines
3.7 KiB
Rust

// Workspace: weaponry
// File: weaponry/src/weaponry_structs.rs
//! All weaponry intermod structures
#![allow(dead_code)]
/// The inner statistics of the equipement, used across all parts and final weapon
// #[derive(Default)]
#[allow(clippy::missing_docs_in_private_items)]
pub struct InnerStats {
rarity: u8,
cost: u8,
difficulty: u8,
tier: u8,
damage: u8,
p_damage: u8,
precision: u8,
rmax: u8,
armor_break: u8,
armor_pierce: u8,
antimaterial: u8,
damage_type: DamageMod,
protection: u8,
integrity: u8,
two_handed: u8,
one_handed: u8,
dodge: u8,
parry: u8,
speed: u8,
stealth: u8,
category: WeaponCategory,
special: Vec<String>,
action_cost: u8,
reload_cost: u8,
range: u8,
agility_bonus: u8,
}
/// The final equipement, obtained by combining all parts
pub struct Equipement {
/// The inner stats used by the equipement
stats: InnerStats,
}
/// Shape of the equipement, first mandatory part of an equipement
pub struct EqShape {
/// The inner stats of the part
stats: InnerStats,
}
/// Material used for the equipement, all equipements are crafted with 1-2 materials
pub struct EqMaterial {
/// The inner stats of the part
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
stats: InnerStats,
/// Which kind of target this nature applies to
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
stats: InnerStats,
}
/// The kind of target this nature can apply to
pub enum NatureTarget {
/// Can apply to a weapon and is unique
WeaponUnique,
/// Can apply to a weapon and must be combined with another
WeaponCombined,
/// Can apply to an armor (all armor nature are unique)
Armor,
}
/// Enum of all different physical weapon damage types
#[allow(clippy::missing_docs_in_private_items)]
pub enum PhysicalDamageType {
Blunt,
Slash,
Pierce,
}
impl From<&str> for PhysicalDamageType {
fn from(value: &str) -> Self {
let _ = value;
// Matchcase for all damage types
todo!()
}
}
/// Weapon damage, combining the base weapon damage type and it's level
///
/// Signifying wether the damage is pure or [secondary] or [[tertiary]]
#[allow(clippy::missing_docs_in_private_items)]
pub enum DamageMod {
Primary(PhysicalDamageType),
Secondary(PhysicalDamageType),
Tertiary(PhysicalDamageType),
}
impl From<&str> for DamageMod {
fn from(value: &str) -> Self {
let _ = value;
// Detect [] and recurse from
todo!()
}
}
/// Combined damage type, as a vector of all damage types
///
/// Meant to be serialised to tex and deserialized directly from the table
pub struct DamageType(Vec<DamageMod>);
impl From<&str> for DamageType {
fn from(value: &str) -> Self {
let _ = value;
// Split by , then recurse from and collect
todo!()
}
}
/// List all weapon categories
#[allow(clippy::missing_docs_in_private_items)]
pub enum WeaponCategory {
Exotic,
Dagger,
Claws,
Blade,
Haroth,
Axe,
Kahml,
Hammer,
Rhodarak,
Staff,
Lance,
Landscapper,
Bow,
Crossbow,
Cannon,
}
impl From<&str> for WeaponCategory {
fn from(value: &str) -> Self {
let _ = value;
todo!()
}
}
#[cfg(test)]
mod test {
// use super::*;
#[test]
fn test_data_serialisation() {}
#[test]
fn test_data_deserialisation() {}
}