Base analysis
Build Successful The build was successful
Ravenous/ravenous-tools/pipeline/head This commit looks good Details

This commit is contained in:
Dandaedre 2026-07-24 07:56:27 +02:00
parent 886f139bbb
commit 264fadfdc8
Signed by: Dandaedre
GPG Key ID: 440C6592E8A26D99
4 changed files with 31 additions and 20 deletions

View File

@ -83,19 +83,20 @@ pub fn attack_player(
/ bin.len() as f64;
let avg_damage_incomming: f64 = bin
.iter()
.map(|(dices, p)| how_much_with_succeses(&attack.damage, (attack.successes - dices)) as f64)
.sum::<f64>()
/ bin.len() as f64;
.map(|(dices, p)| {
how_much_with_succeses(&attack.damage, attack.successes - dices) as f64 * p
})
.sum::<f64>();
// / bin.len() as f64;
// println!(
// "{}{:.2?}{avg_successes_left:.2} {avg_damage_incomming}",
// attack.name, bin
// "{} 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 mut damage_incoming = avg_damage_incomming;
let mut damage_tanked =
(damage_incoming - (victim.protection + victim.strength) as f64).max(0.0);
let mut armor_loss =
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;

View File

@ -11,15 +11,15 @@ impl From<FullMonster> for Vec<MonsterBalancingAttack> {
.into_iter()
.flat_map(|(_, phases)| {
phases.into_iter().flat_map(|monster_full_attack| {
let mut cumul = 0;
// let mut cumul = 0;
monster_full_attack
.attacklist
.into_iter()
.map(move |sub_attack| {
cumul += from_successes(sub_attack.success.as_ref());
// cumul += from_successes(sub_attack.success.as_ref());
MonsterBalancingAttack {
damage: damage_from_string(sub_attack.damage_regular.as_ref()),
successes: cumul,
successes: from_successes(sub_attack.success.as_ref()),
armor_break: from_opt_i64(sub_attack.armor_break.as_ref()),
action_cost: from_actions(sub_attack.cost_action.as_ref()),
name: sub_attack.name,
@ -83,8 +83,10 @@ pub struct DamageDone {
#[derive(Copy, Clone, Debug, EnumString, Default, strum::Display, PartialEq)]
pub enum DamageCategory {
/// No lasting damage
/// Malformed data
#[default]
Malformed,
/// No lasting damage
None,
/// Chip damage
Chip,
@ -102,8 +104,10 @@ pub enum DamageCategory {
#[derive(Copy, Clone, Debug, EnumString, Default, strum::Display, PartialEq, Eq)]
pub enum ArmorBreakCategory {
/// No lasting damage
/// Malformed data
#[default]
Malformed,
/// No lasting damage
None,
/// Chip damage
Chip,
@ -132,7 +136,7 @@ impl From<Option<String>> for DamageCategory {
if let Some(value) = value {
Self::from_str(&value).unwrap_or_default()
} else {
Self::None
Self::Malformed
}
}
}
@ -142,7 +146,7 @@ impl From<Option<String>> for ArmorBreakCategory {
if let Some(value) = value {
Self::from_str(&value).unwrap_or_default()
} else {
Self::None
Self::Malformed
}
}
}

View File

@ -74,7 +74,11 @@ impl ToRow for DamageReport {
fn to_row(&self) -> Row {
vec![
self.name.to_cell().fg(Color::Green),
format!("{} [{}r]", self.damage_incoming, self.attack_successes,).to_cell(),
format!(
"{:.1} [{:.1}r]",
self.damage_incoming, self.attack_successes,
)
.to_cell(),
format!("{:.1} [>{:.1}]", self.successes_left, self.threshold)
.to_cell()
.fg(if self.successes_left > 0.0 {
@ -82,7 +86,7 @@ impl ToRow for DamageReport {
} else {
Color::Red
}),
format!("{}/{}", self.damage_tanked, self.player_health)
format!("{:.1}/{:.1}", self.damage_tanked, self.player_health)
.to_cell()
.fg(self.damage_category.get_color()),
self.damage_category.to_cell().add_attribute(
@ -93,7 +97,7 @@ impl ToRow for DamageReport {
},
),
self.damage_expected.to_cell(),
format!("{}/{}", self.armor_loss, self.player_integrity)
format!("{:.1}/{:.1}", self.armor_loss, self.player_integrity)
.to_cell()
.fg(self.armor_category.get_color()),
self.armor_category.to_cell().add_attribute(
@ -126,6 +130,7 @@ impl ToColor for DamageCategory {
DamageCategory::NearDeath => Color::Yellow,
DamageCategory::Kill => Color::Red,
DamageCategory::Overkill => Color::DarkRed,
DamageCategory::Malformed => Color::Black,
}
}
}
@ -143,6 +148,7 @@ impl ToColor for ArmorBreakCategory {
ArmorBreakCategory::High => Color::Yellow,
ArmorBreakCategory::FullBreak => Color::Red,
ArmorBreakCategory::Overkill => Color::DarkRed,
ArmorBreakCategory::Malformed => Color::Black,
}
}
}

@ -1 +1 @@
Subproject commit 265a89610bcb3ec621e0386ec2284e49f2b5288e
Subproject commit abacba00c4b888241d47bfb2621322d5586f77d4