Removed exception for missing subType to prevent empty card list in older deck editors.

This commit is contained in:
LevelX2 2017-09-16 15:14:52 +02:00
parent d66a9d1693
commit afd6bc080d
2 changed files with 19 additions and 19 deletions

View file

@ -4,7 +4,6 @@ import java.util.Arrays;
import java.util.EnumSet;
import java.util.Set;
import java.util.stream.Collectors;
import mage.util.SubTypeList;
public enum SubType {
@ -12,7 +11,6 @@ public enum SubType {
//205.3k Instants and sorceries share their lists of subtypes; these subtypes are called spell types.
ARCANE("Arcane", SubTypeSet.SpellType),
TRAP("Trap", SubTypeSet.SpellType),
// 205.3i: Lands have their own unique set of subtypes; these subtypes are called land types.
// Of that list, Forest, Island, Mountain, Plains, and Swamp are the basic land types.
FOREST("Forest", SubTypeSet.BasicLandType),
@ -28,13 +26,11 @@ public enum SubType {
MINE("Mine", SubTypeSet.NonBasicLandType),
POWER_PLANT("Power-Plant", SubTypeSet.NonBasicLandType),
TOWER("Tower", SubTypeSet.NonBasicLandType),
// 205.3h Enchantments have their own unique set of subtypes; these subtypes are called enchantment types.
AURA("Aura", SubTypeSet.EnchantmentType),
CARTOUCHE("Cartouche", SubTypeSet.EnchantmentType),
CURSE("Curse", SubTypeSet.EnchantmentType),
SHRINE("Shrine", SubTypeSet.EnchantmentType),
// 205.3g: Artifacts have their own unique set of subtypes; these subtypes are called artifact types.
CLUE("Clue", SubTypeSet.ArtifactType),
CONTRAPTION("Contraption", SubTypeSet.ArtifactType),
@ -42,7 +38,6 @@ public enum SubType {
FORTIFICATION("Fortification", SubTypeSet.ArtifactType),
TREASURE("Treasure", SubTypeSet.ArtifactType),
VEHICLE("Vehicle", SubTypeSet.ArtifactType),
// 205.3m : Creatures and tribals share their lists of subtypes; these subtypes are called creature types.
// A
ADVISOR("Advisor", SubTypeSet.CreatureType),
@ -427,9 +422,12 @@ public enum SubType {
return s;
}
}
throw new IllegalArgumentException("no subtype for " + subType + " exists");
org.apache.log4j.Logger.getLogger(SubType.class).error("no subtype for " + subType + " exists");
return null;
}
;
public SubTypeSet getSubTypeSet() {
return subTypeSet;
}

View file

@ -5,7 +5,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import mage.constants.SubType;
public class SubTypeList extends ArrayList<SubType> {
@ -24,7 +23,6 @@ public class SubTypeList extends ArrayList<SubType> {
.collect(Collectors.toList()));
}
public boolean add(SubType... subTypes) {
return Collections.addAll(this, subTypes);
}
@ -36,7 +34,11 @@ public class SubTypeList extends ArrayList<SubType> {
@Deprecated
public boolean add(String s) {
return add(SubType.byDescription(s));
SubType subType = SubType.byDescription(s);
if (subType != null) {
return add(subType);
}
return false;
}
@Deprecated