genius_invokation/cards/character/
mod.rs

1use crate::{Card, Element::{self, *}};
2
3pub use weapon::WeaponType;
4mod weapon;
5
6pub use faction::Faction;
7mod faction;
8
9#[derive(Debug, Hash, Clone, Copy, PartialEq, Eq)]
10#[non_exhaustive]
11pub enum CharacterCard {
12    KamisatoAyaka,
13    Chongyun,
14    Diona,
15    Ganyu,
16    Kaeya,
17    Barbara,
18    Mona,
19    Xingqiu,
20    Cyno,
21    Fischl,
22    Keqing,
23    Razor,
24    Ningguang,
25    Noelle,
26    Collei,
27    Jean,
28    Sucrose,
29    Bennett,
30    Diluc,
31    Xiangling,
32    Yoimiya,
33    MirrorMaiden,
34    RhodeiaOfLoch,
35    StonehideLawachurl,
36    JadeplumeTerrorshroom,
37    MaguuKenki,
38    FatuiPyroAgent,
39}
40
41use WeaponType::*;
42use Faction::*;
43
44impl CharacterCard {
45    pub fn name(&self) -> &'static str {
46        self.info_dump().0
47    }
48
49    pub fn element(&self) -> Element {
50        self.info_dump().1
51    }
52
53    /// The weapon type this character can hold
54    /// 
55    /// Returns `None` for characters listed as "Other Weapon"
56    pub fn weapon(&self) -> Option<WeaponType> {
57        self.info_dump().2
58    }
59
60    pub fn faction(&self) -> Faction {
61        self.info_dump().3  
62    }
63
64    fn info_dump(&self) -> (&'static str, Element, Option<WeaponType>, Faction) {
65        match self {
66            Self::KamisatoAyaka => ("Kamisato Ayaka", Cryo,    Some(Sword),    Inazuma),
67            Self::Chongyun =>      ("Chongyun",       Cryo,    Some(Claymore), Liyue),
68            Self::Diona =>         ("Diona",          Cryo,    Some(Bow),      Mondstadt),
69            Self::Ganyu =>         ("Ganyu",          Cryo,    Some(Bow),      Liyue),
70            Self::Kaeya =>         ("Kaeya",          Cryo,    Some(Sword),    Mondstadt),
71            Self::Barbara =>       ("Barbara",        Hydro,   Some(Catalyst), Mondstadt),
72            Self::Mona =>          ("Mona",           Hydro,   Some(Catalyst), Mondstadt),
73            Self::Xingqiu =>       ("Xingqiu",        Hydro,   Some(Sword),    Liyue),
74            Self::Cyno =>          ("Cyno",           Electro, Some(Polearm),  Sumeru),
75            Self::Fischl =>        ("Fischl",         Electro, Some(Bow),      Mondstadt),
76            Self::Keqing =>        ("Keqing",         Electro, Some(Sword),    Liyue),
77            Self::Razor =>         ("Razor",          Electro, Some(Claymore), Mondstadt),
78            Self::Ningguang =>     ("Ningguang",      Geo,     Some(Catalyst), Liyue),
79            Self::Noelle =>        ("Noelle",         Geo,     Some(Claymore), Mondstadt),
80            Self::Collei =>        ("Collei",         Dendro,  Some(Bow),      Sumeru),
81            Self::Jean =>          ("Jean",           Anemo,   Some(Sword),    Mondstadt),
82            Self::Sucrose =>       ("Sucrose",        Anemo,   Some(Catalyst), Mondstadt),
83            Self::Bennett =>       ("Bennett",        Pyro,    Some(Sword),    Mondstadt),
84            Self::Diluc =>         ("Diluc",          Pyro,    Some(Claymore), Mondstadt),
85            Self::Xiangling =>     ("Xiangling",      Pyro,    Some(Polearm),  Liyue),
86            Self::Yoimiya =>       ("Yoimiya",        Pyro,    Some(Bow),      Inazuma),
87            Self::MirrorMaiden =>          ("Mirror Maiden",          Hydro,  None, Fatui),
88            Self::RhodeiaOfLoch =>         ("Rhodeia of Loch",        Hydro,  None, Monster),
89            Self::StonehideLawachurl =>    ("Stonehide Lawachurl",    Geo,    None, Monster),
90            Self::JadeplumeTerrorshroom => ("Jadeplume Terrorshroom", Dendro, None, Monster),
91            Self::MaguuKenki =>            ("Maguu Kenki",            Anemo,  None, Monster),
92            Self::FatuiPyroAgent =>        ("Fatui Pyro Agent",       Pyro,   None, Fatui),
93        }
94    }
95}
96
97impl From<CharacterCard> for Card {
98    fn from(card: CharacterCard) -> Card {
99        Card::Character(card)
100    }
101}
102
103impl super::CardOrd for CharacterCard {
104    fn cmp(&self, other: &Self) -> std::cmp::Ordering {
105        (*self as u32).cmp(&(*other as u32))
106    }
107}