mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
game: reverted changed in NamePredicate and added additional tests (related to #11041)
This commit is contained in:
parent
be4b568e88
commit
c691612526
2 changed files with 66 additions and 1 deletions
|
|
@ -17,10 +17,21 @@ public class NamePredicate implements Predicate<MageObject> {
|
|||
private final String name;
|
||||
private final Boolean ignoreMtgRuleForEmptyNames; // NamePredicate uses at test and checks, it's must ignore that rules (empty names is not equals in mtg)
|
||||
|
||||
/**
|
||||
* For cards/effects, must have a name to search
|
||||
*
|
||||
* @param name empty name for non-selected target/choice, e.g. return nothing
|
||||
*/
|
||||
public NamePredicate(String name) {
|
||||
this(name, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* For tests only, can find face down permanents too
|
||||
*
|
||||
* @param name
|
||||
* @param ignoreMtgRuleForEmptyNames
|
||||
*/
|
||||
public NamePredicate(String name, Boolean ignoreMtgRuleForEmptyNames) {
|
||||
this.name = name;
|
||||
this.ignoreMtgRuleForEmptyNames = ignoreMtgRuleForEmptyNames;
|
||||
|
|
@ -28,7 +39,7 @@ public class NamePredicate implements Predicate<MageObject> {
|
|||
|
||||
@Override
|
||||
public boolean apply(MageObject input, Game game) {
|
||||
if (name == null || (name.isEmpty() && !this.ignoreMtgRuleForEmptyNames)) {
|
||||
if (name == null) {
|
||||
return false;
|
||||
}
|
||||
// If a player names a card, the player may name either half of a split card, but not both.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue