genius_invokation/cards/action/support/
location.rs

1use crate::CardCost;
2
3use super::Price;
4
5#[derive(Debug, Hash, Clone, Copy, PartialEq, Eq)]
6#[non_exhaustive]
7pub enum LocationCard {
8    DawnWinery,
9    FavoniusCathedral,
10    KnightsOfFavoniusLibrary,
11    JadeChamber,
12    LiyueHarborWharf,
13    WangshuInn,
14}
15
16impl super::PlayingCard for LocationCard {
17    fn name(&self) -> &'static str {
18        self.info_dump().0
19    }
20
21    fn shop_price(&self) -> Option<Price> {
22        Some(700)
23    }
24
25    fn cost(&self) -> CardCost {
26        self.info_dump().1
27    }
28
29    fn location(&self) -> Option<LocationCard> {
30        Some(*self)
31    }
32}
33
34impl LocationCard {
35    fn info_dump(&self) -> (&'static str, CardCost) {
36        match self {
37            Self::DawnWinery =>               ("Dawn Winery",                 CardCost::MATCH2),
38            Self::FavoniusCathedral =>        ("Favonius Cathedral",          CardCost::MATCH2),
39            Self::KnightsOfFavoniusLibrary => ("Knights of Favonius Library", CardCost::ONE),
40            Self::JadeChamber =>              ("Jade Chamber",                CardCost::ONE),
41            Self::LiyueHarborWharf =>         ("Liyue Harbor Wharf",          CardCost::MATCH2),
42            Self::WangshuInn =>               ("Wangshu Inn",                 CardCost::MATCH2),
43        }
44    }
45}
46
47impl super::CardOrd for LocationCard {
48    fn cmp(&self, other: &Self) -> std::cmp::Ordering {
49        (*self as u32).cmp(&(*other as u32))
50    }
51}
52
53impl_from!(Location: LocationCard => crate::SupportCard => crate::ActionCard => crate::Card);