Refactor deck chooser and editor to support variants

This commit is contained in:
drdev
2014-06-27 05:03:24 +00:00
parent 0fd838a2e9
commit 74e64c36d7
12 changed files with 347 additions and 260 deletions

View File

@@ -258,9 +258,27 @@ public class DeckProxy implements InventoryItem {
}
// TODO: The methods below should not take the decks collections from singletons, instead they are supposed to use data passed in parameters
public static Iterable<DeckProxy> getAllConstructedDecks(IStorage<Deck> storageRoot) {
public static Iterable<DeckProxy> getAllConstructedDecks() {
List<DeckProxy> result = new ArrayList<DeckProxy>();
addDecksRecursivelly("Constructed", GameType.Constructed, result, "", storageRoot);
addDecksRecursivelly("Constructed", GameType.Constructed, result, "", FModel.getDecks().getConstructed());
return result;
}
public static Iterable<DeckProxy> getAllCommanderDecks() {
List<DeckProxy> result = new ArrayList<DeckProxy>();
addDecksRecursivelly("Commander", GameType.Commander, result, "", FModel.getDecks().getCommander());
return result;
}
public static Iterable<DeckProxy> getAllSchemeDecks() {
List<DeckProxy> result = new ArrayList<DeckProxy>();
addDecksRecursivelly("Scheme", GameType.Archenemy, result, "", FModel.getDecks().getScheme());
return result;
}
public static Iterable<DeckProxy> getAllPlanarDecks() {
List<DeckProxy> result = new ArrayList<DeckProxy>();
addDecksRecursivelly("Plane", GameType.Planechase, result, "", FModel.getDecks().getPlane());
return result;
}

View File

@@ -5,7 +5,8 @@ public enum DeckType {
PRECONSTRUCTED_DECK("Preconstructed Decks"),
QUEST_OPPONENT_DECK ("Quest Opponent Decks"),
COLOR_DECK ("Random Color Decks"),
THEME_DECK ("Random Theme Decks");
THEME_DECK ("Random Theme Decks"),
RANDOM_DECK ("Random Decks");
private String value;
private DeckType(String value) {

View File

@@ -195,7 +195,13 @@ public class DeckgenUtil {
return result;
}
public static CardPool generateSchemeDeck() {
public static Deck generateSchemeDeck() {
Deck deck = new Deck("");
deck.putSection(DeckSection.Schemes, generateSchemePool());
return deck;
}
public static CardPool generateSchemePool() {
CardPool schemes = new CardPool();
List<PaperCard> allSchemes = new ArrayList<PaperCard>();
for (PaperCard c : FModel.getMagicDb().getVariantCards().getAllCards()) {
@@ -221,7 +227,13 @@ public class DeckgenUtil {
return schemes;
}
public static CardPool generatePlanarDeck() {
public static Deck generatePlanarDeck() {
Deck deck = new Deck("");
deck.putSection(DeckSection.Planes, generatePlanarPool());
return deck;
}
public static CardPool generatePlanarPool() {
CardPool res = new CardPool();
List<PaperCard> allPlanars = new ArrayList<PaperCard>();
for (PaperCard c : FModel.getMagicDb().getVariantCards().getAllCards()) {

View File

@@ -54,6 +54,14 @@ public enum ItemManagerConfig {
GroupDef.DEFAULT, ColumnDef.CMC, 4, 1),
CONSTRUCTED_DECKS(SColumnUtil.getDecksDefaultColumns(true, true), false, false, false,
null, null, 3, 0),
COMMANDER_DECKS(SColumnUtil.getDecksDefaultColumns(true, false), false, false, false,
null, null, 3, 0),
PLANAR_DECKS(SColumnUtil.getDecksDefaultColumns(true, false), false, false, false,
null, null, 3, 0),
SCHEME_DECKS(SColumnUtil.getDecksDefaultColumns(true, false), false, false, false,
null, null, 3, 0),
VANGUARDS(SColumnUtil.getDecksDefaultColumns(true, false), false, false, false,
null, null, 3, 0),
DRAFT_DECKS(SColumnUtil.getDecksDefaultColumns(true, false), false, false, false,
null, null, 3, 0),
SEALED_DECKS(SColumnUtil.getDecksDefaultColumns(true, false), false, false, false,