mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
- Initial checkin for Winston Draft mode. The menu item for Winston Draft is currently commented out, but it should be functional even though the AI is randomnly taking piles based on pile size.
This commit is contained in:
@@ -416,6 +416,15 @@ public class DeckProxy implements InventoryItem {
|
||||
return decks;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Iterable<DeckProxy> getWinstonDecks(IStorage<DeckGroup> draft) {
|
||||
ArrayList<DeckProxy> decks = new ArrayList<DeckProxy>();
|
||||
for (DeckGroup d : draft) {
|
||||
decks.add(new DeckProxy(d, "Winston", ((Function<IHasName, Deck>)(Object)DeckGroup.FN_HUMAN_DECK), GameType.Winston, draft));
|
||||
}
|
||||
return decks;
|
||||
}
|
||||
|
||||
public static final Predicate<DeckProxy> IS_WHITE = new Predicate<DeckProxy>() {
|
||||
@Override
|
||||
public boolean apply(final DeckProxy deck) {
|
||||
|
||||
@@ -58,6 +58,8 @@ public enum ItemManagerConfig {
|
||||
null, null, 3, 0),
|
||||
SEALED_DECKS(SColumnUtil.getDecksDefaultColumns(true, false), false, false, false,
|
||||
null, null, 3, 0),
|
||||
WINSTON_DECKS(SColumnUtil.getDecksDefaultColumns(true, false), false, false, false,
|
||||
null, null, 3, 0),
|
||||
QUEST_DECKS(SColumnUtil.getDecksDefaultColumns(true, false), false, false, false,
|
||||
null, null, 3, 0),
|
||||
PRECON_DECKS(SColumnUtil.getDecksDefaultColumns(false, false), false, false, false,
|
||||
|
||||
@@ -50,31 +50,35 @@ import java.util.Map.Entry;
|
||||
* Booster Draft Format.
|
||||
*
|
||||
*/
|
||||
public final class BoosterDraft implements IBoosterDraft {
|
||||
public class BoosterDraft implements IBoosterDraft {
|
||||
private final BoosterDraftAI draftAI = new BoosterDraftAI();
|
||||
private static final int N_PLAYERS = 8;
|
||||
public static final String FILE_EXT = ".draft";
|
||||
|
||||
private int nextBoosterGroup = 0;
|
||||
protected int nextBoosterGroup = 0;
|
||||
private int currentBoosterSize = 0;
|
||||
private int currentBoosterPick = 0;
|
||||
private List<List<PaperCard>> pack; // size 8
|
||||
|
||||
/** The draft picks. */
|
||||
private final Map<String, Float> draftPicks = new TreeMap<String, Float>();
|
||||
private final LimitedPoolType draftFormat;
|
||||
protected LimitedPoolType draftFormat;
|
||||
|
||||
private final List<Supplier<List<PaperCard>>> product = new ArrayList<Supplier<List<PaperCard>>>();
|
||||
protected final List<Supplier<List<PaperCard>>> product = new ArrayList<Supplier<List<PaperCard>>>();
|
||||
|
||||
public static BoosterDraft createDraft(final LimitedPoolType draftType) {
|
||||
BoosterDraft draft = new BoosterDraft(draftType);
|
||||
if (!draft.generateProduct()) { return null; }
|
||||
return draft;
|
||||
}
|
||||
|
||||
switch (draftType) {
|
||||
protected boolean generateProduct() {
|
||||
switch (this.draftFormat) {
|
||||
case Full: // Draft from all cards in Forge
|
||||
Supplier<List<PaperCard>> s = new UnOpenedProduct(SealedProduct.Template.genericBooster);
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
draft.product.add(s);
|
||||
this.product.add(s);
|
||||
}
|
||||
IBoosterDraft.LAND_SET_CODE[0] = CardEdition.Predicates.getRandomSetWithAllBasicLands(FModel.getMagicDb().getEditions());
|
||||
break;
|
||||
@@ -82,7 +86,7 @@ public final class BoosterDraft implements IBoosterDraft {
|
||||
case Block: // Draft from cards by block or set
|
||||
case FantasyBlock:
|
||||
List<CardBlock> blocks = new ArrayList<CardBlock>();
|
||||
IStorage<CardBlock> storage = draftType == LimitedPoolType.Block
|
||||
IStorage<CardBlock> storage = this.draftFormat == LimitedPoolType.Block
|
||||
? FModel.getBlocks() : FModel.getFantasyBlocks();
|
||||
|
||||
for (CardBlock b : storage) {
|
||||
@@ -92,12 +96,12 @@ public final class BoosterDraft implements IBoosterDraft {
|
||||
}
|
||||
|
||||
final CardBlock block = SGuiChoose.oneOrNone("Choose Block", blocks);
|
||||
if (block == null) { return null; }
|
||||
if (block == null) { return false; }
|
||||
|
||||
final CardEdition[] cardSets = block.getSets();
|
||||
if (cardSets.length == 0) {
|
||||
SOptionPane.showErrorDialog(block.toString() + " does not contain any set combinations.");
|
||||
return null;
|
||||
return false;
|
||||
}
|
||||
|
||||
final Stack<String> sets = new Stack<String>();
|
||||
@@ -115,18 +119,18 @@ public final class BoosterDraft implements IBoosterDraft {
|
||||
|
||||
if (sets.size() > 1) {
|
||||
final Object p = SGuiChoose.oneOrNone("Choose Set Combination", getSetCombos(sets));
|
||||
if (p == null) { return null; }
|
||||
if (p == null) { return false; }
|
||||
|
||||
final String[] pp = p.toString().split("/");
|
||||
for (int i = 0; i < nPacks; i++) {
|
||||
draft.product.add(block.getBooster(pp[i]));
|
||||
this.product.add(block.getBooster(pp[i]));
|
||||
}
|
||||
}
|
||||
else {
|
||||
IUnOpenedProduct product1 = block.getBooster(sets.get(0));
|
||||
|
||||
for (int i = 0; i < nPacks; i++) {
|
||||
draft.product.add(product1);
|
||||
this.product.add(product1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,29 +138,28 @@ public final class BoosterDraft implements IBoosterDraft {
|
||||
break;
|
||||
|
||||
case Custom:
|
||||
final List<CustomLimited> myDrafts = draft.loadCustomDrafts();
|
||||
final List<CustomLimited> myDrafts = this.loadCustomDrafts();
|
||||
|
||||
if (myDrafts.isEmpty()) {
|
||||
SOptionPane.showMessageDialog("No custom draft files found.");
|
||||
}
|
||||
else {
|
||||
final CustomLimited customDraft = SGuiChoose.oneOrNone("Choose Custom Draft", myDrafts);
|
||||
if (customDraft == null) { return null; }
|
||||
if (customDraft == null) { return false; }
|
||||
|
||||
draft.setupCustomDraft(customDraft);
|
||||
this.setupCustomDraft(customDraft);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new NoSuchElementException("Draft for mode " + draftType + " has not been set up!");
|
||||
throw new NoSuchElementException("Draft for mode " + this.draftFormat + " has not been set up!");
|
||||
}
|
||||
|
||||
draft.pack = draft.get8BoosterPack();
|
||||
return draft;
|
||||
this.pack = this.get8BoosterPack();
|
||||
return true;
|
||||
}
|
||||
|
||||
public static BoosterDraft createDraft(final LimitedPoolType draftType, final CardBlock block, final String[] boosters) {
|
||||
|
||||
|
||||
public static BoosterDraft createDraft(final LimitedPoolType draftType, final CardBlock block, final String[] boosters) {
|
||||
BoosterDraft draft = new BoosterDraft(draftType);
|
||||
|
||||
final int nPacks = boosters.length;
|
||||
@@ -169,18 +172,20 @@ public final class BoosterDraft implements IBoosterDraft {
|
||||
|
||||
draft.pack = draft.get8BoosterPack();
|
||||
return draft;
|
||||
|
||||
}
|
||||
|
||||
protected BoosterDraft() {
|
||||
this.draftFormat = LimitedPoolType.Full;
|
||||
}
|
||||
/**
|
||||
* <p>
|
||||
* Constructor for BoosterDraft_1.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @param draftType
|
||||
* a {@link java.lang.String} object.
|
||||
*/
|
||||
private BoosterDraft(final LimitedPoolType draftType) {
|
||||
protected BoosterDraft(final LimitedPoolType draftType) {
|
||||
this.draftAI.setBd(this);
|
||||
this.draftFormat = draftType;
|
||||
}
|
||||
@@ -233,7 +238,7 @@ public final class BoosterDraft implements IBoosterDraft {
|
||||
* nextChoice.
|
||||
* </p>
|
||||
*
|
||||
* @return a {@link forge.CardList} object.
|
||||
* @return a {@link forge.deck.CardPool} object.
|
||||
*/
|
||||
@Override
|
||||
public CardPool nextChoice() {
|
||||
@@ -252,7 +257,7 @@ public final class BoosterDraft implements IBoosterDraft {
|
||||
* get8BoosterPack.
|
||||
* </p>
|
||||
*
|
||||
* @return an array of {@link forge.CardList} objects.
|
||||
* @return an array of {@link forge.deck.CardPool} objects.
|
||||
*/
|
||||
public List<List<PaperCard>> get8BoosterPack() {
|
||||
if (this.nextBoosterGroup >= this.product.size()) {
|
||||
@@ -284,7 +289,7 @@ public final class BoosterDraft implements IBoosterDraft {
|
||||
return this.draftAI.getDecks();
|
||||
}
|
||||
|
||||
private void computerChoose() {
|
||||
protected void computerChoose() {
|
||||
final int iHumansBooster = this.getCurrentBoosterIndex();
|
||||
int iPlayer = 0;
|
||||
for (int i = 1; i < this.pack.size(); i++) {
|
||||
@@ -377,6 +382,11 @@ public final class BoosterDraft implements IBoosterDraft {
|
||||
HttpUtil.upload(ForgeConstants.URL_DRAFT_UPLOAD + "?fmt=" + draftFormat, outDraftData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPileDraft() {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static List<String> getSetCombos(final List<String> setz) {
|
||||
String[] sets = setz.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
|
||||
List<String> setCombos = new ArrayList<String>();
|
||||
|
||||
@@ -45,11 +45,11 @@ public class BoosterDraftAI {
|
||||
/**
|
||||
* Constant <code>nDecks=7.</code>
|
||||
*/
|
||||
private static final int N_DECKS = 7;
|
||||
protected static final int N_DECKS = 7;
|
||||
|
||||
// holds all the cards for each of the computer's decks
|
||||
private final List<List<PaperCard>> deck = new ArrayList<List<PaperCard>>();
|
||||
private final ArrayList<DeckColors> playerColors = new ArrayList<DeckColors>();
|
||||
protected final List<List<PaperCard>> deck = new ArrayList<List<PaperCard>>();
|
||||
protected final ArrayList<DeckColors> playerColors = new ArrayList<DeckColors>();
|
||||
|
||||
// roughly equivalent to 25 ranks in a core set, or 15 ranks in a small set
|
||||
private static final double TAKE_BEST_THRESHOLD = 0.1;
|
||||
@@ -63,7 +63,7 @@ public class BoosterDraftAI {
|
||||
* List of CardPrinted
|
||||
* @param player
|
||||
* a int.
|
||||
* @return a {@link forge.CardList} object.
|
||||
* @return a {@link forge.item.PaperCard} object.
|
||||
*/
|
||||
public PaperCard choose(final List<PaperCard> chooseFrom, final int player) {
|
||||
if (ForgePreferences.DEV_MODE) {
|
||||
|
||||
@@ -22,6 +22,8 @@ import forge.card.MagicColor;
|
||||
import forge.card.mana.ManaCost;
|
||||
import forge.item.IPaperCard;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA. User: dhudson Date: 6/24/11 Time: 8:42 PM To change
|
||||
* this template use File | Settings | File Templates.
|
||||
@@ -64,6 +66,14 @@ class DeckColors {
|
||||
}
|
||||
}
|
||||
|
||||
public void setColorsByList(List<Byte> colors) {
|
||||
colorMask = 0;
|
||||
for (Byte col : colors) {
|
||||
colorMask |= col;
|
||||
}
|
||||
chosen = null;
|
||||
}
|
||||
|
||||
|
||||
public boolean canChoseMoreColors() {
|
||||
return getChosenColors().countColors() < MAX_COLORS;
|
||||
|
||||
@@ -76,4 +76,6 @@ public interface IBoosterDraft {
|
||||
*/
|
||||
void finishedDrafting();
|
||||
|
||||
boolean isPileDraft();
|
||||
|
||||
}
|
||||
|
||||
178
forge-gui/src/main/java/forge/limited/WinstonDraft.java
Normal file
178
forge-gui/src/main/java/forge/limited/WinstonDraft.java
Normal file
@@ -0,0 +1,178 @@
|
||||
package forge.limited;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.collect.Iterables;
|
||||
import forge.deck.CardPool;
|
||||
import forge.deck.Deck;
|
||||
import forge.item.IPaperCard;
|
||||
import forge.item.PaperCard;
|
||||
import forge.quest.data.GameFormatQuest;
|
||||
import forge.util.MyRandom;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class WinstonDraft extends BoosterDraft {
|
||||
private WinstonDraftAI draftAI = null;
|
||||
private static int NUM_PILES = 3;
|
||||
private static int NUM_PLAYERS = 2;
|
||||
|
||||
private Stack<PaperCard> deck; // main deck where all cards
|
||||
private List<List<PaperCard>> piles; // 3 piles to draft from
|
||||
|
||||
public static WinstonDraft createDraft(final LimitedPoolType draftType) {
|
||||
WinstonDraft draft = new WinstonDraft(draftType);
|
||||
if (!draft.generateProduct()) {
|
||||
return null;
|
||||
}
|
||||
draft.initializeWinstonDraft();
|
||||
return draft;
|
||||
}
|
||||
|
||||
private WinstonDraft(LimitedPoolType draftType) {
|
||||
draftFormat = draftType;
|
||||
draftAI = new WinstonDraftAI();
|
||||
|
||||
}
|
||||
|
||||
private void initializeWinstonDraft() {
|
||||
this.deck = new Stack<PaperCard>();
|
||||
for (int i = 0; i < this.product.size(); i++) {
|
||||
Supplier<List<PaperCard>> supply = this.product.get(i);
|
||||
for(int j = 0; j < NUM_PLAYERS; j++) {
|
||||
// Remove Basic Lands from draft for simplicity
|
||||
for (PaperCard paperCard : Iterables.filter(supply.get(), Predicates.not(PaperCard.Predicates.Presets.IS_BASIC_LAND))) {
|
||||
this.deck.add(paperCard);
|
||||
}
|
||||
}
|
||||
}
|
||||
Collections.shuffle(this.deck, MyRandom.getRandom());
|
||||
|
||||
// Create three Winston piles, adding the top card from the Winston deck to start each pile
|
||||
this.piles = new ArrayList<>();
|
||||
for(int i = 0; i < NUM_PILES; i++) {
|
||||
List<PaperCard> pile = new ArrayList<PaperCard>();
|
||||
pile.add(this.deck.pop());
|
||||
this.piles.add(pile);
|
||||
}
|
||||
|
||||
this.nextBoosterGroup = 0;
|
||||
|
||||
draftAI.setDraft(this);
|
||||
|
||||
if (MyRandom.percentTrue(50)) {
|
||||
// 50% chance of the AI picking the first card in a Winston Draft
|
||||
//this.computerChoose();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CardPool nextChoice() {
|
||||
// This is called for two reasons: Skipping a pile, and getting the next one in line
|
||||
// Or taking a pile and getting reset back to the first non-empty pile
|
||||
int nextPile = -1;
|
||||
for(int i = nextBoosterGroup; i < this.piles.size(); i++) {
|
||||
if (this.piles.get(i).size() > 0) {
|
||||
nextPile = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (nextPile < 0 || nextPile > this.piles.size())
|
||||
return null;
|
||||
|
||||
nextBoosterGroup = nextPile;
|
||||
|
||||
return getPoolByPile(nextBoosterGroup);
|
||||
}
|
||||
|
||||
public CardPool getActivePool() {
|
||||
return getPoolByPile(this.nextBoosterGroup);
|
||||
}
|
||||
|
||||
private CardPool getPoolByPile(int i) {
|
||||
CardPool result = new CardPool();
|
||||
result.addAllFlat(this.piles.get(i));
|
||||
return result;
|
||||
}
|
||||
|
||||
public void computerChoose() {
|
||||
nextBoosterGroup = 0;
|
||||
draftAI.choose();
|
||||
}
|
||||
|
||||
public void refillPile(List<PaperCard> pile) {
|
||||
if (this.deck.size() > 0)
|
||||
pile.add(this.deck.pop());
|
||||
}
|
||||
|
||||
public int getNextChoice(int startPile) {
|
||||
for(int i = startPile; i < NUM_PILES; i++) {
|
||||
if (this.piles.get(i).size() > 0)
|
||||
return i;
|
||||
}
|
||||
// All piles are empty, so draft is about to end.
|
||||
return -1;
|
||||
}
|
||||
|
||||
public boolean hasNextChoice() {
|
||||
return getNextChoice(0) >= 0;
|
||||
}
|
||||
|
||||
public boolean isLastPileAndEmptyDeck(int pile) {
|
||||
return this.deck.size() == 0 && getNextChoice(pile+1) >= 0;
|
||||
}
|
||||
|
||||
public int getCurrentBoosterIndex() {
|
||||
return nextBoosterGroup;
|
||||
}
|
||||
|
||||
public CardPool takeActivePile(boolean humanAction) {
|
||||
CardPool pool = getPoolByPile(this.nextBoosterGroup);
|
||||
|
||||
this.piles.get(this.nextBoosterGroup).clear();
|
||||
this.refillPile(this.piles.get(this.nextBoosterGroup));
|
||||
this.nextBoosterGroup = 0;
|
||||
if (humanAction)
|
||||
computerChoose();
|
||||
return pool;
|
||||
}
|
||||
|
||||
public CardPool passActivePile(boolean humanAction) {
|
||||
this.refillPile(this.piles.get(this.nextBoosterGroup));
|
||||
this.nextBoosterGroup++;
|
||||
if (this.nextBoosterGroup >= this.piles.size()) {
|
||||
CardPool pool = new CardPool();
|
||||
if (this.deck.size() > 0)
|
||||
pool.add(this.deck.pop());
|
||||
this.nextBoosterGroup = 0;
|
||||
if (humanAction)
|
||||
computerChoose();
|
||||
return pool;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getNumPiles() {
|
||||
return NUM_PILES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Deck[] getDecks() {
|
||||
this.determineAIDeckColors();
|
||||
return this.draftAI.getDecks();
|
||||
}
|
||||
|
||||
public void determineAIDeckColors() {
|
||||
this.draftAI.determineDeckColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPileDraft() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getDeckSize() { return this.deck.size(); }
|
||||
|
||||
public int getAIDraftSize() { return this.draftAI.getAIDraftSize(); }
|
||||
}
|
||||
114
forge-gui/src/main/java/forge/limited/WinstonDraftAI.java
Normal file
114
forge-gui/src/main/java/forge/limited/WinstonDraftAI.java
Normal file
@@ -0,0 +1,114 @@
|
||||
package forge.limited;
|
||||
|
||||
import forge.card.ColorSet;
|
||||
import forge.card.MagicColor;
|
||||
import forge.deck.CardPool;
|
||||
import forge.game.card.CardColor;
|
||||
import forge.item.PaperCard;
|
||||
import forge.util.MyRandom;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class WinstonDraftAI extends BoosterDraftAI{
|
||||
|
||||
private WinstonDraft draft = null;
|
||||
private static final int N_DECKS = 1;
|
||||
private ArrayList<Byte> colorPreference = new ArrayList<>();
|
||||
|
||||
public WinstonDraft getDraft() {
|
||||
return draft;
|
||||
}
|
||||
|
||||
public void setDraft(WinstonDraft draft) {
|
||||
this.draft = draft;
|
||||
}
|
||||
|
||||
public WinstonDraftAI() {
|
||||
this.deck.clear();
|
||||
this.playerColors.clear();
|
||||
for (int i = 0; i < N_DECKS; i++) {
|
||||
this.deck.add(new ArrayList<PaperCard>());
|
||||
this.playerColors.add(new DeckColors());
|
||||
}
|
||||
}
|
||||
|
||||
public void determineDeckColor() {
|
||||
// Turn colorPreference into playerColors
|
||||
int count[] = tallyDeckColors();
|
||||
// Just take the three best colors, but maybe sometimes only take best two
|
||||
this.playerColors.get(0).setColorsByList(colorPreference.subList(0, 3));
|
||||
}
|
||||
|
||||
public void choose() {
|
||||
boolean takenPile = true;
|
||||
CardPool acquire = null;
|
||||
while(takenPile) {
|
||||
CardPool pool = draft.getActivePool();
|
||||
// Determine if the current pool is worth taking
|
||||
// For now, each card in a pile is worth 10 points. Compare versus a d100 roll
|
||||
String desc = "Pile " + (draft.getCurrentBoosterIndex()+1);
|
||||
int value = pool.countAll() * 10;
|
||||
// If this is the last pile, and the deck is empty, definitely take the pile!
|
||||
boolean takePile = MyRandom.percentTrue(value) || draft.isLastPileAndEmptyDeck(draft.getCurrentBoosterIndex());
|
||||
|
||||
if (takePile) {
|
||||
acquire = draft.takeActivePile(false);
|
||||
} else {
|
||||
acquire = draft.passActivePile(false);
|
||||
desc = "Top of Deck";
|
||||
}
|
||||
if (acquire != null) {
|
||||
System.out.println("AI taking " + desc + "(" + acquire.countAll() + " cards).");
|
||||
takenPile = false;
|
||||
}
|
||||
}
|
||||
if (acquire != null) {
|
||||
this.deck.get(0).addAll(acquire.toFlatList());
|
||||
//tallyDeckColors();
|
||||
}
|
||||
}
|
||||
|
||||
private int[] tallyDeckColors() {
|
||||
int[] colorCount = new int[5];
|
||||
|
||||
for(PaperCard pc : this.deck.get(0)) {
|
||||
ColorSet colors = pc.getRules().getColor();
|
||||
if (colors.hasWhite())
|
||||
colorCount[0]++;
|
||||
if (colors.hasBlue())
|
||||
colorCount[1]++;
|
||||
if (colors.hasBlack())
|
||||
colorCount[2]++;
|
||||
if (colors.hasRed())
|
||||
colorCount[3]++;
|
||||
if (colors.hasGreen())
|
||||
colorCount[4]++;
|
||||
}
|
||||
|
||||
// Just keep order or should I keep order/value pairs?
|
||||
colorPreference.clear();
|
||||
for(int i = 0; i < colorCount.length; i++) {
|
||||
// Sort colors in order.
|
||||
Byte col = MagicColor.WUBRG[i];
|
||||
int spot = 0;
|
||||
for (int j = 0; j < i; j++) {
|
||||
if (colorCount[i] > colorCount[j]) {
|
||||
// If new color has more than the current slot, we need to add into that slot
|
||||
// And push all remaining colors further down
|
||||
break;
|
||||
}
|
||||
spot++;
|
||||
}
|
||||
colorPreference.add(spot, col);
|
||||
}
|
||||
// Is this the right order?
|
||||
return colorCount;
|
||||
}
|
||||
|
||||
public int getAIDraftSize() {
|
||||
return this.deck.get(0).size();
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,7 @@ public class CardCollections {
|
||||
private final IStorage<Deck> constructed;
|
||||
private final IStorage<DeckGroup> draft;
|
||||
private final IStorage<DeckGroup> sealed;
|
||||
private final IStorage<DeckGroup> winston;
|
||||
private final IStorage<Deck> cube;
|
||||
private final IStorage<Deck> scheme;
|
||||
private final IStorage<Deck> plane;
|
||||
@@ -53,11 +54,11 @@ public class CardCollections {
|
||||
this.constructed = new StorageImmediatelySerialized<Deck>("Constructed decks", new DeckStorage(new File(ForgeConstants.DECK_CONSTRUCTED_DIR), true), true);
|
||||
this.draft = new StorageImmediatelySerialized<DeckGroup>("Draft deck sets", new DeckGroupSerializer(new File(ForgeConstants.DECK_DRAFT_DIR)));
|
||||
this.sealed = new StorageImmediatelySerialized<DeckGroup>("Sealed deck sets", new DeckGroupSerializer(new File(ForgeConstants.DECK_SEALED_DIR)));
|
||||
this.winston = new StorageImmediatelySerialized<DeckGroup>("Winston draft deck sets", new DeckGroupSerializer(new File(ForgeConstants.DECK_WINSTON_DIR)));
|
||||
this.cube = new StorageImmediatelySerialized<Deck>("Cubes", new DeckStorage(new File(ForgeConstants.DECK_CUBE_DIR)));
|
||||
this.scheme = new StorageImmediatelySerialized<Deck>("Archenemy decks", new DeckStorage(new File(ForgeConstants.DECK_SCHEME_DIR)));
|
||||
this.plane = new StorageImmediatelySerialized<Deck>("Planechase decks", new DeckStorage(new File(ForgeConstants.DECK_PLANE_DIR)));
|
||||
this.commander = new StorageImmediatelySerialized<Deck>("Commander decks", new DeckStorage(new File(ForgeConstants.DECK_COMMANDER_DIR)));
|
||||
|
||||
sw.stop();
|
||||
System.out.printf("Read decks (%d ms): %d constructed, %d sealed, %d draft, %d cubes, %d scheme, %d planar, %d commander.%n", sw.getTime(), constructed.size(), sealed.size(), draft.size(), cube.size(), scheme.size(), plane.size(),commander.size());
|
||||
// int sum = constructed.size() + sealed.size() + draft.size() + cube.size() + scheme.size() + plane.size();
|
||||
@@ -85,6 +86,10 @@ public class CardCollections {
|
||||
return this.draft;
|
||||
}
|
||||
|
||||
public final IStorage<DeckGroup> getWinston() {
|
||||
return this.winston;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cubes.
|
||||
*
|
||||
|
||||
@@ -102,6 +102,7 @@ public final class ForgeConstants {
|
||||
public static final String DECK_BASE_DIR = USER_DIR + "decks/";
|
||||
public static final String DECK_CONSTRUCTED_DIR = DECK_BASE_DIR + "constructed/";
|
||||
public static final String DECK_DRAFT_DIR = DECK_BASE_DIR + "draft/";
|
||||
public static final String DECK_WINSTON_DIR = DECK_BASE_DIR + "winston/";
|
||||
public static final String DECK_SEALED_DIR = DECK_BASE_DIR + "sealed/";
|
||||
public static final String DECK_SCHEME_DIR = DECK_BASE_DIR + "scheme/";
|
||||
public static final String DECK_PLANE_DIR = DECK_BASE_DIR + "planar/";
|
||||
|
||||
Reference in New Issue
Block a user