mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
CopyPerm: rewoke and update with Populate
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package forge.card;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Iterator;
|
||||
@@ -24,10 +25,11 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import forge.util.TextUtil;
|
||||
import org.apache.commons.lang3.NotImplementedException;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
@@ -181,6 +183,20 @@ public final class CardType implements Comparable<CardType>, CardTypeView {
|
||||
subtypes.clear();
|
||||
calculatedType = null;
|
||||
}
|
||||
|
||||
public boolean remove(final Supertype st) {
|
||||
return supertypes.remove(st);
|
||||
}
|
||||
|
||||
public boolean setCreatureTypes(Collection<String> ctypes) {
|
||||
// if it isn't a creature then this has no effect
|
||||
if (coreTypes.contains(CoreType.Creature)) {
|
||||
return false;
|
||||
}
|
||||
boolean changed = Iterables.removeIf(subtypes, Predicates.IS_CREATURE_TYPE);
|
||||
subtypes.addAll(ctypes);
|
||||
return changed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
@@ -552,6 +568,15 @@ public final class CardType implements Comparable<CardType>, CardTypeView {
|
||||
// plural -> singular
|
||||
public static final BiMap<String,String> singularTypes = pluralTypes.inverse();
|
||||
}
|
||||
public static class Predicates {
|
||||
public static Predicate<String> IS_CREATURE_TYPE = new Predicate<String>() {
|
||||
@Override
|
||||
public boolean apply(String input) {
|
||||
return CardType.isACreatureType(input);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
///////// Utility methods
|
||||
public static boolean isACardType(final String cardType) {
|
||||
|
||||
Reference in New Issue
Block a user