Browse Source

add best quest. add rare monsters to quests. dont use the same seed for random numbers if you want different results

pull/60/head
andy 3 years ago
parent
commit
5c49ded823
  1. 6
      data/quests.toml
  2. 8
      src/ship/map/enemy.rs
  3. 5
      src/ship/map/maps.rs
  4. 3
      src/ship/packet/handler/quest.rs

6
data/quests.toml

@ -32,4 +32,8 @@ dat = "q233-ext-bb.dat"
[[Retrieval.quests]]
bin = "q236-ext-bb.bin"
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"

8
src/ship/map/enemy.rs

@ -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
}

5
src/ship/map/maps.rs

@ -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>>, rare_monster_table: RareMonsterAppearTable) {
// 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_appear_table: &RareMonsterAppearTable) {
self.enemy_data = enemies;
self.roll_monster_appearance(rare_monster_appear_table);
// self.enemy_data = enemies
// .iter()

3
src/ship/packet/handler/quest.rs

@ -83,7 +83,8 @@ pub fn player_chose_quest(id: ClientId, questmenuselect: &QuestMenuSelect, quest
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))?;
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();
let bin = quest::quest_header(questmenuselect, &quest.bin_blob, "bin");

Loading…
Cancel
Save