Adds a better sort (still miles from real custom cli)
This commit is contained in:
parent
e99d723e5d
commit
32ff0ef115
Binary file not shown.
|
|
@ -124,7 +124,7 @@ fn cmd_to_filter(og_entry: &str) -> Result<DynamicFilterType, FatalEquipementErr
|
|||
return_if_starts_with!(armor_break_per_attack);
|
||||
return_if_starts_with!(expected_armor_break_per_attack);
|
||||
return_if_starts_with!(avg_damage_2a_safe);
|
||||
return_if_starts_with!(avg_damage_single_huge_hit);
|
||||
return_if_starts_with!(avg_damage_2a_huge_hit);
|
||||
return_if_starts_with!(speed);
|
||||
return_if_starts_with!(scenario_damage);
|
||||
return_if_starts_with!(defensive);
|
||||
|
|
|
|||
|
|
@ -102,14 +102,14 @@ impl ToAnalysis for RefinedEquipementList {
|
|||
index # &String,
|
||||
max_damage_per_attack # f64,
|
||||
armor_break_per_attack # f64,
|
||||
expected_armor_break_per_attack # f64,
|
||||
// expected_armor_break_per_attack # f64,
|
||||
avg_damage_2a_safe # f64,
|
||||
avg_damage_single_huge_hit # f64,
|
||||
avg_damage_2a_huge_hit # f64,
|
||||
// speed # f64,
|
||||
variance # f64,
|
||||
variance_pct # f64,
|
||||
scenario_damage # f64,
|
||||
// defensive # f64,
|
||||
defensive # f64,
|
||||
earlygame_sustained_damage_per_turn # f64,
|
||||
midgame_sustained_damage_per_turn # f64,
|
||||
endgame_sustained_damage_per_turn # f64,
|
||||
|
|
@ -119,14 +119,14 @@ impl ToAnalysis for RefinedEquipementList {
|
|||
&ref_equipement.advanced.display_name,
|
||||
round!(ref_equipement.advanced.max_damage_per_attack ),
|
||||
round!(ref_equipement.advanced.armor_break_per_attack ),
|
||||
round!(ref_equipement.advanced.expected_armor_break_per_attack ),
|
||||
// round!(ref_equipement.advanced.expected_armor_break_per_attack ),
|
||||
round!(ref_equipement.advanced.avg_damage_2a_safe ),
|
||||
round!(ref_equipement.advanced.avg_damage_single_huge_hit ),
|
||||
round!(ref_equipement.advanced.avg_damage_2a_huge_hit ),
|
||||
// round!(ref_equipement.advanced.speed),
|
||||
round!(ref_equipement.advanced.variance),
|
||||
round!(ref_equipement.advanced.variance_pct ),
|
||||
round!(ref_equipement.advanced.scenario_damage ),
|
||||
// round!(ref_equipement.advanced.defensive ),
|
||||
round!(ref_equipement.advanced.defensive ),
|
||||
round!(ref_equipement.advanced.earlygame_sustained_damage_per_turn ),
|
||||
round!(ref_equipement.advanced.midgame_sustained_damage_per_turn ),
|
||||
round!(ref_equipement.advanced.endgame_sustained_damage_per_turn ),
|
||||
|
|
@ -157,7 +157,7 @@ pub struct AdvancedStats {
|
|||
/// Dps with two actions and 5 dices over a variety of scenarios
|
||||
pub avg_damage_2a_safe: f64,
|
||||
/// Dps with four actions and 11 dices over a variety of scenarios
|
||||
pub avg_damage_single_huge_hit: f64,
|
||||
pub avg_damage_2a_huge_hit: f64,
|
||||
/// The speed given by the weapon
|
||||
pub speed: f64,
|
||||
/// The damage obtained after a 10 turn pseudo scenario
|
||||
|
|
@ -205,11 +205,11 @@ impl From<&InnerEquipementStats> 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,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue