|
@ -112,7 +112,7 @@ pub struct ItemDrop { |
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub struct DropTable<R: Rng + SeedableRng> {
|
|
|
|
|
|
|
|
|
pub struct DropTable {
|
|
|
monster_stats: HashMap<MonsterType, MonsterDropStats>,
|
|
|
monster_stats: HashMap<MonsterType, MonsterDropStats>,
|
|
|
rare_table: RareDropTable,
|
|
|
rare_table: RareDropTable,
|
|
|
weapon_table: GenericWeaponTable,
|
|
|
weapon_table: GenericWeaponTable,
|
|
@ -121,11 +121,11 @@ pub struct DropTable<R: Rng + SeedableRng> { |
|
|
unit_table: GenericUnitTable,
|
|
|
unit_table: GenericUnitTable,
|
|
|
tool_table: ToolTable,
|
|
|
tool_table: ToolTable,
|
|
|
box_table: BoxDropTable,
|
|
|
box_table: BoxDropTable,
|
|
|
rng: R,
|
|
|
|
|
|
|
|
|
rng: rand_chacha::ChaCha20Rng,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
impl<R: Rng + SeedableRng> DropTable<R> {
|
|
|
|
|
|
pub fn new(episode: Episode, difficulty: Difficulty, section_id: SectionID) -> DropTable<R> {
|
|
|
|
|
|
|
|
|
impl DropTable {
|
|
|
|
|
|
pub fn new(episode: Episode, difficulty: Difficulty, section_id: SectionID) -> DropTable {
|
|
|
let monster_stats: HashMap<String, MonsterDropStats> = load_data_file(episode, difficulty, section_id, "monster_dar.toml");
|
|
|
let monster_stats: HashMap<String, MonsterDropStats> = load_data_file(episode, difficulty, section_id, "monster_dar.toml");
|
|
|
|
|
|
|
|
|
DropTable {
|
|
|
DropTable {
|
|
@ -137,7 +137,7 @@ impl<R: Rng + SeedableRng> DropTable<R> { |
|
|
unit_table: GenericUnitTable::new(episode, difficulty, section_id),
|
|
|
unit_table: GenericUnitTable::new(episode, difficulty, section_id),
|
|
|
tool_table: ToolTable::new(episode, difficulty, section_id),
|
|
|
tool_table: ToolTable::new(episode, difficulty, section_id),
|
|
|
box_table: BoxDropTable::new(episode, difficulty, section_id),
|
|
|
box_table: BoxDropTable::new(episode, difficulty, section_id),
|
|
|
rng: R::from_entropy(),
|
|
|
|
|
|
|
|
|
rng: rand_chacha::ChaCha20Rng::from_entropy(),
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
@ -203,6 +203,6 @@ mod test { |
|
|
let section_id = vec![SectionID::Viridia, SectionID::Greenill, SectionID::Skyly, SectionID::Bluefull, SectionID::Purplenum,
|
|
|
let section_id = vec![SectionID::Viridia, SectionID::Greenill, SectionID::Skyly, SectionID::Bluefull, SectionID::Purplenum,
|
|
|
SectionID::Pinkal, SectionID::Redria, SectionID::Oran, SectionID::Yellowboze, SectionID::Whitill]
|
|
|
SectionID::Pinkal, SectionID::Redria, SectionID::Oran, SectionID::Yellowboze, SectionID::Whitill]
|
|
|
.into_iter().choose(&mut rng).unwrap();
|
|
|
.into_iter().choose(&mut rng).unwrap();
|
|
|
DropTable::<rand_chacha::ChaCha20Rng>::new(episode, difficulty, section_id);
|
|
|
|
|
|
|
|
|
DropTable::new(episode, difficulty, section_id);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|