diff --git a/weaponry/databases/weapons.db b/weaponry/databases/weapons.db index e1924d3..6b5528b 100644 Binary files a/weaponry/databases/weapons.db and b/weaponry/databases/weapons.db differ diff --git a/weaponry/examples/usage_scenario.rs b/weaponry/examples/usage_scenario.rs index 7644c7e..42a3a5e 100644 --- a/weaponry/examples/usage_scenario.rs +++ b/weaponry/examples/usage_scenario.rs @@ -124,7 +124,7 @@ fn cmd_to_filter(og_entry: &str) -> Result for AdvancedStats { ) .map(|f| *f) .unwrap_or_default(), - avg_damage_single_huge_hit: BestDamageScenarios::from_action_constraints( + avg_damage_2a_huge_hit: BestDamageScenarios::from_action_constraints( value, Actions(2), Attacks(2), - Dices(8), + Dices(10), Precision(9), ) .map(|f| *f) @@ -290,7 +290,7 @@ macro_rules! sort_by { #[macro_export] /// A simple macro to sort the inner advanced field by a specific field // TODO[6] find a way to not have to import the refinedequipement -macro_rules! sort_by_cat_then { +macro_rules! sort_by_weapon_then { ($field:ident) => { |a, b| match a.inner.id[0].cmp(&b.inner.id[0]) { std::cmp::Ordering::Equal => a.advanced.$field.total_cmp(&b.advanced.$field), @@ -298,3 +298,35 @@ macro_rules! sort_by_cat_then { } }; } + +#[macro_export] +/// Sort by size first, then by the given field +macro_rules! sort_by_cat_then { + ($field:ident) => { + |a, b| { + if let (Some(c), Some(d)) = ( + a.inner.category_size.as_ref(), + b.inner.category_size.as_ref(), + ) { + match c.cmp(d) { + std::cmp::Ordering::Equal => a.advanced.$field.total_cmp(&b.advanced.$field), + ord => ord, + } + } else { + a.advanced.$field.total_cmp(&b.advanced.$field) + } + } + }; +} + +#[macro_export] +/// A simple macro to sort the inner advanced field by a specific field +// TODO[6] find a way to not have to import the refinedequipement +macro_rules! sort_by_size_then { + ($field:ident) => { + |a, b| match a.inner.category_size.cmp(&b.inner.category_size) { + std::cmp::Ordering::Equal => a.advanced.$field.total_cmp(&b.advanced.$field), + ord => ord, + } + }; +} diff --git a/weaponry/src/weaponry_structs/equipement_fields.rs b/weaponry/src/weaponry_structs/equipement_fields.rs index 84679d9..4f436ac 100644 --- a/weaponry/src/weaponry_structs/equipement_fields.rs +++ b/weaponry/src/weaponry_structs/equipement_fields.rs @@ -266,8 +266,10 @@ impl EquipementTargets { // TODO[!] : This part is initialized by the natures subtable and might be better of being a new column in the database /// 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)] -#[cfg_attr(test, derive(PartialEq))] +#[derive( + Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Display, Deserialize, Serialize, strum::EnumString, +)] +// #[cfg_attr(test, derive(PartialEq))] pub enum WeaponBaseSize { Light, Medium,