clean up autobuy

This commit is contained in:
ntr 2019-04-10 21:07:57 +10:00
parent 2e698b3b55
commit 0f21269a7e
2 changed files with 7 additions and 15 deletions

View File

@ -127,12 +127,12 @@ impl Player {
if self.vbox.bound.len() < 3 || num_colours < 2 { if self.vbox.bound.len() < 3 || num_colours < 2 {
if (needs_skills && self.vbox.bits < 4) || self.vbox.bits < 5 { if (needs_skills && self.vbox.bits < 4) || self.vbox.bits < 5 {
// println!("insufficient balance"); // println!("insufficient balance");
return self; break;
} }
// get 2 colours and something else // get 2 colours and something else
if self.vbox.free[0].len() < 2 { if self.vbox.free[0].len() < 2 {
return self; break;
} }
self.vbox_accept(0, 0).expect("could't accept colour 0"); self.vbox_accept(0, 0).expect("could't accept colour 0");
self.vbox_accept(0, 0).expect("could't accept colour 1"); self.vbox_accept(0, 0).expect("could't accept colour 1");
@ -149,21 +149,12 @@ impl Player {
}; };
// first 2 colours can be whatever // first 2 colours can be whatever
match self.vbox_combine(vec![0, 1, combo_i]) { self.vbox_combine(vec![0, 1, combo_i]).ok();
Ok(_) => {
// println!("refined {:?}", self.vbox.bound[self.vbox.bound.len() - 1]);
}
Err(e) => println!("{:?}", e),
};
let var_i = self.vbox.bound.len() - 1; let var_i = self.vbox.bound.len() - 1;
match self.vbox_apply(var_i, target_cryp_id) { self.vbox_apply(var_i, target_cryp_id).ok();
Ok(_) => {
// println!("{:?} improved", self.cryps[target_cryp_i].name);
},
Err(e) => println!("{:?}", e),
}
} }
return self;
} }
pub fn vbox_discard(&mut self) -> Result<&mut Player, Error> { pub fn vbox_discard(&mut self) -> Result<&mut Player, Error> {

View File

@ -770,6 +770,7 @@ impl Skill {
Skill::Block => true, Skill::Block => true,
Skill::Banish => rng.gen_bool(0.5), Skill::Banish => rng.gen_bool(0.5),
_ => false, _ => false,
} }
} }