2014-09-03 22:37:26 -07:00
|
|
|
package magic.data;
|
|
|
|
|
2014-10-10 03:38:02 -07:00
|
|
|
import java.nio.file.Path;
|
|
|
|
import java.nio.file.Paths;
|
2014-09-03 22:37:26 -07:00
|
|
|
import java.util.EnumSet;
|
|
|
|
import java.util.Set;
|
2016-10-26 01:46:59 -07:00
|
|
|
import magic.translate.MText;
|
2017-01-31 12:43:53 -08:00
|
|
|
import magic.utility.DeckUtils;
|
2014-09-03 22:37:26 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Ways to group decks.
|
|
|
|
* <p>
|
|
|
|
* Be careful about renaming the enum value since this is used
|
|
|
|
* in settings files such as those used to store new duel configuration.
|
|
|
|
*/
|
|
|
|
public enum DeckType {
|
|
|
|
|
|
|
|
// TODO: Bookmarked("Bookmarked"), // decks tagged by player
|
2016-02-11 12:33:14 -08:00
|
|
|
Random(DeckTypeString._S1),
|
|
|
|
Preconstructed(DeckTypeString._S2),
|
|
|
|
Custom(DeckTypeString._S3),
|
2017-01-31 12:43:53 -08:00
|
|
|
Firemind(DeckTypeString._S4),
|
2017-01-31 18:38:45 -08:00
|
|
|
PopularDecks("Popular decks"),
|
2017-01-31 18:50:01 -08:00
|
|
|
WinningDecks("Winning decks"),
|
|
|
|
RecentDecks("Recently played decks")
|
2014-09-03 22:37:26 -07:00
|
|
|
;
|
|
|
|
|
|
|
|
private final String deckTypeCaption;
|
|
|
|
|
|
|
|
private DeckType(final String caption) {
|
2016-10-26 01:46:59 -07:00
|
|
|
this.deckTypeCaption = MText.get(caption);
|
2014-09-03 22:37:26 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String toString() {
|
|
|
|
return deckTypeCaption;
|
|
|
|
}
|
|
|
|
|
2014-10-10 03:38:02 -07:00
|
|
|
public static Path getDeckFolder(final DeckType deckType) {
|
|
|
|
switch (deckType) {
|
|
|
|
case Preconstructed: return DeckUtils.getPrebuiltDecksFolder();
|
|
|
|
case Firemind: return DeckUtils.getFiremindDecksFolder();
|
|
|
|
default: return Paths.get(DeckUtils.getDeckFolder());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-31 12:43:53 -08:00
|
|
|
public static final Set<DeckType> getPredefinedDecks() {
|
|
|
|
return GeneralConfig.isGameStatsOn()
|
2017-01-31 18:50:01 -08:00
|
|
|
? EnumSet.range(Preconstructed, RecentDecks)
|
2017-01-31 12:43:53 -08:00
|
|
|
: EnumSet.range(Preconstructed, Firemind);
|
|
|
|
}
|
|
|
|
|
2017-02-08 05:08:42 -08:00
|
|
|
public static final DeckType[] getDuelDeckTypes() {
|
|
|
|
return EnumSet.range(Random, Firemind).toArray(new DeckType[0]);
|
|
|
|
}
|
|
|
|
|
2014-09-03 22:37:26 -07:00
|
|
|
}
|