buckshot_roulette_gameplay_engine/
shell.rs

1#[derive(Debug, Clone, Copy, PartialEq)]
2pub enum ShellType {
3    Live,
4    Blank,
5}
6
7#[derive(Debug, Clone, Copy)]
8pub enum ShotgunDamage {
9    Blank,
10    RegularShot(bool),
11    SawedShot(bool),
12}
13
14#[derive(Debug, Clone)]
15pub struct Shell(ShellType);
16
17impl Shell {
18    pub fn new(shell_type: ShellType) -> Self {
19        Shell(shell_type)
20    }
21
22    pub fn invert(&mut self) {
23        match self.0 {
24            ShellType::Live => self.0 = ShellType::Blank,
25            ShellType::Blank => self.0 = ShellType::Live,
26        }
27    }
28
29    pub fn fire(self) -> bool {
30        self.0 == ShellType::Live
31    }
32
33    pub fn shell_type(&self) -> ShellType {
34        self.0
35    }
36}