Repose & Abilities

2024-06-20

I think the strategy for abilities is to just stick them in a massive array (using slotmap) but I've been thinking about how to store the ends of a continuous effect.

Something like:

Gain control of target creature until end of turn.

How do we represent that "end of turn" bit? The idea is as follows:

because something's zone and controller is defined implicitly by which zone and controller it is found under within Field, we make the edit, but store something called a "repose", which would be something like "when phase X happens on turn count Y" or "if this card has power 4 or less" or something.

As a state-based action (or faster, I'd have to check the CR) we check if a repose is satisfied (it's condition no longer holds) from newest to oldest. (I would need to actually see how this would work and if it should invalidate newer reposes.)

Looks something like

[
  ControllerRepose(as long as power > 3, Player 1)
  ControllerRepose(until end of turn, Player 4)
]

while being on Player 3's field.

This is interesting (CR.611.2c):

If a continuous effect generated by the resolution of a spell or ability modifies the characteristics or changes the controller of any objects, the set of objects it affects is determined when that continuous effect begins. After that point, the set won’t change. (Note that this works differently than a continuous effect from a static ability.) A continuous effect generated by the resolution of a spell or ability that doesn’t modify the characteristics or change the controller of any objects modifies the rules of the game, so it can affect objects that weren’t affected when that continuous effect began. If a single continuous effect has parts that modify the characteristics or changes the controller of any objects and other parts that don’t, the set of objects each part applies to is determined independently.