genius_invokation/cards/action/event/
resonance.rs

1use crate::{CardCost, DiceCost::Exact, Element::{self, *}};
2
3use super::Price;
4
5#[derive(Debug, Hash, Clone, Copy, PartialEq, Eq)]
6#[non_exhaustive]
7pub enum ElementalResonanceCard {
8    WovenIce,
9    ShatteringIce,
10    WovenWaters,
11    SoothingWater,
12    WovenFlames,
13    FerventFlames,
14    WovenThunder,
15    HighVoltage,
16    WovenWinds,
17    ImpetuousWinds,
18    WovenStone,
19    EnduringRock,
20    WovenWeeds,
21    SprawlingGreenery,
22}
23
24impl ElementalResonanceCard {
25    /// Returns which element this resonance card is attached to
26    pub fn element(&self) -> Element {
27        self.info_dump().1
28    }
29}
30
31impl super::PlayingCard for ElementalResonanceCard {
32    fn name(&self) -> &'static str {
33        self.info_dump().0
34    }
35
36    fn shop_price(&self) -> Option<Price> {
37        Some(500)
38    }
39
40    fn cost(&self) -> CardCost {
41        self.info_dump().2
42    }
43
44    fn resonance(&self) -> Option<ElementalResonanceCard> {
45        Some(*self)
46    }
47}
48
49impl ElementalResonanceCard {
50    fn info_dump(&self) -> (&'static str, Element, CardCost) {
51        match self {
52            Self::WovenIce =>          ("Woven Ice",          Cryo,    CardCost::ZERO),
53            Self::ShatteringIce =>     ("Shattering Ice",     Cryo,    CardCost::new(Exact(Cryo),    1, 0)),
54            Self::WovenWaters =>       ("Woven Waters",       Hydro,   CardCost::ZERO),
55            Self::SoothingWater =>     ("Soothing Water",     Hydro,   CardCost::new(Exact(Hydro),   1, 0)),
56            Self::WovenFlames =>       ("Woven Flames",       Pyro,    CardCost::ZERO),
57            Self::FerventFlames =>     ("Fervent Flames",     Pyro,    CardCost::new(Exact(Pyro),    1, 0)),
58            Self::WovenThunder =>      ("Woven Thunder",      Electro, CardCost::ZERO),
59            Self::HighVoltage =>       ("High Voltage",       Electro, CardCost::new(Exact(Electro), 1, 0)),
60            Self::WovenWinds =>        ("Woven Winds",        Anemo,   CardCost::ZERO),
61            Self::ImpetuousWinds =>    ("Impetuous Winds",    Anemo,   CardCost::new(Exact(Anemo),   1, 0)),
62            Self::WovenStone =>        ("Woven Stone",        Geo,     CardCost::ZERO),
63            Self::EnduringRock =>      ("Enduring Rock",      Geo,     CardCost::new(Exact(Geo),     1, 0)),
64            Self::WovenWeeds =>        ("Woven Weeds",        Dendro,  CardCost::ZERO),
65            Self::SprawlingGreenery => ("Sprawling Greenery", Dendro,  CardCost::new(Exact(Dendro),  1, 0)),
66        }
67    }
68}
69
70impl super::CardOrd for ElementalResonanceCard {
71    fn cmp(&self, other: &Self) -> std::cmp::Ordering {
72        (*self as u32).cmp(&(*other as u32))
73    }
74}
75
76impl_from!(Resonance: ElementalResonanceCard => crate::EventCard => crate::ActionCard => crate::Card);