1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use core::fmt;
use serde::{Deserialize, Serialize};
use crate::creature::Creature;
#[cfg_attr(feature = "diesel", derive(Queryable, Insertable))]
#[cfg_attr(feature = "diesel", diesel(table_name = "monsters"))]
#[derive(Serialize, Deserialize, Debug)]
pub struct Monster {
pub creature: Creature,
}
impl Monster {
pub fn new(creature: Creature) -> Self {
Self { creature }
}
}
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)]
pub enum MonsterType {
Aberration,
Beast,
Celestial,
Construct,
Dragon,
Elemental,
Fey,
Fiend,
Giant,
Humanoid,
Monstrosity,
Ooze,
Plant,
Undead,
}
impl fmt::Display for MonsterType {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{:?}", self)
}
}