mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
remove ItemPoolView class, instead a read-only pool will be an instance of same class, but backed with an unmodifiable map
This commit is contained in:
@@ -24,7 +24,6 @@ import forge.quest.QuestEvent;
|
||||
import forge.quest.QuestEventChallenge;
|
||||
import forge.quest.QuestEventDuel;
|
||||
import forge.util.Aggregates;
|
||||
import forge.util.ItemPoolView;
|
||||
import forge.util.Lang;
|
||||
import forge.util.MyRandom;
|
||||
import forge.util.storage.IStorage;
|
||||
@@ -72,7 +71,7 @@ public class DeckgenUtil {
|
||||
}
|
||||
gen.setSingleton(Singletons.getModel().getPreferences().getPrefBoolean(FPref.DECKGEN_SINGLETONS));
|
||||
gen.setUseArtifacts(Singletons.getModel().getPreferences().getPrefBoolean(FPref.DECKGEN_ARTIFACTS));
|
||||
ItemPoolView<PaperCard> cards = gen == null ? null : gen.getDeck(60, forAi);
|
||||
CardPool cards = gen == null ? null : gen.getDeck(60, forAi);
|
||||
|
||||
if (null == deckName) {
|
||||
deckName = Lang.joinHomogenous(Arrays.asList(selection));
|
||||
|
||||
@@ -23,11 +23,10 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.deck.CardPool;
|
||||
import forge.deck.generation.DeckGeneratorBase;
|
||||
import forge.error.BugReporter;
|
||||
import forge.item.PaperCard;
|
||||
import forge.util.FileUtil;
|
||||
import forge.util.ItemPoolView;
|
||||
import forge.util.MyRandom;
|
||||
|
||||
/**
|
||||
@@ -95,7 +94,7 @@ public class GenerateThemeDeck extends DeckGeneratorBase {
|
||||
* a int.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public final ItemPoolView<PaperCard> getThemeDeck(final String themeName, final int size) {
|
||||
public final CardPool getThemeDeck(final String themeName, final int size) {
|
||||
String s = "";
|
||||
|
||||
// read theme file
|
||||
|
||||
@@ -42,7 +42,6 @@ import forge.gui.toolbox.itemmanager.views.SColumnUtil;
|
||||
import forge.gui.toolbox.itemmanager.views.ItemColumn;
|
||||
import forge.item.PaperCard;
|
||||
import forge.util.ItemPool;
|
||||
import forge.util.ItemPoolView;
|
||||
|
||||
/**
|
||||
* Child controller for constructed deck editor UI.
|
||||
@@ -60,8 +59,8 @@ public final class CEditorCommander extends ACEditorBase<PaperCard, Deck> {
|
||||
private DragCell deckGenParent = null;
|
||||
|
||||
private List<DeckSection> allSections = new ArrayList<DeckSection>();
|
||||
private final ItemPoolView<PaperCard> commanderPool;
|
||||
private final ItemPoolView<PaperCard> normalPool;
|
||||
private final ItemPool<PaperCard> commanderPool;
|
||||
private final ItemPool<PaperCard> normalPool;
|
||||
|
||||
//=========== Constructor
|
||||
/**
|
||||
|
||||
@@ -39,7 +39,6 @@ import forge.gui.toolbox.itemmanager.views.SColumnUtil;
|
||||
import forge.gui.toolbox.itemmanager.views.ItemColumn;
|
||||
import forge.item.PaperCard;
|
||||
import forge.util.ItemPool;
|
||||
import forge.util.ItemPoolView;
|
||||
|
||||
/**
|
||||
* Child controller for constructed deck editor UI.
|
||||
@@ -54,7 +53,7 @@ import forge.util.ItemPoolView;
|
||||
public final class CEditorConstructed extends ACEditorBase<PaperCard, Deck> {
|
||||
private final DeckController<Deck> controller;
|
||||
private final List<DeckSection> allSections = new ArrayList<DeckSection>();
|
||||
private final ItemPoolView<PaperCard> normalPool, avatarPool, planePool, schemePool;
|
||||
private final ItemPool<PaperCard> normalPool, avatarPool, planePool, schemePool;
|
||||
|
||||
//=========== Constructor
|
||||
/**
|
||||
|
||||
@@ -37,7 +37,7 @@ import forge.gui.toolbox.itemmanager.views.SColumnUtil;
|
||||
import forge.item.PaperCard;
|
||||
import forge.limited.BoosterDraft;
|
||||
import forge.limited.IBoosterDraft;
|
||||
import forge.util.ItemPoolView;
|
||||
import forge.util.ItemPool;
|
||||
|
||||
/**
|
||||
* Updates the deck editor UI as necessary draft selection mode.
|
||||
@@ -132,7 +132,7 @@ public class CEditorDraftingProcess extends ACEditorBase<PaperCard, DeckGroup> {
|
||||
* @param list
|
||||
* a {@link forge.CardList} object.
|
||||
*/
|
||||
private void showChoices(final ItemPoolView<PaperCard> list) {
|
||||
private void showChoices(final ItemPool<PaperCard> list) {
|
||||
int packNumber = ((BoosterDraft) boosterDraft).getCurrentBoosterIndex() + 1;
|
||||
|
||||
this.getCatalogManager().setCaption("Pack " + packNumber + " - Cards");
|
||||
|
||||
@@ -65,7 +65,6 @@ import forge.item.TournamentPack;
|
||||
import forge.quest.QuestController;
|
||||
import forge.quest.io.ReadPriceList;
|
||||
import forge.util.ItemPool;
|
||||
import forge.util.ItemPoolView;
|
||||
|
||||
/**
|
||||
* Child controller for quest card shop UI.
|
||||
@@ -97,7 +96,7 @@ public final class CEditorQuestCardShop extends ACEditorBase<InventoryItem, Deck
|
||||
private double multiplier;
|
||||
private final QuestController questData;
|
||||
|
||||
private ItemPoolView<InventoryItem> cardsForSale;
|
||||
private ItemPool<InventoryItem> cardsForSale;
|
||||
private final ItemPool<InventoryItem> fullCatalogCards =
|
||||
ItemPool.createFrom(Singletons.getMagicDb().getCommonCards().getAllCards(), InventoryItem.class);
|
||||
private boolean showingFullCatalog = false;
|
||||
|
||||
@@ -15,7 +15,6 @@ import forge.gui.framework.ICDoc;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.util.ItemPool;
|
||||
import forge.util.ItemPoolView;
|
||||
import forge.util.MyRandom;
|
||||
|
||||
/**
|
||||
@@ -68,7 +67,7 @@ public enum CProbabilities implements ICDoc {
|
||||
|
||||
if (ed == null) { return new ArrayList<String>(); }
|
||||
|
||||
final ItemPoolView<PaperCard> deck = ItemPool.createFrom(ed.getDeckManager().getPool(), PaperCard.class);
|
||||
final ItemPool<PaperCard> deck = ItemPool.createFrom(ed.getDeckManager().getPool(), PaperCard.class);
|
||||
|
||||
final List<String> cardProbabilities = new ArrayList<String>();
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ import forge.gui.toolbox.itemmanager.SItemManagerUtil;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.util.ItemPool;
|
||||
import forge.util.ItemPoolView;
|
||||
|
||||
|
||||
/**
|
||||
@@ -57,7 +56,7 @@ public enum CStatistics implements ICDoc {
|
||||
analyze();
|
||||
}
|
||||
|
||||
private void setLabelValue(JLabel label, ItemPoolView<PaperCard> deck, Predicate<CardRules> predicate, int total) {
|
||||
private void setLabelValue(JLabel label, ItemPool<PaperCard> deck, Predicate<CardRules> predicate, int total) {
|
||||
int tmp = deck.countAll(Predicates.compose(predicate, PaperCard.FN_GET_RULES));
|
||||
label.setText(tmp + " (" + SItemManagerUtil.calculatePercentage(tmp, total) + "%)");
|
||||
}
|
||||
@@ -70,7 +69,7 @@ public enum CStatistics implements ICDoc {
|
||||
|
||||
if (ed == null) { return; }
|
||||
|
||||
final ItemPoolView<PaperCard> deck = ItemPool.createFrom(ed.getDeckManager().getPool(), PaperCard.class);
|
||||
final ItemPool<PaperCard> deck = ItemPool.createFrom(ed.getDeckManager().getPool(), PaperCard.class);
|
||||
|
||||
int total = deck.countAll();
|
||||
|
||||
|
||||
@@ -66,7 +66,6 @@ import forge.gui.toolbox.itemmanager.views.ItemView;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.util.Aggregates;
|
||||
import forge.util.ItemPool;
|
||||
import forge.util.ItemPoolView;
|
||||
import forge.util.ReflectionUtil;
|
||||
|
||||
|
||||
@@ -383,7 +382,7 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel {
|
||||
*
|
||||
* @return ItemPoolView
|
||||
*/
|
||||
public ItemPoolView<T> getPool() {
|
||||
public ItemPool<T> getPool() {
|
||||
return this.pool;
|
||||
}
|
||||
|
||||
@@ -397,15 +396,6 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel {
|
||||
this.setPool(ItemPool.createFrom(items, this.genericType), false);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Sets the item pool.
|
||||
*
|
||||
* @param poolView
|
||||
*/
|
||||
public void setPool(final ItemPoolView<T> poolView) {
|
||||
this.setPool(poolView, false);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -414,17 +404,11 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel {
|
||||
* @param poolView
|
||||
* @param infinite
|
||||
*/
|
||||
public void setPool(final ItemPoolView<T> poolView, boolean infinite) {
|
||||
public void setPool(final ItemPool<T> poolView, boolean infinite) {
|
||||
this.setPoolImpl(ItemPool.createFrom(poolView, this.genericType), infinite);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Sets the item pool.
|
||||
*
|
||||
* @param pool0
|
||||
*/
|
||||
public void setPool(final ItemPool<T> pool0) {
|
||||
this.setPoolImpl(pool0, false);
|
||||
}
|
||||
@@ -708,7 +692,7 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel {
|
||||
*
|
||||
* @return ItemPoolView<T>
|
||||
*/
|
||||
public ItemPoolView<T> getFilteredItems() {
|
||||
public ItemPool<T> getFilteredItems() {
|
||||
return this.model.getItems();
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ import java.util.Map.Entry;
|
||||
|
||||
import forge.item.InventoryItem;
|
||||
import forge.util.ItemPool;
|
||||
import forge.util.ItemPoolView;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -107,7 +106,7 @@ public final class ItemManagerModel<T extends InventoryItem> {
|
||||
*
|
||||
* @return ItemPoolView<T>
|
||||
*/
|
||||
public ItemPoolView<T> getItems() {
|
||||
public ItemPool<T> getItems() {
|
||||
return this.data.getView();
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import forge.deck.Deck;
|
||||
import forge.gui.toolbox.itemmanager.ItemManager;
|
||||
import forge.gui.toolbox.itemmanager.SItemManagerUtil.StatTypes;
|
||||
import forge.util.BinaryUtil;
|
||||
import forge.util.ItemPoolView;
|
||||
import forge.util.ItemPool;
|
||||
|
||||
/**
|
||||
* TODO: Write javadoc for this type.
|
||||
@@ -121,7 +121,7 @@ public class DeckColorFilter extends StatTypeFilter<Deck> {
|
||||
|
||||
@Override
|
||||
public void afterFiltersApplied() {
|
||||
final ItemPoolView<? super Deck> items = itemManager.getFilteredItems();
|
||||
final ItemPool<? super Deck> items = itemManager.getFilteredItems();
|
||||
|
||||
buttonMap.get(StatTypes.DECK_WHITE).setText(String.valueOf(items.countAll(IS_WHITE, Deck.class)));
|
||||
buttonMap.get(StatTypes.DECK_BLUE).setText(String.valueOf(items.countAll(IS_BLUE, Deck.class)));
|
||||
|
||||
@@ -10,7 +10,7 @@ import forge.gui.toolbox.itemmanager.ItemManager;
|
||||
import forge.gui.toolbox.itemmanager.SItemManagerUtil;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.item.PaperCard;
|
||||
import forge.util.ItemPoolView;
|
||||
import forge.util.ItemPool;
|
||||
|
||||
public abstract class DeckStatTypeFilter extends StatTypeFilter<Deck> {
|
||||
public DeckStatTypeFilter(ItemManager<? super Deck> itemManager0) {
|
||||
@@ -24,7 +24,7 @@ public abstract class DeckStatTypeFilter extends StatTypeFilter<Deck> {
|
||||
|
||||
@Override
|
||||
public void afterFiltersApplied() {
|
||||
final ItemPoolView<? super Deck> items = itemManager.getFilteredItems();
|
||||
final ItemPool<? super Deck> items = itemManager.getFilteredItems();
|
||||
|
||||
for (Map.Entry<SItemManagerUtil.StatTypes, FLabel> btn : buttonMap.entrySet()) {
|
||||
if (btn.getKey().predicate != null) {
|
||||
|
||||
@@ -15,7 +15,7 @@ import forge.gui.toolbox.itemmanager.SItemManagerUtil.StatTypes;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.item.ItemPredicate;
|
||||
import forge.item.PaperCard;
|
||||
import forge.util.ItemPoolView;
|
||||
import forge.util.ItemPool;
|
||||
|
||||
public abstract class StatTypeFilter<T extends InventoryItem> extends ToggleButtonsFilter<T> {
|
||||
protected final Map<SItemManagerUtil.StatTypes, FLabel> buttonMap;
|
||||
@@ -118,7 +118,7 @@ public abstract class StatTypeFilter<T extends InventoryItem> extends ToggleButt
|
||||
|
||||
@Override
|
||||
public void afterFiltersApplied() {
|
||||
final ItemPoolView<? super T> items = itemManager.getFilteredItems();
|
||||
final ItemPool<? super T> items = itemManager.getFilteredItems();
|
||||
|
||||
FLabel btnPackOrDeck = buttonMap.get(StatTypes.PACK_OR_DECK);
|
||||
if (btnPackOrDeck != null) { //support special pack/deck case
|
||||
|
||||
@@ -34,7 +34,6 @@ import forge.card.CardRarity;
|
||||
import forge.card.CardRules;
|
||||
import forge.card.ColorSet;
|
||||
import forge.card.mana.ManaCost;
|
||||
import forge.deck.CardPool;
|
||||
import forge.deck.Deck;
|
||||
import forge.deck.DeckSection;
|
||||
import forge.game.GameFormat;
|
||||
@@ -491,7 +490,7 @@ public class ItemColumn extends TableColumn {
|
||||
private static final Pattern AE_FINDER = Pattern.compile("AE", Pattern.LITERAL);
|
||||
|
||||
private static String toType(final InventoryItem i) {
|
||||
return i instanceof PaperCard ? ((IPaperCard)i).getRules().getType().toString() : i.getItemType();
|
||||
return i instanceof IPaperCard ? ((IPaperCard)i).getRules().getType().toString() : i.getItemType();
|
||||
}
|
||||
|
||||
private static IPaperCard toCard(final InventoryItem i) {
|
||||
@@ -551,12 +550,7 @@ public class ItemColumn extends TableColumn {
|
||||
}
|
||||
private static int toDeckCount(final InventoryItem i, DeckSection section) {
|
||||
Deck deck = toDeck(i);
|
||||
if (deck == null) { return -1; }
|
||||
CardPool cards = deck.get(section);
|
||||
if (cards == null) { return -1; }
|
||||
int count = cards.countAll();
|
||||
if (count == 0) { return -1; }
|
||||
return count;
|
||||
return deck != null && deck.has(section) ? deck.get(section).countAll() : -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ import forge.Singletons;
|
||||
import forge.card.CardEdition;
|
||||
import forge.card.IUnOpenedProduct;
|
||||
import forge.card.UnOpenedProduct;
|
||||
import forge.deck.CardPool;
|
||||
import forge.deck.Deck;
|
||||
import forge.game.card.Card;
|
||||
import forge.gui.GuiChoose;
|
||||
@@ -48,7 +49,6 @@ import forge.properties.NewConstants;
|
||||
import forge.util.FileUtil;
|
||||
import forge.util.HttpUtil;
|
||||
import forge.util.ItemPool;
|
||||
import forge.util.ItemPoolView;
|
||||
import forge.util.storage.IStorage;
|
||||
|
||||
/**
|
||||
@@ -153,7 +153,7 @@ public final class BoosterDraft implements IBoosterDraft {
|
||||
}
|
||||
|
||||
private void setupCustomDraft(final CustomLimited draft) {
|
||||
final ItemPoolView<PaperCard> dPool = draft.getCardPool();
|
||||
final ItemPool<PaperCard> dPool = draft.getCardPool();
|
||||
if (dPool == null) {
|
||||
throw new RuntimeException("BoosterGenerator : deck not found");
|
||||
}
|
||||
@@ -203,13 +203,15 @@ public final class BoosterDraft implements IBoosterDraft {
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
@Override
|
||||
public ItemPoolView<PaperCard> nextChoice() {
|
||||
public CardPool nextChoice() {
|
||||
if (this.pack.get(this.getCurrentBoosterIndex()).size() == 0) {
|
||||
this.pack = this.get8BoosterPack();
|
||||
}
|
||||
|
||||
this.computerChoose();
|
||||
return ItemPool.createFrom(this.pack.get(this.getCurrentBoosterIndex()), PaperCard.class);
|
||||
CardPool result = new CardPool();
|
||||
result.addAllFlat(this.pack.get(this.getCurrentBoosterIndex()));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,7 +32,6 @@ import forge.item.PaperCard;
|
||||
import forge.item.SealedProduct;
|
||||
import forge.util.FileSection;
|
||||
import forge.util.ItemPool;
|
||||
import forge.util.ItemPoolView;
|
||||
import forge.util.TextUtil;
|
||||
import forge.util.storage.IStorage;
|
||||
|
||||
@@ -63,7 +62,7 @@ public class CustomLimited extends DeckBase {
|
||||
/** The Num packs. */
|
||||
private int numPacks = 3;
|
||||
|
||||
private transient ItemPoolView<PaperCard> cardPool;
|
||||
private transient ItemPool<PaperCard> cardPool;
|
||||
|
||||
/** The Land set code. */
|
||||
private String landSetCode = CardEdition.Predicates.getRandomSetWithAllBasicLands(Singletons.getMagicDb().getEditions()).getCode();
|
||||
@@ -153,7 +152,7 @@ public class CustomLimited extends DeckBase {
|
||||
*
|
||||
* @see forge.item.CardCollectionBase#getCardPool()
|
||||
*/
|
||||
public ItemPoolView<PaperCard> getCardPool() {
|
||||
public ItemPool<PaperCard> getCardPool() {
|
||||
return this.cardPool;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
package forge.limited;
|
||||
|
||||
import forge.card.CardEdition;
|
||||
import forge.deck.CardPool;
|
||||
import forge.deck.Deck;
|
||||
import forge.item.PaperCard;
|
||||
import forge.util.ItemPoolView;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -38,7 +38,7 @@ public interface IBoosterDraft {
|
||||
*
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
ItemPoolView<PaperCard> nextChoice();
|
||||
CardPool nextChoice();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
||||
@@ -33,7 +33,6 @@ import forge.deck.DeckSection;
|
||||
import forge.deck.generation.DeckGeneratorBase;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.IPaperCard;
|
||||
import forge.util.ItemPoolView;
|
||||
import forge.util.MyRandom;
|
||||
|
||||
/**
|
||||
@@ -97,7 +96,7 @@ public class LimitedDeckBuilder extends DeckGeneratorBase{
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemPoolView<PaperCard> getDeck(int size, boolean forAi) {
|
||||
public CardPool getDeck(int size, boolean forAi) {
|
||||
return buildDeck().getMain();
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,6 @@ import forge.quest.data.QuestPreferences.DifficultyPrefs;
|
||||
import forge.quest.data.QuestPreferences.QPref;
|
||||
import forge.util.Aggregates;
|
||||
import forge.util.ItemPool;
|
||||
import forge.util.ItemPoolView;
|
||||
import forge.util.MyRandom;
|
||||
|
||||
/**
|
||||
@@ -87,7 +86,7 @@ public final class QuestUtilCards {
|
||||
* @param usedFormat currently enforced game format, if any
|
||||
* @return the item pool view
|
||||
*/
|
||||
public static ItemPoolView<PaperCard> generateBasicLands(final int nBasic, final int nSnow, final GameFormatQuest usedFormat) {
|
||||
public static ItemPool<PaperCard> generateBasicLands(final int nBasic, final int nSnow, final GameFormatQuest usedFormat) {
|
||||
final ICardDatabase db = Singletons.getMagicDb().getCommonCards();
|
||||
final ItemPool<PaperCard> pool = new ItemPool<PaperCard>(PaperCard.class);
|
||||
|
||||
@@ -591,7 +590,7 @@ public final class QuestUtilCards {
|
||||
*
|
||||
* @return the shop list
|
||||
*/
|
||||
public ItemPoolView<InventoryItem> getShopList() {
|
||||
public ItemPool<InventoryItem> getShopList() {
|
||||
if (this.qa.getShopList().isEmpty()) {
|
||||
this.generateCardsInShop();
|
||||
}
|
||||
@@ -603,7 +602,7 @@ public final class QuestUtilCards {
|
||||
*
|
||||
* @return the new cards
|
||||
*/
|
||||
public ItemPoolView<InventoryItem> getNewCards() {
|
||||
public ItemPool<InventoryItem> getNewCards() {
|
||||
return this.qa.getNewCardList();
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ import forge.quest.QuestUtilCards;
|
||||
import forge.quest.bazaar.QuestItemType;
|
||||
import forge.quest.data.QuestPreferences.QPref;
|
||||
import forge.util.ItemPool;
|
||||
import forge.util.ItemPoolView;
|
||||
|
||||
/** */
|
||||
public class QuestAssets {
|
||||
@@ -171,7 +170,7 @@ public class QuestAssets {
|
||||
if (useFormat != null && !useFormat.hasSnowLands()) {
|
||||
snowLands = 0;
|
||||
}
|
||||
final ItemPoolView<PaperCard> lands = QuestUtilCards.generateBasicLands(
|
||||
final ItemPool<PaperCard> lands = QuestUtilCards.generateBasicLands(
|
||||
prefs.getPrefInt(QPref.STARTING_BASIC_LANDS), snowLands, useFormat);
|
||||
this.getCardPool().addAll(lands);
|
||||
}
|
||||
|
||||
@@ -2,10 +2,9 @@ package forge;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import forge.item.PaperCard;
|
||||
import forge.deck.CardPool;
|
||||
import forge.limited.BoosterDraft;
|
||||
import forge.limited.LimitedPoolType;
|
||||
import forge.util.ItemPoolView;
|
||||
|
||||
/**
|
||||
* Unit test for simple App.
|
||||
@@ -23,7 +22,7 @@ public class BoosterDraft1Test {
|
||||
public void boosterDraft1Test1() throws Exception {
|
||||
final BoosterDraft draft = new BoosterDraft(LimitedPoolType.Full);
|
||||
while (draft.hasNextChoice()) {
|
||||
final ItemPoolView<PaperCard> list = draft.nextChoice();
|
||||
final CardPool list = draft.nextChoice();
|
||||
System.out.println(list.countAll());
|
||||
draft.setChoice(list.toFlatList().get(0));
|
||||
}
|
||||
|
||||
@@ -5,13 +5,12 @@ import java.util.List;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import forge.card.BoosterGenerator;
|
||||
import forge.deck.CardPool;
|
||||
import forge.deck.Deck;
|
||||
import forge.game.card.Card;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.SealedProduct;
|
||||
import forge.limited.IBoosterDraft;
|
||||
import forge.util.ItemPool;
|
||||
import forge.util.ItemPoolView;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -48,10 +47,12 @@ public class BoosterDraftTest implements IBoosterDraft {
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
@Override
|
||||
public ItemPoolView<PaperCard> nextChoice() {
|
||||
public CardPool nextChoice() {
|
||||
this.n--;
|
||||
SealedProduct.Template booster = Singletons.getMagicDb().getBoosters().get("M11");
|
||||
return ItemPool.createFrom(BoosterGenerator.getBoosterPack(booster), PaperCard.class);
|
||||
CardPool result = new CardPool();
|
||||
result.addAllFlat(BoosterGenerator.getBoosterPack(booster));
|
||||
return result;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
||||
@@ -7,7 +7,7 @@ import forge.Singletons;
|
||||
import forge.card.CardDb;
|
||||
import forge.deck.generation.DeckGenerator2Color;
|
||||
import forge.item.PaperCard;
|
||||
import forge.util.ItemPoolView;
|
||||
import forge.util.ItemPool;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA. User: dhudson
|
||||
@@ -22,7 +22,7 @@ public class Generate2ColorDeckTest {
|
||||
public void generate2ColorDeckTest1() {
|
||||
CardDb cardDb = Singletons.getMagicDb().getCommonCards();
|
||||
final DeckGenerator2Color gen = new DeckGenerator2Color(cardDb, "white", "blue");
|
||||
final ItemPoolView<PaperCard> cardList = gen.getDeck(60, false);
|
||||
final ItemPool<PaperCard> cardList = gen.getDeck(60, false);
|
||||
Assert.assertNotNull(cardList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,8 @@ import org.testng.annotations.Test;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.card.CardDb;
|
||||
import forge.deck.CardPool;
|
||||
import forge.deck.generation.DeckGenerator3Color;
|
||||
import forge.item.PaperCard;
|
||||
import forge.util.ItemPoolView;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA. User: dhudson
|
||||
@@ -22,7 +21,7 @@ public class Generate3ColorDeckTest {
|
||||
public void generate3ColorDeckTest1() {
|
||||
CardDb cardDb = Singletons.getMagicDb().getCommonCards();
|
||||
final DeckGenerator3Color gen = new DeckGenerator3Color(cardDb, "white", "blue", "black");
|
||||
final ItemPoolView<PaperCard> cardList = gen.getDeck(60, false);
|
||||
final CardPool cardList = gen.getDeck(60, false);
|
||||
Assert.assertNotNull(cardList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,8 @@ import org.testng.annotations.Test;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.card.CardDb;
|
||||
import forge.deck.CardPool;
|
||||
import forge.deck.generation.DeckGenerator5Color;
|
||||
import forge.item.PaperCard;
|
||||
import forge.util.ItemPoolView;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA. User: dhudson
|
||||
@@ -22,7 +21,7 @@ public class Generate5ColorDeckTest {
|
||||
public void generate5ColorDeckTest1() {
|
||||
CardDb cardDb = Singletons.getMagicDb().getCommonCards();
|
||||
final DeckGenerator5Color gen = new DeckGenerator5Color(cardDb);
|
||||
final ItemPoolView<PaperCard> cardList = gen.getDeck(60, false);
|
||||
final CardPool cardList = gen.getDeck(60, false);
|
||||
Assert.assertNotNull(cardList);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user