genius_invokation/cards/action/
cost.rs1use crate::Element;
2
3#[derive(Debug, Hash, Clone, Copy, PartialEq, Eq)]
4pub struct CardCost {
5 dice: DiceCost,
6 amount: u8,
7 energy: u8,
8}
9
10#[derive(Debug, Hash, Clone, Copy, PartialEq, Eq)]
11pub enum DiceCost {
12 Any,
14 Same,
16 Exact(Element)
18}
19
20impl CardCost {
21 pub(crate) const ZERO: Self = Self { dice: DiceCost::Same, amount: 0, energy: 0 };
23
24 pub(crate) const ONE: Self = Self { dice: DiceCost::Same, amount: 1, energy: 0 };
26
27 pub(crate) const ANY2: Self = Self { dice: DiceCost::Any, amount: 2, energy: 0 };
29
30 pub(crate) const MATCH2: Self = Self { dice: DiceCost::Same, amount: 2, energy: 0 };
32
33 pub(crate) const MATCH3: Self = Self { dice: DiceCost::Same, amount: 3, energy: 0 };
35
36 pub(crate) const fn new(dice: DiceCost, amount: u8, energy: u8) -> Self {
37 Self { dice, amount, energy }
38 }
39
40 pub fn dice_type(&self) -> DiceCost {
42 self.dice
43 }
44
45 pub fn amount(&self) -> u8 {
47 self.amount
48 }
49
50 pub fn energy(&self) -> u8 {
54 self.energy
55 }
56}
57