mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
reverting unwanted changes from r19381 to core classes
This commit is contained in:
@@ -228,9 +228,9 @@ public class MetaSet {
|
||||
// ItemPool<CardPrinted> cardPool = new ItemPool<CardPrinted>(CardPrinted.class);
|
||||
for (CardPrinted aCard : CardDb.instance().getAllTraditionalCards()) {
|
||||
if (data.indexOf(aCard.getEdition()) > -1) {
|
||||
cardPool.add(aCard, 1);
|
||||
cardPool.add(aCard);
|
||||
// System.out.println("Added card" + aCard.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final BoosterGenerator bpSets = new BoosterGenerator(cardPool);
|
||||
@@ -274,10 +274,10 @@ public class MetaSet {
|
||||
if (typeTest[0].equalsIgnoreCase("choose1") || typeTest[0].equalsIgnoreCase("random1")
|
||||
|| typeTest[0].equalsIgnoreCase("combo")) {
|
||||
System.out.println("WARNING - MetaSet type '" + typeTest[0] + "' ignored in pool creation.");
|
||||
}
|
||||
}
|
||||
else if (typeTest[0].equalsIgnoreCase("full")) {
|
||||
for (CardPrinted aCard : CardDb.instance().getAllUniqueCards()) {
|
||||
cardPool.add(aCard, 1);
|
||||
cardPool.add(aCard);
|
||||
}
|
||||
return cardPool;
|
||||
}
|
||||
@@ -296,10 +296,10 @@ public class MetaSet {
|
||||
for (CardPrinted aCard : CardDb.instance().getAllTraditionalCards()) {
|
||||
if (mData.indexOf(aCard.getEdition()) > -1) {
|
||||
if (!cardPool.contains(aCard)) {
|
||||
cardPool.add(aCard, 1);
|
||||
cardPool.add(aCard);
|
||||
// System.out.println(mSet.type + " " + mData + ": Added card: " + aCard.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (mSet.type.equalsIgnoreCase("cube")) {
|
||||
final File dFolder = new File("res/sealed/");
|
||||
@@ -317,9 +317,9 @@ public class MetaSet {
|
||||
final CustomLimited myCube = CustomLimited.parse(dfData, Singletons.getModel().getDecks().getCubes());
|
||||
for (CardPrinted aCard : myCube.getCardPool().toFlatList()) {
|
||||
if (!cardPool.contains(aCard)) {
|
||||
cardPool.add(aCard, 1);
|
||||
cardPool.add(aCard);
|
||||
// System.out.println(mSet.type + " " + mSet.data + ": Added card: " + aCard.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ public enum DeckFormat {
|
||||
DeckSection tmp = new DeckSection(deck.getMain());
|
||||
tmp.addAll(deck.getSideboard());
|
||||
if (null != deck.getCommander() && this == Commander) {
|
||||
tmp.add(deck.getCommander(), 1);
|
||||
tmp.add(deck.getCommander());
|
||||
}
|
||||
|
||||
List<String> limitExceptions = Arrays.asList("Relentless Rats");
|
||||
|
||||
@@ -58,7 +58,7 @@ public class DeckSection extends ItemPool<CardPrinted> {
|
||||
public void set(final Iterable<String> cardNames) {
|
||||
this.clear();
|
||||
for (final String name : cardNames) {
|
||||
this.add(CardDb.instance().getCard(name), 1);
|
||||
this.add(CardDb.instance().getCard(name));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,8 +68,20 @@ public class DeckSection extends ItemPool<CardPrinted> {
|
||||
* @param card
|
||||
* the card
|
||||
*/
|
||||
public void add(final Card card, int qty) {
|
||||
this.add(CardDb.instance().getCard(card), qty);
|
||||
public void add(final Card card) {
|
||||
this.add(CardDb.instance().getCard(card));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the.
|
||||
*
|
||||
* @param cardName
|
||||
* the card name
|
||||
* @param setCode
|
||||
* the set code
|
||||
*/
|
||||
public void add(final String cardName, final String setCode) {
|
||||
this.add(CardDb.instance().getCard(cardName, setCode));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,8 +91,8 @@ public class DeckSection extends ItemPool<CardPrinted> {
|
||||
* @param setCode the set code
|
||||
* @param amount the amount
|
||||
*/
|
||||
public void add(final String cardName, final String setCode, final int qty) {
|
||||
this.add(CardDb.instance().getCard(cardName, setCode), qty);
|
||||
public void add(final String cardName, final String setCode, final int amount) {
|
||||
this.add(CardDb.instance().getCard(cardName, setCode), amount);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,7 +103,7 @@ public class DeckSection extends ItemPool<CardPrinted> {
|
||||
*/
|
||||
public void add(final List<Card> cardList) {
|
||||
for (final Card c : cardList) {
|
||||
this.add(c, 1);
|
||||
this.add(c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +115,7 @@ public class DeckSection extends ItemPool<CardPrinted> {
|
||||
*/
|
||||
public void add(final Iterable<CardPrinted> list) {
|
||||
for (CardPrinted cp : list) {
|
||||
this.add(cp, 1);
|
||||
this.add(cp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,8 +124,8 @@ public class DeckSection extends ItemPool<CardPrinted> {
|
||||
*
|
||||
* @param cardName the card name
|
||||
*/
|
||||
public void add(final String cardName, int qty) {
|
||||
this.add(CardDb.instance().getCard(cardName), qty);
|
||||
public void add(final String cardName) {
|
||||
this.add(CardDb.instance().getCard(cardName));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -323,7 +323,7 @@ public class DeckgenUtil {
|
||||
CardPrinted cp = Aggregates.random(allSchemes);
|
||||
int appearances = res.getSideboard().count(cp) + 1;
|
||||
if (appearances < 2) {
|
||||
res.getSideboard().add(cp, 1);
|
||||
res.getSideboard().add(cp);
|
||||
schemesToAdd--;
|
||||
} else {
|
||||
attemptsLeft--;
|
||||
@@ -351,12 +351,12 @@ public class DeckgenUtil {
|
||||
|
||||
if(rndPlane.getCard().getType().isPhenomenon() && phenoms < 2)
|
||||
{
|
||||
res.getSideboard().add(rndPlane, 1);
|
||||
res.getSideboard().add(rndPlane);
|
||||
phenoms++;
|
||||
}
|
||||
else if (rndPlane.getCard().getType().isPlane())
|
||||
{
|
||||
res.getSideboard().add(rndPlane, 1);
|
||||
res.getSideboard().add(rndPlane);
|
||||
}
|
||||
|
||||
if(allPlanars.isEmpty() || res.getSideboard().countAll() == targetsize)
|
||||
|
||||
@@ -114,7 +114,7 @@ public abstract class GenerateColoredDeckBase {
|
||||
throw new RuntimeException("Generate2ColorDeck : get2ColorDeck -- looped too much -- Cr12");
|
||||
}
|
||||
|
||||
tDeck.add(CardDb.instance().getCard(cp.getName(), Aggregates.random(cp.getCard().getSetsPrinted()).getKey()), 1);
|
||||
tDeck.add(CardDb.instance().getCard(cp.getName(), Aggregates.random(cp.getCard().getSetsPrinted()).getKey()));
|
||||
final int n = this.cardCounts.get(cp.getName());
|
||||
this.cardCounts.put(cp.getName(), n + 1);
|
||||
tmpDeck.append(cp.getName() + " " + cp.getCard().getManaCost() + "\n");
|
||||
@@ -133,7 +133,7 @@ public abstract class GenerateColoredDeckBase {
|
||||
// not an error if looped too much - could play singleton mode, with 6 slots for 3 non-basic lands.
|
||||
|
||||
CardPrinted cp = CardDb.instance().getCard(s);
|
||||
tDeck.add(CardDb.instance().getCard(cp.getName(), Aggregates.random(cp.getCard().getSetsPrinted()).getKey()), 1);
|
||||
tDeck.add(CardDb.instance().getCard(cp.getName(), Aggregates.random(cp.getCard().getSetsPrinted()).getKey()));
|
||||
|
||||
final int n = this.cardCounts.get(s);
|
||||
this.cardCounts.put(s, n + 1);
|
||||
@@ -171,7 +171,7 @@ public abstract class GenerateColoredDeckBase {
|
||||
CardPrinted cp = CardDb.instance().getCard(color);
|
||||
String basicLandSet = Aggregates.random(cp.getCard().getSetsPrinted()).getKey();
|
||||
for (int j = 0; j <= nLand; j++) {
|
||||
tDeck.add(CardDb.instance().getCard(cp.getName(), basicLandSet), 1);
|
||||
tDeck.add(CardDb.instance().getCard(cp.getName(), basicLandSet));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ public class GenerateThemeDeck extends GenerateColoredDeckBase {
|
||||
}
|
||||
|
||||
final int n = cardCounts.get(s);
|
||||
tDeck.add(CardDb.instance().getCard(s), 1);
|
||||
tDeck.add(CardDb.instance().getCard(s));
|
||||
cardCounts.put(s, n + 1);
|
||||
tmpDeck += s + "\n";
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ public class GauntletIO {
|
||||
final String nodename = reader.getNodeName();
|
||||
|
||||
if ("string".equals(nodename)) {
|
||||
result.add(CardDb.instance().getCard(reader.getValue()), cnt);
|
||||
result.add(CardDb.instance().getCard(reader.getValue()));
|
||||
} else if ("card".equals(nodename)) { // new format
|
||||
result.add(this.readCardPrinted(reader), cnt);
|
||||
}
|
||||
|
||||
@@ -84,12 +84,12 @@ public enum CDeckgen implements ICDoc {
|
||||
Iterable<CardPrinted> source = Iterables.filter(CardDb.instance().getAllUniqueCards(), notBasicLand);
|
||||
randomDeck.getMain().addAllFlat(Aggregates.random(source, 15 * 5));
|
||||
|
||||
randomDeck.getMain().add("Plains", 1);
|
||||
randomDeck.getMain().add("Island", 1);
|
||||
randomDeck.getMain().add("Swamp", 1);
|
||||
randomDeck.getMain().add("Mountain", 1);
|
||||
randomDeck.getMain().add("Forest", 1);
|
||||
randomDeck.getMain().add("Terramorphic Expanse", 1);
|
||||
randomDeck.getMain().add("Plains");
|
||||
randomDeck.getMain().add("Island");
|
||||
randomDeck.getMain().add("Swamp");
|
||||
randomDeck.getMain().add("Mountain");
|
||||
randomDeck.getMain().add("Forest");
|
||||
randomDeck.getMain().add("Terramorphic Expanse");
|
||||
|
||||
final ACEditorBase<TItem, TModel> ed = (ACEditorBase<TItem, TModel>)
|
||||
CDeckEditorUI.SINGLETON_INSTANCE.getCurrentEditorController();
|
||||
|
||||
@@ -137,9 +137,9 @@ public class ControlWinLose {
|
||||
|
||||
for (Card c : compAntes) {
|
||||
CardPrinted toRemove = CardDb.instance().getCard(c);
|
||||
cDeck.getMain().remove(toRemove, 1);
|
||||
cDeck.getMain().remove(toRemove);
|
||||
if ( cDeck != oDeck )
|
||||
oDeck.getMain().remove(toRemove, 1);
|
||||
oDeck.getMain().remove(toRemove);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ public class ControlWinLose {
|
||||
if (null != chosen) {
|
||||
Deck d = match.getPlayersDeck(p.getLobbyPlayer());
|
||||
for (CardPrinted c : chosen) {
|
||||
d.getMain().add(c, 1);
|
||||
d.getMain().add(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,6 +113,18 @@ public class ItemPool<T extends InventoryItem> extends ItemPoolView<T> {
|
||||
return new ItemPoolView<T>(Collections.unmodifiableMap(this.getCards()), this.getMyClass());
|
||||
}
|
||||
|
||||
// Cards manipulation
|
||||
/**
|
||||
*
|
||||
* Add Card.
|
||||
*
|
||||
* @param card
|
||||
* a T
|
||||
*/
|
||||
public void add(final T card) {
|
||||
this.add(card, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* add method.
|
||||
@@ -147,7 +159,7 @@ public class ItemPool<T extends InventoryItem> extends ItemPoolView<T> {
|
||||
public <U extends InventoryItem> void addAllFlat(final Iterable<U> cards) {
|
||||
for (final U cr : cards) {
|
||||
if (this.getMyClass().isInstance(cr)) {
|
||||
this.add((T) cr, 1);
|
||||
this.add((T) cr);
|
||||
}
|
||||
}
|
||||
this.setListInSync(false);
|
||||
@@ -172,6 +184,17 @@ public class ItemPool<T extends InventoryItem> extends ItemPoolView<T> {
|
||||
this.setListInSync(false);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Remove.
|
||||
*
|
||||
* @param card
|
||||
* a T
|
||||
*/
|
||||
public boolean remove(final T card) {
|
||||
return this.remove(card, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Remove.
|
||||
@@ -216,7 +239,7 @@ public class ItemPool<T extends InventoryItem> extends ItemPoolView<T> {
|
||||
*/
|
||||
public void removeAllFlat(final Iterable<T> flat) {
|
||||
for (final T e : flat) {
|
||||
this.remove(e, 1);
|
||||
this.remove(e);
|
||||
}
|
||||
// need not set out-of-sync: either remove did set, or nothing was removed
|
||||
}
|
||||
|
||||
@@ -176,10 +176,10 @@ public final class QuestUtilCards {
|
||||
* the card
|
||||
*/
|
||||
public void addSingleCard(final CardPrinted card) {
|
||||
this.qa.getCardPool().add(card, 1);
|
||||
this.qa.getCardPool().add(card);
|
||||
|
||||
// register card into that list so that it would appear as a new one.
|
||||
this.qa.getNewCardList().add(card, 1);
|
||||
this.qa.getNewCardList().add(card);
|
||||
}
|
||||
|
||||
private static final Predicate<CardPrinted> RARE_PREDICATE = CardPrinted.Predicates.Presets.IS_RARE_OR_MYTHIC;
|
||||
@@ -251,7 +251,7 @@ public final class QuestUtilCards {
|
||||
public void buyCard(final CardPrinted card, final int value) {
|
||||
if (this.qa.getCredits() >= value) {
|
||||
this.qa.setCredits(this.qa.getCredits() - value);
|
||||
this.qa.getShopList().remove(card, 1);
|
||||
this.qa.getShopList().remove(card);
|
||||
this.addSingleCard(card);
|
||||
}
|
||||
}
|
||||
@@ -282,7 +282,7 @@ public final class QuestUtilCards {
|
||||
public void buyPreconDeck(final PreconDeck precon, final int value) {
|
||||
if (this.qa.getCredits() >= value) {
|
||||
this.qa.setCredits(this.qa.getCredits() - value);
|
||||
this.qa.getShopList().remove(precon, 1);
|
||||
this.qa.getShopList().remove(precon);
|
||||
addPreconDeck(precon);
|
||||
}
|
||||
}
|
||||
@@ -456,7 +456,7 @@ public final class QuestUtilCards {
|
||||
filter = Predicates.and(CardEdition.Predicates.CAN_MAKE_BOOSTER, isLegalInQuestFormat(qc.getFormat()));
|
||||
}
|
||||
Iterable<CardEdition> rightEditions = Iterables.filter(Singletons.getModel().getEditions(), filter);
|
||||
this.qa.getShopList().add(BoosterPack.FN_FROM_SET.apply(Aggregates.random(rightEditions)), 1);
|
||||
this.qa.getShopList().add(BoosterPack.FN_FROM_SET.apply(Aggregates.random(rightEditions)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -551,7 +551,7 @@ public class QuestDataIO {
|
||||
final String nodename = reader.getNodeName();
|
||||
|
||||
if ("string".equals(nodename)) {
|
||||
result.add(CardDb.instance().getCard(reader.getValue()), cnt);
|
||||
result.add(CardDb.instance().getCard(reader.getValue()));
|
||||
} else if ("card".equals(nodename)) { // new format
|
||||
result.add(this.readCardPrinted(reader), cnt);
|
||||
} else if ("booster".equals(nodename)) {
|
||||
@@ -631,7 +631,7 @@ public class QuestDataIO {
|
||||
final String nodename = reader.getNodeName();
|
||||
|
||||
if ("string".equals(nodename)) {
|
||||
result.add(CardDb.instance().getCard(reader.getValue()), cnt);
|
||||
result.add(CardDb.instance().getCard(reader.getValue()));
|
||||
} else if ("card".equals(nodename)) { // new format
|
||||
result.add(this.readCardPrinted(reader), cnt);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user