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

Use counters asynchronously (and a few related improvements) + costs paid checkpoint #7970

Merged
merged 29 commits into from
Feb 25, 2025

Conversation

NBKelly
Copy link
Collaborator

@NBKelly NBKelly commented Feb 21, 2025

Closes #7969
Closes #7957

Currently:

  • All cards use counters asyncronously
  • You can set the default autoresolve status of a card (or any other special keys) as part of the card data now (see bankroll for an example). IE, :data {:special {:auto-place-credits true}} will transfer the contents of that special map to the card when it is initialized. I didn't need to do this, turns out I can just tack :special keys onto the cdef and it just works/is much cleaner. I added a few cards to this list (cookbook, consume, bankroll, friday chip), and made sure it plays nice with cards like compile and the shaper ids that also manipulate that space.
  • I updated the async validator to ensure that :move-zone fns were handled asynchronously
  • I also added add-counter and add-prop to the list of fns that should be marked as async, so we can catch stuff in the future
  • I removed the overloads for add-counter and add-prop that did not include an eid, since they were no longer being used anywhere
  • I updated costs so that spending counters now directly calls add-counter with the checkpoint suppressed
  • I updated the prompts that spend counters so that they make fake eids for it (maybe we should update those functions? that's a job for later)
  • I updated pick_counters to actually trigger spend-counter-from-card events
  • I added a couple of helper functions to def-helpers:
    • 'take-credits' - takes (up to) n counters from the target card and places them in your credit pool as if they were credits. Handles the events/them being simultaneous, etc
    • 'spend-credits' - the same thing, but fires a :spent-credit-from-card event (ie for paladin manual usage)
  • I went through jamie's list of cards that can prevent themselves from being trashed, and checked/enforced all of these.
    • Crowdfunding, environmental testing, the trash-on-tag resources, jackpot, time bomb were modified (I only added a test for envtesting)
    • Everything else we were doing correctly anyway 💯
    • I made it so that revealing, losing tags, gaining bad pub, and a few other things used checkpoints (and allowed them to be suppressed)
    • All of the cost-paid triggers happen after costs have been paid now (except derez, that's pending on derez itself being reworked later)

Somehow, I think I'm actually done with this/it's ready to go.

@NBKelly NBKelly changed the title agendas use counters asynchronously Use counters asynchronously (and a few related improvements) Feb 21, 2025
@NBKelly NBKelly marked this pull request as ready for review February 22, 2025 09:37
@NBKelly
Copy link
Collaborator Author

NBKelly commented Feb 22, 2025

Oh yeah, since adding counters will trigger a checkpoint (by default, anyway) now, there's a chance that a lot of cards can have their 'check win'/'update strength' functions or whatever they do after placing counters removed.

@NBKelly NBKelly changed the title Use counters asynchronously (and a few related improvements) Use counters asynchronously (and a few related improvements) + costs paid checkpoint Feb 22, 2025
@NBKelly
Copy link
Collaborator Author

NBKelly commented Feb 22, 2025

I thought to make sure like costs are grouped (ie there's one trash event for Simulchip, when previously there were two: one for the hardware, and one for the program), and I was pleasantly surprised to find that queue-event actually handles that for us. That's make a some of the future playtesting stuff easier 💯.

@NoahTheDuke NoahTheDuke merged commit f3c437e into mtgred:master Feb 25, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants