-
Notifications
You must be signed in to change notification settings - Fork 773
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
Tests: fix choice on notTarget wrongly not checking Filter #12350
base: master
Are you sure you want to change the base?
Conversation
@@ -4143,7 +4143,7 @@ public boolean choose(Outcome outcome, Cards cards, TargetCard target, Ability s | |||
continue; | |||
} | |||
if (hasObjectTargetNameOrAlias(card, targetName)) { | |||
if (target.isNotTarget() || target.canTarget(card.getId(), source, game)) { | |||
if (target.canTarget(getId(), card.getId(), source, game)) { |
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.
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.
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 don't think there is an issue for real gameplay (we have choices using target code with the notTarget set to true, and that's important to be allowed to sacrifice a shroud creature for instance).
The thing with the test is that we were wrongly accepting some invalid choices. I'm running all the tests with the others 2 instances in TestPlayer without the call to isNotTarget(). I do believe this was wrong usage there and skipped filter validation.
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.
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.
Fix an issue with
setChoice
of non-target choices not validating that the choice matched the target'sFilter
(also was not using the one with a 4-argumentFilter::match
).Of note, we don't have a way to check that is choice is invalid through the checkXXX methods. It would be nice to add at some point. The try/catch way is the current workaround.