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

View File

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