Skip to main content

manabrew_engine/ability/
static_ability_api_based.rs

1//! StaticAbilityApiBased — static abilities backed by an API type.
2//!
3//! Mirrors Java's `StaticAbilityApiBased.java`.
4//! A static ability whose resolution is dispatched through the effect
5//! system based on its `ApiType`.
6
7use crate::spellability::SpellAbility;
8
9/// Marker trait for API-based static abilities.
10///
11/// In Java, `StaticAbilityApiBased extends AbilityStatic` and holds a
12/// reference to `SpellAbilityEffect`. In Rust the dispatch is centralized
13/// in `effect_dispatch!`, so this provides structural parity.
14pub trait StaticAbilityApiBased {
15    /// The API type string (e.g. "Pump", "Animate").
16    fn api_type(&self) -> &str;
17
18    /// Resolve this static ability by dispatching to the effect system.
19    fn resolve(&self, sa: &SpellAbility);
20}
21
22/// Resolve an API-based static ability.
23/// Mirrors Java's `StaticAbilityApiBased.resolve()` which delegates to its effect.
24///
25/// In the Rust engine, resolution is centralized in `effects::resolve_effect`.
26pub fn resolve(ctx: &mut crate::ability::effects::EffectContext, sa: &SpellAbility) {
27    crate::ability::effects::resolve_effect(ctx, sa);
28}