mons_rust/models/
mon.rs

1use crate::*;
2
3#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)]
4pub enum MonKind {
5    Demon,
6    Drainer,
7    Angel,
8    Spirit,
9    Mystic,
10}
11
12#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)]
13pub struct Mon {
14    pub kind: MonKind,
15    pub color: Color,
16    pub cooldown: i32,
17}
18
19impl Mon {
20    pub fn new(kind: MonKind, color: Color, cooldown: i32) -> Self {
21        Mon { kind, color, cooldown }
22    }
23
24    pub fn is_fainted(&self) -> bool {
25        self.cooldown > 0
26    }
27
28    pub fn faint(&mut self) {
29        self.cooldown = 2;
30    }
31
32    pub fn decrease_cooldown(&mut self) {
33        if self.cooldown > 0 {
34            self.cooldown -= 1;
35        }
36    }
37}