multiple drubs

main
HeNine 1 year ago
parent 110eefd597
commit 35616e74cc

@ -13,10 +13,9 @@ fn main() {
loop { loop {
let mut bob = get_bob(); let mut bob = get_bob();
let mut drub = get_drub(); let mut drubs = (0..2).map(|_| get_drub()).collect::<Vec<_>>();
let mut drub2 = get_drub();
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; battles += 1.0;
total_turns += turns as f64; total_turns += turns as f64;
@ -28,7 +27,7 @@ fn main() {
println!("Drub died in {} turns.", turns) 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; break;
} }
} else { } else {

@ -28,7 +28,7 @@ pub fn get_drub() -> Character {
String::from("Drub"), String::from("Drub"),
Class::NPC, Class::NPC,
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(), StatBlock::default(),
Armor::Light, Armor::Light,
WeaponType::SimpleWeapon.create_weapon(String::from("Knife")), WeaponType::SimpleWeapon.create_weapon(String::from("Knife")),

Loading…
Cancel
Save