manabrew_engine/keyword/
hexproof.rs1use super::keyword_instance::Keyword;
6use super::keyword_with_type::KeywordWithType;
7
8#[derive(Debug, Clone)]
12pub struct Hexproof {
13 pub inner: KeywordWithType,
14}
15
16impl Hexproof {
17 pub fn new(original: String) -> Self {
19 Self {
20 inner: KeywordWithType::new(Keyword::Hexproof, original),
21 }
22 }
23
24 pub fn parse(&mut self, details: &str) {
26 self.inner.parse(details);
27 }
28
29 pub fn get_title(&self) -> String {
31 if self.inner.type_str.is_empty() {
32 "Hexproof".to_string()
33 } else {
34 format!("Hexproof from {}", self.inner.desc_type)
35 }
36 }
37
38 pub fn format_reminder_text(&self, reminder_text: &str) -> String {
40 if self.inner.type_str.is_empty() {
41 "This can't be the target of spells or abilities your opponents control.".to_string()
42 } else {
43 reminder_text.replace("%s", &self.inner.desc_type)
44 }
45 }
46}