|
@ -174,3 +174,22 @@ impl<R: Rng + SeedableRng> DropTable<R> { |
|
|
self.box_table.get_drop(map_area, object, &mut self.rng)
|
|
|
self.box_table.get_drop(map_area, object, &mut self.rng)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
|
|
mod test {
|
|
|
|
|
|
use super::*;
|
|
|
|
|
|
use rand::seq::IteratorRandom;
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
fn test_initializing_drop_table() {
|
|
|
|
|
|
let mut rng = rand_chacha::ChaCha20Rng::from_entropy();
|
|
|
|
|
|
let episode = vec![Episode::One, Episode::Two].into_iter().choose(&mut rng).unwrap();
|
|
|
|
|
|
let difficulty = vec![Difficulty::Normal, Difficulty::Hard, Difficulty::VeryHard, Difficulty::Ultimate]
|
|
|
|
|
|
.into_iter().choose(&mut rng).unwrap();
|
|
|
|
|
|
let section_id = vec![SectionID::Viridia, SectionID::Greenill, SectionID::Skyly, SectionID::Bluefull, SectionID::Purplenum,
|
|
|
|
|
|
SectionID::Pinkal, SectionID::Redria, SectionID::Oran, SectionID::Yellowboze, SectionID::Whitill]
|
|
|
|
|
|
.into_iter().choose(&mut rng).unwrap();
|
|
|
|
|
|
DropTable::<rand_chacha::ChaCha20Rng>::new(episode, difficulty, section_id);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|