From a449407ab436ebcef00986718cfccfb15860147d Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Mon, 27 Jul 2026 00:38:16 +0200 Subject: [PATCH] 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