manabrew_engine/keyword/
kicker.rs1use super::keyword_instance::Keyword;
6use super::keyword_with_cost::KeywordWithCost;
7
8#[derive(Debug, Clone)]
12pub struct Kicker {
13 pub inner: KeywordWithCost,
14 pub cost2: Option<String>,
16}
17
18impl Kicker {
19 pub fn new(original: String) -> Self {
21 Self {
22 inner: KeywordWithCost::new(Keyword::Kicker, original),
23 cost2: None,
24 }
25 }
26
27 pub fn parse(&mut self, details: &str) {
29 let parts: Vec<&str> = details.split(':').collect();
30 self.inner.parse(parts[0]);
31 if parts.len() > 1 {
32 self.cost2 = Some(parts[1].to_string());
33 }
34 }
35
36 pub fn format_reminder_text(&self, reminder_text: &str) -> String {
38 if let Some(ref cost2) = self.cost2 {
39 format!(
40 "You may pay an additional {} and/or {} as you cast this spell.",
41 self.inner.cost_string, cost2
42 )
43 } else {
44 self.inner.format_reminder_text(reminder_text)
45 }
46 }
47
48 pub fn get_title(&self) -> String {
50 self.inner.get_title()
51 }
52}