rare_monsters #60
| @ -324,14 +324,13 @@ impl MapEnemy { | ||||
|     } | ||||
| 
 | ||||
|     pub fn has_rare_appearance(self) -> bool { | ||||
|         match self.monster { | ||||
|         matches!(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 => true, | ||||
|             _ => false | ||||
|         } | ||||
|             MonsterType::SaintMillion | MonsterType::Shambertin | ||||
|         ) | ||||
|     } | ||||
|     
 | ||||
|     /* | ||||
|  | ||||
| @ -33,8 +33,7 @@ fn parse_enemy(episode: &Episode, map_area: &MapArea, raw_enemy: RawMapEnemy) -> | ||||
| 
 | ||||
|     enemy | ||||
|         .map_or(vec![None], |monster| { | ||||
|             let mut monsters = Vec::new(); | ||||
|             monsters.push(Some(monster)); | ||||
|             let mut monsters = vec![Some(monster)]; | ||||
|             
 | ||||
|             match monster.monster { | ||||
|                 MonsterType::Monest => { | ||||
| @ -333,9 +332,9 @@ impl Maps { | ||||
|                 } | ||||
|             }) | ||||
|             .collect(); | ||||
|         for i in 0..shiny.len() { | ||||
|         for monster in &shiny { | ||||
|             if let Some(j) = rare_monsters.iter().position(|&x| x == 0xFFFF) { | ||||
|                 rare_monsters[j] = shiny[i].0 as u16; | ||||
|                 rare_monsters[j] = monster.0 as u16; | ||||
|             } else { | ||||
|                 break
 | ||||
|             } | ||||
| @ -346,11 +345,18 @@ impl Maps { | ||||
|     pub fn roll_monster_appearance(&mut self, rare_monster_table: &RareMonsterAppearTable) { | ||||
|         self.enemy_data = self.enemy_data | ||||
|                             .iter() | ||||
|                             .map(|&x| if x.is_some() && x.unwrap().has_rare_appearance() { | ||||
|                                 Some(x.unwrap().roll_appearance_for_mission(&rare_monster_table)) | ||||
|                             } else { | ||||
|                                 x | ||||
|                             }) | ||||
|                             // .map(|&x| if x.is_some() && x.unwrap().has_rare_appearance() {
 | ||||
|                             .map(|&x| | ||||
|                                 if let Some(monster) = x { | ||||
|                                     if monster.has_rare_appearance() { | ||||
|                                         Some(monster.roll_appearance_for_mission(rare_monster_table)) | ||||
|                                     } else { | ||||
|                                         Some(monster) | ||||
|                                     } | ||||
|                                 } else { | ||||
|                                     x | ||||
|                                 } | ||||
|                             ) | ||||
|                             .collect(); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -72,8 +72,8 @@ pub fn add_to_room(_id: ClientId, | ||||
|     }) | ||||
| } | ||||
| 
 | ||||
| pub fn build_rare_monster_list(rare_monster_vec: Vec<u16>) -> Result<RareMonsterList, ShipError> { | ||||
|     Ok(RareMonsterList { | ||||
| pub fn build_rare_monster_list(rare_monster_vec: Vec<u16>) -> RareMonsterList { | ||||
|     RareMonsterList { | ||||
|         ids: rare_monster_vec.try_into().unwrap_or([0xFFFFu16; 16]), | ||||
|     }) | ||||
|     } | ||||
| } | ||||
| @ -130,9 +130,15 @@ pub fn done_bursting(id: ClientId, | ||||
|              .flatten() | ||||
|     ); | ||||
| 
 | ||||
|     // // TODO: check how often `done_bursting` is called. ie: make sure it's only used when joining a room and not each time a player warps in a pipe
 | ||||
|     // if rare_monster_list.is_some() {
 | ||||
|     //     let rare_monster_packet = SendShipPacket::RareMonsterList(builder::room::build_rare_monster_list(rare_monster_list.unwrap()).unwrap()); // TODO: don't double unwrap
 | ||||
|     //     result = Box::new(result.chain(vec![(id, rare_monster_packet)])); // TODO: make sure we arent clobbering `result` here
 | ||||
|     // }
 | ||||
| 
 | ||||
|     // TODO: check how often `done_bursting` is called. ie: make sure it's only used when joining a room and not each time a player warps in a pipe
 | ||||
|     if rare_monster_list.is_some() { | ||||
|         let rare_monster_packet = SendShipPacket::RareMonsterList(builder::room::build_rare_monster_list(rare_monster_list.unwrap()).unwrap()); // TODO: don't double unwrap
 | ||||
|     if let Some(rare_list) = rare_monster_list { | ||||
|         let rare_monster_packet = SendShipPacket::RareMonsterList(builder::room::build_rare_monster_list(rare_list)); | ||||
|         result = Box::new(result.chain(vec![(id, rare_monster_packet)])); // TODO: make sure we arent clobbering `result` here
 | ||||
|     } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user