From 21618a8782c744d76d614ef8a7f61d8e77180a25 Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Sun, 23 Feb 2025 08:18:46 +0100 Subject: [PATCH] Adds some fields in the categories --- weaponry/examples/usage_scenario.rs | 2 +- .../equipement_advanced_repr.rs | 11 +++-- .../src/weaponry_structs/equipement_fields.rs | 47 ++++++++++++++++++- 3 files changed, 55 insertions(+), 5 deletions(-) diff --git a/weaponry/examples/usage_scenario.rs b/weaponry/examples/usage_scenario.rs index 23800e1..62fa6a2 100644 --- a/weaponry/examples/usage_scenario.rs +++ b/weaponry/examples/usage_scenario.rs @@ -28,7 +28,7 @@ fn main() { }) .unwrap(); let mut refined_list = scenarios.generate_refined_recipes().unwrap(); - refined_list.inner_sort(|a, b| a.advanced.dps_safe.total_cmp(&b.advanced.dps_safe)); + refined_list.inner_sort(|a, b| a.advanced.avg_dps_safe.total_cmp(&b.advanced.avg_dps_safe)); // if args.html_export{} refined_list.write_html(&save_path).unwrap(); diff --git a/weaponry/src/weaponry_structs/equipement_advanced_repr.rs b/weaponry/src/weaponry_structs/equipement_advanced_repr.rs index 88de8a0..ad6fd1a 100644 --- a/weaponry/src/weaponry_structs/equipement_advanced_repr.rs +++ b/weaponry/src/weaponry_structs/equipement_advanced_repr.rs @@ -164,10 +164,12 @@ pub struct AdvancedStats { /// Armor break factoring in the damage output: While a weapon might have high AB, not having any damage will seriously hinder that AB pub expected_armor_break_per_turn: f64, /// Dps with two actions and 5 dices - pub dps_safe: f64, + pub avg_dps_safe: f64, // /// Dps with four actions and 11 dices // pub dps_unsafe: f64, // All other criterias are already in the inner as raw criterias + /// Avg damage for bit attack + pub avg_huge_hit: f64, } impl From<&InnerEquipementStats> for AdvancedStats { fn from(value: &InnerEquipementStats) -> Self { @@ -188,8 +190,10 @@ impl From<&InnerEquipementStats> for AdvancedStats { // Adds the base strength, substracts the expected protection expected_armor_break_per_turn: (damage_per_attack + 6. - 8.) .min(armor_break_per_attack), - dps_safe: damage_matrix.get_safe_dmg(value.action_cost), - // dps_unsafe: damage_matrix.get_unsafe_dmg(value.action_cost), + + avg_huge_hit: damage_matrix.get_damage(FixedPrecision::High, FixedDiceNumber::Many), + avg_dps_safe: damage_matrix.get_safe_dmg(value.action_cost), + // avg_dps_unsafe: damage_matrix.get_unsafe_dmg(value.action_cost), damage_matrix, } } @@ -198,6 +202,7 @@ impl From<&InnerEquipementStats> for AdvancedStats { /// A damage matrix, crossing damage conditions (high dice to low dice) with precision (high precision to low precision) /// /// This simulation does only calculate a very limited preset of damage values +// TODO[9]: Rewrite with (HashMap,HashMap) if it becomes needed #[cfg_attr(test, derive(Debug))] pub struct DamageMatrix { /// The inner damage matrix diff --git a/weaponry/src/weaponry_structs/equipement_fields.rs b/weaponry/src/weaponry_structs/equipement_fields.rs index d6aa96c..7e00926 100644 --- a/weaponry/src/weaponry_structs/equipement_fields.rs +++ b/weaponry/src/weaponry_structs/equipement_fields.rs @@ -119,7 +119,7 @@ impl Add for DamageType { } // TODO: Convert into this category at the end, depending on all important factors -/// List all weapon categories +/// List all the final weapon categories, this enum should be infered from and if they were defined #[allow(clippy::missing_docs_in_private_items, missing_docs)] #[derive(Clone, Debug, PartialEq, Display, Deserialize, Serialize, strum::EnumString)] // #[cfg_attr(test, derive(PartialEq))] @@ -143,8 +143,28 @@ pub enum WeaponCategory { // Shield, } +// TODO[4]: Have a final weapon category tied to the speciality, if any appliable to the character +// : Since this is not needed for balencing, this will be left alone for a while +// impl WeaponCategory { +// fn from_category_and_size(macro_category: &WeaponBaseShape, size: &WeaponBaseSize) -> Self { +// match (macro_category, size) { +// (WeaponBaseShape::Axe, WeaponBaseSize::SuperHeavy) => Self::Kahml, +// (WeaponBaseShape::Blade, WeaponBaseSize::SuperHeavy) => Self::Haroth, +// (WeaponBaseShape::Hammer, WeaponBaseSize::SuperHeavy) => Self::Rhodarak, +// (WeaponBaseShape::Claws, WeaponBaseSize::SuperHeavy) => Self::Landscapper, +// (WeaponBaseShape::Staves, WeaponBaseSize::SuperHeavy) => Self::Landscapper, +// (WeaponBaseShape::Bow, WeaponBaseSize::SuperHeavy) => Self::Bow, +// (WeaponBaseShape::Crossbow, WeaponBaseSize::SuperHeavy) => Self::Crossbow, +// (WeaponBaseShape::Cannon, WeaponBaseSize::SuperHeavy) => Self::Cannon, + +// (WeaponBaseShape::Exotic, WeaponBaseSize::SuperHeavy) => Self::Exotic, +// } +// } +// } + // TODO: This is the real initial category /// The list of initial weapon meta categories +// TODO[!]: This enum should only include Weapons, Shields, Armors and no #[allow(clippy::missing_docs_in_private_items, missing_docs)] #[derive(Clone, Debug, Display, Deserialize, Serialize, strum::EnumString)] pub enum WeaponMacroCategory { @@ -163,6 +183,31 @@ pub enum WeaponMacroCategory { None, } +/// The Base Shape of the weapon, used to infer the final category of the weapon +#[allow(clippy::missing_docs_in_private_items, missing_docs)] +#[derive(Clone, Debug, Display, Deserialize, Serialize, strum::EnumString)] +pub enum WeaponBaseShape { + Staves, + Blunt, + Slash, + Ranged, + Armor, + Shields, + Exotic, + // TODO[!]: Check the soundness of this + None, +} + +/// The Base Size of the weapon, used to infer the final category of the weapon +#[allow(clippy::missing_docs_in_private_items, missing_docs)] +#[derive(Clone, Debug, Display, Deserialize, Serialize, strum::EnumString)] +pub enum WeaponBaseSize { + Light, + Medium, + Heavy, + SuperHeavy, +} + // TODO: This is only needed as long as we dont have a special category for the target impl PartialEq for WeaponMacroCategory { fn eq(&self, other: &Self) -> bool {