|
@ -0,0 +1,48 @@ |
|
|
|
|
|
use std::convert::TryFrom;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
|
|
pub enum MonsterParseError {
|
|
|
|
|
|
UnknownMonster(String),
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Copy, Clone)]
|
|
|
|
|
|
pub enum MonsterType {
|
|
|
|
|
|
Booma,
|
|
|
|
|
|
Gobooma,
|
|
|
|
|
|
Gigobooma,
|
|
|
|
|
|
RagRappy,
|
|
|
|
|
|
AlRappy,
|
|
|
|
|
|
BarbarousWolf,
|
|
|
|
|
|
SavageWolf,
|
|
|
|
|
|
Hildebear,
|
|
|
|
|
|
Hildeblue,
|
|
|
|
|
|
Monest,
|
|
|
|
|
|
Mothmant,
|
|
|
|
|
|
|
|
|
|
|
|
EvilShark,
|
|
|
|
|
|
PalShark,
|
|
|
|
|
|
GuilShark,
|
|
|
|
|
|
// etc...
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl TryFrom<&str> for MonsterType {
|
|
|
|
|
|
type Error = MonsterParseError;
|
|
|
|
|
|
|
|
|
|
|
|
fn try_from(monster: &str) -> Result<MonsterType, MonsterParseError> {
|
|
|
|
|
|
match monster {
|
|
|
|
|
|
"Booma" | "Bartle" => Ok(MonsterType::Booma),
|
|
|
|
|
|
"Gobooma" | "Barble" => Ok(MonsterType::Gobooma),
|
|
|
|
|
|
"Gigobooma" | "Tollaw" => Ok(MonsterType::Gigobooma),
|
|
|
|
|
|
// etc...
|
|
|
|
|
|
_ => Err(MonsterParseError::UnknownMonster(monster.to_owned()))
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|