use of mage.filter.common.FilterPermanentOrPlayer in project mage by magefree.
the class PreventAllDamageToAllEffect method createFilter.
private static FilterPermanentOrPlayer createFilter(FilterPermanent filterPermanent, FilterPlayer filterPlayer) {
String mes1 = filterPermanent != null ? filterPermanent.getMessage() : "";
String mes2 = filterPlayer != null ? filterPlayer.getMessage() : "";
String message;
if (!mes1.isEmpty() && !mes2.isEmpty()) {
message = mes1 + " and " + mes2;
} else {
message = mes1 + mes2;
}
FilterPermanent filter1 = filterPermanent;
if (filter1 == null) {
filter1 = new FilterPermanent();
// disable filter
filter1.add(new PermanentIdPredicate(UUID.randomUUID()));
}
FilterPlayer filter2 = filterPlayer;
if (filter2 == null) {
filter2 = new FilterPlayer();
// disable filter
filter2.add(new PlayerIdPredicate(UUID.randomUUID()));
}
return new FilterPermanentOrPlayer(message, filter1, filter2);
}
Aggregations