genius_invokation/cards/action/equip/
weapon.rs

1use crate::{CardCost, WeaponType::{self, *}};
2use super::Price;
3
4#[derive(Debug, Hash, Clone, Copy, PartialEq, Eq)]
5#[non_exhaustive]
6pub enum WeaponCard {
7    MagicGuide,
8    SacrificialFragments,
9    SkywardAtlas,
10    RavenBow,
11    SacrificialBow,
12    SkywardHarp,
13    WhiteIronGreatsword,
14    SacrificialGreatsword,
15    WolfsGravestone,
16    WhiteTassel,
17    LithicSpear,
18    SkywardSpine,
19    TravelersHandySword,
20    SacrificialSword,
21    AquilaFavonia,
22}
23
24impl super::PlayingCard for WeaponCard {
25    fn name(&self) -> &'static str {
26        self.info_dump().0
27    }
28
29    fn shop_price(&self) -> Option<Price> {
30        Some(self.info_dump().1)
31    }
32
33    fn cost(&self) -> CardCost {
34        self.info_dump().2
35    }
36
37    fn weapon(&self) -> Option<WeaponCard> {
38        Some(*self)
39    }
40}
41
42impl WeaponCard {
43    /// Retrieves the weapon type for this card
44    /// 
45    /// Currently, this method never returns `None`, but since some character cards have the
46    /// "Other Weapons" subtype, this could potentially mean there will be cards in the future
47    /// that don't fit into any of the weapon types, which would return None for this method
48    pub fn subtype(&self) -> Option<WeaponType> {
49        Some(self.info_dump().3)
50    }
51
52    fn info_dump(&self) -> (&'static str, Price, CardCost, WeaponType) {
53        match self {
54            Self::MagicGuide            => ("Magic Guide",             500, CardCost::MATCH2, Catalyst),
55            Self::SacrificialFragments  => ("Sacrificial Fragments",   700, CardCost::MATCH3, Catalyst),
56            Self::SkywardAtlas          => ("Skyward Atlas",          1000, CardCost::MATCH3, Catalyst),
57            Self::RavenBow              => ("Raven Bow",               500, CardCost::MATCH2, Bow),
58            Self::SacrificialBow        => ("Sacrificial Bow",         700, CardCost::MATCH3, Bow),
59            Self::SkywardHarp           => ("Skyward Harp",           1000, CardCost::MATCH3, Bow),
60            Self::WhiteIronGreatsword   => ("White Iron Greatsword",   500, CardCost::MATCH2, Claymore),
61            Self::SacrificialGreatsword => ("Sacrificial Greatsword",  700, CardCost::MATCH3, Claymore),
62            Self::WolfsGravestone       => ("Wolf's Gravestone",      1000, CardCost::MATCH3, Claymore),
63            Self::WhiteTassel           => ("White Tassel",            500, CardCost::MATCH2, Polearm),
64            Self::LithicSpear           => ("Lithic Spear",            700, CardCost::MATCH3, Polearm),
65            Self::SkywardSpine          => ("Skyward Spine",          1000, CardCost::MATCH3, Polearm),
66            Self::TravelersHandySword   => ("Traveler's Handy Sword",  500, CardCost::MATCH2, Sword),
67            Self::SacrificialSword      => ("Sacrificial Sword",       700, CardCost::MATCH3, Sword),
68            Self::AquilaFavonia         => ("Aquila Favonia",         1000, CardCost::MATCH3, Sword),
69        }
70    }
71}
72
73impl super::CardOrd for WeaponCard {
74    fn cmp(&self, other: &Self) -> std::cmp::Ordering {
75        (*self as u32).cmp(&(*other as u32))
76    }
77}
78
79impl_from!(Weapon: WeaponCard => crate::EquipmentCard => crate::ActionCard => crate::Card);