67 lines
1.5 KiB
Rust
67 lines
1.5 KiB
Rust
use core::{fmt::Debug, num::NonZeroU8};
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use crate::{game::DateTime, player::CharacterId};
|
|
|
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
|
pub enum DiedTo {
|
|
Execution {
|
|
day: NonZeroU8,
|
|
},
|
|
MapleWolf {
|
|
source: CharacterId,
|
|
night: NonZeroU8,
|
|
starves_if_fails: bool,
|
|
},
|
|
MapleWolfStarved {
|
|
night: NonZeroU8,
|
|
},
|
|
Militia {
|
|
killer: CharacterId,
|
|
night: NonZeroU8,
|
|
},
|
|
Wolfpack {
|
|
night: NonZeroU8,
|
|
},
|
|
AlphaWolf {
|
|
killer: CharacterId,
|
|
night: NonZeroU8,
|
|
},
|
|
Shapeshift {
|
|
into: CharacterId,
|
|
night: NonZeroU8,
|
|
},
|
|
Hunter {
|
|
killer: CharacterId,
|
|
night: NonZeroU8,
|
|
},
|
|
Guardian {
|
|
killer: CharacterId,
|
|
night: NonZeroU8,
|
|
},
|
|
}
|
|
|
|
impl DiedTo {
|
|
pub const fn date_time(&self) -> DateTime {
|
|
match self {
|
|
DiedTo::Execution { day } => DateTime::Day { number: *day },
|
|
|
|
DiedTo::Guardian { killer: _, night }
|
|
| DiedTo::MapleWolf {
|
|
source: _,
|
|
night,
|
|
starves_if_fails: _,
|
|
}
|
|
| DiedTo::MapleWolfStarved { night }
|
|
| DiedTo::Militia { killer: _, night }
|
|
| DiedTo::Wolfpack { night }
|
|
| DiedTo::AlphaWolf { killer: _, night }
|
|
| DiedTo::Shapeshift { into: _, night }
|
|
| DiedTo::Hunter { killer: _, night } => DateTime::Night {
|
|
number: night.get(),
|
|
},
|
|
}
|
|
}
|
|
}
|