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