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

Add a function to simplify revealing cards #7739

Merged
merged 6 commits into from
Oct 10, 2024

Conversation

NBKelly
Copy link
Collaborator

@NBKelly NBKelly commented Sep 18, 2024

Closes #7729

Essentially, I added a reveal-loud function, reveal-loud [state side eid card args & targets], which stratifies the cards and prints them out nicely for you.

You can optionally pass in and-then as an arg, to format it like "[x] reveals ([y] from [z], ..) [and then]". Additionally, the and-then part of the argument matches the pattern ([it]|[them]) and inserts the correct form depending on if there are one or multiple cards being revealed - because I found this quite awkward to do in code, and I found a few places where I would need to do it (ie revealing 1 card with gatekeeper/adjustment vs. revealing 2).

I cleaned up all the cards which were cumbersome and ugly looking. I also updated name-zone to refer to stack, heap, grip as the stack, the heap, the grip, and updated the exactly one part of the code-base where that was relevant. This means functions relying on name-zone don't need to double-check what they enter to see if they need to add an article to it.

For example, Gatekeeper (I also made it print out that it's shuffling when you say no). The only difference in terms of player experience is that this will correctly say "it" instead of "them" when there is one card shuffled in.

Before:

:effect (req (wait-for
                (reveal state side targets)
                (doseq [c targets]
                  (move state :corp c :deck))
                (shuffle! state :corp :deck)
                (effect-completed state :corp eid)))
:msg (msg "reveal "
       (enumerate-str
         (filter identity  [(when-let [h (->> targets
                                            (filter in-hand?)
                                            (map :title)
                                             not-empty)]
                          (str (enumerate-str h)
                                                     " from HQ"))
                                              (when-let [d (->> targets
                                                                (filter in-discard?)
                                                                (map :title)
                                                                not-empty)]
                                                (str (enumerate-str d)
                                                     " from Archives"))]))
                                   " and shuffle them into R&D")}

After (the msg key is cut entirely because it's not needed anymore):

:effect (req (wait-for
               (reveal-loud state side card {:and-then ", and shuffle [them] into R&D"} targets)
               (doseq [c targets]
                 (move state :corp c :deck))
               (shuffle! state :corp :deck)
               (effect-completed state :corp eid)))

The other two big cleanups were bring them home and attitude adjustment. Angel Arena also didn't reveal before (probably done before revealing was an event), it does now.

@NoahTheDuke NoahTheDuke merged commit 4134374 into mtgred:master Oct 10, 2024
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
Development

Successfully merging this pull request may close these issues.

Streamline revealing cards
2 participants