mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
Initial commit for Planar Conquest mode
This commit is contained in:
@@ -10,6 +10,7 @@ import forge.util.PredicateString.StringOp;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Filtering conditions specific for CardRules class, defined here along with
|
||||
@@ -149,6 +150,23 @@ public final class CardRulesPredicates {
|
||||
return new LeafString(LeafString.CardField.JOINED_TYPE, op, what);
|
||||
}
|
||||
|
||||
public static Predicate<CardRules> hasCreatureType(final String... creatureTypes) {
|
||||
return new Predicate<CardRules>() {
|
||||
@Override
|
||||
public boolean apply(final CardRules card) {
|
||||
if (!card.getType().isCreature()) { return false; }
|
||||
|
||||
Set<String> set = card.getType().getCreatureTypes();
|
||||
for (String creatureType : creatureTypes) {
|
||||
if (set.contains(creatureType)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Has Keyword.
|
||||
*
|
||||
@@ -292,6 +310,15 @@ public final class CardRulesPredicates {
|
||||
return new LeafColor(LeafColor.ColorOperator.CountColorsGreaterOrEqual, cntColors);
|
||||
}
|
||||
|
||||
public static Predicate<CardRules> hasColorIdentity(final byte colors) {
|
||||
return new Predicate<CardRules>() {
|
||||
@Override
|
||||
public boolean apply(CardRules rules) {
|
||||
return rules.getColorIdentity().hasAllColors(colors);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static class LeafString extends PredicateString<CardRules> {
|
||||
public enum CardField {
|
||||
ORACLE_TEXT, NAME, SUBTYPE, JOINED_TYPE, COST
|
||||
|
||||
@@ -19,6 +19,11 @@ public class FCollection<T> implements List<T>, Set<T>, FCollectionView<T>, Clon
|
||||
public FCollection(T e) {
|
||||
add(e);
|
||||
}
|
||||
public FCollection(T[] c) {
|
||||
for (T e : c) {
|
||||
add(e);
|
||||
}
|
||||
}
|
||||
public FCollection(Collection<T> c) {
|
||||
for (T e : c) {
|
||||
add(e);
|
||||
|
||||
Reference in New Issue
Block a user