use super::keyword_instance::Keyword;
use super::keyword_with_cost::KeywordWithCost;
#[derive(Debug, Clone)]
pub struct Ninjutsu {
pub inner: KeywordWithCost,
pub commander: bool,
}
impl Ninjutsu {
pub fn new(original: String) -> Self {
Self {
inner: KeywordWithCost::new(Keyword::Ninjutsu, original),
commander: false,
}
}
pub fn parse(&mut self, details: &str) {
let mut cost_details = details;
if details.contains(':') {
let k: Vec<&str> = details.split(':').collect();
cost_details = k[0];
if k.len() > 1 && k[1] == "Commander" {
self.commander = true;
}
}
self.inner.parse(cost_details);
}
pub fn format_reminder_text(&self, reminder_text: &str) -> String {
let zone = if self.commander {
"hand or the command zone"
} else {
"hand"
};
reminder_text
.replace("%s", &self.inner.cost_string)
.replace("%1$s", &self.inner.cost_string)
.replace("%2$s", zone)
}
pub fn get_title(&self) -> String {
self.inner.get_title()
}
}