Skip to main content

manabrew_engine/ability/effects/
permanent_noncreature_effect.rs

1//! PermanentNoncreature — move host card to battlefield as a noncreature permanent.
2//! Ported from Java's PermanentNoncreatureEffect.
3
4use super::EffectContext;
5use crate::game::GameState;
6use crate::spellability::SpellAbility;
7
8/// Struct form of this effect so it can participate in the
9/// `SpellAbilityEffect` trait hierarchy — mirrors Java's
10/// `PermanentNoncreatureEffect` class extending `SpellAbilityEffect`.
11#[manabrew_engine_macros::spell_effect(PermanentNoncreatureEffect)]
12fn resolve(ctx: &mut EffectContext, sa: &crate::spellability::SpellAbility) {
13    super::permanent_effect::resolve_permanent_common(ctx, sa);
14}
15
16/// Stack text — the card's name. Mirrors Java
17/// `PermanentNoncreatureEffect.getStackDescription(SpellAbility)`.
18pub fn get_stack_description(game: &GameState, sa: &SpellAbility) -> String {
19    sa.source
20        .map(|cid| game.card(cid).card_name.clone())
21        .unwrap_or_default()
22}