more drops

This commit is contained in:
ntr 2019-03-04 13:12:22 +11:00
parent 9dcb21eefa
commit 8b18e7aa20
2 changed files with 33 additions and 10 deletions

View File

@ -57,7 +57,6 @@ class LineBox extends Phaser.GameObjects.Graphics {
return delta[j];
});
}
console.log(this.lineCoord);
this.lineStyle(5, 0xFF00FF, 1);
this.lineBetween(this.lineCoord[0], horizY, this.lineCoord[1], horizY);

View File

@ -19,16 +19,24 @@ use cryp::{cryp_get, cryp_write};
#[derive(Debug,Clone,Copy,PartialEq,Serialize,Deserialize)]
pub enum Var {
// colours
Blue,
Green,
Red,
// base skills
Attack,
Block,
Stun,
Buff,
Debuff,
// specs
Damage,
Protection,
Healing,
Hp,
Amplify,
Banish,
Blast,
@ -134,11 +142,13 @@ impl Vbox {
}
pub fn fill(&mut self) -> &mut Vbox {
let vars = vec![
let colours = vec![
(Var::Red, 1),
(Var::Green, 1),
(Var::Blue, 1),
];
let skills = vec![
(Var::Attack, 1),
(Var::Block, 1),
(Var::Buff, 1),
@ -146,14 +156,28 @@ impl Vbox {
(Var::Stun, 1),
];
self.free = iter::
repeat_with(|| {
let mut rng = thread_rng();
let dist = WeightedIndex::new(vars.iter().map(|item| item.1)).unwrap();
return vars[dist.sample(&mut rng)].0;
})
.take(8)
.collect::<Vec<Var>>();
let specs = vec![
(Var::Damage, 1),
(Var::Protection, 1),
(Var::Healing, 1),
(Var::Hp, 1),
];
let mut free = vec![];
let mut rng = thread_rng();
for i in 0..18 {
let vars = match i {
0...5 => &colours,
6...11 => &skills,
12...17 => &specs,
_ => panic!("vars oor"),
};
let dist = WeightedIndex::new(vars.iter().map(|item| item.1)).unwrap();
free.push(vars[dist.sample(&mut rng)].0);
}
self.free = free;
self
}