This commit is contained in:
ntr
2019-03-05 17:59:10 +11:00
parent 26250d5b74
commit 9e16201f3d
2 changed files with 23 additions and 18 deletions
+22 -13
View File
@@ -123,7 +123,7 @@ enum ColourCode {
pub struct Vbox {
pub id: Uuid,
pub balance: u16,
pub free: Vec<Var>,
pub free: Vec<Vec<Var>>,
pub bound: Vec<Var>,
pub instance: Uuid,
pub account: Uuid,
@@ -131,17 +131,33 @@ pub struct Vbox {
impl Vbox {
pub fn new(account_id: Uuid, instance_id: Uuid) -> Vbox {
Vbox {
let starting_items = vec![
Var::Attack,
Var::Attack,
Var::Attack,
Var::Stam5,
Var::Stam5,
Var::Speed5,
Var::Speed5,
Var::Damage,
Var::Damage,
];
let vbox = Vbox {
id: Uuid::new_v4(),
account: account_id,
instance: instance_id,
free: vec![],
free: starting_items,
bound: vec![],
balance: 0,
}
balance: 9,
};
vbox.fill();
return vbox;
}
pub fn fill(&mut self, init: bool) -> &mut Vbox {
pub fn fill(&mut self) -> &mut Vbox {
let colours = vec![
(Var::Red, 1),
(Var::Green, 1),
@@ -177,13 +193,6 @@ impl Vbox {
free.push(vars[dist.sample(&mut rng)].0);
}
// make sure there are 3 attacks in the first round
if init {
free[6] = Var::Attack;
free[7] = Var::Attack;
free[8] = Var::Attack;
}
self.free = free;
self