Skip to main content

manabrew_engine/ability/effects/
radiation_effect.rs

1//! Radiation — give radiation counters (Fallout).
2
3use super::EffectContext;
4
5/// Struct form of this effect so it can participate in the
6/// `SpellAbilityEffect` trait hierarchy — mirrors Java's
7/// `RadiationEffect` class extending `SpellAbilityEffect`.
8#[manabrew_engine_macros::spell_effect(RadiationEffect)]
9fn resolve(ctx: &mut EffectContext, sa: &crate::spellability::SpellAbility) {
10    let amount = super::resolve_numeric_svar(ctx.game, sa, "Num", 1).max(0);
11    let target = sa
12        .target_chosen
13        .target_player
14        .unwrap_or(sa.activating_player);
15    ctx.game.player_add_radiation(target, amount);
16    ctx.game
17        .player_register_radiation_effect(target, ctx.trigger_handler);
18}