|
|
@ -240,7 +240,7 @@ impl AttributeTable { |
|
|
|
|
|
|
|
|
|
|
|
fn generate_attribute<R: Rng>(&self, pattern: &PercentPatternType, rates: &AttributeRate, rng: &mut R) -> Option<WeaponAttribute> {
|
|
|
|
let attribute_weights = WeightedIndex::new(&[rates.none, rates.native, rates.abeast, rates.machine, rates.dark, rates.hit]).unwrap();
|
|
|
|
let attribute_weights = WeightedIndex::new([rates.none, rates.native, rates.abeast, rates.machine, rates.dark, rates.hit]).unwrap();
|
|
|
|
let attr = match attribute_weights.sample(rng) {
|
|
|
|
0 => return None,
|
|
|
|
1 => Attribute::Native,
|
|
|
@ -253,7 +253,7 @@ impl AttributeTable { |
|
|
|
|
|
|
|
let percents = self.percent_rates.get_by_pattern(pattern);
|
|
|
|
|
|
|
|
let value_weights = WeightedIndex::new(&percents.as_array()).unwrap();
|
|
|
|
let value_weights = WeightedIndex::new(percents.as_array()).unwrap();
|
|
|
|
let value = value_weights.sample(rng);
|
|
|
|
let percent = ((value + 1) * 5) as i8;
|
|
|
|
|
|
|
@ -477,7 +477,7 @@ impl GenericWeaponTable { |
|
|
|
let pattern = std::cmp::min(area % ratio.inc, 3);
|
|
|
|
|
|
|
|
let weights = self.grind_rates.grind_rate[pattern as usize];
|
|
|
|
let grind_choice = WeightedIndex::new(&weights).unwrap();
|
|
|
|
let grind_choice = WeightedIndex::new(weights).unwrap();
|
|
|
|
grind_choice.sample(rng)
|
|
|
|
}
|
|
|
|
|
|
|
|