Adds some fields in the categories

This commit is contained in:
Dandaedre 2025-02-23 08:18:46 +01:00
parent ab6515c742
commit 21618a8782
Signed by: Dandaedre
GPG Key ID: 440C6592E8A26D99
3 changed files with 55 additions and 5 deletions

View File

@ -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();

View File

@ -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

View File

@ -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 <Size> and <BaseShape> 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 <BaseShape>
#[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 {