pub struct TargetChoices {
pub target_player: Option<PlayerId>,
pub additional_target_players: Vec<PlayerId>,
pub target_card: Option<CardId>,
pub target_card_zone_timestamp: Option<u64>,
pub target_stack_entry: Option<u32>,
pub divided_map: HashMap<CardId, i32>,
}Expand description
Targets chosen for a single ability in the SubAbility chain.
Mirrors Java’s TargetChoices which holds selected targets (cards, players, stack entries).
Fields§
§target_player: Option<PlayerId>§additional_target_players: Vec<PlayerId>§target_card: Option<CardId>§target_card_zone_timestamp: Option<u64>Zone timestamp captured when target_card was chosen.
Used to preserve object identity across zone changes (CR 400.7).
target_stack_entry: Option<u32>ID of a targeted stack entry (for Counter effects).
divided_map: HashMap<CardId, i32>Divided damage/effect allocation per target card.
Mirrors Java’s TargetChoices.dividedMap.
Implementations§
Source§impl TargetChoices
impl TargetChoices
Sourcepub fn all_target_players(&self) -> Vec<PlayerId>
pub fn all_target_players(&self) -> Vec<PlayerId>
Collect all targeted players for this node.
Sourcepub fn all_target_cards(&self) -> Vec<CardId>
pub fn all_target_cards(&self) -> Vec<CardId>
Collect all targeted cards for this node.
Sourcepub fn add(
&mut self,
target_card: Option<CardId>,
target_player: Option<PlayerId>,
)
pub fn add( &mut self, target_card: Option<CardId>, target_player: Option<PlayerId>, )
Add a target (card and/or player).
Mirrors Java’s TargetChoices.add(GameObject).
Sourcepub fn remove(&mut self, card: CardId)
pub fn remove(&mut self, card: CardId)
Remove a card target.
Mirrors Java’s TargetChoices.remove(Card).
Sourcepub fn remove_all(&mut self)
pub fn remove_all(&mut self)
Clear all targets.
Mirrors Java’s TargetChoices.removeAll().
Sourcepub fn contains(&self, card: CardId) -> bool
pub fn contains(&self, card: CardId) -> bool
Check if a card is targeted.
Mirrors Java’s TargetChoices.contains(Card).
Sourcepub fn replace_target_card(&mut self, old: CardId, new: CardId)
pub fn replace_target_card(&mut self, old: CardId, new: CardId)
Replace one card target with another.
Mirrors Java’s TargetChoices.replaceTargetCard(Card, Card).
Sourcepub fn for_each_controller_changed(&self) -> Vec<PlayerId>
pub fn for_each_controller_changed(&self) -> Vec<PlayerId>
Returns controllers that changed for targeted cards.
Mirrors Java’s TargetChoices.forEachControllerChanged().
Currently returns an empty vec since controller-change tracking
is handled at the game state level.
Sourcepub fn add_divided_allocation(&mut self, card: CardId, amount: i32)
pub fn add_divided_allocation(&mut self, card: CardId, amount: i32)
Add a divided damage/effect allocation for a target card.
Mirrors Java’s TargetChoices.addDividedAllocation(Card, int).
Trait Implementations§
Source§impl Clone for TargetChoices
impl Clone for TargetChoices
Source§fn clone(&self) -> TargetChoices
fn clone(&self) -> TargetChoices
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more