From 35616e74cc2491f08a3319058f3cd9c7d94024b0 Mon Sep 17 00:00:00 2001 From: HeNine <> Date: Sun, 28 May 2023 20:48:04 +0200 Subject: [PATCH] multiple drubs --- examples/bob_v_drub.rs | 7 +++---- src/premade/mod.rs | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/examples/bob_v_drub.rs b/examples/bob_v_drub.rs index d88170e..7447d23 100644 --- a/examples/bob_v_drub.rs +++ b/examples/bob_v_drub.rs @@ -13,10 +13,9 @@ fn main() { loop { let mut bob = get_bob(); - let mut drub = get_drub(); - let mut drub2 = get_drub(); + let mut drubs = (0..2).map(|_| get_drub()).collect::>(); - if let Some(turns) = make_them_fight(vec![&mut bob], vec![&mut drub, &mut drub2]) { + if let Some(turns) = make_them_fight(vec![&mut bob], drubs.iter_mut().collect()) { battles += 1.0; total_turns += turns as f64; @@ -28,7 +27,7 @@ fn main() { println!("Drub died in {} turns.", turns) } - if (a * b) / (f64::powi(a + b, 2) * (a + b + 1.0)) <= 0.00001 { + if (a * b) / (f64::powi(a + b, 2) * (a + b + 1.0)) <= 0.0001 { break; } } else { diff --git a/src/premade/mod.rs b/src/premade/mod.rs index 70e9ade..e536844 100644 --- a/src/premade/mod.rs +++ b/src/premade/mod.rs @@ -28,7 +28,7 @@ pub fn get_drub() -> Character { String::from("Drub"), Class::NPC, Class::NPC, - StatBlock::from((2, 3, 2, 0, 1, 0, -3, -2)), + StatBlock::from((1, 3, 1, 0, 1, 0, -3, -2)), StatBlock::default(), Armor::Light, WeaponType::SimpleWeapon.create_weapon(String::from("Knife")),