add best quest. add rare monsters to quests. dont use the same seed for random numbers if you want different results
This commit is contained in:
parent
14e14639c8
commit
5c49ded823
@ -32,4 +32,8 @@ dat = "q233-ext-bb.dat"
|
|||||||
[[Retrieval.quests]]
|
[[Retrieval.quests]]
|
||||||
bin = "q236-ext-bb.bin"
|
bin = "q236-ext-bb.bin"
|
||||||
dat = "q236-ext-bb.dat"
|
dat = "q236-ext-bb.dat"
|
||||||
#drop_table = "q102-drops"
|
#drop_table = "q102-drops"
|
||||||
|
|
||||||
|
[[Retrieval.quests]]
|
||||||
|
bin = "q118-vr-bb.bin"
|
||||||
|
dat = "q118-vr-bb.dat"
|
||||||
|
@ -108,12 +108,8 @@ impl RareMonsterAppearTable {
|
|||||||
|
|
||||||
pub fn roll_appearance(&self, monster: &MonsterType) -> bool {
|
pub fn roll_appearance(&self, monster: &MonsterType) -> bool {
|
||||||
println!("rolling appearance for {:?} with seed {:?}", monster, self.seed);
|
println!("rolling appearance for {:?} with seed {:?}", monster, self.seed);
|
||||||
let mut rng = rand_chacha::ChaChaRng::from_entropy();
|
// let mut rng = rand_chacha::ChaChaRng::from_entropy();
|
||||||
let roll: f32 = rng.gen();
|
if rand_chacha::ChaChaRng::from_entropy().gen::<f32>() < *self.appear_rate.get(monster).unwrap_or(&0.0f32) {
|
||||||
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) {
|
|
||||||
println!("its a rare!");
|
println!("its a rare!");
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
@ -398,9 +398,10 @@ impl Maps {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_quest_data(&mut self, enemies: Vec<Option<MapEnemy>>, objects: Vec<Option<MapObject>>) {
|
// pub fn set_quest_data(&mut self, enemies: Vec<Option<MapEnemy>>, objects: Vec<Option<MapObject>>) {
|
||||||
// pub fn set_quest_data(&mut self, enemies: Vec<Option<MapEnemy>>, objects: Vec<Option<MapObject>>, rare_monster_table: RareMonsterAppearTable) {
|
pub fn set_quest_data(&mut self, enemies: Vec<Option<MapEnemy>>, objects: Vec<Option<MapObject>>, rare_monster_appear_table: &RareMonsterAppearTable) {
|
||||||
self.enemy_data = enemies;
|
self.enemy_data = enemies;
|
||||||
|
self.roll_monster_appearance(rare_monster_appear_table);
|
||||||
|
|
||||||
// self.enemy_data = enemies
|
// self.enemy_data = enemies
|
||||||
// .iter()
|
// .iter()
|
||||||
|
@ -83,7 +83,8 @@ pub fn player_chose_quest(id: ClientId, questmenuselect: &QuestMenuSelect, quest
|
|||||||
let room = rooms.get_mut(room_id.0)
|
let room = rooms.get_mut(room_id.0)
|
||||||
.ok_or_else(|| ShipError::InvalidRoom(room_id.0 as u32))?.as_mut()
|
.ok_or_else(|| ShipError::InvalidRoom(room_id.0 as u32))?.as_mut()
|
||||||
.ok_or_else(|| ShipError::InvalidRoom(room_id.0 as u32))?;
|
.ok_or_else(|| ShipError::InvalidRoom(room_id.0 as u32))?;
|
||||||
room.maps.set_quest_data(quest.enemies.clone(), quest.objects.clone());
|
// room.maps.set_quest_data(quest.enemies.clone(), quest.objects.clone());
|
||||||
|
room.maps.set_quest_data(quest.enemies.clone(), quest.objects.clone(), &room.rare_monster_table);
|
||||||
room.map_areas = quest.map_areas.clone();
|
room.map_areas = quest.map_areas.clone();
|
||||||
|
|
||||||
let bin = quest::quest_header(questmenuselect, &quest.bin_blob, "bin");
|
let bin = quest::quest_header(questmenuselect, &quest.bin_blob, "bin");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user