From 70cde5aa526fffa567254c3821066596faa7409c Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Mon, 27 Jul 2026 00:03:10 +0200 Subject: [PATCH 1/2] Switch to stable --- Cargo.toml | 10 ++++++++++ crates/graphs/src/graphs.rs | 6 +++--- crates/make/src/makepdf_functions.rs | 6 +++--- crates/monsters/src/lib.rs | 2 +- .../src/monster_analysis/monster_analysis_structs.rs | 4 ++-- crates/monsters/src/monster_export.rs | 8 ++++---- crates/tablegen/src/table_types.rs | 2 +- crates/weaponry/Cargo.toml | 3 +++ crates/weaponry/src/database.rs | 2 +- crates/weaponry/src/interfaces.rs | 6 +++--- crates/weaponry/src/lib.rs | 5 ++--- .../src/weaponry_structs/equipement_impl_basics.rs | 4 ++-- .../src/weaponry_structs/equipement_impl_database.rs | 4 ++-- helper_config.toml | 2 +- rust-toolchain.toml | 2 +- 15 files changed, 39 insertions(+), 27 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5765c7a..a0b7eac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,6 +30,16 @@ codegen-units = 256 incremental = true panic = "abort" +# [profile.dev-analysis] +# inherits = "dev" +# opt-level = 0 +# debug = 0 +# strip = "none" +# lto = false +# # codegen-units = 256 +# incremental = true +# # codegen-backend = "cranelift" + [workspace.dependencies] config = {path = "./crates/config"} tablegen = {path = "./crates/tablegen"} diff --git a/crates/graphs/src/graphs.rs b/crates/graphs/src/graphs.rs index 4c17e52..71ee4f8 100644 --- a/crates/graphs/src/graphs.rs +++ b/crates/graphs/src/graphs.rs @@ -48,7 +48,7 @@ fn init_graph_config(_args: &GraphConfig) -> Result<()> { /// Load the config if given of the default config if none fn load_graph_config(args: &GraphConfig) -> Result { if let Some(c) = &args.config { - println!("[INFO] Reading config {}", &c); + println!("[INFO] Reading config {}", c); let mut f = File::open(c).context("Opening config")?; let mut buf = String::new(); f.read_to_string(&mut buf).context("Reading the config")?; @@ -104,8 +104,8 @@ fn gen_graph(args: &GraphConfig) -> Result<()> { let cfg = load_graph_config(args)?; for graph in csv.values { - let path_svg = format!("{}/{}.svg", args.destination, &graph.name); - let path_png = format!("{}/{}.png", args.destination, &graph.name); + let path_svg = format!("{}/{}.svg", args.destination, graph.name); + let path_png = format!("{}/{}.png", args.destination, graph.name); println!("[INFO] Processing {}", path_svg); let mut f = File::create(&path_svg)?; diff --git a/crates/make/src/makepdf_functions.rs b/crates/make/src/makepdf_functions.rs index 60a6b88..656cebb 100644 --- a/crates/make/src/makepdf_functions.rs +++ b/crates/make/src/makepdf_functions.rs @@ -89,7 +89,7 @@ pub(super) fn make_file(args: &MakeConfig) -> BuilderParseResult { } BuilderParseResult { - new_name: format!("{:?}", &path), + new_name: format!("{:?}", path), chapt_list: chapters, } } @@ -301,9 +301,9 @@ pub(super) fn make_clean(args: &MakeConfig) { for s in list_suff { // The most ghetto *** I've done so far // cmd.arg(format!("{}{}", &target, s)); - cmd.arg(format!("{}_build{}", &target, s)); + cmd.arg(format!("{}_build{}", target, s)); } - cmd.arg(format!("{}_build{}", &target, ".tex")); + cmd.arg(format!("{}_build{}", target, ".tex")); // println!("{:?}", cmd); if let Err(e) = cmd.output() { println!( diff --git a/crates/monsters/src/lib.rs b/crates/monsters/src/lib.rs index d598fb2..c992535 100644 --- a/crates/monsters/src/lib.rs +++ b/crates/monsters/src/lib.rs @@ -43,7 +43,7 @@ pub fn monsters_dispatch(args: &MonsterConfig, config: &Config) -> Result<()> { // MonsterTarget::Show => unimplemented!("implement show logic"), MonsterTarget::Balance(ref args) => { let connection = Connection::open(&args.db.database) - .context(format!("Opening database {}", &args.db.database))?; + .context(format!("Opening database {}", args.db.database))?; show_balancing_data(args, config, connection)? } } diff --git a/crates/monsters/src/monster_analysis/monster_analysis_structs.rs b/crates/monsters/src/monster_analysis/monster_analysis_structs.rs index 37b16ff..4bff56a 100644 --- a/crates/monsters/src/monster_analysis/monster_analysis_structs.rs +++ b/crates/monsters/src/monster_analysis/monster_analysis_structs.rs @@ -219,8 +219,8 @@ impl DamageCategory { pub fn from_percent(percent: f64) -> Self { match percent { ..0.01 => Self::None, - 0.01..0.15 => Self::Chip, - 0.15..0.5 => Self::Moderate, + 0.01..0.25 => Self::Chip, + 0.25..0.5 => Self::Moderate, 0.5..0.8 => Self::High, 0.8..1.0 => Self::NearDeath, 1.0..1.5 => Self::Kill, diff --git a/crates/monsters/src/monster_export.rs b/crates/monsters/src/monster_export.rs index 3cd94b2..c4e2d70 100644 --- a/crates/monsters/src/monster_export.rs +++ b/crates/monsters/src/monster_export.rs @@ -64,14 +64,14 @@ pub fn generate_monsters_tex( if args.player || args.all { println!("Generating Player Bestiaire"); let path = format!("./{}/player_bestiaire.tex", args.destination); - let mut f = File::create(&path).context(format!("Opening file {}", &path))?; - write!(f, "{}", p_out).context(format!("Writing {}", &path))?; + let mut f = File::create(&path).context(format!("Opening file {}", path))?; + write!(f, "{}", p_out).context(format!("Writing {}", path))?; } if args.master || args.all { println!("Generating Master Bestiaire"); let path = format!("./{}/master_bestiaire.tex", args.destination); - let mut f = File::create(&path).context(format!("Opening file {}", &path))?; - write!(f, "{}", m_out).context(format!("Writing {}", &path))?; + let mut f = File::create(&path).context(format!("Opening file {}", path))?; + write!(f, "{}", m_out).context(format!("Writing {}", path))?; } Ok(()) } diff --git a/crates/tablegen/src/table_types.rs b/crates/tablegen/src/table_types.rs index 14575de..4a4044b 100644 --- a/crates/tablegen/src/table_types.rs +++ b/crates/tablegen/src/table_types.rs @@ -137,7 +137,7 @@ impl WriteTable for ClassesArray { continue; } if lvl != 0 { - writeln!(buffer, "{}", &config.classes.sep)?; + writeln!(buffer, "{}", config.classes.sep)?; } writeln!(buffer, "{}", formatted_tier)?; for elem in tier { diff --git a/crates/weaponry/Cargo.toml b/crates/weaponry/Cargo.toml index 3e19fa3..abafc47 100644 --- a/crates/weaponry/Cargo.toml +++ b/crates/weaponry/Cargo.toml @@ -34,5 +34,8 @@ rayon = "1.12.0" name = "iter_creation" harness = false +[features] +dev-analysis = [] # gate for the feature flag + # [lints.rust] # unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tarpaulin_include)'] } diff --git a/crates/weaponry/src/database.rs b/crates/weaponry/src/database.rs index 5f5c048..e3cbc8d 100644 --- a/crates/weaponry/src/database.rs +++ b/crates/weaponry/src/database.rs @@ -30,7 +30,7 @@ where /// Generate a SELECT query with fields generated from a struct. Returns a SQL request as a String #[inline] -#[coverage(off)] // INCORRECT: Error with line report +#[cfg_attr(feature = "dev-analysis", coverage(off))] // INCORRECT: Error with line report fn generate_select_query( table_name: &str, filter: Option<&str>, diff --git a/crates/weaponry/src/interfaces.rs b/crates/weaponry/src/interfaces.rs index c838794..775a5d7 100644 --- a/crates/weaponry/src/interfaces.rs +++ b/crates/weaponry/src/interfaces.rs @@ -62,7 +62,7 @@ where /// A blanket implementation giving all combinaisons of recipes with another RecipeCollection /// /// This method doesn't make use of parallel iterators as the workload is way faster than would be the memory dispatch - #[coverage(off)] // Tarpaulin cannot deal with iter and long lines + #[cfg_attr(feature = "dev-analysis", coverage(off))] // Tarpaulin cannot deal with iter and long lines fn combine_all(&mut self, other: &G) where G: RecipeCollection, @@ -96,7 +96,7 @@ where fn from_vectored(list: Vec) -> Self; /// Create a collection from an iterator of intermediate values T - #[coverage(off)] // INCORRECT: Error with line report + #[cfg_attr(feature = "dev-analysis", coverage(off))] // INCORRECT: Error with line report fn from_iter_intermediate( iter_inter: impl Iterator>, ) -> Result @@ -233,7 +233,7 @@ pub trait RecipeDatabase { } /// Insert a row inside the database, while mostly unused this function is needed to initialize the empty table with an empty row if needed - #[coverage(off)] // INCORRECT: Error with line report + #[cfg_attr(feature = "dev-analysis", coverage(off))] // INCORRECT: Error with line report fn insert_row( &self, table_name: &str, diff --git a/crates/weaponry/src/lib.rs b/crates/weaponry/src/lib.rs index 0942313..3b72a7a 100644 --- a/crates/weaponry/src/lib.rs +++ b/crates/weaponry/src/lib.rs @@ -2,10 +2,9 @@ // File: weaponry/src/lib.rs //! Weaponry module, handling all weaponry creation and analysis -#![feature(coverage_attribute)] -// #![feature(int_roundings)] +#![cfg_attr(feature = "dev-analysis", feature(coverage_attribute))] #![warn(missing_docs, clippy::missing_docs_in_private_items)] -#![feature(iter_intersperse)] +// #![feature(iter_intersperse)] pub mod analysis; mod database; diff --git a/crates/weaponry/src/weaponry_structs/equipement_impl_basics.rs b/crates/weaponry/src/weaponry_structs/equipement_impl_basics.rs index 9daaa7f..962e367 100644 --- a/crates/weaponry/src/weaponry_structs/equipement_impl_basics.rs +++ b/crates/weaponry/src/weaponry_structs/equipement_impl_basics.rs @@ -136,7 +136,7 @@ impl Display for InnerEquipementStats { vec![ self.special .iter() - .intersperse(&",".to_string()) + // .intersperse(&",".to_string()) .fold(String::new(), |res, new| format!("{}; {}", res, new)), ], ); @@ -190,7 +190,7 @@ impl Default for FilterFunction { } } impl PartialEq for FilterFunction { - // #[coverage(off)] // INCORRECT: Error with line report + #[cfg_attr(feature = "dev-analysis", coverage(off))] // INCORRECT: Error with line report fn eq(&self, _other: &Self) -> bool { true } diff --git a/crates/weaponry/src/weaponry_structs/equipement_impl_database.rs b/crates/weaponry/src/weaponry_structs/equipement_impl_database.rs index c9fdb5e..0031d1f 100644 --- a/crates/weaponry/src/weaponry_structs/equipement_impl_database.rs +++ b/crates/weaponry/src/weaponry_structs/equipement_impl_database.rs @@ -30,7 +30,7 @@ impl RecipeDatabase for EquipementDatabase { &self.conn } - #[coverage(off)] // INCORRECT: Error with line report + #[cfg_attr(feature = "dev-analysis", coverage(off))] // INCORRECT: Error with line report fn serialize_into_intermediate( &self, table: &str, @@ -132,7 +132,7 @@ impl TryFrom for InnerEquipementStats { type SubCategories = (Option, Option); /// Infer all subcategories from a deserialized DatabaseCategory -#[coverage(off)] // A test would literally be a copy paste of this match +#[cfg_attr(feature = "dev-analysis", coverage(off))] // A test would literally be a copy paste of this match fn get_sub_categories_from_serde(category: &str) -> Result { Ok(if let Some(category) = from_serde!(category)? { match category { diff --git a/helper_config.toml b/helper_config.toml index 8df5d8c..35cedb4 100644 --- a/helper_config.toml +++ b/helper_config.toml @@ -229,7 +229,7 @@ master_part = ''' \SetCell{c} Res & \slash & \pierce & \blunt & \symceleste & \symfire & \symearth & \symwood & \symmagma & \symabyss & \symwater & \symwind & \symice & \symthunder \\ \hline {{#each body_parts.body_parts}} -\SetCell{font=\footnotesize} {{{body_part_name}}} & ${{{slash}}} $ & ${{{pierce}}} $ & ${{{blunt}}} $ & ${{{celestial}}} $ & ${{{fire}}} $ & ${{{earth}}} $ & ${{{wood}}} $ & ${{{magma}}} $ & ${{{celeste}}} $ & ${{{water}}} $ & ${{{wind}}} $ & ${{{ice}}} $ & ${{{thunder}}} $ \\ +\SetCell{font=\footnotesize} {{{body_part_name}}} & ${{{slash}}} $ & ${{{piercing}}} $ & ${{{blunt}}} $ & ${{{celestial}}} $ & ${{{fire}}} $ & ${{{earth}}} $ & ${{{wood}}} $ & ${{{magma}}} $ & ${{{celeste}}} $ & ${{{water}}} $ & ${{{wind}}} $ & ${{{ice}}} $ & ${{{thunder}}} $ \\ {{/each}} \end{tblr} \end{center} diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 5d56faf..292fe49 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "nightly" +channel = "stable" -- 2.45.1 From a449407ab436ebcef00986718cfccfb15860147d Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Mon, 27 Jul 2026 00:38:16 +0200 Subject: [PATCH 2/2] Switch to stable, cleanup --- Cargo.toml | 2 +- .../src/monster_analysis/attack_analysis.rs | 17 +---------------- .../src/monster_analysis/defense_analysis.rs | 10 +++++----- crates/monsters/src/monster_render.rs | 10 +++------- crates/monsters/src/monster_structs.rs | 16 ++++++++-------- helper_config.toml | 2 +- ravenous_databases | 2 +- 7 files changed, 20 insertions(+), 39 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a0b7eac..e83a81e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ resolver = "3" # edition = "2024" # license = "MIT OR Apache-2.0" [workspace.package] -version = "0.3.20" +version = "0.3.21" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/monsters/src/monster_analysis/attack_analysis.rs b/crates/monsters/src/monster_analysis/attack_analysis.rs index ca81f44..cb4743a 100644 --- a/crates/monsters/src/monster_analysis/attack_analysis.rs +++ b/crates/monsters/src/monster_analysis/attack_analysis.rs @@ -61,35 +61,20 @@ pub fn attack_player( } + victim.specialty_def; let bin = helpers::binomial_dice_distribution(threshold, victim.successes_def); - // let successes_left = attack.successes - thld(victim.successes_def, threshold); let avg_successes_left: f64 = bin .iter() .map(|(dice, p)| (attack.successes - dice) as f64 * p) .sum::(); - // TODO : Pretty sure - // / bin.len() as f64; let avg_damage_incomming: f64 = bin .iter() .map(|(dices, p)| { helpers::how_much_with_succeses(&attack.damage, attack.successes - dices) as f64 * p }) .sum::(); - // / bin.len() as f64; - - // println!( - // "{} DMG:{:?} {:.2?} Left[{avg_successes_left:.2}/{} with {}] = {avg_damage_incomming}", - // attack.name, attack.damage, bin, attack.successes, victim.successes_def - // ); - // let mut damage_incoming = how_much_with_succeses(&attack.damage, successes_left); let damage_incoming = avg_damage_incomming; let damage_tanked = (damage_incoming - (victim.protection + victim.strength) as f64).max(0.0); let armor_loss = (damage_incoming - victim.protection as f64).clamp(0.0, attack.armor_break as f64); - // if avg_successes_left < 0.0 { - // damage_incoming = 0.0; - // damage_tanked = 0.0; - // armor_loss = 0.0; - // } let report = DamageReport { damage_incoming, damage_tanked, @@ -105,7 +90,7 @@ pub fn attack_player( player_health: victim.health, player_integrity: victim.integrity, threshold, - attack_successes: attack.fatigue, + attack_successes: attack.successes, mode, showcase, fatigue: attack.fatigue, diff --git a/crates/monsters/src/monster_analysis/defense_analysis.rs b/crates/monsters/src/monster_analysis/defense_analysis.rs index 585485e..9d16485 100644 --- a/crates/monsters/src/monster_analysis/defense_analysis.rs +++ b/crates/monsters/src/monster_analysis/defense_analysis.rs @@ -216,12 +216,12 @@ pub struct DefenseReport { pub damage_per_turn_p1: f64, /// (Actual) Turns needed to reach phase 2. /// Computed from the monster’s health and damage output or from simulation data. - #[INTEGER(name = "P1 🠲 P2")] + #[REAL(name = "P1 🠲 P2")] pub time_to_p2: f64, /// (Goal) Desired turns to reach phase 2. /// If the current `time_to_p2` exceeds this value, the fight is considered inefficient. #[SKIP] - pub time_to_p2_target: i64, + pub time_to_p2_target: f64, /// Damage per turn while in phase 2. #[INTEGER(name = "DPT P2")] pub damage_per_turn_p2: f64, @@ -232,14 +232,14 @@ pub struct DefenseReport { /// (Goal) Desired turns to kill the monster. /// If actual `time_to_kill` is larger, you may need to adjust attack power or strategy. #[SKIP] - pub time_to_kill_target: i64, + pub time_to_kill_target: f64, /// (Goal) Desired turns until the monster’s armor breaks. /// A lower value indicates a more aggressive strategy. #[SKIP(name = "ttAB")] - pub time_to_armorbreak_target: i64, + pub time_to_armorbreak_target: f64, /// (Goal) Average turns to kill a single player #[SKIP(name = "ttPK")] - pub time_to_player_kill: i64, + pub time_to_player_kill: f64, /// (Fixed) The number of monsters in a single group. /// Usually `1`, but can be > 1 for bosses that spawn multiple instances. #[SKIP] diff --git a/crates/monsters/src/monster_render.rs b/crates/monsters/src/monster_render.rs index b608ecb..80d4bca 100644 --- a/crates/monsters/src/monster_render.rs +++ b/crates/monsters/src/monster_render.rs @@ -249,19 +249,15 @@ impl ToRow for DefenseReport { format!("{:.1?}/{}", self.armor_break_per_turn, self.integrity_p1) .to_cell() .fg(Color::DarkGrey), - compare_vals( - "t", - self.time_to_armorbreak, - self.time_to_armorbreak_target as f64, - ), + compare_vals("t", self.time_to_armorbreak, self.time_to_armorbreak_target), format!("{:.1?}/{}", self.damage_per_turn_p1, self.health_p1) .to_cell() .fg(Color::DarkGrey), - compare_vals("t", self.time_to_p2, self.time_to_p2_target as f64), + compare_vals("t", self.time_to_p2, self.time_to_p2_target), format!("{:.1?}/{}", self.damage_per_turn_p2, self.health_p2) .to_cell() .fg(Color::DarkGrey), - compare_vals("t", self.time_to_kill, self.time_to_kill_target as f64), + compare_vals("t", self.time_to_kill, self.time_to_kill_target), format!( "[{:.0} & {:.0}] ⇝ {}", self.damage_through_p1, diff --git a/crates/monsters/src/monster_structs.rs b/crates/monsters/src/monster_structs.rs index af2b2b3..fdf2928 100644 --- a/crates/monsters/src/monster_structs.rs +++ b/crates/monsters/src/monster_structs.rs @@ -420,18 +420,18 @@ pub struct CreatureBalancing { #[TEXT] /// (Fixed) HSE profile of the monster (see `ProfileHSE`). pub profile_hse: ProfileHSE, - #[INTEGER] + #[REAL] /// (Goal) Turns needed to reach phase 2. - pub time_to_p2: i64, - #[INTEGER] + pub time_to_p2: f64, + #[REAL] /// (Goal) Turns needed to kill from phase 2. - pub time_to_kill: i64, - #[INTEGER] + pub time_to_kill: f64, + #[REAL] /// (Goal) Turns until the monster’s armor breaks. - pub time_to_armorbreak: i64, - #[INTEGER] + pub time_to_armorbreak: f64, + #[REAL] /// (GOAL) Avg. turns to kill a single target. - pub time_to_player_kill: i64, + pub time_to_player_kill: f64, #[REAL] /// (FIXED) Size of a single monster group (usually one). pub monster_groupsize: f64, diff --git a/helper_config.toml b/helper_config.toml index 35cedb4..03932a5 100644 --- a/helper_config.toml +++ b/helper_config.toml @@ -241,7 +241,7 @@ master_part = ''' } & \SetCell[c=2]{c} P1 & & \SetCell[c=2]{c} P2 & & & \SetCell[c=7]{c} Stats & & & & & & & & \SetCell[c=4]{c} Mouvement & & & & & Extra & \\ \cline{2-3} \cline{4-5} \cline{7-13} \cline{15-18} \cline{20-21} -\rb{Initiative} & \rb{Valeur} & \rb{Actions} & \rb{Valeur} & \rb{Actions} & & \rb{Force} & \rb{Perception} & \rb{Volonté} & \rb{Res Alt} & \rb{Torque} & \rb{Vigilance} & \rb{Fatigue} & & \rb{Marche} & \rb{Trot} & \rb{Course} & \rb{Vol} & & \rb{Bon. Phy} {{#if elemental_bonus_dmg}}& \rb{Bon. Élém} {{/if}}\\ +\rb{Initiative} & \rb{Valeur} & \rb{Actions} & \rb{Valeur} & \rb{Actions} & & \rb{Force} & \rb{Perception} & \rb{Volonté} & \rb{Res Alt} & \rb{Torque} & \rb{Vigilance} & \rb{Fatigue} & & \rb{Marche} & \rb{Trot} & \rb{Course} & \rb{Vol} & & \rb{Bon. Phy} {{#if elemental_bonus}}& \rb{Bon. Élém} {{/if}}\\ {{#each init_full}} {{#if @index}} \SetCell{font=\footnotesize} $t_{{(plus @index 1)}} $ & ${{{p1_value}}} $ & {{{pt1_actions}}} & ${{{p2_value}}} $ & {{{p2_actions}}} \\ diff --git a/ravenous_databases b/ravenous_databases index b153252..2eb936d 160000 --- a/ravenous_databases +++ b/ravenous_databases @@ -1 +1 @@ -Subproject commit b1532527561263e6ae23b8e5a0fe6d4acc52b553 +Subproject commit 2eb936d1b8b2f2fc897141b1d353692d1bc82476 -- 2.45.1