CardPool renamed to ItemPool, moved to forge.item, dependencies updated

This commit is contained in:
Maxmtg
2011-09-14 05:52:17 +00:00
parent d3a51720a8
commit 49b21e09ad
58 changed files with 243 additions and 228 deletions

10
.gitattributes vendored
View File

@@ -9658,20 +9658,15 @@ src/main/java/forge/ZCTrigger.java svneol=native#text/plain
src/main/java/forge/card/CardBlock.java -text
src/main/java/forge/card/CardColor.java -text
src/main/java/forge/card/CardCoreType.java -text
src/main/java/forge/card/CardDb.java -text
src/main/java/forge/card/CardInSet.java -text
src/main/java/forge/card/CardManaCost.java -text
src/main/java/forge/card/CardManaCostShard.java -text
src/main/java/forge/card/CardPool.java -text
src/main/java/forge/card/CardPoolView.java -text
src/main/java/forge/card/CardPrinted.java -text
src/main/java/forge/card/CardRarity.java -text
src/main/java/forge/card/CardRules.java -text
src/main/java/forge/card/CardRulesReader.java svneol=native#text/plain
src/main/java/forge/card/CardSet.java -text
src/main/java/forge/card/CardSuperType.java -text
src/main/java/forge/card/CardType.java -text
src/main/java/forge/card/InventoryItem.java -text
src/main/java/forge/card/MtgDataParser.java -text
src/main/java/forge/card/abilityFactory/AbilityFactory.java svneol=native#text/plain
src/main/java/forge/card/abilityFactory/AbilityFactory_AlterLife.java svneol=native#text/plain
@@ -9876,6 +9871,11 @@ src/main/java/forge/gui/input/Input_PayManaCostUtil.java svneol=native#text/plai
src/main/java/forge/gui/input/Input_PayManaCost_Ability.java svneol=native#text/plain
src/main/java/forge/gui/input/package-info.java svneol=native#text/plain
src/main/java/forge/gui/package-info.java svneol=native#text/plain
src/main/java/forge/item/CardDb.java -text
src/main/java/forge/item/CardPrinted.java -text
src/main/java/forge/item/InventoryItem.java -text
src/main/java/forge/item/ItemPool.java -text
src/main/java/forge/item/ItemPoolView.java -text
src/main/java/forge/model/BuildInfo.java -text
src/main/java/forge/model/FGameState.java -text
src/main/java/forge/model/FModel.java svneol=native#text/plain

View File

@@ -1,10 +1,10 @@
package forge;
import forge.card.CardDb;
import forge.card.CardPoolView;
import forge.card.CardPrinted;
import forge.deck.Deck;
import forge.deck.DeckManager;
import forge.item.CardDb;
import forge.item.CardPrinted;
import forge.item.ItemPoolView;
import java.util.ArrayList;
import java.util.Arrays;
@@ -85,7 +85,7 @@ public class BoosterGenerator {
throw new RuntimeException("BoosterGenerator : deck not found - " + deckFile);
}
CardPoolView<CardPrinted> tList = dPool.getMain();
ItemPoolView<CardPrinted> tList = dPool.getMain();
for (Entry<CardPrinted, Integer> e : tList) {
if (ignoreRarity) { commons.add(e.getKey()); }
else { addToRarity(e.getKey()); }

View File

@@ -13,7 +13,6 @@ import java.util.TreeMap;
import com.esotericsoftware.minlog.Log;
import forge.card.CardDb;
import forge.card.cardFactory.CardFactoryUtil;
import forge.card.cost.Cost;
import forge.card.mana.ManaCost;
@@ -23,6 +22,7 @@ import forge.card.spellability.SpellAbility;
import forge.card.spellability.Spell_Permanent;
import forge.card.staticAbility.StaticAbility;
import forge.card.trigger.Trigger;
import forge.item.CardDb;
/**
* <p>Card class.</p>

View File

@@ -1,9 +1,9 @@
package forge;
import forge.card.CardPrinted;
import forge.card.mana.ManaCost;
import forge.card.spellability.SpellAbility;
import forge.card.spellability.SpellAbilityList;
import forge.item.CardPrinted;
import forge.properties.ForgeProps;
import forge.properties.NewConstants;

View File

@@ -29,9 +29,9 @@ import javax.swing.event.MouseInputAdapter;
import javax.swing.table.DefaultTableModel;
import forge.card.CardRules;
import forge.card.CardPoolView;
import forge.card.CardPrinted;
import forge.card.CardType;
import forge.item.CardPrinted;
import forge.item.ItemPoolView;
import net.miginfocom.swing.MigLayout;
@@ -98,7 +98,7 @@ public class GUI_DeckAnalysis extends javax.swing.JDialog {
// private ButtonGroup buttonGroup1;
public CardList filterCardList;
public CardPoolView<CardPrinted> deck;
public ItemPoolView<CardPrinted> deck;
/**
* <p>
@@ -110,7 +110,7 @@ public class GUI_DeckAnalysis extends javax.swing.JDialog {
* @param tb
* a {@link forge.gui.deckeditor.TableModel} object.
*/
public GUI_DeckAnalysis(JFrame g, CardPoolView<CardPrinted> deckView) {
public GUI_DeckAnalysis(JFrame g, ItemPoolView<CardPrinted> deckView) {
super(g);
deck = deckView;

View File

@@ -1,7 +1,6 @@
package forge;
import forge.card.CardPrinted;
import forge.card.abilityFactory.AbilityFactory;
import forge.card.abilityFactory.AbilityFactory_Attach;
import forge.card.cardFactory.CardFactoryInterface;
@@ -27,6 +26,7 @@ import forge.gui.GuiUtils;
import forge.gui.input.Input_Mulligan;
import forge.gui.input.Input_PayManaCost;
import forge.gui.input.Input_PayManaCost_Ability;
import forge.item.CardPrinted;
import forge.properties.ForgeProps;
import forge.properties.NewConstants.LANG.GameAction.GAMEACTION_TEXT;

View File

@@ -78,7 +78,6 @@ import com.google.code.jyield.YieldUtils;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.XStreamException;
import forge.card.CardPrinted;
import forge.card.cardFactory.CardFactoryUtil;
import forge.error.ErrorViewer;
import forge.gui.ForgeAction;
@@ -89,6 +88,7 @@ import forge.gui.input.Input_Attack;
import forge.gui.input.Input_Block;
import forge.gui.input.Input_PayManaCost;
import forge.gui.input.Input_PayManaCost_Ability;
import forge.item.CardPrinted;
import forge.properties.ForgePreferences;
import forge.properties.ForgeProps;
import forge.properties.NewConstants;

View File

@@ -2,10 +2,10 @@ package forge;
import com.esotericsoftware.minlog.Log;
import forge.card.CardDb;
import forge.card.CardPrinted;
import forge.card.CardSet;
import forge.error.ErrorViewer;
import forge.item.CardDb;
import forge.item.CardPrinted;
import forge.properties.ForgeProps;
import forge.properties.NewConstants;

View File

@@ -1,6 +1,5 @@
package forge;
import forge.card.CardPrinted;
import forge.error.ErrorViewer;
import forge.game.GameEndReason;
import forge.game.GameFormat;
@@ -10,6 +9,7 @@ import forge.game.GameSummary;
import forge.game.PlayerIndex;
import forge.gui.CardListViewer;
import forge.gui.ListChooser;
import forge.item.CardPrinted;
import forge.properties.ForgeProps;
import forge.properties.NewConstants;
import forge.properties.NewConstants.LANG.Gui_WinLose.WINLOSE_TEXT;

View File

@@ -7,7 +7,7 @@ import com.google.common.collect.ComputationException;
import com.google.common.collect.MapMaker;
import com.mortennobel.imagescaling.ResampleOp;
import forge.card.InventoryItem;
import forge.item.InventoryItem;
import forge.properties.ForgeProps;
import forge.properties.NewConstants;

View File

@@ -3,7 +3,7 @@ package forge;
import java.util.ArrayList;
import java.util.List;
import forge.card.CardPrinted;
import forge.item.CardPrinted;
/**
* <p>Quest_Assignment class.</p>

View File

@@ -6,10 +6,10 @@ package forge;
//import java.io.FileReader;
import forge.card.CardRules;
import forge.card.CardDb;
import forge.card.CardPool;
import forge.card.CardPoolView;
import forge.card.CardPrinted;
import forge.item.CardDb;
import forge.item.CardPrinted;
import forge.item.ItemPool;
import forge.item.ItemPoolView;
import forge.properties.NewConstants;
import java.util.ArrayList;
@@ -54,8 +54,8 @@ public class ReadBoosterPack implements NewConstants {
*
* @return a {@link forge.CardList} object.
*/
public CardPoolView<CardPrinted> getBoosterPack5() {
CardPool<CardPrinted> list = new CardPool<CardPrinted>();
public ItemPoolView<CardPrinted> getBoosterPack5() {
ItemPool<CardPrinted> list = new ItemPool<CardPrinted>();
for (int i = 0; i < 5; i++) { list.addAll(getBoosterPack()); }
addBasicLands(list, 20);
@@ -67,7 +67,7 @@ public class ReadBoosterPack implements NewConstants {
return list;
}//getBoosterPack5()
public static final void addBasicLands(final CardPool<CardPrinted> pool, final int count) {
public static final void addBasicLands(final ItemPool<CardPrinted> pool, final int count) {
for (int i = 0; i < count; i++) {
pool.add(CardDb.instance().getCard("Forest", "M10"));
pool.add(CardDb.instance().getCard("Island", "M10"));
@@ -76,7 +76,7 @@ public class ReadBoosterPack implements NewConstants {
pool.add(CardDb.instance().getCard("Swamp", "M10"));
}
}
public static final void addBasicSnowLands(final CardPool<CardPrinted> pool, final int count) {
public static final void addBasicSnowLands(final ItemPool<CardPrinted> pool, final int count) {
for (int i = 0; i < count; i++) {
pool.add(CardDb.instance().getCard("Snow-Covered Forest", "ICE"));
pool.add(CardDb.instance().getCard("Snow-Covered Island", "ICE"));
@@ -91,8 +91,8 @@ public class ReadBoosterPack implements NewConstants {
*
* @return a {@link forge.CardList} object.
*/
public CardPoolView<CardPrinted> getBoosterPack() {
CardPool<CardPrinted> pack = new CardPool<CardPrinted>();
public ItemPoolView<CardPrinted> getBoosterPack() {
ItemPool<CardPrinted> pack = new ItemPool<CardPrinted>();
pack.add(getRandomCard(rares));
@@ -125,8 +125,8 @@ public class ReadBoosterPack implements NewConstants {
* @param questLevel a int.
* @return a {@link forge.CardList} object.
*/
public CardPoolView<CardPrinted> getShopCards(int totalPacks) {
CardPool<CardPrinted> list = new CardPool<CardPrinted>();
public ItemPoolView<CardPrinted> getShopCards(int totalPacks) {
ItemPool<CardPrinted> list = new ItemPool<CardPrinted>();
// Number of Packs granted

View File

@@ -2,11 +2,11 @@ package forge;
import forge.card.CardRules;
import forge.card.CardDb;
import forge.card.CardPool;
import forge.card.CardPoolView;
import forge.card.CardPrinted;
import forge.error.ErrorViewer;
import forge.item.CardDb;
import forge.item.CardPrinted;
import forge.item.ItemPool;
import forge.item.ItemPoolView;
import forge.properties.ForgeProps;
import forge.properties.NewConstants;
@@ -45,8 +45,8 @@ public class ReadDraftBoosterPack implements NewConstants {
setup();
}
public CardPoolView<CardPrinted> getBoosterPack5() {
CardPool<CardPrinted> list = new CardPool<CardPrinted>();
public ItemPoolView<CardPrinted> getBoosterPack5() {
ItemPool<CardPrinted> list = new ItemPool<CardPrinted>();
for (int i = 0; i < 5; i++) { list.addAll(getBoosterPack()); }
addBasicLands(list, 20);
@@ -59,7 +59,7 @@ public class ReadDraftBoosterPack implements NewConstants {
return list;
} //getBoosterPack5()
public static final void addBasicLands(final CardPool<CardPrinted> pool, final int count) {
public static final void addBasicLands(final ItemPool<CardPrinted> pool, final int count) {
CardDb db = CardDb.instance();
pool.add(db.getCard("Forest", "M10"), count);
pool.add(db.getCard("Island", "M10"), count);
@@ -68,7 +68,7 @@ public class ReadDraftBoosterPack implements NewConstants {
pool.add(db.getCard("Swamp", "M10"), count);
}
public static final void addBasicSnowLands(final CardPool<CardPrinted> pool, final int count) {
public static final void addBasicSnowLands(final ItemPool<CardPrinted> pool, final int count) {
CardDb db = CardDb.instance();
pool.add(db.getCard("Snow-Covered Forest", "ICE"), count);
pool.add(db.getCard("Snow-Covered Island", "ICE"), count);
@@ -81,8 +81,8 @@ public class ReadDraftBoosterPack implements NewConstants {
*
* @return a {@link forge.CardList} object.
*/
public final CardPoolView<CardPrinted> getBoosterPack() {
CardPool<CardPrinted> pack = new CardPool<CardPrinted>();
public final ItemPoolView<CardPrinted> getBoosterPack() {
ItemPool<CardPrinted> pack = new ItemPool<CardPrinted>();
pack.add(getRandomCard(rareList));

View File

@@ -3,6 +3,8 @@ package forge.card;
import java.util.ArrayList;
import java.util.List;
import forge.item.CardPrinted;
import net.slightlymagic.maxmtg.Predicate;
/**

View File

@@ -25,8 +25,6 @@ import forge.Counters;
import forge.FileUtil;
import forge.Player;
import forge.PlayerZone;
import forge.card.CardDb;
import forge.card.CardPrinted;
import forge.card.abilityFactory.AbilityFactory;
import forge.card.cost.Cost;
import forge.card.spellability.*;
@@ -36,6 +34,8 @@ import forge.gui.GuiUtils;
import forge.gui.ListChooser;
import forge.gui.input.Input;
import forge.gui.input.Input_PayManaCost;
import forge.item.CardDb;
import forge.item.CardPrinted;
import forge.properties.ForgeProps;
import forge.properties.NewConstants;

View File

@@ -3,8 +3,6 @@ package forge.card.cardFactory;
import com.esotericsoftware.minlog.Log;
import forge.*;
import forge.card.CardDb;
import forge.card.CardPrinted;
import forge.card.abilityFactory.AbilityFactory;
import forge.card.cost.Cost;
import forge.card.spellability.*;
@@ -13,6 +11,8 @@ import forge.card.trigger.TriggerHandler;
import forge.gui.GuiUtils;
import forge.gui.input.Input;
import forge.gui.input.Input_PayManaCost;
import forge.item.CardDb;
import forge.item.CardPrinted;
import javax.swing.*;

View File

@@ -9,9 +9,9 @@ import java.util.List;
import forge.AllZone;
import forge.Card;
import forge.CardReader;
import forge.card.CardDb;
import forge.card.CardRules;
import forge.error.ErrorViewer;
import forge.item.CardDb;
import forge.properties.ForgeProps;
/**

View File

@@ -1,11 +1,11 @@
package forge.deck;
import forge.PlayerType;
import forge.card.CardDb;
import forge.card.CardPool;
import forge.card.CardPoolView;
import forge.card.CardPrinted;
import forge.game.GameType;
import forge.item.CardDb;
import forge.item.CardPrinted;
import forge.item.ItemPool;
import forge.item.ItemPoolView;
import java.io.Serializable;
@@ -32,8 +32,8 @@ public final class Deck implements Comparable<Deck>, Serializable {
private String comment = null;
private PlayerType playerType = null;
private CardPool<CardPrinted> main;
private CardPool<CardPrinted> sideboard;
private ItemPool<CardPrinted> main;
private ItemPool<CardPrinted> sideboard;
//gameType is from Constant.GameType, like GameType.Regular
@@ -41,8 +41,8 @@ public final class Deck implements Comparable<Deck>, Serializable {
* <p>Constructor for Deck.</p>
*/
public Deck() {
main = new CardPool<CardPrinted>();
sideboard = new CardPool<CardPrinted>();
main = new ItemPool<CardPrinted>();
sideboard = new ItemPool<CardPrinted>();
}
/**
@@ -60,7 +60,7 @@ public final class Deck implements Comparable<Deck>, Serializable {
*
* @return a {@link java.util.List} object.
*/
public CardPoolView<CardPrinted> getMain() {
public ItemPoolView<CardPrinted> getMain() {
return main.getView();
}
@@ -69,7 +69,7 @@ public final class Deck implements Comparable<Deck>, Serializable {
*
* @return a {@link java.util.List} object.
*/
public CardPoolView<CardPrinted> getSideboard() {
public ItemPoolView<CardPrinted> getSideboard() {
return sideboard.getView();
}
@@ -140,7 +140,7 @@ public final class Deck implements Comparable<Deck>, Serializable {
*/
public void addMain(final String cardName) { addMain(CardDb.instance().getCard(cardName)); }
public void addMain(final CardPrinted card) { main.add(card); }
public void addMain(final CardPoolView<CardPrinted> list) { main.addAll(list); }
public void addMain(final ItemPoolView<CardPrinted> list) { main.addAll(list); }
public void removeMain(final CardPrinted card) { main.remove(card); }
public void removeMain(final CardPrinted card, final int amount) { main.remove(card, amount); }
public int countMain() { return main.countAll(); }
@@ -153,7 +153,7 @@ public final class Deck implements Comparable<Deck>, Serializable {
public final void addSideboard(final String cardName) { addSideboard(CardDb.instance().getCard(cardName)); }
public final void addSideboard(final CardPrinted card) { sideboard.add(card); }
public final void addSideboard(final CardPrinted card, final int amount) { sideboard.add(card, amount); }
public final void addSideboard(final CardPoolView<CardPrinted> cards) { sideboard.addAll(cards); }
public final void addSideboard(final ItemPoolView<CardPrinted> cards) { sideboard.addAll(cards); }
/**
* <p>countSideboard.</p>

View File

@@ -2,11 +2,11 @@ package forge.deck;
import forge.PlayerType;
import forge.card.CardPoolView;
import forge.card.CardPrinted;
import forge.error.ErrorViewer;
import forge.game.GameType;
import forge.gui.deckeditor.TableSorter;
import forge.item.CardPrinted;
import forge.item.ItemPoolView;
import forge.properties.ForgeProps;
import forge.properties.NewConstants;
@@ -502,7 +502,7 @@ public class DeckManager {
writeCardPool(d.getSideboard(), out);
}
private static void writeCardPool(final CardPoolView<CardPrinted> pool, final BufferedWriter out) throws IOException
private static void writeCardPool(final ItemPoolView<CardPrinted> pool, final BufferedWriter out) throws IOException
{
List<Entry<CardPrinted, Integer>> main2sort = pool.getOrderedList();
Collections.sort(main2sort, TableSorter.byNameThenSet);

View File

@@ -1,6 +1,6 @@
package forge.deck;
import forge.card.CardDb;
import forge.item.CardDb;
/**
* <p>DownloadDeck class.</p>

View File

@@ -5,8 +5,8 @@ import java.util.List;
import net.slightlymagic.maxmtg.Predicate;
import forge.card.CardPrinted;
import forge.card.CardRules;
import forge.item.CardPrinted;
/**
* TODO: Write javadoc for this type.

View File

@@ -1,8 +1,9 @@
package forge.game.limited;
import forge.card.CardPoolView;
import forge.card.CardPrinted;
import forge.deck.Deck;
import forge.item.CardPrinted;
import forge.item.ItemPoolView;
import java.util.Map;
import java.util.TreeMap;
@@ -18,7 +19,7 @@ public interface BoosterDraft {
*
* @return a {@link forge.CardList} object.
*/
CardPoolView<CardPrinted> nextChoice();
ItemPoolView<CardPrinted> nextChoice();
/**
* <p>setChoice.</p>

View File

@@ -8,12 +8,12 @@ import forge.Constant;
import forge.FileUtil;
import forge.SetUtils;
import forge.card.CardBlock;
import forge.card.CardPool;
import forge.card.CardPoolView;
import forge.card.CardPrinted;
import forge.card.CardSet;
import forge.deck.Deck;
import forge.gui.GuiUtils;
import forge.item.CardPrinted;
import forge.item.ItemPool;
import forge.item.ItemPoolView;
import java.io.File;
import java.util.ArrayList;
@@ -237,13 +237,13 @@ public class BoosterDraft_1 implements BoosterDraft {
*
* @return a {@link forge.CardList} object.
*/
public final CardPoolView<CardPrinted> nextChoice() {
public final ItemPoolView<CardPrinted> nextChoice() {
if (pack.get(getCurrentBoosterIndex()).size() == 0) {
pack = get8BoosterPack();
}
computerChoose();
return CardPool.createFrom(pack.get(getCurrentBoosterIndex()), CardPrinted.class);
return ItemPool.createFrom(pack.get(getCurrentBoosterIndex()), CardPrinted.class);
}
/**

View File

@@ -11,14 +11,14 @@ import forge.FileUtil;
import forge.MyRandom;
import forge.SetUtils;
import forge.card.CardBlock;
import forge.card.CardDb;
import forge.card.CardPool;
import forge.card.CardPrinted;
import forge.card.CardSet;
import forge.card.spellability.Ability_Mana;
import forge.deck.Deck;
import forge.game.GameType;
import forge.gui.GuiUtils;
import forge.item.CardDb;
import forge.item.CardPrinted;
import forge.item.ItemPool;
import javax.swing.*;
import java.io.File;
@@ -181,8 +181,8 @@ public class SealedDeck {
*
* @return a {@link forge.CardList} object.
*/
public CardPool<CardPrinted> getCardpool() {
CardPool<CardPrinted> pool = new CardPool<CardPrinted>();
public ItemPool<CardPrinted> getCardpool() {
ItemPool<CardPrinted> pool = new ItemPool<CardPrinted>();
for (int i = 0; i < packs.size(); i++)
pool.addAllCards(packs.get(i).getBoosterPack());

View File

@@ -14,9 +14,9 @@ import javax.swing.event.ListSelectionListener;
import forge.AllZone;
import forge.Card;
import forge.CardUtil;
import forge.card.CardPrinted;
import forge.gui.game.CardDetailPanel;
import forge.gui.game.CardPicturePanel;
import forge.item.CardPrinted;
import java.awt.event.ActionEvent;

View File

@@ -1,7 +1,8 @@
package forge.gui.deckeditor;
import javax.swing.JPanel;
import forge.card.InventoryItem;
import forge.item.InventoryItem;
/**
* Base class for any cardView panel

View File

@@ -18,9 +18,9 @@ import forge.Card;
import forge.GuiDisplayUtil;
import forge.ImagePreviewPanel;
import forge.Singletons;
import forge.card.CardPrinted;
import forge.card.InventoryItem;
import forge.gui.game.CardDetailPanel;
import forge.item.CardPrinted;
import forge.item.InventoryItem;
import forge.properties.ForgeProps;
import forge.properties.NewConstants;
//import forge.view.swing.OldGuiNewGame;

View File

@@ -3,10 +3,10 @@ package forge.gui.deckeditor;
import net.miginfocom.swing.MigLayout;
import forge.Card;
import forge.card.CardPrinted;
import forge.card.InventoryItem;
import forge.gui.game.CardDetailPanel;
import forge.gui.game.CardPicturePanel;
import forge.item.CardPrinted;
import forge.item.InventoryItem;
/**
* This panel is to be placed in the right part of a deck editor

View File

@@ -1,10 +1,10 @@
package forge.gui.deckeditor;
import forge.card.CardPoolView;
import forge.card.CardPrinted;
import forge.card.InventoryItem;
import forge.deck.Deck;
import forge.game.GameType;
import forge.item.CardPrinted;
import forge.item.InventoryItem;
import forge.item.ItemPoolView;
/**
* Created by IntelliJ IDEA.
@@ -15,16 +15,16 @@ import forge.game.GameType;
* @version $Id$
*/
public interface DeckDisplay {
void setDeck(CardPoolView<CardPrinted> top, CardPoolView<CardPrinted> bottom, GameType gameType);
void setDeck(ItemPoolView<CardPrinted> top, ItemPoolView<CardPrinted> bottom, GameType gameType);
//top shows available card pool
//if constructed, top shows all cards
//if sealed, top shows 5 booster packs
//if draft, top shows cards that were chosen
CardPoolView<InventoryItem> getTop();
ItemPoolView<InventoryItem> getTop();
//bottom shows cards that the user has chosen for his library
CardPoolView<InventoryItem> getBottom();
ItemPoolView<InventoryItem> getBottom();
void setTitle(String message);

View File

@@ -21,14 +21,14 @@ import net.slightlymagic.maxmtg.Predicate;
import forge.AllZone;
import forge.Command;
import forge.Singletons;
import forge.card.CardDb;
import forge.card.CardPool;
import forge.card.CardPoolView;
import forge.card.CardPrinted;
import forge.card.InventoryItem;
import forge.error.ErrorViewer;
import forge.game.GameType;
//import forge.view.swing.OldGuiNewGame;
import forge.item.CardDb;
import forge.item.CardPrinted;
import forge.item.InventoryItem;
import forge.item.ItemPool;
import forge.item.ItemPoolView;
/**
* <p>
@@ -221,11 +221,11 @@ public final class DeckEditor extends DeckEditorBase {
}
@Override
public void setDeck(CardPoolView<CardPrinted> topParam, CardPoolView<CardPrinted> bottomParam, GameType gt)
public void setDeck(ItemPoolView<CardPrinted> topParam, ItemPoolView<CardPrinted> bottomParam, GameType gt)
{
boolean keepRecievedCards = gt.isLimited() || topParam != null;
// if constructed, can add the all cards above
CardPoolView<CardPrinted> top = keepRecievedCards ? topParam : CardPool.createFrom(CardDb.instance().getAllCards(), CardPrinted.class);
ItemPoolView<CardPrinted> top = keepRecievedCards ? topParam : ItemPool.createFrom(CardDb.instance().getAllCards(), CardPrinted.class);
super.setDeck(top, bottomParam, gt);
}

View File

@@ -12,12 +12,12 @@ import javax.swing.event.DocumentListener;
import net.slightlymagic.maxmtg.Predicate;
import forge.GUI_DeckAnalysis;
import forge.card.CardPool;
import forge.card.CardPrinted;
import forge.card.CardPoolView;
import forge.card.InventoryItem;
import forge.deck.Deck;
import forge.game.GameType;
import forge.item.CardPrinted;
import forge.item.InventoryItem;
import forge.item.ItemPool;
import forge.item.ItemPoolView;
public abstract class DeckEditorBase extends JFrame implements DeckDisplay {
private static final long serialVersionUID = -401223933343539977L;
@@ -42,16 +42,16 @@ public abstract class DeckEditorBase extends JFrame implements DeckDisplay {
// if sealed, top shows N booster packs
// if draft, top shows cards that were chosen
public final TableWithCards getTopTableModel() { return top; }
public final CardPoolView<InventoryItem> getTop() { return top.getCards(); }
public final ItemPoolView<InventoryItem> getTop() { return top.getCards(); }
// bottom shows player's choice - be it deck or draft
public final CardPoolView<InventoryItem> getBottom() { return bottom.getCards(); }
public final ItemPoolView<InventoryItem> getBottom() { return bottom.getCards(); }
// THIS IS HERE FOR OVERLOADING!!!1
// or may be return abstract getFilter from derived class + this filter ... virtual protected member, but later
protected abstract Predicate<InventoryItem> buildFilter();
void analysisButton_actionPerformed(ActionEvent e) {
CardPoolView<CardPrinted> deck = CardPool.createFrom(bottom.getCards(), CardPrinted.class);
ItemPoolView<CardPrinted> deck = ItemPool.createFrom(bottom.getCards(), CardPrinted.class);
if (deck.isEmpty()) {
JOptionPane.showMessageDialog(null, "Cards in deck not found.", "Analysis Deck",
JOptionPane.INFORMATION_MESSAGE);
@@ -68,7 +68,7 @@ public abstract class DeckEditorBase extends JFrame implements DeckDisplay {
gameType = gametype;
}
public void setDeck(CardPoolView<CardPrinted> topParam, CardPoolView<CardPrinted> bottomParam, GameType gt) {
public void setDeck(ItemPoolView<CardPrinted> topParam, ItemPoolView<CardPrinted> bottomParam, GameType gt) {
gameType = gt;
top.setDeck(topParam);
bottom.setDeck(bottomParam);
@@ -93,11 +93,11 @@ public abstract class DeckEditorBase extends JFrame implements DeckDisplay {
public Deck getDeck() {
Deck deck = new Deck(gameType);
deck.addMain(CardPool.createFrom(getBottom(), CardPrinted.class));
deck.addMain(ItemPool.createFrom(getBottom(), CardPrinted.class));
//if sealed or draft, move "top" to sideboard
if (gameType.isLimited() && gameType != GameType.Quest) {
deck.addSideboard(CardPool.createFrom(getTop(), CardPrinted.class));
deck.addSideboard(ItemPool.createFrom(getTop(), CardPrinted.class));
}
return deck;
}//getDeck()

View File

@@ -4,17 +4,17 @@ import forge.AllZone;
import forge.Constant;
import forge.FileUtil;
import forge.HttpUtil;
import forge.card.CardDb;
import forge.card.CardPool;
import forge.card.CardPoolView;
import forge.card.CardPrinted;
import forge.card.InventoryItem;
import forge.deck.Deck;
import forge.deck.DeckManager;
import forge.error.ErrorViewer;
import forge.game.GameType;
import forge.game.limited.BoosterDraft;
import forge.gui.GuiUtils;
import forge.item.CardDb;
import forge.item.CardPrinted;
import forge.item.InventoryItem;
import forge.item.ItemPool;
import forge.item.ItemPoolView;
import forge.properties.ForgeProps;
import forge.properties.NewConstants;
import forge.view.swing.OldGuiNewGame;
@@ -228,7 +228,7 @@ public class DeckEditorDraft extends DeckEditorBase implements NewConstants, New
*
* @param list a {@link forge.CardList} object.
*/
private void showChoices(CardPoolView<CardPrinted> list) {
private void showChoices(ItemPoolView<CardPrinted> list) {
top.setDeck(list);
cardView.showCard(null);
top.fixSelection(0);
@@ -244,7 +244,7 @@ public class DeckEditorDraft extends DeckEditorBase implements NewConstants, New
Constant.Runtime.HumanDeck[0] = deck;
//add sideboard to deck
CardPoolView<CardPrinted> list = CardPool.createFrom(bottom.getCards(), CardPrinted.class);
ItemPoolView<CardPrinted> list = ItemPool.createFrom(bottom.getCards(), CardPrinted.class);
deck.addSideboard(list);
String landSet = BoosterDraft.LandSetCode[0];

View File

@@ -3,15 +3,15 @@ package forge.gui.deckeditor;
import forge.Card;
import forge.CardList;
import forge.Command;
import forge.card.CardDb;
import forge.card.CardPool;
import forge.card.CardPrinted;
import forge.deck.Deck;
import forge.deck.DeckManager;
import forge.deck.generate.GenerateConstructedDeck;
import forge.error.ErrorViewer;
import forge.game.GameType;
import forge.gui.GuiUtils;
import forge.item.CardDb;
import forge.item.CardPrinted;
import forge.item.ItemPool;
import forge.properties.ForgeProps;
import forge.properties.NewConstants;
import org.apache.commons.lang3.StringUtils;
@@ -147,7 +147,7 @@ public final class DeckEditorMenu extends JMenuBar implements NewConstants {
// The only remaining reference to global variable!
CardList random = new CardList(forge.AllZone.getCardFactory().getRandomCombinationWithoutRepetition(15 * 5));
CardPool<CardPrinted> cpRandom = new CardPool<CardPrinted>();
ItemPool<CardPrinted> cpRandom = new ItemPool<CardPrinted>();
for (Card c : random) { cpRandom.add(CardDb.instance().getCard(c)); }
cpRandom.add(CardDb.instance().getCard("Forest"));
cpRandom.add(CardDb.instance().getCard("Island"));
@@ -166,7 +166,7 @@ public final class DeckEditorMenu extends JMenuBar implements NewConstants {
GenerateConstructedDeck gen = new GenerateConstructedDeck();
CardPool<CardPrinted> generated = new CardPool<CardPrinted>();
ItemPool<CardPrinted> generated = new ItemPool<CardPrinted>();
for (Card c : gen.generateDeck()) { generated.add(CardDb.instance().getCard(c)); }
deckDisplay.setDeck(null, generated, GameType.Constructed);
}

View File

@@ -3,14 +3,14 @@ package forge.gui.deckeditor;
import forge.Command;
import forge.Constant;
import forge.Singletons;
import forge.card.CardPool;
import forge.card.CardPoolView;
import forge.card.CardPrinted;
import forge.card.InventoryItem;
import forge.deck.Deck;
import forge.error.ErrorViewer;
import forge.game.GameType;
import forge.gui.GuiUtils;
import forge.item.CardPrinted;
import forge.item.InventoryItem;
import forge.item.ItemPool;
import forge.item.ItemPoolView;
import forge.properties.NewConstants;
import forge.quest.data.QuestData;
//import forge.view.swing.OldGuiNewGame;
@@ -98,8 +98,8 @@ public final class DeckEditorQuest extends DeckEditorBase implements NewConstant
// tell Gui_Quest_DeckEditor the name of the deck
customMenu.setPlayerDeckName(deck.getName());
CardPoolView<CardPrinted> bottomPool = deck.getMain();
CardPool<CardPrinted> cardpool = new CardPool<CardPrinted>();
ItemPoolView<CardPrinted> bottomPool = deck.getMain();
ItemPool<CardPrinted> cardpool = new ItemPool<CardPrinted>();
cardpool.addAll(questData.getCards().getCardpool());
// remove bottom cards that are in the deck from the card pool

View File

@@ -4,17 +4,17 @@ package forge.gui.deckeditor;
import forge.Command;
import forge.Constant;
import forge.card.CardRules;
import forge.card.CardDb;
import forge.card.CardPool;
import forge.card.CardPoolView;
import forge.card.CardPrinted;
import forge.card.InventoryItem;
import forge.deck.Deck;
import forge.deck.DeckManager;
import forge.error.ErrorViewer;
import forge.game.GameType;
import forge.gui.GuiUtils;
import forge.gui.ListChooser;
import forge.item.CardDb;
import forge.item.CardPrinted;
import forge.item.InventoryItem;
import forge.item.ItemPool;
import forge.item.ItemPoolView;
import forge.quest.data.QuestData;
import javax.swing.*;
@@ -171,7 +171,7 @@ public class DeckEditorQuestMenu extends JMenuBar {
*/
private String getExportDeckText(final Deck aDeck) {
//convert Deck into CardList
CardPoolView<CardPrinted> all = aDeck.getMain();
ItemPoolView<CardPrinted> all = aDeck.getMain();
//sort by card name
Collections.sort(all.getOrderedList(), TableSorter.byNameThenSet);
@@ -270,8 +270,8 @@ public class DeckEditorQuestMenu extends JMenuBar {
Deck newDeck = DeckManager.readDeck(file);
questData.addDeck(newDeck);
CardPool<CardPrinted> cardpool = CardPool.createFrom(questData.getCards().getCardpool(), CardPrinted.class);
CardPool<CardPrinted> decklist = new CardPool<CardPrinted>();
ItemPool<CardPrinted> cardpool = ItemPool.createFrom(questData.getCards().getCardpool(), CardPrinted.class);
ItemPool<CardPrinted> decklist = new ItemPool<CardPrinted>();
for (Entry<CardPrinted, Integer> s : newDeck.getMain()) {
CardPrinted cp = s.getKey();
decklist.add(cp, s.getValue());
@@ -337,8 +337,8 @@ public class DeckEditorQuestMenu extends JMenuBar {
if (StringUtils.isBlank(deckName)) { return; }
setPlayerDeckName(deckName);
CardPool<CardPrinted> cards = CardPool.createFrom(questData.getCards().getCardpool().getView(), CardPrinted.class);
CardPoolView<CardPrinted> deck = questData.getDeck(deckName).getMain();
ItemPool<CardPrinted> cards = ItemPool.createFrom(questData.getCards().getCardpool().getView(), CardPrinted.class);
ItemPoolView<CardPrinted> deck = questData.getDeck(deckName).getMain();
// show in pool all cards except ones used in deck
cards.removeAll(deck);
@@ -499,10 +499,10 @@ public class DeckEditorQuestMenu extends JMenuBar {
* @param list a {@link forge.CardPool} object.
* @return a {@link forge.deck.Deck} object.
*/
private Deck cardPoolToDeck(final CardPoolView<InventoryItem> list) {
private Deck cardPoolToDeck(final ItemPoolView<InventoryItem> list) {
//put CardPool into Deck main
Deck deck = new Deck(GameType.Sealed);
deck.addMain(CardPool.createFrom(list, CardPrinted.class));
deck.addMain(ItemPool.createFrom(list, CardPrinted.class));
return deck;
}

View File

@@ -22,13 +22,13 @@ import net.slightlymagic.maxmtg.Predicate;
import forge.Command;
import forge.ReadPriceList;
import forge.Singletons;
import forge.card.CardPoolView;
import forge.card.CardPrinted;
import forge.card.InventoryItem;
import forge.deck.Deck;
import forge.error.ErrorViewer;
import forge.game.GameType;
import forge.gui.GuiUtils;
import forge.item.CardPrinted;
import forge.item.InventoryItem;
import forge.item.ItemPoolView;
import forge.quest.data.QuestData;
//import forge.view.swing.OldGuiNewGame;
@@ -88,12 +88,12 @@ public final class DeckEditorShop extends DeckEditorBase {
multiplier = questData.getCards().getSellMutliplier();
CardPoolView<CardPrinted> forSale = questData.getCards().getShopList();
ItemPoolView<CardPrinted> forSale = questData.getCards().getShopList();
if (forSale.isEmpty()) {
questData.getCards().generateCardsInShop();
forSale = questData.getCards().getShopList();
}
CardPoolView<CardPrinted> owned = questData.getCards().getCardpool().getView();
ItemPoolView<CardPrinted> owned = questData.getCards().getCardpool().getView();
//newCardsList = questData.getCards().getNewCards();
setDeck(forSale, owned, GameType.Quest);

View File

@@ -7,8 +7,8 @@ import java.util.List;
import javax.swing.JCheckBox;
import net.slightlymagic.maxmtg.Predicate;
import forge.card.CardPrinted;
import forge.card.CardRules;
import forge.item.CardPrinted;
/**
* A structural class for some checkboxes need for a deck editor, contains no JPanel to store boxes on

View File

@@ -17,10 +17,10 @@ import net.slightlymagic.maxmtg.PredicateString.StringOp;
import org.apache.commons.lang3.StringUtils;
import forge.SetUtils;
import forge.card.CardPrinted;
import forge.card.CardRules;
import forge.card.CardSet;
import forge.game.GameFormat;
import forge.item.CardPrinted;
/**
* A panel that holds Name, Type, Rules text fields aligned horizontally together with set filter

View File

@@ -6,10 +6,10 @@ import net.slightlymagic.braids.util.lambda.Lambda1;
import forge.SetUtils;
import forge.card.CardColor;
import forge.card.CardManaCost;
import forge.card.CardPrinted;
import forge.card.CardRarity;
import forge.card.CardSet;
import forge.card.InventoryItem;
import forge.item.CardPrinted;
import forge.item.InventoryItem;
/**
* TODO: Write javadoc for this type.

View File

@@ -9,9 +9,9 @@ import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import forge.card.CardPool;
import forge.card.CardPoolView;
import forge.card.InventoryItem;
import forge.item.InventoryItem;
import forge.item.ItemPool;
import forge.item.ItemPoolView;
import java.awt.event.*;
import java.util.ArrayList;
@@ -91,7 +91,7 @@ public final class TableModel<T extends InventoryItem> extends AbstractTableMode
}
}
private CardPool<T> data = new CardPool<T>();
private ItemPool<T> data = new ItemPool<T>();
private final CardPanelBase cardDisplay;
private final List<TableColumnInfo<T>> columns;
private final SortOrders sortOrders = new SortOrders();
@@ -118,7 +118,7 @@ public final class TableModel<T extends InventoryItem> extends AbstractTableMode
}
public void clear() { data.clear(); }
public CardPoolView<T> getCards() { return data.getView(); }
public ItemPoolView<T> getCards() { return data.getView(); }
/**
* <p>removeCard.</p>

View File

@@ -1,7 +1,8 @@
package forge.gui.deckeditor;
import forge.card.CardPrinted;
import forge.item.CardPrinted;
import java.util.Comparator;
import java.util.Map.Entry;

View File

@@ -1,6 +1,6 @@
package forge.gui.deckeditor;
import forge.card.InventoryItem;
import forge.item.InventoryItem;
import java.util.Comparator;
import java.util.List;

View File

@@ -17,11 +17,11 @@ import net.slightlymagic.maxmtg.Predicate;
import forge.Constant;
import forge.Singletons;
import forge.card.CardPool;
import forge.card.CardPoolView;
import forge.card.CardPrinted;
import forge.card.CardRules;
import forge.card.InventoryItem;
import forge.item.CardPrinted;
import forge.item.InventoryItem;
import forge.item.ItemPool;
import forge.item.ItemPoolView;
/**
* TODO: Write javadoc for this type.
@@ -29,7 +29,7 @@ import forge.card.InventoryItem;
*/
public final class TableWithCards {
protected CardPool<InventoryItem> pool;
protected ItemPool<InventoryItem> pool;
protected TableModel<InventoryItem> model;
protected JTable table = new JTable();
protected JScrollPane jScrollPane = new JScrollPane();
@@ -82,7 +82,7 @@ public final class TableWithCards {
// get stats from deck
model.addTableModelListener(new TableModelListener() {
public void tableChanged(final TableModelEvent ev) {
CardPoolView<InventoryItem> deck = model.getCards();
ItemPoolView<InventoryItem> deck = model.getCards();
statsLabel.setText(getStats(deck));
}
});
@@ -90,7 +90,7 @@ public final class TableWithCards {
}
// This should not be here, but still found no better place
public static String getStats(final CardPoolView<InventoryItem> deck) {
public static String getStats(final ItemPoolView<InventoryItem> deck) {
int total = deck.countAll();
int creature = CardRules.Predicates.Presets.isCreature.aggregate(deck, deck.fnToCard, deck.fnToCount);
int land = CardRules.Predicates.Presets.isLand.aggregate(deck, deck.fnToCard, deck.fnToCount);
@@ -124,14 +124,14 @@ public final class TableWithCards {
}
public void setDeck(final Iterable<InventoryItem> cards) {
setDeckImpl(CardPool.createFrom(cards, InventoryItem.class));
setDeckImpl(ItemPool.createFrom(cards, InventoryItem.class));
}
public <T extends InventoryItem> void setDeck(final CardPoolView<T> poolView) {
setDeckImpl(CardPool.createFrom(poolView, InventoryItem.class));
public <T extends InventoryItem> void setDeck(final ItemPoolView<T> poolView) {
setDeckImpl(ItemPool.createFrom(poolView, InventoryItem.class));
}
protected void setDeckImpl(CardPool<InventoryItem> thePool)
protected void setDeckImpl(ItemPool<InventoryItem> thePool)
{
model.clear();
pool = thePool;
@@ -184,7 +184,7 @@ public final class TableWithCards {
model.resort();
}
public CardPoolView<InventoryItem> getCards() {
public ItemPoolView<InventoryItem> getCards() {
return pool;
}

View File

@@ -13,8 +13,8 @@ import arcane.ui.ScaledImagePanel.ScalingType;
import forge.Card;
import forge.CardContainer;
import forge.ImageCache;
import forge.card.CardPrinted;
import forge.card.InventoryItem;
import forge.item.CardPrinted;
import forge.item.InventoryItem;
import javax.swing.*;
import java.awt.*;

View File

@@ -1,4 +1,4 @@
package forge.card;
package forge.item;
import java.util.ArrayList;
import java.util.Hashtable;
@@ -13,6 +13,9 @@ import net.slightlymagic.braids.util.lambda.Lambda1;
import org.apache.commons.lang3.StringUtils;
import forge.Card;
import forge.card.CardInSet;
import forge.card.CardRules;
import forge.card.MtgDataParser;
/**
@@ -41,7 +44,8 @@ public final class CardDb {
}
// Here oracle cards
private final Map<String, CardRules> cards = new Hashtable<String, CardRules>();
//private final Map<String, CardRules> cards = new Hashtable<String, CardRules>();
// Here are refs, get them by name
private final Map<String, CardPrinted> uniqueCards = new Hashtable<String, CardPrinted>();
@@ -72,7 +76,7 @@ public final class CardDb {
String cardName = card.getName().toLowerCase();
// 1. register among oracle uniques
cards.put(cardName, card);
//cards.put(cardName, card);
// 2. Save refs into two lists: one flat and other keyed with sets & name
CardPrinted lastAdded = null;

View File

@@ -1,4 +1,4 @@
package forge.card;
package forge.item;
import java.util.Arrays;
import java.util.List;
@@ -11,6 +11,8 @@ import net.slightlymagic.maxmtg.PredicateString;
import forge.AllZone;
import forge.Card;
import forge.CardUtil;
import forge.card.CardRarity;
import forge.card.CardRules;
/**
* <p>CardReference class.</p>

View File

@@ -1,4 +1,4 @@
package forge.card;
package forge.item;
/**
* Interface to define a player's inventory may hold.

View File

@@ -1,26 +1,27 @@
package forge.card;
package forge.item;
import java.util.Collections;
import java.util.List;
import java.util.Map.Entry;
/**
* <p>CardPool class.</p>
* Represents a list of cards with amount of each
*/
public final class CardPool<T extends InventoryItem> extends CardPoolView<T> {
public final class ItemPool<T extends InventoryItem> extends ItemPoolView<T> {
// Constructors here
public CardPool() { super(); }
public ItemPool() { super(); }
@SuppressWarnings("unchecked") // conversion here must be safe
public CardPool(final List<String> names) { super(); addAllCards((Iterable<T>) CardDb.instance().getCards(names)); }
public ItemPool(final List<String> names) { super(); addAllCards((Iterable<T>) CardDb.instance().getCards(names)); }
@SuppressWarnings("unchecked")
public static <Tin extends InventoryItem, Tout extends InventoryItem> CardPool<Tout>
createFrom(CardPoolView<Tin> from, Class<Tout> clsHint)
public static <Tin extends InventoryItem, Tout extends InventoryItem> ItemPool<Tout>
createFrom(ItemPoolView<Tin> from, Class<Tout> clsHint)
{
CardPool<Tout> result = new CardPool<Tout>();
ItemPool<Tout> result = new ItemPool<Tout>();
if (from != null) {
for (Entry<Tin, Integer> e : from) {
Tin srcKey = e.getKey();
@@ -33,9 +34,9 @@ public final class CardPool<T extends InventoryItem> extends CardPoolView<T> {
}
@SuppressWarnings("unchecked")
public static <Tin extends InventoryItem, Tout extends InventoryItem> CardPool<Tout>
public static <Tin extends InventoryItem, Tout extends InventoryItem> ItemPool<Tout>
createFrom(Iterable<Tin> from, Class<Tout> clsHint) {
CardPool<Tout> result = new CardPool<Tout>();
ItemPool<Tout> result = new ItemPool<Tout>();
if (from != null) {
for (Tin srcKey : from) {
if (clsHint.isInstance(srcKey)) {
@@ -47,7 +48,7 @@ public final class CardPool<T extends InventoryItem> extends CardPoolView<T> {
}
// get
public CardPoolView<T> getView() { return new CardPoolView<T>(Collections.unmodifiableMap(cards)); }
public ItemPoolView<T> getView() { return new ItemPoolView<T>(Collections.unmodifiableMap(cards)); }
// Cards manipulation
public void add(final T card) { add(card, 1); }

View File

@@ -1,4 +1,4 @@
package forge.card;
package forge.item;
import java.util.ArrayList;
import java.util.Hashtable;
@@ -8,6 +8,7 @@ import java.util.Map;
import java.util.Map.Entry;
import forge.CardList;
import forge.card.CardRules;
import net.slightlymagic.braids.util.lambda.Lambda1;
@@ -17,7 +18,7 @@ import net.slightlymagic.braids.util.lambda.Lambda1;
* @author Forge
* @version $Id: CardPoolView.java 9708 2011-08-09 19:34:12Z jendave $
*/
public class CardPoolView<T extends InventoryItem> implements Iterable<Entry<T, Integer>> {
public class ItemPoolView<T extends InventoryItem> implements Iterable<Entry<T, Integer>> {
// Field Accessors for select/aggregate operations with filters.
public final Lambda1<CardRules, Entry<T, Integer>> fnToCard =
@@ -41,8 +42,8 @@ public class CardPoolView<T extends InventoryItem> implements Iterable<Entry<T,
};
// Constructors
public CardPoolView() { cards = new Hashtable<T, Integer>(); }
public CardPoolView(final Map<T, Integer> inMap) { cards = inMap; }
public ItemPoolView() { cards = new Hashtable<T, Integer>(); }
public ItemPoolView(final Map<T, Integer> inMap) { cards = inMap; }
// Data members
protected Map<T, Integer> cards;

View File

@@ -1,9 +1,10 @@
package forge.quest.data;
import forge.card.CardDb;
import forge.card.CardPrinted;
import forge.card.CardRarity;
import forge.card.CardRules;
import forge.item.CardDb;
import forge.item.CardPrinted;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

View File

@@ -2,11 +2,11 @@ package forge.quest.data;
import forge.MyRandom;
import forge.SetUtils;
import forge.card.CardPool;
import forge.card.CardPrinted;
import forge.card.InventoryItem;
import forge.deck.Deck;
import forge.error.ErrorViewer;
import forge.item.CardPrinted;
import forge.item.InventoryItem;
import forge.item.ItemPool;
import forge.properties.ForgeProps;
import forge.properties.NewConstants;
import forge.quest.data.item.QuestInventory;
@@ -68,9 +68,9 @@ public final class QuestData {
Map<String, Deck> myDecks = new HashMap<String, Deck>();
// Cards associated with quest
CardPool<CardPrinted> cardPool = new CardPool<CardPrinted>(); // player's belonging
CardPool<CardPrinted> shopList = new CardPool<CardPrinted>(); // the current shop list
CardPool<InventoryItem> newCardList = new CardPool<InventoryItem>(); // cards acquired since last game-win/loss
ItemPool<CardPrinted> cardPool = new ItemPool<CardPrinted>(); // player's belonging
ItemPool<CardPrinted> shopList = new ItemPool<CardPrinted>(); // the current shop list
ItemPool<InventoryItem> newCardList = new ItemPool<InventoryItem>(); // cards acquired since last game-win/loss
// Quests history
int questsPlayed;
@@ -116,8 +116,8 @@ public final class QuestData {
myRewards = new QuestUtilRewards(this);
// to avoid NPE some pools will be created here if they are null
if (null == newCardList) { newCardList = new CardPool<InventoryItem>(); }
if (null == shopList) { shopList = new CardPool<CardPrinted>(); }
if (null == newCardList) { newCardList = new ItemPool<InventoryItem>(); }
if (null == shopList) { shopList = new ItemPool<CardPrinted>(); }
}

View File

@@ -8,12 +8,12 @@ import com.thoughtworks.xstream.converters.Converter;
import com.thoughtworks.xstream.converters.MarshallingContext;
import com.thoughtworks.xstream.converters.UnmarshallingContext;
import forge.card.CardDb;
import forge.card.CardPool;
import forge.card.CardPrinted;
import forge.card.InventoryItem;
import forge.error.ErrorViewer;
import forge.game.GameType;
import forge.item.CardDb;
import forge.item.CardPrinted;
import forge.item.InventoryItem;
import forge.item.ItemPool;
import forge.properties.ForgeProps;
import forge.properties.NewConstants;
import forge.quest.data.item.QuestInventory;
@@ -72,7 +72,7 @@ public class QuestDataIO {
IgnoringXStream xStream = new IgnoringXStream();
xStream.registerConverter(new CardPoolToXml());
xStream.registerConverter(new GameTypeToXml());
xStream.alias("CardPool", CardPool.class);
xStream.alias("CardPool", ItemPool.class);
data = (QuestData) xStream.fromXML(xml.toString());
if (data.versionNumber != QuestData.CURRENT_VERSION_NUMBER) {
@@ -151,7 +151,7 @@ public class QuestDataIO {
try {
XStream xStream = new XStream();
xStream.registerConverter(new CardPoolToXml());
xStream.alias("CardPool", CardPool.class);
xStream.alias("CardPool", ItemPool.class);
File f = ForgeProps.getFile(NewConstants.QUEST.XMLDATA);
BufferedOutputStream bout = new BufferedOutputStream(new FileOutputStream(f));
@@ -219,7 +219,7 @@ public class QuestDataIO {
@SuppressWarnings("rawtypes")
@Override
public boolean canConvert(Class clasz) {
return clasz.equals(CardPool.class);
return clasz.equals(ItemPool.class);
}
private void writeCardRef(CardPrinted cref, HierarchicalStreamWriter writer)
@@ -234,7 +234,7 @@ public class QuestDataIO {
@Override
public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) {
@SuppressWarnings("unchecked")
CardPool<InventoryItem> pool = (CardPool<InventoryItem>) source;
ItemPool<InventoryItem> pool = (ItemPool<InventoryItem>) source;
for (Entry<InventoryItem, Integer> e : pool) {
if ( e.getKey() instanceof CardPrinted)
{
@@ -249,7 +249,7 @@ public class QuestDataIO {
@Override
public Object unmarshal(final HierarchicalStreamReader reader, final UnmarshallingContext context) {
CardPool<CardPrinted> result = new CardPool<CardPrinted>();
ItemPool<CardPrinted> result = new ItemPool<CardPrinted>();
while (reader.hasMoreChildren()) {
reader.moveDown();
String nodename = reader.getNodeName();

View File

@@ -4,8 +4,8 @@ import forge.Card;
import forge.CardList;
import forge.Constant;
import forge.Quest_Assignment;
import forge.card.CardPrinted;
import forge.card.CardRarity;
import forge.item.CardPrinted;
import java.util.List;

View File

@@ -8,13 +8,13 @@ import net.slightlymagic.braids.util.lambda.Lambda1;
import net.slightlymagic.maxmtg.Predicate;
import forge.ReadBoosterPack;
import forge.card.CardDb;
import forge.card.CardPool;
import forge.card.CardPoolView;
import forge.card.CardPrinted;
import forge.card.CardRarity;
import forge.card.InventoryItem;
import forge.deck.Deck;
import forge.item.CardDb;
import forge.item.CardPrinted;
import forge.item.InventoryItem;
import forge.item.ItemPool;
import forge.item.ItemPoolView;
/**
* This is a helper class to execute operations on QuestData.
@@ -146,23 +146,23 @@ public final class QuestUtilCards {
int winPacks = q.getWin() / 10;
int totalPacks = Math.min(levelPacks + winPacks, 6);
CardPoolView<CardPrinted> fromBoosters = pack.getShopCards(totalPacks);
ItemPoolView<CardPrinted> fromBoosters = pack.getShopCards(totalPacks);
q.shopList.clear();
q.shopList.addAll(fromBoosters);
}
public CardPool<CardPrinted> getCardpool() {
public ItemPool<CardPrinted> getCardpool() {
return q.cardPool;
}
public CardPoolView<CardPrinted> getShopList() {
public ItemPoolView<CardPrinted> getShopList() {
if (q.shopList.isEmpty()) {
generateCardsInShop();
}
return q.shopList;
}
public CardPoolView<InventoryItem> getNewCards() {
public ItemPoolView<InventoryItem> getNewCards() {
return q.newCardList;
}

View File

@@ -3,8 +3,6 @@ package forge.view.swing;
import arcane.ui.util.ManaSymbols;
import com.esotericsoftware.minlog.Log;
import forge.*;
import forge.card.CardPool;
import forge.card.CardPrinted;
import forge.deck.Deck;
import forge.deck.DeckGeneration;
import forge.deck.DeckManager;
@@ -17,6 +15,8 @@ import forge.gui.GuiUtils;
import forge.gui.ListChooser;
import forge.gui.deckeditor.DeckEditorDraft;
import forge.gui.deckeditor.DeckEditor;
import forge.item.CardPrinted;
import forge.item.ItemPool;
import forge.properties.ForgePreferences;
import forge.properties.ForgePreferences.CardSizeType;
import forge.properties.ForgePreferences.StackOffsetType;
@@ -336,7 +336,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
"choice <<" + safeToString(o) + ">> does not equal any of the sealedTypes.");
}
CardPool<CardPrinted> sDeck = sd.getCardpool();
ItemPool<CardPrinted> sDeck = sd.getCardpool();
if (sDeck.countAll() > 1) {

View File

@@ -2,10 +2,10 @@ package forge;
import java.util.List;
import forge.card.CardPool;
import forge.card.CardPrinted;
import forge.deck.Deck;
import forge.game.limited.BoosterDraftAI;
import forge.item.CardPrinted;
import forge.item.ItemPool;
import org.testng.annotations.Test;
@@ -43,7 +43,7 @@ public class BoosterDraftAITest {
public void runTest(BoosterDraftAI ai) {
ReadDraftBoosterPack booster = new ReadDraftBoosterPack();
for (int outer = 0; outer < 1; outer++) {
CardPool<CardPrinted> allBooster = new CardPool<CardPrinted>();
ItemPool<CardPrinted> allBooster = new ItemPool<CardPrinted>();
for (int i = 0; i < 21; i++)
allBooster.addAll(booster.getBoosterPack());

View File

@@ -1,10 +1,11 @@
package forge;
import forge.card.CardPoolView;
import forge.card.CardPrinted;
import forge.deck.Deck;
import forge.game.limited.BoosterDraft;
import forge.item.CardPrinted;
import forge.item.ItemPoolView;
import org.testng.annotations.Test;
/**
@@ -32,7 +33,7 @@ public class BoosterDraftTest implements BoosterDraft {
*
* @return a {@link forge.CardList} object.
*/
public CardPoolView<CardPrinted> nextChoice() {
public ItemPoolView<CardPrinted> nextChoice() {
n--;
ReadDraftBoosterPack pack = new ReadDraftBoosterPack();
return pack.getBoosterPack();

View File

@@ -2,10 +2,10 @@ package forge;
import org.testng.annotations.Test;
import forge.card.CardPrinted;
import forge.card.CardPoolView;
import forge.game.limited.BoosterDraft_1;
import forge.item.CardPrinted;
import forge.item.ItemPoolView;
/**
@@ -21,7 +21,7 @@ public class BoosterDraft_1Test {
public void BoosterDraft_1Test1() throws Exception {
BoosterDraft_1 draft = new BoosterDraft_1();
while (draft.hasNextChoice()) {
CardPoolView<CardPrinted> list = draft.nextChoice();
ItemPoolView<CardPrinted> list = draft.nextChoice();
System.out.println(list.countAll());
draft.setChoice(list.toFlatList().get(0));
}