use super::keyword_instance::Keyword;
use super::keyword_with_cost::KeywordWithCost;
#[derive(Debug, Clone)]
pub struct Craft {
pub inner: KeywordWithCost,
pub mana_string: String,
pub exile_string: String,
}
impl Craft {
pub fn new(original: String) -> Self {
Self {
inner: KeywordWithCost::new(Keyword::Craft, original),
mana_string: "Mana?".to_string(),
exile_string: "Exile?".to_string(),
}
}
pub fn parse(&mut self, details: &str) {
let k: Vec<&str> = details.split(':').collect();
if !k.is_empty() {
self.inner.parse(k[0]);
self.mana_string = k[0].to_string();
}
if k.len() > 2 {
self.exile_string = format!(
"Exile {} from among permanents you control and/or cards in your graveyard",
k[2]
);
}
}
pub fn format_reminder_text(&self, reminder_text: &str) -> String {
let cost_desc = format!(
"{}, Exile this artifact, {}",
self.mana_string, self.exile_string
);
reminder_text.replace("%s", &cost_desc)
}
pub fn get_title(&self) -> String {
self.inner.get_title()
}
}