diff --git a/forge-game/src/main/java/forge/game/GameFormat.java b/forge-game/src/main/java/forge/game/GameFormat.java index ace852683b6..0c7129fdad9 100644 --- a/forge-game/src/main/java/forge/game/GameFormat.java +++ b/forge-game/src/main/java/forge/game/GameFormat.java @@ -57,8 +57,28 @@ import forge.util.storage.StorageReaderRecursiveFolderWithUserFolder; public class GameFormat implements Comparable { private final String name; - public enum FormatType {Sanctioned, Casual, Historic, Digital, Custom} - public enum FormatSubType {Block, Standard, Extended, Pioneer, Modern, Legacy, Vintage, Commander, Planechase, Videogame, MTGO, Arena, Custom} + public enum FormatType { + SANCTIONED, + CASUAL, + HISTORIC, + DIGITAL, + CUSTOM + } + public enum FormatSubType { + Block, + Standard, + Extended, + Pioneer, + Modern, + Legacy, + Vintage, + Commander, + Planechase, + Videogame, + MTGO, + Arena, + Custom + } // contains allowed sets, when empty allows all sets private FormatType formatType; @@ -85,11 +105,11 @@ public class GameFormat implements Comparable { private final int index; public GameFormat(final String fName, final Iterable sets, final List bannedCards) { - this(fName, parseDate(DEFAULTDATE), sets, bannedCards, null, false, null, null, 0, FormatType.Custom, FormatSubType.Custom); + this(fName, parseDate(DEFAULTDATE), sets, bannedCards, null, false, null, null, 0, FormatType.CUSTOM, FormatSubType.Custom); } public static final GameFormat NoFormat = new GameFormat("(none)", parseDate(DEFAULTDATE) , null, null, null, false - , null, null, Integer.MAX_VALUE, FormatType.Custom, FormatSubType.Custom); + , null, null, Integer.MAX_VALUE, FormatType.CUSTOM, FormatSubType.Custom); public GameFormat(final String fName, final Date effectiveDate, final Iterable sets, final List bannedCards, final List restrictedCards, Boolean restrictedLegendary, final List additionalCards, @@ -283,7 +303,7 @@ public class GameFormat implements Comparable { return formatSubType.compareTo(other.formatSubType); } } - if (formatType.equals(FormatType.Historic)){ + if (formatType.equals(FormatType.HISTORIC)){ if(effectiveDate!=other.effectiveDate) {//for matching dates or default dates default to name sorting return other.effectiveDate.compareTo(effectiveDate); } @@ -340,7 +360,7 @@ public class GameFormat implements Comparable { try { formatType = FormatType.valueOf(section.get("type")); } catch (Exception e) { - formatType = FormatType.Custom; + formatType = FormatType.CUSTOM; } FormatSubType formatsubType; try { @@ -432,7 +452,7 @@ public class GameFormat implements Comparable { public Iterable getSanctionedList() { List coreList = new ArrayList<>(); for(GameFormat format: naturallyOrdered){ - if(format.getFormatType().equals(FormatType.Sanctioned)){ + if(format.getFormatType().equals(FormatType.SANCTIONED)){ coreList.add(format); } } @@ -442,8 +462,8 @@ public class GameFormat implements Comparable { public Iterable getFilterList() { List coreList = new ArrayList<>(); for(GameFormat format: naturallyOrdered){ - if(!format.getFormatType().equals(FormatType.Historic) - &&!format.getFormatType().equals(FormatType.Digital)){ + if(!format.getFormatType().equals(FormatType.HISTORIC) + &&!format.getFormatType().equals(FormatType.DIGITAL)){ coreList.add(format); } } @@ -453,7 +473,7 @@ public class GameFormat implements Comparable { public Iterable getHistoricList() { List coreList = new ArrayList<>(); for(GameFormat format: naturallyOrdered){ - if(format.getFormatType().equals(FormatType.Historic)){ + if(format.getFormatType().equals(FormatType.HISTORIC)){ coreList.add(format); } } @@ -463,7 +483,7 @@ public class GameFormat implements Comparable { public Map> getHistoricMap() { Map> coreList = new HashMap<>(); for(GameFormat format: naturallyOrdered){ - if(format.getFormatType().equals(FormatType.Historic)){ + if(format.getFormatType().equals(FormatType.HISTORIC)){ String alpha = format.getName().substring(0,1); if(!coreList.containsKey(alpha)){ coreList.put(alpha,new ArrayList<>()); @@ -528,7 +548,7 @@ public class GameFormat implements Comparable { Set coveredTypes = new HashSet<>(); CardPool allCards = deck.getAllCardsInASinglePool(); for(GameFormat gf : reverseDateOrdered) { - if (gf.getFormatType().equals(FormatType.Digital) && !exhaustive){ + if (gf.getFormatType().equals(FormatType.DIGITAL) && !exhaustive){ //exclude Digital formats from lists for now continue; } @@ -536,7 +556,7 @@ public class GameFormat implements Comparable { //exclude Commander format as other deck checks are not performed here continue; } - if (gf.getFormatType().equals(FormatType.Historic) && coveredTypes.contains(gf.getFormatSubType()) + if (gf.getFormatType().equals(FormatType.HISTORIC) && coveredTypes.contains(gf.getFormatSubType()) && !exhaustive){ //exclude duplicate formats - only keep first of e.g. Standard historical continue; @@ -570,7 +590,7 @@ public class GameFormat implements Comparable { return gf1.formatSubType.compareTo(gf2.formatSubType); } } - if (gf1.formatType.equals(FormatType.Historic)){ + if (gf1.formatType.equals(FormatType.HISTORIC)){ if(gf1.effectiveDate!=gf2.effectiveDate) {//for matching dates or default dates default to name sorting return gf1.effectiveDate.compareTo(gf2.effectiveDate); } diff --git a/forge-gui-desktop/src/main/java/forge/screens/home/quest/DialogChooseFormats.java b/forge-gui-desktop/src/main/java/forge/screens/home/quest/DialogChooseFormats.java index c271308c108..68f3454effe 100644 --- a/forge-gui-desktop/src/main/java/forge/screens/home/quest/DialogChooseFormats.java +++ b/forge-gui-desktop/src/main/java/forge/screens/home/quest/DialogChooseFormats.java @@ -48,15 +48,15 @@ public class DialogChooseFormats { FCheckBox box = new FCheckBox(format.getName()); box.setName(format.getName()); switch (format.getFormatType()){ - case Sanctioned: + case SANCTIONED: sanctioned.add(box); break; - case Historic: + case HISTORIC: historic.add(box); break; - case Custom: - case Casual: - case Digital: + case CUSTOM: + case CASUAL: + case DIGITAL: default: casual.add(box); break; diff --git a/forge-gui-mobile/src/forge/itemmanager/filters/HistoricFormatSelect.java b/forge-gui-mobile/src/forge/itemmanager/filters/HistoricFormatSelect.java index 8cc9d76f61c..e67066abdb4 100644 --- a/forge-gui-mobile/src/forge/itemmanager/filters/HistoricFormatSelect.java +++ b/forge-gui-mobile/src/forge/itemmanager/filters/HistoricFormatSelect.java @@ -36,7 +36,7 @@ public class HistoricFormatSelect extends FScreen { public HistoricFormatSelect() { super(Localizer.getInstance().getMessage("lblChooseFormat")); for (GameFormat.FormatType group:GameFormat.FormatType.values()){ - if (group == GameFormat.FormatType.Historic){ + if (group == GameFormat.FormatType.HISTORIC){ for (GameFormat.FormatSubType subgroup:GameFormat.FormatSubType.values()){ if (historicSubTypes.contains(subgroup)){ lstFormats.addGroup(group.name() + "-" + subgroup.name()); @@ -48,13 +48,13 @@ public class HistoricFormatSelect extends FScreen { } for (GameFormat format: FModel.getFormats().getOrderedList()){ switch(format.getFormatType()){ - case Sanctioned: + case SANCTIONED: lstFormats.addItem(format, 0); break; - case Casual: + case CASUAL: lstFormats.addItem(format, 1); break; - case Historic: + case HISTORIC: switch (format.getFormatSubType()){ case Block: lstFormats.addItem(format, 2); @@ -77,10 +77,10 @@ public class HistoricFormatSelect extends FScreen { } break; - case Digital: + case DIGITAL: lstFormats.addItem(format, 8); break; - case Custom: + case CUSTOM: lstFormats.addItem(format, 9); } } diff --git a/forge-gui/src/main/java/forge/gamemodes/quest/data/GameFormatQuest.java b/forge-gui/src/main/java/forge/gamemodes/quest/data/GameFormatQuest.java index 96eb2295ca2..ada10b80779 100644 --- a/forge-gui/src/main/java/forge/gamemodes/quest/data/GameFormatQuest.java +++ b/forge-gui/src/main/java/forge/gamemodes/quest/data/GameFormatQuest.java @@ -64,7 +64,7 @@ public final class GameFormatQuest extends GameFormat { public GameFormatQuest(final GameFormat toCopy, boolean allowSetUnlocks) { super(toCopy.getName(), toCopy.getEffectiveDate(), toCopy.getAllowedSetCodes(), toCopy.getBannedCardNames(), toCopy.getRestrictedCards(), toCopy.isRestrictedLegendary(),toCopy.getAdditionalCards(), toCopy.getAllowedRarities(), - toCopy.getIndex(), FormatType.Custom, FormatSubType.Custom); + toCopy.getIndex(), FormatType.CUSTOM, FormatSubType.Custom); allowUnlocks = allowSetUnlocks; }