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

Issue 7821: check multi subtypes card helper function #7833

Merged
merged 3 commits into from
Oct 29, 2024

Conversation

heyshiloh
Copy link
Contributor

@heyshiloh heyshiloh commented Oct 20, 2024

This PR is related to Issue #7821

Description of changes

  • Adds Helper functions and tests for checking if a card contains at least one of the subtypes provided in a list of subtype strings
  • refactors applicable logic

Methodology

  • replaces (or (has-subtype? card subtype1) (has-subtype? card subtype2)) with `(has-any-subtype? card [subtype1 subtype 2])
  • Adept, Savant, other cards that use break-multiple-subroutines will not use this function because they include subtype quantity and therefore splitting the logic into two parts is the most appropriate implementation

Testing

  • Unit testing added for helper functions
  • lein test yields same result as current master state

Next Steps and considerations

  • i'm not sure if there are any other existing places that this could be used
  • has-all-subtypes? is added but not used except for in tests, should it just be commented out?

.gitignore Outdated Show resolved Hide resolved
@heyshiloh heyshiloh marked this pull request as ready for review October 20, 2024 20:55
@heyshiloh heyshiloh changed the title 7821: check multi subtypes card helper function Issue 7821: check multi subtypes card helper function Oct 20, 2024
@NoahTheDuke
Copy link
Collaborator

Given it's unused, I don't think we need has-all-subtypes? but I'm not gonna pause the PR over it.

@NoahTheDuke NoahTheDuke merged commit 4a87bcd into mtgred:master Oct 29, 2024
3 checks passed
@heyshiloh
Copy link
Contributor Author

@NoahTheDuke it can be removed, but this at least documents code that provides the logic of interest presented in the issue. Let me know your thoughts if we should adjust it later

@heyshiloh heyshiloh deleted the nr-7821-multi-subtypes branch October 29, 2024 18:26
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.

Add helper functions for having one of multiple, or all of a set of subtypes
3 participants