mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
Refactor set's legality, Modern Horizons now available for modern formats;
This commit is contained in:
parent
6bfea7bfd9
commit
e30eecead3
29 changed files with 86 additions and 89 deletions
|
@ -95,41 +95,52 @@ public final class ConstructedFormats {
|
|||
return;
|
||||
}
|
||||
|
||||
// build formats list for deck validators
|
||||
for (ExpansionInfo set : ExpansionRepository.instance.getAll()) {
|
||||
expansionInfo.put(set.getName(), set);
|
||||
formats.add(set.getName());
|
||||
|
||||
// full list
|
||||
underlyingSetCodesPerFormat.put(set.getName(), new ArrayList<>());
|
||||
underlyingSetCodesPerFormat.get(set.getName()).add(set.getCode());
|
||||
|
||||
// create the play formats
|
||||
if (set.getType() == SetType.CUSTOM_SET) {
|
||||
// custom
|
||||
if (set.getType().isCustomSet()) {
|
||||
underlyingSetCodesPerFormat.get(CUSTOM).add(set.getCode());
|
||||
continue;
|
||||
}
|
||||
if (set.getType() == SetType.JOKESET) {
|
||||
|
||||
// joke
|
||||
if (set.getType().isJokeSet()) {
|
||||
underlyingSetCodesPerFormat.get(JOKE).add(set.getCode());
|
||||
continue;
|
||||
}
|
||||
|
||||
// vintage/legacy (any set, TODO: even ?custom set?)
|
||||
underlyingSetCodesPerFormat.get(VINTAGE_LEGACY).add(set.getCode());
|
||||
if (set.getType() == SetType.CORE || set.getType() == SetType.EXPANSION || set.getType() == SetType.SUPPLEMENTAL_STANDARD_LEGAL) {
|
||||
if (STANDARD_CARDS.getSetCodes().contains(set.getCode())) {
|
||||
underlyingSetCodesPerFormat.get(STANDARD).add(set.getCode());
|
||||
}
|
||||
if (set.getType() != SetType.SUPPLEMENTAL_STANDARD_LEGAL) {
|
||||
if (set.getReleaseDate().after(extendedDate) && (set.getType() == SetType.EXPANSION || set.getType() == SetType.CORE)) {
|
||||
underlyingSetCodesPerFormat.get(EXTENDED).add(set.getCode());
|
||||
}
|
||||
if (set.getReleaseDate().after(frontierDate) && (set.getType() == SetType.EXPANSION || set.getType() == SetType.CORE)) {
|
||||
underlyingSetCodesPerFormat.get(FRONTIER).add(set.getCode());
|
||||
}
|
||||
if (set.getReleaseDate().after(modernDate) && (set.getType() == SetType.EXPANSION || set.getType() == SetType.CORE)) {
|
||||
underlyingSetCodesPerFormat.get(MODERN).add(set.getCode());
|
||||
}
|
||||
}
|
||||
|
||||
// standard (dependent on current date)
|
||||
if (STANDARD_CARDS.getSetCodes().contains(set.getCode())) {
|
||||
underlyingSetCodesPerFormat.get(STANDARD).add(set.getCode());
|
||||
}
|
||||
|
||||
// Create the Block formats
|
||||
// extended
|
||||
if (set.getType().isStandardLegal() && set.getReleaseDate().after(extendedDate)) {
|
||||
underlyingSetCodesPerFormat.get(EXTENDED).add(set.getCode());
|
||||
}
|
||||
|
||||
// frontier
|
||||
if (set.getType().isStandardLegal() && set.getReleaseDate().after(frontierDate)) {
|
||||
underlyingSetCodesPerFormat.get(FRONTIER).add(set.getCode());
|
||||
}
|
||||
|
||||
// modern
|
||||
if (set.getType().isModernLegal() && set.getReleaseDate().after(modernDate)) {
|
||||
underlyingSetCodesPerFormat.get(MODERN).add(set.getCode());
|
||||
}
|
||||
|
||||
// BLOCKS formats
|
||||
|
||||
if (set.getType() == SetType.EXPANSION && set.getBlockName() != null) {
|
||||
String blockDisplayName = getBlockDisplayName(set.getBlockName());
|
||||
underlyingSetCodesPerFormat.computeIfAbsent(blockDisplayName, k -> new ArrayList<>());
|
||||
|
@ -144,7 +155,6 @@ public final class ConstructedFormats {
|
|||
if (expansionInfo.get(blockDisplayName).getReleaseDate().after(set.getReleaseDate())) {
|
||||
expansionInfo.put(blockDisplayName, set);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (set.getType() == SetType.SUPPLEMENTAL && set.getBlockName() != null) {
|
||||
|
@ -235,6 +245,7 @@ public final class ConstructedFormats {
|
|||
}
|
||||
return expansionInfo1.getType().compareTo(expansionInfo2.getType());
|
||||
});
|
||||
|
||||
if (!formats.isEmpty()) {
|
||||
formats.add(0, CUSTOM);
|
||||
formats.add(0, JOKE);
|
||||
|
|
|
@ -81,7 +81,7 @@ public class AusHighlander extends Constructed {
|
|||
public AusHighlander() {
|
||||
this("Australian Highlander");
|
||||
for (ExpansionSet set : Sets.getInstance().values()) {
|
||||
if (set.isEternalLegal()) {
|
||||
if (set.getSetType().isEternalLegal()) {
|
||||
setCodes.add(set.getCode());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ public class CanadianHighlander extends Constructed {
|
|||
public CanadianHighlander() {
|
||||
this("Canadian Highlander");
|
||||
for (ExpansionSet set : Sets.getInstance().values()) {
|
||||
if (set.isEternalLegal()) {
|
||||
if (set.getSetType().isEternalLegal()) {
|
||||
setCodes.add(set.getCode());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public class Commander extends Constructed {
|
|||
public Commander() {
|
||||
this("Commander");
|
||||
for (ExpansionSet set : Sets.getInstance().values()) {
|
||||
if (set.isEternalLegal()) {
|
||||
if (set.getSetType().isEternalLegal()) {
|
||||
setCodes.add(set.getCode());
|
||||
}
|
||||
}
|
||||
|
@ -743,7 +743,7 @@ public class Commander extends Constructed {
|
|||
}
|
||||
|
||||
edhPowerLevel += numberInfinitePieces * 12;
|
||||
edhPowerLevel = (int) Math.round(edhPowerLevel / 10);
|
||||
edhPowerLevel = Math.round(edhPowerLevel / 10);
|
||||
if (edhPowerLevel >= 100) {
|
||||
edhPowerLevel = 99;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.deck;
|
||||
|
||||
import mage.cards.ExpansionSet;
|
||||
|
@ -17,7 +16,7 @@ public class Eternal extends Constructed {
|
|||
public Eternal() {
|
||||
super("Constructed - Eternal");
|
||||
for (ExpansionSet set : Sets.getInstance().values()) {
|
||||
if (set.isEternalLegal()) {
|
||||
if (set.getSetType().isEternalLegal()) {
|
||||
setCodes.add(set.getCode());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class Extended extends Constructed {
|
|||
cutoff = new GregorianCalendar(current.get(Calendar.YEAR) - 4, Calendar.SEPTEMBER, 1);
|
||||
}
|
||||
for (ExpansionSet set : Sets.getInstance().values()) {
|
||||
if (set.isStandardLegal() && set.getReleaseDate().after(cutoff.getTime())) {
|
||||
if (set.getSetType().isStandardLegal() && set.getReleaseDate().after(cutoff.getTime())) {
|
||||
setCodes.add(set.getCode());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ public class Frontier extends Constructed {
|
|||
|
||||
Date cutoff = new GregorianCalendar(2014, 6, 18).getTime(); // M15 release date
|
||||
for (ExpansionSet set : Sets.getInstance().values()) {
|
||||
if (set.isStandardLegal() && (set.getReleaseDate().after(cutoff) || set.getReleaseDate().equals(cutoff))) {
|
||||
if (set.getSetType().isStandardLegal() && (set.getReleaseDate().after(cutoff) || set.getReleaseDate().equals(cutoff))) {
|
||||
setCodes.add(set.getCode());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -173,7 +173,8 @@ public class HistoricalType2 extends Constructed {
|
|||
// Get the sets in that time period.
|
||||
// (code taken from standard.java)
|
||||
for (ExpansionSet set : Sets.getInstance().values()) {
|
||||
if (set.isStandardLegal() && set.getReleaseDate().after(start.getTime())
|
||||
if (set.getSetType().isStandardLegal()
|
||||
&& set.getReleaseDate().after(start.getTime())
|
||||
&& set.getReleaseDate().before(end.getTime())) {
|
||||
setCodes.add(set.getCode());
|
||||
}
|
||||
|
|
|
@ -3,10 +3,8 @@ package mage.deck;
|
|||
import mage.cards.ExpansionSet;
|
||||
import mage.cards.Sets;
|
||||
import mage.cards.decks.Constructed;
|
||||
import mage.constants.SetType;
|
||||
|
||||
/**
|
||||
*
|
||||
* LevelX2
|
||||
*/
|
||||
public class Legacy extends Constructed {
|
||||
|
@ -14,7 +12,7 @@ public class Legacy extends Constructed {
|
|||
public Legacy() {
|
||||
super("Constructed - Legacy");
|
||||
for (ExpansionSet set : Sets.getInstance().values()) {
|
||||
if (set.isEternalLegal()) {
|
||||
if (set.getSetType().isEternalLegal()) {
|
||||
setCodes.add(set.getCode());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ public class Modern extends Constructed {
|
|||
|
||||
Date cutoff = new GregorianCalendar(2003, 6, 28).getTime(); // Eight edition release date
|
||||
for (ExpansionSet set : Sets.getInstance().values()) {
|
||||
if (set.isStandardLegal() && (set.getReleaseDate().after(cutoff) || set.getReleaseDate().equals(cutoff))) {
|
||||
if (set.getSetType().isModernLegal() && (set.getReleaseDate().after(cutoff) || set.getReleaseDate().equals(cutoff))) {
|
||||
setCodes.add(set.getCode());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,8 +17,7 @@ public class ModernNoBannedList extends Constructed {
|
|||
|
||||
Date cutoff = new GregorianCalendar(2003, 6, 28).getTime(); // Eight edition release date
|
||||
for (ExpansionSet set : Sets.getInstance().values()) {
|
||||
if (set.isStandardLegal()
|
||||
&& (set.getReleaseDate().after(cutoff) || set.getReleaseDate().equals(cutoff))) {
|
||||
if (set.getSetType().isModernLegal() && (set.getReleaseDate().after(cutoff) || set.getReleaseDate().equals(cutoff))) {
|
||||
setCodes.add(set.getCode());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ public class Pauper extends Constructed {
|
|||
|
||||
//TODO: Add only Magic Online sets for pauper
|
||||
for (ExpansionSet set : Sets.getInstance().values()) {
|
||||
if (set.isEternalLegal()) {
|
||||
if (set.getSetType().isEternalLegal()) {
|
||||
setCodes.add(set.getCode());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.deck;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
|
@ -27,7 +26,7 @@ public class PennyDreadfulCommander extends Constructed {
|
|||
public PennyDreadfulCommander() {
|
||||
this("Penny Dreadful Commander");
|
||||
for (ExpansionSet set : Sets.getInstance().values()) {
|
||||
if (set.isEternalLegal()) {
|
||||
if (set.getSetType().isEternalLegal()) {
|
||||
setCodes.add(set.getCode());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public class Standard extends Constructed {
|
|||
|
||||
for (ExpansionSet set : sets) {
|
||||
boolean isDateCompatible = earliestDate != null && !set.getReleaseDate().before(earliestDate) /*!set.getReleaseDate().after(current.getTime())*/; // no after date restrict for early tests and beta
|
||||
if (set.isStandardLegal() && isDateCompatible) {
|
||||
if (set.getSetType().isStandardLegal() && isDateCompatible) {
|
||||
codes.add(set.getCode());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,7 +154,7 @@ public class SuperType2 extends Constructed {
|
|||
// Get the sets in that time period.
|
||||
// (code taken from standard.java)
|
||||
for (ExpansionSet set : Sets.getInstance().values()) {
|
||||
if (set.isStandardLegal()
|
||||
if (set.getSetType().isStandardLegal()
|
||||
&& set.getReleaseDate().after(start.getTime())
|
||||
&& set.getReleaseDate().before(end.getTime())) {
|
||||
setCodes.add(set.getCode());
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.deck;
|
||||
|
||||
import mage.abilities.common.CanBeYourCommanderAbility;
|
||||
|
@ -26,7 +25,7 @@ public class TinyLeaders extends Constructed {
|
|||
public TinyLeaders() {
|
||||
this("Tiny Leaders");
|
||||
for (ExpansionSet set : Sets.getInstance().values()) {
|
||||
if (set.isEternalLegal()) {
|
||||
if (set.getSetType().isEternalLegal()) {
|
||||
setCodes.add(set.getCode());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.deck;
|
||||
|
||||
import mage.cards.ExpansionSet;
|
||||
|
@ -13,7 +12,7 @@ public class Vintage extends Constructed {
|
|||
public Vintage() {
|
||||
super("Constructed - Vintage");
|
||||
for (ExpansionSet set : Sets.getInstance().values()) {
|
||||
if (set.isEternalLegal()) {
|
||||
if (set.getSetType().isEternalLegal()) {
|
||||
setCodes.add(set.getCode());
|
||||
}
|
||||
}
|
||||
|
@ -89,6 +88,5 @@ public class Vintage extends Constructed {
|
|||
restricted.add("Wheel of Fortune");
|
||||
restricted.add("Windfall");
|
||||
restricted.add("Yawgmoth's Will");
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,7 @@ public final class DuelDecksAnthologyDivineVsDemonic extends ExpansionSet {
|
|||
}
|
||||
|
||||
private DuelDecksAnthologyDivineVsDemonic() {
|
||||
super("Duel Decks: Anthology, Divine vs. Demonic", "DD3DVD", ExpansionSet.buildDate(2014, 12, 5),
|
||||
SetType.SUPPLEMENTAL);
|
||||
super("Duel Decks: Anthology, Divine vs. Demonic", "DD3DVD", ExpansionSet.buildDate(2014, 12, 5), SetType.SUPPLEMENTAL);
|
||||
this.blockName = "Duel Decks: Anthology";
|
||||
this.hasBasicLands = true;
|
||||
|
||||
|
|
|
@ -17,10 +17,10 @@ public final class ModernHorizons extends ExpansionSet {
|
|||
|
||||
private ModernHorizons() {
|
||||
// TODO: update the set type closer to release (no point right now, the cards won't be legal for a while)
|
||||
super("Modern Horizons", "MH1", ExpansionSet.buildDate(2019, 6, 14), SetType.SUPPLEMENTAL);
|
||||
super("Modern Horizons", "MH1", ExpansionSet.buildDate(2019, 6, 14), SetType.SUPPLEMENTAL_MODERN_LEGAL);
|
||||
this.blockName = "Modern Horizons";
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.hasBoosters = false; // TODO: enable after more cards will be available
|
||||
this.numBoosterLands = 0;
|
||||
this.numBoosterCommon = 11;
|
||||
this.numBoosterUncommon = 3;
|
||||
|
@ -30,5 +30,4 @@ public final class ModernHorizons extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Cabal Therapist", 80, Rarity.RARE, mage.cards.c.CabalTherapist.class));
|
||||
cards.add(new SetCardInfo("Serra the Benevolent", 26, Rarity.MYTHIC, mage.cards.s.SerraTheBenevolent.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.sets;
|
||||
|
||||
import mage.cards.ExpansionSet;
|
||||
|
@ -6,7 +5,6 @@ import mage.constants.Rarity;
|
|||
import mage.constants.SetType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class ModernMasters extends ExpansionSet {
|
||||
|
@ -18,7 +16,7 @@ public final class ModernMasters extends ExpansionSet {
|
|||
}
|
||||
|
||||
private ModernMasters() {
|
||||
super("Modern Masters", "MMA", ExpansionSet.buildDate(2013, 6, 7), SetType.SUPPLEMENTAL);
|
||||
super("Modern Masters", "MMA", ExpansionSet.buildDate(2013, 6, 7), SetType.SUPPLEMENTAL_MODERN_LEGAL);
|
||||
this.blockName = "Reprint";
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
|
|
|
@ -5,7 +5,6 @@ import mage.constants.Rarity;
|
|||
import mage.constants.SetType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fireshoes
|
||||
*/
|
||||
public final class ModernMasters2015 extends ExpansionSet {
|
||||
|
@ -17,7 +16,7 @@ public final class ModernMasters2015 extends ExpansionSet {
|
|||
}
|
||||
|
||||
private ModernMasters2015() {
|
||||
super("Modern Masters 2015", "MM2", ExpansionSet.buildDate(2015, 5, 22), SetType.SUPPLEMENTAL);
|
||||
super("Modern Masters 2015", "MM2", ExpansionSet.buildDate(2015, 5, 22), SetType.SUPPLEMENTAL_MODERN_LEGAL);
|
||||
this.blockName = "Reprint";
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.sets;
|
||||
|
||||
import mage.cards.ExpansionSet;
|
||||
|
@ -6,7 +5,6 @@ import mage.constants.Rarity;
|
|||
import mage.constants.SetType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fireshoes
|
||||
*/
|
||||
public final class ModernMasters2017 extends ExpansionSet {
|
||||
|
@ -18,7 +16,7 @@ public final class ModernMasters2017 extends ExpansionSet {
|
|||
}
|
||||
|
||||
private ModernMasters2017() {
|
||||
super("Modern Masters 2017", "MM3", ExpansionSet.buildDate(2017, 3, 17), SetType.SUPPLEMENTAL);
|
||||
super("Modern Masters 2017", "MM3", ExpansionSet.buildDate(2017, 3, 17), SetType.SUPPLEMENTAL_MODERN_LEGAL);
|
||||
this.blockName = "Reprint";
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.sets;
|
||||
|
||||
import mage.cards.ExpansionSet;
|
||||
|
@ -17,8 +16,7 @@ public final class PremiumDeckSeriesFireAndLightning extends ExpansionSet {
|
|||
}
|
||||
|
||||
private PremiumDeckSeriesFireAndLightning() {
|
||||
super("Premium Deck Series: Fire and Lightning", "PD2", ExpansionSet.buildDate(2010, 11, 1),
|
||||
SetType.SUPPLEMENTAL);
|
||||
super("Premium Deck Series: Fire and Lightning", "PD2", ExpansionSet.buildDate(2010, 11, 1), SetType.SUPPLEMENTAL);
|
||||
this.hasBasicLands = true;
|
||||
|
||||
cards.add(new SetCardInfo("Ball Lightning", 12, Rarity.RARE, mage.cards.b.BallLightning.class));
|
||||
|
|
|
@ -600,20 +600,6 @@ public abstract class ExpansionSet implements Serializable {
|
|||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public boolean isCustomSet() {
|
||||
return setType == SetType.CUSTOM_SET;
|
||||
}
|
||||
|
||||
public boolean isEternalLegal() {
|
||||
// any official sets except un-sets
|
||||
return setType != SetType.CUSTOM_SET && setType != SetType.JOKESET;
|
||||
}
|
||||
|
||||
public boolean isStandardLegal() {
|
||||
// any official sets that was in standard
|
||||
return setType == SetType.CORE || setType == SetType.EXPANSION || setType == SetType.SUPPLEMENTAL_STANDARD_LEGAL;
|
||||
}
|
||||
|
||||
public void removeSavedCards() {
|
||||
savedCards.clear();
|
||||
}
|
||||
|
|
|
@ -51,15 +51,11 @@ public class Sets extends HashMap<String, ExpansionSet> {
|
|||
throw new IllegalArgumentException("Set code " + set.getCode() + " already exists.");
|
||||
}
|
||||
this.put(set.getCode(), set);
|
||||
if (set.isCustomSet()) {
|
||||
if (set.getSetType().isCustomSet()) {
|
||||
customSets.add(set.getCode());
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isCustomSet(String setCode) {
|
||||
return getInstance().customSets.contains(setCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates card pool of cardsCount cards that have manacost of allowed
|
||||
* colors.
|
||||
|
|
|
@ -12,7 +12,6 @@ import com.j256.ormlite.support.DatabaseConnection;
|
|||
import com.j256.ormlite.table.TableUtils;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SetType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.game.events.Listener;
|
||||
import mage.util.RandomUtil;
|
||||
|
@ -407,8 +406,7 @@ public enum CardRepository {
|
|||
return cardinfo;
|
||||
}
|
||||
|
||||
if ((set.getType() == SetType.EXPANSION || set.getType() == SetType.CORE)
|
||||
&& (lastExpansionDate == null || set.getReleaseDate().after(lastExpansionDate))) {
|
||||
if (set.getType().isStandardLegal() && (lastExpansionDate == null || set.getReleaseDate().after(lastExpansionDate))) {
|
||||
cardToUse = cardinfo;
|
||||
lastExpansionDate = set.getReleaseDate();
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ public final class CardScanner {
|
|||
Collection<ExpansionSet> sets = Sets.getInstance().values();
|
||||
List<Card> cards = new ArrayList<>();
|
||||
for (ExpansionSet set : sets) {
|
||||
if (ignoreCustomSets && set.isCustomSet()) {
|
||||
if (ignoreCustomSets && set.getSetType().isCustomSet()) {
|
||||
continue;
|
||||
}
|
||||
for (ExpansionSet.SetCardInfo setInfo : set.getSetCardInfo()) {
|
||||
|
|
|
@ -3,12 +3,12 @@ package mage.cards.repository;
|
|||
import com.j256.ormlite.field.DataType;
|
||||
import com.j256.ormlite.field.DatabaseField;
|
||||
import com.j256.ormlite.table.DatabaseTable;
|
||||
import java.util.Date;
|
||||
import mage.cards.ExpansionSet;
|
||||
import mage.constants.SetType;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
*/
|
||||
@DatabaseTable(tableName = "expansion")
|
||||
|
@ -16,7 +16,7 @@ public class ExpansionInfo {
|
|||
|
||||
@DatabaseField(unique = true)
|
||||
protected String name;
|
||||
@DatabaseField(id = true,unique = true)
|
||||
@DatabaseField(id = true, unique = true)
|
||||
protected String code;
|
||||
@DatabaseField
|
||||
protected String blockName;
|
||||
|
@ -74,5 +74,4 @@ public class ExpansionInfo {
|
|||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package mage.constants;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
*/
|
||||
public enum SetType {
|
||||
|
@ -10,6 +9,7 @@ public enum SetType {
|
|||
MAGIC_ONLINE("Magic Online"),
|
||||
SUPPLEMENTAL("Supplemental"),
|
||||
SUPPLEMENTAL_STANDARD_LEGAL("Standard Legal Supplemental"),
|
||||
SUPPLEMENTAL_MODERN_LEGAL("Modern Legal Supplemental"),
|
||||
PROMOTIONAL("Promotional"),
|
||||
JOKESET("Joke Set"),
|
||||
CUSTOM_SET("Unofficial Set");
|
||||
|
@ -24,4 +24,27 @@ public enum SetType {
|
|||
public String toString() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public boolean isCustomSet() {
|
||||
return this == SetType.CUSTOM_SET;
|
||||
}
|
||||
|
||||
public boolean isJokeSet() {
|
||||
return this == SetType.JOKESET;
|
||||
}
|
||||
|
||||
public boolean isEternalLegal() {
|
||||
// any official sets except un-sets
|
||||
return this != SetType.CUSTOM_SET && this != SetType.JOKESET;
|
||||
}
|
||||
|
||||
public boolean isStandardLegal() {
|
||||
// any official sets that was in standard
|
||||
return this == SetType.CORE || this == SetType.EXPANSION || this == SetType.SUPPLEMENTAL_STANDARD_LEGAL;
|
||||
}
|
||||
|
||||
public boolean isModernLegal() {
|
||||
// any official sets that was in modern (standard + Modern Horizons)
|
||||
return this.isStandardLegal() || this == SetType.SUPPLEMENTAL_MODERN_LEGAL;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue