|
|
@ -108,12 +108,8 @@ impl RareMonsterAppearTable { |
|
|
|
|
|
|
|
pub fn roll_appearance(&self, monster: &MonsterType) -> bool {
|
|
|
|
println!("rolling appearance for {:?} with seed {:?}", monster, self.seed);
|
|
|
|
let mut rng = rand_chacha::ChaChaRng::from_entropy();
|
|
|
|
let roll: f32 = rng.gen();
|
|
|
|
let monster_rate = self.appear_rate.get(monster).unwrap_or(&0.0f32);
|
|
|
|
println!("rolled {:?} and {:?} has appear rate {:?}", roll, monster, monster_rate);
|
|
|
|
if roll < *monster_rate {
|
|
|
|
// if rng.gen::<f32>() < *self.appear_rate.get(monster).unwrap_or(&0.0f32) {
|
|
|
|
// let mut rng = rand_chacha::ChaChaRng::from_entropy();
|
|
|
|
if rand_chacha::ChaChaRng::from_entropy().gen::<f32>() < *self.appear_rate.get(monster).unwrap_or(&0.0f32) {
|
|
|
|
println!("its a rare!");
|
|
|
|
true
|
|
|
|
}
|
|
|
|