forked from External/mage
* Name card abilities - fixed that it can't find split cards or fused spells with entered name (part of #6603, #6549);
This commit is contained in:
parent
e95ae2675b
commit
4b77cb0fa8
30 changed files with 257 additions and 53 deletions
|
|
@ -11,6 +11,7 @@ import mage.constants.ColoredManaSymbol;
|
|||
import mage.constants.EmptyNames;
|
||||
import mage.constants.ManaType;
|
||||
import mage.filter.Filter;
|
||||
import mage.filter.predicate.mageobject.NamePredicate;
|
||||
import mage.game.CardState;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
|
@ -657,6 +658,14 @@ public final class CardUtil {
|
|||
return object1 != null && object2 != null && haveSameNames(object1.getName(), object2.getName());
|
||||
}
|
||||
|
||||
public static boolean haveSameNames(MageObject object, String needName, Game game) {
|
||||
return containsName(object, needName, game);
|
||||
}
|
||||
|
||||
public static boolean containsName(MageObject object, String name, Game game) {
|
||||
return new NamePredicate(name).apply(object, game);
|
||||
}
|
||||
|
||||
public static boolean haveEmptyName(String name) {
|
||||
return name == null || name.isEmpty() || name.equals(EmptyNames.FACE_DOWN_CREATURE.toString()) || name.equals(EmptyNames.FACE_DOWN_TOKEN.toString());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue