From bcc0c814c5cf65edeb5eb251408ea97b889bccbb Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Wed, 13 May 2026 05:27:46 +0200 Subject: [PATCH] Adds complexity to radars --- crates/config/src/graph.rs | 72 ++++++++++++++++++++++++++----------- crates/graphs/src/graphs.rs | 10 +++--- 2 files changed, 55 insertions(+), 27 deletions(-) diff --git a/crates/config/src/graph.rs b/crates/config/src/graph.rs index f4652ac..40428cd 100644 --- a/crates/config/src/graph.rs +++ b/crates/config/src/graph.rs @@ -87,24 +87,30 @@ pub struct FinalClassRadar { /// The ability to deal damage. #[serde(rename = "Dégats")] pub damage: f64, - /// The ability to move. - #[serde(rename = "Mobilité")] - pub mobility: f64, - /// The ability to inflict state alterations. - #[serde(rename = "Altérations")] - pub alterations: f64, - /// The armor break of the class - #[serde(rename = "Brise-Armure")] - pub armorbreak: f64, + // /// The ability to move. + // Mobility is merged with survivability & QoL + // #[serde(rename = "Mobilité")] + // pub mobility: f64, + // /// The ability to inflict state alterations. + // Altérations is now merged with damage + // #[serde(rename = "Altérations")] + // pub alterations: f64, /// The ability to provide support. #[serde(rename = "Support")] pub support: f64, /// The ability to inflict crowd control. #[serde(rename = "C.C")] pub cc: f64, - /// The ability to improve quality of life. - #[serde(rename = "QoL")] - pub qol: f64, + // /// The ability to improve quality of life. + // QoL is part of complexity + // #[serde(rename = "QoL")] + // pub qol: f64, + /// The armor break of the class + #[serde(rename = "Brise-Armure")] + pub armorbreak: f64, + /// The complexity to play the class + #[serde(rename = "Complexité")] + pub complexity: f64, // / The class complexity } @@ -127,6 +133,8 @@ pub struct LoadedClassRadar { pub cc: f64, /// The ability to improve quality of life. pub qol: f64, + /// The class complexity + pub complexity: f64, } /// All the categories to load from the tables @@ -162,6 +170,8 @@ pub struct RawRow { pub qol: String, /// The ability to break armor. pub armorbreak: String, + /// The complexity of the skill + pub complexity: String, } impl From for LoadedClassRadar { @@ -175,6 +185,7 @@ impl From for LoadedClassRadar { cc: value.cc.parse().unwrap_or(0.0), qol: value.qol.parse().unwrap_or(0.0), armorbreak: value.armorbreak.parse().unwrap_or(0.0), + complexity: value.complexity.parse().unwrap_or(0.0), } } } @@ -192,6 +203,7 @@ impl Add for LoadedClassRadar { cc: self.cc + rhs.cc, qol: self.qol + rhs.qol, armorbreak: self.armorbreak + rhs.armorbreak, + complexity: self.complexity + rhs.complexity, } } } @@ -199,31 +211,49 @@ impl Add for LoadedClassRadar { impl FinalClassRadar { /// A very wastful (but simple) way to only add the max value pub fn find_max(self, rhs: &Self) -> Self { + // Self { + // survivability: self.survivability.max(rhs.survivability), + // damage: self.damage.max(rhs.damage), + // mobility: self.mobility.max(rhs.mobility), + // alterations: self.alterations.max(rhs.alterations), + // support: self.support.max(rhs.support), + // cc: self.cc.max(rhs.cc), + // qol: self.qol.max(rhs.qol), + // armorbreak: self.armorbreak.max(rhs.armorbreak), + // name: self.name, + // } Self { + name: self.name, survivability: self.survivability.max(rhs.survivability), damage: self.damage.max(rhs.damage), - mobility: self.mobility.max(rhs.mobility), - alterations: self.alterations.max(rhs.alterations), support: self.support.max(rhs.support), cc: self.cc.max(rhs.cc), - qol: self.qol.max(rhs.qol), armorbreak: self.armorbreak.max(rhs.armorbreak), - name: self.name, + complexity: self.complexity.max(rhs.complexity), } } /// Create a class from a loaded categories pub fn from_radar_with_name(name: String, categorie: LoadedClassRadar) -> Self { + // Self { + // name, + // survivability: categorie.survivability, + // damage: categorie.damage, + // mobility: categorie.mobility, + // alterations: categorie.alterations, + // support: categorie.support, + // cc: categorie.cc, + // qol: categorie.qol, + // armorbreak: categorie.armorbreak, + // } Self { name, - survivability: categorie.survivability, - damage: categorie.damage, - mobility: categorie.mobility, - alterations: categorie.alterations, + survivability: (categorie.survivability + categorie.mobility / 2.) / 1.5, + damage: (categorie.damage + categorie.alterations) / 2., support: categorie.support, cc: categorie.cc, - qol: categorie.qol, armorbreak: categorie.armorbreak, + complexity: (categorie.complexity), } } diff --git a/crates/graphs/src/graphs.rs b/crates/graphs/src/graphs.rs index 4c17e52..7a908d1 100644 --- a/crates/graphs/src/graphs.rs +++ b/crates/graphs/src/graphs.rs @@ -114,11 +114,11 @@ fn gen_graph(args: &GraphConfig) -> Result<()> { println!("Writing to {}", path_svg); let context = r.svg().context("Converting to SVG")?; - f.write_all(context.as_bytes())?; + f.write_all(context.as_bytes()).context("Writing SVG")?; - let png = svg_to_png_with_size(&context, Some(860), Some(560)).context("Writing png")?; + let png = svg_to_png_with_size(&context, Some(980), Some(560)).context("Creating PNG")?; let mut f = File::create(path_png)?; - f.write_all(&png).context("Writing png")?; + f.write_all(&png).context("Writing PNG")?; } Ok(()) } @@ -128,9 +128,7 @@ fn import_csv(args: &GraphConfig) -> Result { let file = File::open(&args.origin) .context("Opening the radar file") .unwrap(); - let rdr = csv::ReaderBuilder::new().from_reader(file); - - cleanup_csv(rdr) + cleanup_csv(csv::ReaderBuilder::new().from_reader(file)) } /// Generate the csv from all the classes