genius_invokation/cards/action/support/
item.rs

1use crate::CardCost;
2
3use super::Price;
4
5#[derive(Debug, Hash, Clone, Copy, PartialEq, Eq)]
6#[non_exhaustive]
7pub enum ItemCard {
8    ParametricTransformer,
9    NRE,
10}
11
12impl super::PlayingCard for ItemCard {
13    fn name(&self) -> &'static str {
14        self.info_dump().0
15    }
16
17    fn shop_price(&self) -> Option<Price> {
18        Some(self.info_dump().1)
19    }
20
21    fn cost(&self) -> CardCost {
22        self.info_dump().2
23    }
24
25    fn item(&self) -> Option<ItemCard> {
26        Some(*self)
27    }
28}
29
30impl ItemCard {
31    fn info_dump(&self) -> (&'static str, Price, CardCost) {
32        match self {
33            Self::ParametricTransformer => ("Parametric Transformer", 700, CardCost::ANY2),
34            Self::NRE =>                   ("NRE",                    700, CardCost::ANY2),
35        }
36    }
37}
38
39impl super::CardOrd for ItemCard {
40    fn cmp(&self, other: &Self) -> std::cmp::Ordering {
41        (*self as u32).cmp(&(*other as u32))
42    }
43}
44
45impl_from!(Item: ItemCard => crate::SupportCard => crate::ActionCard => crate::Card);