gamemstr-common 0.1.0

Common code for the gamemstr project
Documentation
use core::fmt;

use serde::{Deserialize, Serialize};

use crate::creature::Creature;

#[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)
    }
}