Skip to content
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

WrappedAbility Timestamp issue #4842

Open
Hanmac opened this issue Mar 20, 2024 · 7 comments
Open

WrappedAbility Timestamp issue #4842

Hanmac opened this issue Mar 20, 2024 · 7 comments
Assignees
Labels

Comments

@Hanmac
Copy link
Contributor

Hanmac commented Mar 20, 2024

Problem with Trigger and Timestamps:

protected void timestampCheck() {
final Game game = sa.getActivatingPlayer().getGame();
if (noTimestampCheck.contains(sa.getApi())) {
return;
}
final Map<AbilityKey, Object> triggerMap = AbilityKey.newMap(sa.getTriggeringObjects());
for (Entry<AbilityKey, Object> ev : triggerMap.entrySet()) {
if (ev.getValue() instanceof Card) {
Card card = (Card) ev.getValue();
Card current = game.getCardState(card);
if (card.isInPlay() && current.isInPlay() && current.getTimestamp() != card.getTimestamp()) {
// TODO: figure out if NoTimestampCheck should be the default for ChangesZone triggers
sa.getTriggeringObjects().remove(ev.getKey());
}
}
}
// TODO: CardCollection
}

WrappedAbility does mess with the Triggered Objects,
but the better way would be to have the Effects handle it

currently the way is to update the Effects with equalsGameTimestamp to check if the timestamp is still OK or use LKI instead
for this, it might be better if the Triggered Objects where LKI to begin with so they can't be messed up again?

it would be better if all effects are updated, and the Part could be removed from WrappedAbility

@tool4ever
Copy link
Contributor

Yea there should be no reason to keep it:
Because of Defined$ Self etc. effects need their own checks anyway

For the most part only changezone triggers should be able to find the new object anyway?

  • there we already need the scripter to decide if he needs Card (LKI) or NewCard
  • imo ideally we could remove the *LKICopy parts = never call getCardState() (it's already inconsistent since it never gets applied to CardCollections)

@Hanmac
Copy link
Contributor Author

Hanmac commented Mar 20, 2024

@tool4ever yeah that is my end goal that we don't need "LKICopy" anymore, and have the Effect handle all the stuff

@tool4ever
Copy link
Contributor

A simple example where things get messed up currently:

  • Shelob, Child of Ungoliant trigger on the stack
  • return the dead creature to the battlefield
  • no token 💩

but if we can figure out game timestamps now porting those other changes should lead to some quick wins :)

@tool4ever
Copy link
Contributor

Needs #117

@Hanmac
Copy link
Contributor Author

Hanmac commented Jul 29, 2024

@tool4ever what exactly is still missing? i thought we ported most of that MR into smaller ones?

@tool4ever
Copy link
Contributor

until noTimestampCheck contains all API bugs like the one above can still happen

@Hanmac
Copy link
Contributor Author

Hanmac commented Jul 29, 2024

until noTimestampCheck contains all API bugs like the one above can still happen

oh okay that's what you mean, yeah we should make smaller MR to port all the APIs if able
(and when finished, remove the noTimestampCheck)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants