pub use crate::zone::magic_stack::StackEntry;
use crate::ids::{CardId, PlayerId};
use crate::spellability::target_choices::TargetChoices;
use crate::spellability::SpellAbility;
pub fn next_id() -> u64 {
StackEntry::next_id()
}
impl StackEntry {
pub fn get_spell_ability(&self) -> &SpellAbility {
&self.spell_ability
}
pub fn get_source_card(&self) -> Option<CardId> {
self.spell_ability.source
}
pub fn is_spell_instance(&self) -> bool {
self.spell_ability.is_spell
}
pub fn is_ability_instance(&self) -> bool {
self.spell_ability.is_activated
}
pub fn is_trigger_instance(&self) -> bool {
self.spell_ability.is_trigger
}
pub fn is_optional_trigger(&self) -> bool {
self.optional_trigger_decider.is_some()
}
pub fn get_stack_description(&self) -> String {
if !self.spell_ability.stack_description.is_empty() {
return self.spell_ability.stack_description.clone();
}
self.spell_ability.rebuilt_description()
}
pub fn get_activating_player(&self) -> PlayerId {
self.spell_ability.activating_player
}
pub fn get_target_choices(&self) -> &TargetChoices {
&self.spell_ability.target_chosen
}
}
pub fn update_target(entry: &mut StackEntry, old: CardId, new: CardId) {
entry.update_target(old, new);
}
pub fn set_triggering_object(entry: &mut StackEntry, key: &str, value: &str) {
entry.set_triggering_object(key, value);
}
pub fn update_triggering_object(entry: &mut StackEntry, key: &str, value: &str) {
entry.update_triggering_object(key, value);
}