|
@ -107,9 +107,13 @@ impl RareMonsterAppearTable { |
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
pub fn roll_appearance(&self, monster: &MonsterType) -> bool {
|
|
|
pub fn roll_appearance(&self, monster: &MonsterType) -> bool {
|
|
|
let mut rng = rand_chacha::ChaChaRng::seed_from_u64(self.seed as u64); // TODO: figure out how to seed with a u32
|
|
|
|
|
|
println!("rolling for {:?} appearance", monster);
|
|
|
|
|
|
if rng.gen::<f32>() < *self.appear_rate.get(monster).unwrap_or(&0.0f32) {
|
|
|
|
|
|
|
|
|
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) {
|
|
|
println!("its a rare!");
|
|
|
println!("its a rare!");
|
|
|
true
|
|
|
true
|
|
|
}
|
|
|
}
|
|
@ -349,42 +353,42 @@ impl MapEnemy { |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
// TODO: does `shiny` need to be set here?
|
|
|
|
|
|
// TODO: distinguish between a `random` rare monster and a `set/guaranteed` rare monster? (does any acceptable quest even have this?)
|
|
|
|
|
|
pub fn set_rare_appearance(self) -> MapEnemy {
|
|
|
|
|
|
match self.monster {
|
|
|
|
|
|
MonsterType::RagRappy | MonsterType::Hildebear |
|
|
|
|
|
|
MonsterType::PoisonLily | MonsterType::PofuillySlime |
|
|
|
|
|
|
MonsterType::SandRappyCrater | MonsterType::ZuCrater | MonsterType::Dorphon |
|
|
|
|
|
|
MonsterType::SandRappyDesert | MonsterType::ZuDesert | MonsterType::MerissaA |
|
|
|
|
|
|
MonsterType::SaintMillion | MonsterType::Shambertin => self.set_shiny(),
|
|
|
|
|
|
_ => self,
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// // TODO: does `shiny` need to be set here?
|
|
|
// // TODO: does `shiny` need to be set here?
|
|
|
// // TODO: distinguish between a `random` rare monster and a `set/guaranteed` rare monster? (does any acceptable quest even have this?)
|
|
|
// // TODO: distinguish between a `random` rare monster and a `set/guaranteed` rare monster? (does any acceptable quest even have this?)
|
|
|
// pub fn set_rare_appearance(self) -> MapEnemy {
|
|
|
// pub fn set_rare_appearance(self) -> MapEnemy {
|
|
|
// match (self.monster, self.map_area.to_episode()) {
|
|
|
|
|
|
// (MonsterType::RagRappy, Episode::One) => {MapEnemy {monster: MonsterType::AlRappy, ..self}},
|
|
|
|
|
|
// (MonsterType::RagRappy, Episode::Two) => {MapEnemy {monster: MonsterType::EventRappy, ..self}},
|
|
|
|
|
|
// (MonsterType::Hildebear, _) => {MapEnemy {monster: MonsterType::Hildeblue, ..self}},
|
|
|
|
|
|
// (MonsterType::PoisonLily, _) => {MapEnemy {monster: MonsterType::NarLily, ..self}},
|
|
|
|
|
|
// (MonsterType::PofuillySlime, _) => {MapEnemy {monster: MonsterType::PouillySlime, ..self}},
|
|
|
|
|
|
// (MonsterType::SandRappyCrater, _) => {MapEnemy {monster: MonsterType::DelRappyCrater, ..self}},
|
|
|
|
|
|
// (MonsterType::ZuCrater, _) => {MapEnemy {monster: MonsterType::PazuzuCrater, ..self}},
|
|
|
|
|
|
// (MonsterType::Dorphon, _) => {MapEnemy {monster: MonsterType::DorphonEclair, ..self}},
|
|
|
|
|
|
// (MonsterType::SandRappyDesert, _) => {MapEnemy {monster: MonsterType::DelRappyDesert, ..self}},
|
|
|
|
|
|
// (MonsterType::ZuDesert, _) => {MapEnemy {monster: MonsterType::PazuzuDesert, ..self}},
|
|
|
|
|
|
// (MonsterType::MerissaA, _) => {MapEnemy {monster: MonsterType::MerissaAA, ..self}},
|
|
|
|
|
|
// (MonsterType::SaintMillion, _) => {MapEnemy {monster: MonsterType::Kondrieu, ..self}},
|
|
|
|
|
|
// (MonsterType::Shambertin, _) => {MapEnemy {monster: MonsterType::Kondrieu, ..self}},
|
|
|
|
|
|
// _ => {self},
|
|
|
|
|
|
|
|
|
// match self.monster {
|
|
|
|
|
|
// MonsterType::RagRappy | MonsterType::Hildebear |
|
|
|
|
|
|
// MonsterType::PoisonLily | MonsterType::PofuillySlime |
|
|
|
|
|
|
// MonsterType::SandRappyCrater | MonsterType::ZuCrater | MonsterType::Dorphon |
|
|
|
|
|
|
// MonsterType::SandRappyDesert | MonsterType::ZuDesert | MonsterType::MerissaA |
|
|
|
|
|
|
// MonsterType::SaintMillion | MonsterType::Shambertin => self.set_shiny(),
|
|
|
|
|
|
// _ => self,
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: does `shiny` need to be set here?
|
|
|
|
|
|
// TODO: distinguish between a `random` rare monster and a `set/guaranteed` rare monster? (does any acceptable quest even have this?)
|
|
|
|
|
|
pub fn set_rare_appearance(self) -> MapEnemy {
|
|
|
|
|
|
match (self.monster, self.map_area.to_episode()) {
|
|
|
|
|
|
(MonsterType::RagRappy, Episode::One) => {MapEnemy {monster: MonsterType::AlRappy, shiny:true, ..self}},
|
|
|
|
|
|
(MonsterType::RagRappy, Episode::Two) => {MapEnemy {monster: MonsterType::EventRappy, shiny:true, ..self}},
|
|
|
|
|
|
(MonsterType::Hildebear, _) => {MapEnemy {monster: MonsterType::Hildeblue, shiny:true, ..self}},
|
|
|
|
|
|
(MonsterType::PoisonLily, _) => {MapEnemy {monster: MonsterType::NarLily, shiny:true, ..self}},
|
|
|
|
|
|
(MonsterType::PofuillySlime, _) => {MapEnemy {monster: MonsterType::PouillySlime, shiny:true, ..self}},
|
|
|
|
|
|
(MonsterType::SandRappyCrater, _) => {MapEnemy {monster: MonsterType::DelRappyCrater, shiny:true, ..self}},
|
|
|
|
|
|
(MonsterType::ZuCrater, _) => {MapEnemy {monster: MonsterType::PazuzuCrater, shiny:true, ..self}},
|
|
|
|
|
|
(MonsterType::Dorphon, _) => {MapEnemy {monster: MonsterType::DorphonEclair, shiny:true, ..self}},
|
|
|
|
|
|
(MonsterType::SandRappyDesert, _) => {MapEnemy {monster: MonsterType::DelRappyDesert, shiny:true, ..self}},
|
|
|
|
|
|
(MonsterType::ZuDesert, _) => {MapEnemy {monster: MonsterType::PazuzuDesert, shiny:true, ..self}},
|
|
|
|
|
|
(MonsterType::MerissaA, _) => {MapEnemy {monster: MonsterType::MerissaAA, shiny:true, ..self}},
|
|
|
|
|
|
(MonsterType::SaintMillion, _) => {MapEnemy {monster: MonsterType::Kondrieu, shiny:true, ..self}},
|
|
|
|
|
|
(MonsterType::Shambertin, _) => {MapEnemy {monster: MonsterType::Kondrieu, shiny:true, ..self}},
|
|
|
|
|
|
_ => {self},
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
// in theory this should only be called on monsters we know can have rare types
|
|
|
// in theory this should only be called on monsters we know can have rare types
|
|
|
pub fn roll_appearance_for_quest(self, rare_monster_table: &RareMonsterAppearTable) -> MapEnemy {
|
|
|
|
|
|
|
|
|
pub fn roll_appearance_for_mission(self, rare_monster_table: &RareMonsterAppearTable) -> MapEnemy {
|
|
|
if rare_monster_table.roll_appearance(&self.monster) {
|
|
|
if rare_monster_table.roll_appearance(&self.monster) {
|
|
|
return self.set_rare_appearance()
|
|
|
return self.set_rare_appearance()
|
|
|
}
|
|
|
}
|
|
|