Skip to main content

Module layer

Module layer 

Source
Expand description

CR 613 layer system — continuous effect application.

Mirrors Java Forge’s GameAction.checkStaticAbilities() and StaticAbilityContinuous.applyContinuousAbility().

§How to use

Call apply_continuous_effects after any event that could change which static abilities are active (card entering/leaving the battlefield, spell resolution, etc.):

apply_continuous_effects(&mut game);

The function resets all derived fields (static_power_modifier, static_toughness_modifier, static_set_power, static_set_toughness, granted_keywords, cant_attack_static, cant_block_static) and recomputes them from scratch.

§Layer ordering (CR 613)

  1. Copy effects (not yet implemented)
  2. Control-changing
  3. Text-changing (not yet implemented)
  4. Type-changing → Layer::Type
  5. Color-changing → Layer::Color
  6. Ability-adding/removing → Layer::Ability 7a. CDA P/T → Layer::Characteristic 7b. Set P/T → Layer::SetPT 7c. Modify P/T → Layer::ModifyPT 7d. Counters (handled intrinsically by Card::power())
  7. Forge rules-modifying layer → Layer::Rules

Functions§

apply_continuous_effects
Recompute all continuously-applied static-ability effects for the current game state.
apply_etb_tapped
Apply ETB-tapped effects to entering_card as it enters the battlefield.
apply_etb_tapped_with_agents
classify_static_layers
CR 613 layers a Continuous static contributes to.
get_etb_unless_life_cost
Check if a card has a shock-land-style “enters tapped unless you pay life” effect.
get_etb_unless_reveal_cost
Check if a card has a “enters tapped unless you reveal a from hand” effect.
prompt_etb_tapped_replacement_with_agents