-
Notifications
You must be signed in to change notification settings - Fork 839
Perpetual: use StaticAbilities #9680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| 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)); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?)
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove List above
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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; } |
There was a problem hiding this comment.
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
b369294 to
566687d
Compare
|
@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 |
Closes #9241
still WIP
need to refactor the other ones into Statics
Also, the removePerpetual Effect for this needs to be deeper refactored:
Because right now, we can't handle
Runeblade RaiserwithIn theory, the CardTraits Changes need a way to remove a specific Trigger (per Id?)