Merge branch 'develop' of ssh://git.mnml.gg:40022/~/mnml into develop
This commit is contained in:
commit
70db52737f
@ -184,6 +184,7 @@ impl Player {
|
||||
// do we have any colours in store?
|
||||
let colours = self.vbox.store[&ItemType::Colours].keys()
|
||||
.cloned()
|
||||
.take(2)
|
||||
.collect::<Vec<String>>();
|
||||
|
||||
// how about a base skill?
|
||||
@ -193,11 +194,13 @@ impl Player {
|
||||
};
|
||||
|
||||
// if no: try to refill and start again
|
||||
match colours.len() < 2 || base.is_none() {
|
||||
true => match self.vbox_refill() {
|
||||
match colours.len() != 2 || base.is_none() {
|
||||
true => {
|
||||
match self.vbox_refill() {
|
||||
Ok(_) => continue,
|
||||
Err(_) => break, // give up
|
||||
},
|
||||
};
|
||||
}
|
||||
false => {
|
||||
let mut vbox_items = HashMap::new();
|
||||
vbox_items.insert(ItemType::Colours, colours);
|
||||
@ -230,7 +233,7 @@ impl Player {
|
||||
// there's a bad bug here where if this apply fails
|
||||
// the item in question will be silently dropped
|
||||
let item = self.vbox.stash.remove(&i).unwrap();
|
||||
self.vbox_apply(item, construct_id).ok();
|
||||
self.vbox_apply(item, construct_id).unwrap();
|
||||
continue;
|
||||
}
|
||||
// need to buy one
|
||||
@ -238,6 +241,7 @@ impl Player {
|
||||
// do we have any colours in store?
|
||||
let colours = self.vbox.store[&ItemType::Colours].keys()
|
||||
.cloned()
|
||||
.take(2)
|
||||
.collect::<Vec<String>>();
|
||||
|
||||
// how about a base spec?
|
||||
@ -247,7 +251,7 @@ impl Player {
|
||||
};
|
||||
|
||||
// if no: try to refill and start again
|
||||
match colours.len() < 2 || base.is_none() {
|
||||
match colours.len() != 2 || base.is_none() {
|
||||
true => match self.vbox_refill() {
|
||||
Ok(_) => continue,
|
||||
Err(_) => break, // give up
|
||||
@ -446,9 +450,11 @@ mod tests {
|
||||
let mut player = Player::new(player_account, &"test".to_string(), constructs).set_bot(true);
|
||||
|
||||
player.vbox.fill();
|
||||
player.vbox.bits = 100;
|
||||
player.autobuy();
|
||||
|
||||
assert!(player.constructs.iter().all(|c| c.skills.len() >= 1));
|
||||
assert!(player.constructs.iter().all(|c| c.skills.len() > 1));
|
||||
assert!(player.constructs.iter().all(|c| c.specs.len() >= 1));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user