Skip to main content

manabrew_engine/staticability/
static_ability_view.rs

1use crate::ids::CardId;
2use serde::{Deserialize, Serialize};
3
4/// View representation of a static ability for UI display.
5/// Mirrors Java's `StaticAbilityView`.
6#[derive(Debug, Clone, Serialize, Deserialize)]
7pub struct StaticAbilityView {
8    pub host_card: Option<CardId>,
9    pub description: String,
10}
11
12impl StaticAbilityView {
13    pub fn new(host_card: Option<CardId>, description: String) -> Self {
14        Self {
15            host_card,
16            description,
17        }
18    }
19
20    pub fn get_host_card(&self) -> Option<CardId> {
21        self.host_card
22    }
23
24    pub fn get_description(&self) -> &str {
25        &self.description
26    }
27}
28
29impl std::fmt::Display for StaticAbilityView {
30    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
31        write!(f, "{}", self.description)
32    }
33}