manabrew_engine/keyword/
equip.rs1use super::keyword_instance::Keyword;
6use super::keyword_with_cost::KeywordWithCost;
7
8#[derive(Debug, Clone)]
11pub struct Equip {
12 pub inner: KeywordWithCost,
13 pub equip_type: String,
15}
16
17impl Equip {
18 pub fn new(original: String) -> Self {
20 Self {
21 inner: KeywordWithCost::new(Keyword::Equip, original),
22 equip_type: "creature".to_string(),
23 }
24 }
25
26 pub fn parse(&mut self, details: &str) {
28 let k: Vec<&str> = details.split(':').collect();
29 self.inner.parse(k[0]);
30 if k.len() > 2 {
31 self.equip_type = k[2].to_string();
32 }
33 }
34
35 pub fn get_valid_description(&self) -> &str {
37 &self.equip_type
38 }
39
40 pub fn format_reminder_text(&self, reminder_text: &str) -> String {
42 reminder_text
43 .replace("%s", &self.inner.cost_string)
44 .replace("%1$s", &self.inner.cost_string)
45 .replace("%2$s", &self.equip_type)
46 }
47
48 pub fn get_title(&self) -> String {
50 self.inner.get_title()
51 }
52}