manabrew_engine/keyword/
mayhem.rs1use super::keyword_instance::Keyword;
6use super::keyword_with_cost::KeywordWithCost;
7
8#[derive(Debug, Clone)]
11pub struct Mayhem {
12 pub inner: KeywordWithCost,
13 pub no_cost: bool,
15}
16
17impl Mayhem {
18 pub fn new(original: String) -> Self {
20 Self {
21 inner: KeywordWithCost::new(Keyword::Mayhem, original),
22 no_cost: false,
23 }
24 }
25
26 pub fn parse(&mut self, details: &str) {
28 if details.is_empty() {
29 self.no_cost = true;
30 } else {
31 self.inner.parse(details);
32 }
33 }
34
35 pub fn get_title(&self) -> String {
37 if self.no_cost {
38 self.inner.base.keyword.display_name().to_string()
39 } else {
40 self.inner.get_title()
41 }
42 }
43
44 pub fn format_reminder_text(&self, reminder_text: &str) -> String {
46 if self.no_cost {
47 "You may play this card from your graveyard if you discarded it this turn. Timing rules still apply.".to_string()
48 } else {
49 self.inner.format_reminder_text(reminder_text)
50 }
51 }
52}