Skip to main content

manabrew_engine/keyword/
amplify.rs

1//! Amplify keyword implementation.
2//!
3//! Ported from Java's `Amplify.java` in `forge/game/keyword/`.
4
5use super::keyword_instance::Keyword;
6use super::keyword_with_amount::KeywordWithAmount;
7
8/// Amplify keyword data.
9/// As this creature enters, put +1/+1 counters on it for each matching creature card revealed.
10#[derive(Debug, Clone)]
11pub struct Amplify {
12    pub inner: KeywordWithAmount,
13}
14
15impl Amplify {
16    /// Create a new Amplify keyword.
17    pub fn new(original: String) -> Self {
18        Self {
19            inner: KeywordWithAmount::new(Keyword::Amplify, original),
20        }
21    }
22
23    /// Parse the details string.
24    pub fn parse(&mut self, details: &str) {
25        self.inner.parse(details);
26    }
27
28    /// Format reminder text.
29    /// Overrides the base to include creature type information.
30    pub fn format_reminder_text(&self, reminder_text: &str) -> String {
31        let type_desc = "creature"; // In Java this reads from the host card's creature types
32        reminder_text
33            .replace("%d", &self.inner.amount.to_string())
34            .replace("%1$d", &self.inner.amount.to_string())
35            .replace("%s", type_desc)
36    }
37}