Skip to content

Perpetual: use StaticAbilities#9680

Draft
Hanmac wants to merge 4 commits intomasterfrom
perpetualStatic
Draft

Perpetual: use StaticAbilities#9680
Hanmac wants to merge 4 commits intomasterfrom
perpetualStatic

Conversation

@Hanmac
Copy link
Contributor

@Hanmac Hanmac commented Feb 6, 2026

Closes #9241

still WIP

need to refactor the other ones into Statics

Also, the removePerpetual Effect for this needs to be deeper refactored:

They perpetually gain “When you cast this spell, create a Treasure token and this spell perpetually loses this ability.”

Because right now, we can't handle Runeblade Raiser with

When this creature dies, return it to the battlefield under its owner’s control. It perpetually loses this ability.

In theory, the CardTraits Changes need a way to remove a specific Trigger (per Id?)

for (Map.Entry<PerpetualInterface, StaticAbility> e : oldCard.perpetualEffects.entries()) {
StaticAbility st = e.getValue().copy(this, lki);
if (!lki) { // change zone sets the timestamp of negative infinite, but -1 is good enough
st.putParam("Timestamp", String.valueOf(-1));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you really want to do it correctly this still needs to preserve the relative order

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i added oldTimestamp - currentGameTimestamp
that should shift them into negative

or does this need more fine tuning?
(i think if it changes zones again and again, they should be shifted more back, right?)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do some testing for it when the PR is more ready

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see two problems:

  • without extra logic this would just reverse the order
    • A: 2 & B: 3 => A: -3 & B: -2
  • when only changing a single card this way its timestamps could still grow smaller than those of perpetual effects from other cards in a way that switches the order

can't we just add Long.MIN_VALUE the first time it changes?

}

private List<PerpetualInterface> perpetual = new ArrayList<>();
private Multimap<PerpetualInterface, StaticAbility> perpetualEffects = MultimapBuilder.hashKeys().arrayListValues().build();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove List above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not all are transformed yet, the list will be removed later

(i don't know yet if the new one needs to be a Multimap or if a List is enough)

c.addPerpetual(new PerpetualTypes(timestamp, addType, removeType, remove));
c.addPerpetual(new PerpetualTypes(timestamp, addType, removeType, remove), timestamp);
}
c.addChangedCardTypes(addType, removeType, addAllCreatureTypes, remove, timestamp, 0, true, false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't all be else now?

public interface PerpetualInterface {
long getTimestamp();
void applyEffect(Card c);
default long getTimestamp() { return -1; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reminder to remove this later

@Hanmac
Copy link
Contributor Author

Hanmac commented Feb 6, 2026

@tool4ever over the weekend i might need some help to find a way to remove Triggers via ChangedCardTraits and Static Ability

especially this one: https://scryfall.com/card/ytdm/8/runeblade-raiser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Perpetual Effect into Hidden Statics

2 participants