mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Class rename, as voted on http://www.slightlymagic.net/forum/viewtopic.php?f=52&t=9700
This commit is contained in:
4
.gitattributes
vendored
4
.gitattributes
vendored
@@ -14565,8 +14565,6 @@ src/main/java/forge/gui/toolbox/SaveOpenDialog.java -text
|
||||
src/main/java/forge/gui/toolbox/package-info.java svneol=native#text/plain
|
||||
src/main/java/forge/item/BoosterPack.java -text
|
||||
src/main/java/forge/item/CardDb.java -text
|
||||
src/main/java/forge/item/CardPrinted.java -text
|
||||
src/main/java/forge/item/CardToken.java -text
|
||||
src/main/java/forge/item/FatPack.java -text
|
||||
src/main/java/forge/item/IPaperCard.java -text
|
||||
src/main/java/forge/item/InventoryItem.java -text
|
||||
@@ -14575,6 +14573,8 @@ src/main/java/forge/item/ItemPool.java -text
|
||||
src/main/java/forge/item/ItemPoolView.java -text
|
||||
src/main/java/forge/item/ItemPredicate.java -text
|
||||
src/main/java/forge/item/OpenablePack.java -text
|
||||
src/main/java/forge/item/PaperCard.java -text
|
||||
src/main/java/forge/item/PaperToken.java -text
|
||||
src/main/java/forge/item/PreconDeck.java -text
|
||||
src/main/java/forge/item/PrintSheet.java -text
|
||||
src/main/java/forge/item/TournamentPack.java -text
|
||||
|
||||
@@ -39,8 +39,8 @@ import forge.card.CardSplitType;
|
||||
import forge.game.player.IHasIcon;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.item.BoosterPack;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.CardToken;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.PaperToken;
|
||||
import forge.item.FatPack;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.item.PreconDeck;
|
||||
@@ -215,8 +215,8 @@ public class ImageCache {
|
||||
// Inventory items don't have to know how a certain client should draw them.
|
||||
// That's why this method is not encapsulated and overloaded in the InventoryItem descendants
|
||||
public static String getImageKey(InventoryItem ii, boolean altState) {
|
||||
if ( ii instanceof CardPrinted )
|
||||
return getImageKey((CardPrinted)ii, altState, true);
|
||||
if ( ii instanceof PaperCard )
|
||||
return getImageKey((PaperCard)ii, altState, true);
|
||||
if ( ii instanceof TournamentPack )
|
||||
return ImageCache.TOURNAMENTPACK_PREFIX + ((TournamentPack)ii).getEdition();
|
||||
if ( ii instanceof BoosterPack ) {
|
||||
@@ -228,12 +228,12 @@ public class ImageCache {
|
||||
return ImageCache.FATPACK_PREFIX + ((FatPack)ii).getEdition();
|
||||
if ( ii instanceof PreconDeck )
|
||||
return ImageCache.PRECON_PREFIX + ((PreconDeck)ii).getImageFilename();
|
||||
if ( ii instanceof CardToken )
|
||||
return ImageCache.TOKEN_PREFIX + ((CardToken)ii).getImageFilename();
|
||||
if ( ii instanceof PaperToken )
|
||||
return ImageCache.TOKEN_PREFIX + ((PaperToken)ii).getImageFilename();
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String getImageLocator(CardPrinted cp, boolean backFace, boolean includeSet, boolean isDownloadUrl) {
|
||||
private static String getImageLocator(PaperCard cp, boolean backFace, boolean includeSet, boolean isDownloadUrl) {
|
||||
final String nameToUse = getNameToUse(cp, backFace);
|
||||
if ( null == nameToUse )
|
||||
return null;
|
||||
@@ -290,7 +290,7 @@ public class ImageCache {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean hasBackFacePicture(CardPrinted cp) {
|
||||
public static boolean hasBackFacePicture(PaperCard cp) {
|
||||
CardSplitType cst = cp.getRules().getSplitType();
|
||||
return cst == CardSplitType.Transform || cst == CardSplitType.Flip;
|
||||
}
|
||||
@@ -301,7 +301,7 @@ public class ImageCache {
|
||||
: NewConstants.CACHE_CARD_PICS_SUBDIR.get(edition); // may use custom paths though
|
||||
}
|
||||
|
||||
private static String getNameToUse(CardPrinted cp, boolean backFace) {
|
||||
private static String getNameToUse(PaperCard cp, boolean backFace) {
|
||||
final CardRules card = cp.getRules();
|
||||
if (backFace ) {
|
||||
if ( hasBackFacePicture(cp) )
|
||||
@@ -315,11 +315,11 @@ public class ImageCache {
|
||||
}
|
||||
}
|
||||
|
||||
public static String getImageKey(CardPrinted cp, boolean backFace, boolean includeSet) {
|
||||
public static String getImageKey(PaperCard cp, boolean backFace, boolean includeSet) {
|
||||
return getImageLocator(cp, backFace, includeSet, false);
|
||||
}
|
||||
|
||||
public static String getDownloadUrl(CardPrinted cp, boolean backFace) {
|
||||
public static String getDownloadUrl(PaperCard cp, boolean backFace) {
|
||||
return getImageLocator(cp, backFace, true, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ import com.google.common.collect.Lists;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.IPaperCard;
|
||||
import forge.item.PrintSheet;
|
||||
import forge.util.TextUtil;
|
||||
@@ -70,8 +70,8 @@ public class BoosterGenerator {
|
||||
return cachedSheets.get(key);
|
||||
}
|
||||
|
||||
public static final List<CardPrinted> getBoosterPack(SealedProductTemplate booster) {
|
||||
List<CardPrinted> result = new ArrayList<CardPrinted>();
|
||||
public static final List<PaperCard> getBoosterPack(SealedProductTemplate booster) {
|
||||
List<PaperCard> result = new ArrayList<PaperCard>();
|
||||
for(Pair<String, Integer> slot : booster.getSlots()) {
|
||||
String slotType = slot.getLeft(); // add expansion symbol here?
|
||||
int numCards = slot.getRight().intValue();
|
||||
@@ -87,13 +87,13 @@ public class BoosterGenerator {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static final PrintSheet makeSheet(String sheetKey, Iterable<CardPrinted> src) {
|
||||
public static final PrintSheet makeSheet(String sheetKey, Iterable<PaperCard> src) {
|
||||
PrintSheet ps = new PrintSheet(sheetKey);
|
||||
String[] sKey = TextUtil.splitWithParenthesis(sheetKey, ' ', 2);
|
||||
Predicate<CardPrinted> setPred = (Predicate<CardPrinted>) (sKey.length > 1 ? IPaperCard.Predicates.printedInSets(sKey[1].split(" ")) : Predicates.alwaysTrue());
|
||||
Predicate<PaperCard> setPred = (Predicate<PaperCard>) (sKey.length > 1 ? IPaperCard.Predicates.printedInSets(sKey[1].split(" ")) : Predicates.alwaysTrue());
|
||||
|
||||
List<String> operators = new LinkedList<String>(Arrays.asList(TextUtil.splitWithParenthesis(sKey[0], ':')));
|
||||
Predicate<CardPrinted> extraPred = buildExtraPredicate(operators);
|
||||
Predicate<PaperCard> extraPred = buildExtraPredicate(operators);
|
||||
|
||||
// source replacement operators - if one is applied setPredicate will be ignored
|
||||
Iterator<String> itMod = operators.iterator();
|
||||
@@ -107,7 +107,7 @@ public class BoosterGenerator {
|
||||
} else if (mainCode.startsWith("promo")) { // get exactly the named cards, that's a tiny inlined print sheet
|
||||
String list = StringUtils.strip(mainCode.substring(5), "() ");
|
||||
String[] cardNames = TextUtil.splitWithParenthesis(list, ',', '"', '"');
|
||||
List<CardPrinted> srcList = new ArrayList<CardPrinted>();
|
||||
List<PaperCard> srcList = new ArrayList<PaperCard>();
|
||||
for(String cardName: cardNames)
|
||||
srcList.add(CardDb.instance().getCard(cardName));
|
||||
src = srcList;
|
||||
@@ -123,24 +123,24 @@ public class BoosterGenerator {
|
||||
String mainCode = operators.isEmpty() ? null : operators.get(0).trim();
|
||||
|
||||
if( null == mainCode || mainCode.equalsIgnoreCase(ANY) ) { // no restriction on rarity
|
||||
Predicate<CardPrinted> predicate = Predicates.and(setPred, extraPred);
|
||||
Predicate<PaperCard> predicate = Predicates.and(setPred, extraPred);
|
||||
ps.addAll(Iterables.filter(src, predicate));
|
||||
|
||||
} else if ( mainCode.equalsIgnoreCase(UNCOMMON_RARE) ) { // for sets like ARN, where U1 cards are considered rare and U3 are uncommon
|
||||
Predicate<CardPrinted> predicateRares = Predicates.and(setPred, IPaperCard.Predicates.Presets.IS_RARE, extraPred);
|
||||
Predicate<PaperCard> predicateRares = Predicates.and(setPred, IPaperCard.Predicates.Presets.IS_RARE, extraPred);
|
||||
ps.addAll(Iterables.filter(src, predicateRares));
|
||||
|
||||
Predicate<CardPrinted> predicateUncommon = Predicates.and( setPred, IPaperCard.Predicates.Presets.IS_UNCOMMON, extraPred);
|
||||
Predicate<PaperCard> predicateUncommon = Predicates.and( setPred, IPaperCard.Predicates.Presets.IS_UNCOMMON, extraPred);
|
||||
ps.addAll(Iterables.filter(src, predicateUncommon), 3);
|
||||
|
||||
} else if ( mainCode.equalsIgnoreCase(RARE_MYTHIC) ) {
|
||||
// Typical ratio of rares to mythics is 53:15, changing to 35:10 in smaller sets.
|
||||
// To achieve the desired 1:8 are all mythics are added once, and all rares added twice per print sheet.
|
||||
|
||||
Predicate<CardPrinted> predicateMythic = Predicates.and( setPred, IPaperCard.Predicates.Presets.IS_MYTHIC_RARE, extraPred);
|
||||
Predicate<PaperCard> predicateMythic = Predicates.and( setPred, IPaperCard.Predicates.Presets.IS_MYTHIC_RARE, extraPred);
|
||||
ps.addAll(Iterables.filter(src, predicateMythic));
|
||||
|
||||
Predicate<CardPrinted> predicateRare = Predicates.and( setPred, IPaperCard.Predicates.Presets.IS_RARE, extraPred);
|
||||
Predicate<PaperCard> predicateRare = Predicates.and( setPred, IPaperCard.Predicates.Presets.IS_RARE, extraPred);
|
||||
ps.addAll(Iterables.filter(src, predicateRare), 2);
|
||||
} else
|
||||
throw new IllegalArgumentException("Booster generator: operator could not be parsed - " + mainCode);
|
||||
@@ -150,8 +150,8 @@ public class BoosterGenerator {
|
||||
/**
|
||||
* This method also modifies passed parameter
|
||||
*/
|
||||
private static Predicate<CardPrinted> buildExtraPredicate(List<String> operators) {
|
||||
List<Predicate<CardPrinted>> conditions = new ArrayList<Predicate<CardPrinted>>();
|
||||
private static Predicate<PaperCard> buildExtraPredicate(List<String> operators) {
|
||||
List<Predicate<PaperCard>> conditions = new ArrayList<Predicate<PaperCard>>();
|
||||
|
||||
Iterator<String> itOp = operators.iterator();
|
||||
while(itOp.hasNext()) {
|
||||
@@ -167,9 +167,9 @@ public class BoosterGenerator {
|
||||
boolean invert = operator.charAt(0) == '!';
|
||||
if( invert ) operator = operator.substring(1);
|
||||
|
||||
Predicate<CardPrinted> toAdd = null;
|
||||
if( operator.equalsIgnoreCase("dfc") ) { toAdd = Predicates.compose(CardRulesPredicates.splitType(CardSplitType.Transform), CardPrinted.FN_GET_RULES);
|
||||
} else if ( operator.equalsIgnoreCase(LAND) ) { toAdd = Predicates.compose(CardRulesPredicates.Presets.IS_LAND, CardPrinted.FN_GET_RULES);
|
||||
Predicate<PaperCard> toAdd = null;
|
||||
if( operator.equalsIgnoreCase("dfc") ) { toAdd = Predicates.compose(CardRulesPredicates.splitType(CardSplitType.Transform), PaperCard.FN_GET_RULES);
|
||||
} else if ( operator.equalsIgnoreCase(LAND) ) { toAdd = Predicates.compose(CardRulesPredicates.Presets.IS_LAND, PaperCard.FN_GET_RULES);
|
||||
} else if ( operator.equalsIgnoreCase(BASIC_LAND)) { toAdd = IPaperCard.Predicates.Presets.IS_BASIC_LAND;
|
||||
} else if ( operator.equalsIgnoreCase(TIME_SHIFTED)) { toAdd = IPaperCard.Predicates.Presets.IS_SPECIAL;
|
||||
} else if ( operator.equalsIgnoreCase(MYTHIC)) { toAdd = IPaperCard.Predicates.Presets.IS_MYTHIC_RARE;
|
||||
|
||||
@@ -28,7 +28,7 @@ import com.google.common.base.Function;
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.IPaperCard;
|
||||
import forge.util.TextUtil;
|
||||
import forge.util.storage.StorageReaderFile;
|
||||
@@ -48,7 +48,7 @@ public final class CardBlock implements Comparable<CardBlock> {
|
||||
private final CardEdition landSet;
|
||||
private final int cntBoostersDraft;
|
||||
private final int cntBoostersSealed;
|
||||
private Predicate<CardPrinted> filter = null;
|
||||
private Predicate<PaperCard> filter = null;
|
||||
|
||||
/**
|
||||
* Instantiates a new card block.
|
||||
@@ -131,14 +131,14 @@ public final class CardBlock implements Comparable<CardBlock> {
|
||||
*
|
||||
* @return the filter
|
||||
*/
|
||||
public Predicate<CardPrinted> getFilter() {
|
||||
public Predicate<PaperCard> getFilter() {
|
||||
if (this.filter == null) {
|
||||
this.filter = this.buildFilter();
|
||||
}
|
||||
return this.filter;
|
||||
}
|
||||
|
||||
private Predicate<CardPrinted> buildFilter() {
|
||||
private Predicate<PaperCard> buildFilter() {
|
||||
final List<String> setCodes = new ArrayList<String>();
|
||||
for (final CardEdition set : this.sets) {
|
||||
setCodes.add(set.getCode());
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.util.PredicateString.StringOp;
|
||||
|
||||
/**
|
||||
@@ -80,36 +80,36 @@ public class DeckHints {
|
||||
* list of cards to be filtered
|
||||
* @return List<Card> of Cards that match this DeckHints.
|
||||
*/
|
||||
public List<CardPrinted> filter(Iterable<CardPrinted> cardList) {
|
||||
List<CardPrinted> ret;
|
||||
public List<PaperCard> filter(Iterable<PaperCard> cardList) {
|
||||
List<PaperCard> ret;
|
||||
switch (type) {
|
||||
case TYPE:
|
||||
ret = new ArrayList<CardPrinted>();
|
||||
ret = new ArrayList<PaperCard>();
|
||||
String[] types = filterParam.split("\\|");
|
||||
for (String type : types) {
|
||||
addMatchingItems(ret, cardList, CardRulesPredicates.subType(type), CardPrinted.FN_GET_RULES);
|
||||
addMatchingItems(ret, cardList, CardRulesPredicates.subType(type), PaperCard.FN_GET_RULES);
|
||||
}
|
||||
break;
|
||||
case COLOR:
|
||||
ret = new ArrayList<CardPrinted>();
|
||||
ret = new ArrayList<PaperCard>();
|
||||
String[] colors = filterParam.split("\\|");
|
||||
for (String color : colors) {
|
||||
ColorSet cc = ColorSet.fromNames(color);
|
||||
addMatchingItems(ret, cardList, CardRulesPredicates.isColor(cc.getColor()), CardPrinted.FN_GET_RULES);
|
||||
addMatchingItems(ret, cardList, CardRulesPredicates.isColor(cc.getColor()), PaperCard.FN_GET_RULES);
|
||||
}
|
||||
break;
|
||||
case KEYWORD:
|
||||
ret = new ArrayList<CardPrinted>();
|
||||
ret = new ArrayList<PaperCard>();
|
||||
String[] keywords = filterParam.split("\\|");
|
||||
for (String keyword : keywords) {
|
||||
addMatchingItems(ret, cardList, CardRulesPredicates.hasKeyword(keyword), CardPrinted.FN_GET_RULES);
|
||||
addMatchingItems(ret, cardList, CardRulesPredicates.hasKeyword(keyword), PaperCard.FN_GET_RULES);
|
||||
}
|
||||
break;
|
||||
case NAME:
|
||||
ret = new ArrayList<CardPrinted>();
|
||||
ret = new ArrayList<PaperCard>();
|
||||
String[] names = filterParam.split("\\|");
|
||||
for (String name : names) {
|
||||
addMatchingItems(ret, cardList, CardRulesPredicates.name(StringOp.EQUALS, name), CardPrinted.FN_GET_RULES);
|
||||
addMatchingItems(ret, cardList, CardRulesPredicates.name(StringOp.EQUALS, name), PaperCard.FN_GET_RULES);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -4,13 +4,13 @@ import java.util.List;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
|
||||
/**
|
||||
* TODO: Write javadoc for this type.
|
||||
*
|
||||
*/
|
||||
|
||||
public interface IUnOpenedProduct extends Supplier<List<CardPrinted>> {
|
||||
public List<CardPrinted> get();
|
||||
public interface IUnOpenedProduct extends Supplier<List<PaperCard>> {
|
||||
public List<PaperCard> get();
|
||||
}
|
||||
@@ -24,7 +24,7 @@ import java.util.List;
|
||||
import com.google.common.base.Predicate;
|
||||
import forge.Singletons;
|
||||
import forge.game.limited.CustomLimited;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.IPaperCard;
|
||||
import forge.util.FileUtil;
|
||||
|
||||
@@ -173,7 +173,7 @@ public class MetaSet {
|
||||
return new UnOpenedProduct(Singletons.getModel().getTournamentPacks().get(data));
|
||||
|
||||
case JoinedSet:
|
||||
Predicate<CardPrinted> predicate = IPaperCard.Predicates.printedInSets(data.split(" "));
|
||||
Predicate<PaperCard> predicate = IPaperCard.Predicates.printedInSets(data.split(" "));
|
||||
return new UnOpenedProduct(BoosterTemplate.genericBooster, predicate);
|
||||
|
||||
case Choose: return UnOpenedMeta.choose(data);
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import forge.gui.GuiChoose;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.util.MyRandom;
|
||||
import forge.util.TextUtil;
|
||||
|
||||
@@ -66,7 +66,7 @@ public class UnOpenedMeta implements IUnOpenedProduct {
|
||||
* @return List, list of cards.
|
||||
*/
|
||||
@Override
|
||||
public List<CardPrinted> get() {
|
||||
public List<PaperCard> get() {
|
||||
return this.open(true);
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class UnOpenedMeta implements IUnOpenedProduct {
|
||||
* known partialities for the AI.
|
||||
* @return List, list of cards.
|
||||
*/
|
||||
public List<CardPrinted> open(final boolean isHuman) {
|
||||
public List<PaperCard> open(final boolean isHuman) {
|
||||
|
||||
if (metaSets.isEmpty()) {
|
||||
throw new RuntimeException("Empty UnOpenedMetaset, cannot generate booster.");
|
||||
@@ -97,7 +97,7 @@ public class UnOpenedMeta implements IUnOpenedProduct {
|
||||
return newBooster.get();
|
||||
|
||||
case SelectAll:
|
||||
List<CardPrinted> allCards = new ArrayList<CardPrinted>();
|
||||
List<PaperCard> allCards = new ArrayList<PaperCard>();
|
||||
for (MetaSet ms : metaSets) {
|
||||
allCards.addAll(ms.getBooster().get());
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.ItemPoolView;
|
||||
import forge.item.PrintSheet;
|
||||
|
||||
@@ -37,41 +37,41 @@ public class UnOpenedProduct implements IUnOpenedProduct {
|
||||
}
|
||||
|
||||
// Invoke this constructor only if you are sure that the pool is not equal to deafult carddb
|
||||
public UnOpenedProduct(SealedProductTemplate template, ItemPoolView<CardPrinted> pool) {
|
||||
public UnOpenedProduct(SealedProductTemplate template, ItemPoolView<PaperCard> pool) {
|
||||
this(template, pool.toFlatList());
|
||||
}
|
||||
|
||||
public UnOpenedProduct(SealedProductTemplate template, Iterable<CardPrinted> cards) {
|
||||
public UnOpenedProduct(SealedProductTemplate template, Iterable<PaperCard> cards) {
|
||||
tpl = template;
|
||||
sheets = new TreeMap<String, PrintSheet>();
|
||||
prebuildSheets(cards);
|
||||
}
|
||||
|
||||
public UnOpenedProduct(SealedProductTemplate sealedProductTemplate, Predicate<CardPrinted> filterPrinted) {
|
||||
public UnOpenedProduct(SealedProductTemplate sealedProductTemplate, Predicate<PaperCard> filterPrinted) {
|
||||
this(sealedProductTemplate, Iterables.filter(CardDb.instance().getAllCards(), filterPrinted));
|
||||
}
|
||||
|
||||
private void prebuildSheets(Iterable<CardPrinted> sourceList) {
|
||||
private void prebuildSheets(Iterable<PaperCard> sourceList) {
|
||||
for(Pair<String, Integer> cc : tpl.getSlots()) {
|
||||
sheets.put(cc.getKey(), BoosterGenerator.makeSheet(cc.getKey(), sourceList));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CardPrinted> get() {
|
||||
public List<PaperCard> get() {
|
||||
return sheets == null ? BoosterGenerator.getBoosterPack(tpl) : getBoosterPack();
|
||||
}
|
||||
|
||||
// If they request cards from an arbitrary pool, there's no use to cache printsheets.
|
||||
private final List<CardPrinted> getBoosterPack() {
|
||||
List<CardPrinted> result = new ArrayList<CardPrinted>();
|
||||
private final List<PaperCard> getBoosterPack() {
|
||||
List<PaperCard> result = new ArrayList<PaperCard>();
|
||||
for(Pair<String, Integer> slot : tpl.getSlots()) {
|
||||
PrintSheet ps = sheets.get(slot.getLeft());
|
||||
if(ps.isEmpty() && poolLimited ) {
|
||||
throw new IllegalStateException("The cardpool has been depleted and has no more cards for slot " + slot.getKey());
|
||||
}
|
||||
|
||||
List<CardPrinted> foundCards = ps.random(slot.getRight().intValue(), true);
|
||||
List<PaperCard> foundCards = ps.random(slot.getRight().intValue(), true);
|
||||
if(poolLimited)
|
||||
ps.removeAll(foundCards);
|
||||
result.addAll(foundCards);
|
||||
|
||||
@@ -24,7 +24,7 @@ import forge.game.player.Player;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.gui.GuiChoose;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.util.Aggregates;
|
||||
import forge.util.ComparableOp;
|
||||
|
||||
@@ -70,9 +70,9 @@ public class ChooseCardNameEffect extends SpellAbilityEffect {
|
||||
|
||||
Predicate<CardRules> additionalRule = CardRulesPredicates.cmc(ComparableOp.EQUALS, validAmount);
|
||||
|
||||
List<CardPrinted> cards = Lists.newArrayList(CardDb.instance().getUniqueCards());
|
||||
Predicate<CardPrinted> cpp = Predicates.and(Predicates.compose(baseRule, CardPrinted.FN_GET_RULES),
|
||||
Predicates.compose(additionalRule, CardPrinted.FN_GET_RULES));
|
||||
List<PaperCard> cards = Lists.newArrayList(CardDb.instance().getUniqueCards());
|
||||
Predicate<PaperCard> cpp = Predicates.and(Predicates.compose(baseRule, PaperCard.FN_GET_RULES),
|
||||
Predicates.compose(additionalRule, PaperCard.FN_GET_RULES));
|
||||
cards = Lists.newArrayList(Iterables.filter(cards, cpp));
|
||||
if (!cards.isEmpty()) {
|
||||
host.setNamedCard(Aggregates.random(cards).getName());
|
||||
@@ -83,31 +83,31 @@ public class ChooseCardNameEffect extends SpellAbilityEffect {
|
||||
} else if (p.isHuman()) {
|
||||
final String message = validDesc.equals("card") ? "Name a card" : "Name a " + validDesc + " card.";
|
||||
|
||||
List<CardPrinted> cards = Lists.newArrayList(CardDb.instance().getUniqueCards());
|
||||
List<PaperCard> cards = Lists.newArrayList(CardDb.instance().getUniqueCards());
|
||||
if ( StringUtils.containsIgnoreCase(valid, "nonland") )
|
||||
{
|
||||
Predicate<CardPrinted> cpp = Predicates.compose(CardRulesPredicates.Presets.IS_NON_LAND, CardPrinted.FN_GET_RULES);
|
||||
Predicate<PaperCard> cpp = Predicates.compose(CardRulesPredicates.Presets.IS_NON_LAND, PaperCard.FN_GET_RULES);
|
||||
cards = Lists.newArrayList(Iterables.filter(cards, cpp));
|
||||
}
|
||||
if ( StringUtils.containsIgnoreCase(valid, "nonbasic") )
|
||||
{
|
||||
Predicate<CardPrinted> cpp = Predicates.compose(Predicates.not(CardRulesPredicates.Presets.IS_BASIC_LAND), CardPrinted.FN_GET_RULES);
|
||||
Predicate<PaperCard> cpp = Predicates.compose(Predicates.not(CardRulesPredicates.Presets.IS_BASIC_LAND), PaperCard.FN_GET_RULES);
|
||||
cards = Lists.newArrayList(Iterables.filter(cards, cpp));
|
||||
}
|
||||
if ( StringUtils.containsIgnoreCase(valid, "noncreature") )
|
||||
{
|
||||
Predicate<CardPrinted> cpp = Predicates.compose(Predicates.not(CardRulesPredicates.Presets.IS_CREATURE), CardPrinted.FN_GET_RULES);
|
||||
Predicate<PaperCard> cpp = Predicates.compose(Predicates.not(CardRulesPredicates.Presets.IS_CREATURE), PaperCard.FN_GET_RULES);
|
||||
cards = Lists.newArrayList(Iterables.filter(cards, cpp));
|
||||
}
|
||||
else if ( StringUtils.containsIgnoreCase(valid, "creature") )
|
||||
{
|
||||
Predicate<CardPrinted> cpp = Predicates.compose(CardRulesPredicates.Presets.IS_CREATURE, CardPrinted.FN_GET_RULES);
|
||||
Predicate<PaperCard> cpp = Predicates.compose(CardRulesPredicates.Presets.IS_CREATURE, PaperCard.FN_GET_RULES);
|
||||
cards = Lists.newArrayList(Iterables.filter(cards, cpp));
|
||||
}
|
||||
|
||||
Collections.sort(cards);
|
||||
|
||||
CardPrinted cp = GuiChoose.one(message, cards);
|
||||
PaperCard cp = GuiChoose.one(message, cards);
|
||||
if (cp.getMatchingForgeCard().isValid(valid, host.getController(), host)) {
|
||||
host.setNamedCard(cp.getName());
|
||||
ok = true;
|
||||
|
||||
@@ -31,7 +31,7 @@ import forge.game.player.Player;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.gui.GuiChoose;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.util.Aggregates;
|
||||
import forge.util.PredicateString.StringOp;
|
||||
|
||||
@@ -73,26 +73,26 @@ public class CopyPermanentEffect extends SpellAbilityEffect {
|
||||
final Target tgt = sa.getTarget();
|
||||
|
||||
if (sa.hasParam("ValidSupportedCopy")) {
|
||||
List<CardPrinted> cards = Lists.newArrayList(CardDb.instance().getUniqueCards());
|
||||
List<PaperCard> cards = Lists.newArrayList(CardDb.instance().getUniqueCards());
|
||||
String valid = sa.getParam("ValidSupportedCopy");
|
||||
if (valid.contains("X")) {
|
||||
valid = valid.replace("X", Integer.toString(AbilityUtils.calculateAmount(hostCard, "X", sa)));
|
||||
}
|
||||
if (StringUtils.containsIgnoreCase(valid, "creature")) {
|
||||
Predicate<CardPrinted> cpp = Predicates.compose(CardRulesPredicates.Presets.IS_CREATURE, CardPrinted.FN_GET_RULES);
|
||||
Predicate<PaperCard> cpp = Predicates.compose(CardRulesPredicates.Presets.IS_CREATURE, PaperCard.FN_GET_RULES);
|
||||
cards = Lists.newArrayList(Iterables.filter(cards, cpp));
|
||||
}
|
||||
if (StringUtils.containsIgnoreCase(valid, "equipment")) {
|
||||
Predicate<CardPrinted> cpp = Predicates.compose(CardRulesPredicates.Presets.IS_EQUIPMENT, CardPrinted.FN_GET_RULES);
|
||||
Predicate<PaperCard> cpp = Predicates.compose(CardRulesPredicates.Presets.IS_EQUIPMENT, PaperCard.FN_GET_RULES);
|
||||
cards = Lists.newArrayList(Iterables.filter(cards, cpp));
|
||||
}
|
||||
if (sa.hasParam("RandomCopied")) {
|
||||
List<CardPrinted> copysource = new ArrayList<CardPrinted>(cards);
|
||||
List<PaperCard> copysource = new ArrayList<PaperCard>(cards);
|
||||
List<Card> choice = new ArrayList<Card>();
|
||||
final String num = sa.hasParam("RandomNum") ? sa.getParam("RandomNum") : "1";
|
||||
int ncopied = AbilityUtils.calculateAmount(hostCard, num, sa);
|
||||
while(ncopied > 0) {
|
||||
final CardPrinted cp = Aggregates.random(copysource);
|
||||
final PaperCard cp = Aggregates.random(copysource);
|
||||
if (cp.getMatchingForgeCard().isValid(valid, hostCard.getController(), hostCard)) {
|
||||
choice.add(cp.getMatchingForgeCard());
|
||||
copysource.remove(cp);
|
||||
@@ -108,7 +108,7 @@ public class CopyPermanentEffect extends SpellAbilityEffect {
|
||||
}
|
||||
}
|
||||
|
||||
Predicate<CardPrinted> cpp = Predicates.compose(CardRulesPredicates.name(StringOp.EQUALS, name), CardPrinted.FN_GET_RULES);
|
||||
Predicate<PaperCard> cpp = Predicates.compose(CardRulesPredicates.name(StringOp.EQUALS, name), PaperCard.FN_GET_RULES);
|
||||
cards = Lists.newArrayList(Iterables.filter(cards, cpp));
|
||||
|
||||
tgtCards.clear();
|
||||
|
||||
@@ -28,7 +28,7 @@ import forge.game.zone.ZoneType;
|
||||
import forge.gui.GuiChoose;
|
||||
import forge.gui.GuiDialog;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.util.Aggregates;
|
||||
|
||||
public class PlayEffect extends SpellAbilityEffect {
|
||||
@@ -87,23 +87,23 @@ public class PlayEffect extends SpellAbilityEffect {
|
||||
useEncoded = true;
|
||||
}
|
||||
else if (sa.hasParam("AnySupportedCard")) {
|
||||
List<CardPrinted> cards = Lists.newArrayList(CardDb.instance().getUniqueCards());
|
||||
List<PaperCard> cards = Lists.newArrayList(CardDb.instance().getUniqueCards());
|
||||
String valid = sa.getParam("AnySupportedCard");
|
||||
if (StringUtils.containsIgnoreCase(valid, "sorcery")) {
|
||||
Predicate<CardPrinted> cpp = Predicates.compose(CardRulesPredicates.Presets.IS_SORCERY, CardPrinted.FN_GET_RULES);
|
||||
Predicate<PaperCard> cpp = Predicates.compose(CardRulesPredicates.Presets.IS_SORCERY, PaperCard.FN_GET_RULES);
|
||||
cards = Lists.newArrayList(Iterables.filter(cards, cpp));
|
||||
}
|
||||
if (StringUtils.containsIgnoreCase(valid, "instant")) {
|
||||
Predicate<CardPrinted> cpp = Predicates.compose(CardRulesPredicates.Presets.IS_INSTANT, CardPrinted.FN_GET_RULES);
|
||||
Predicate<PaperCard> cpp = Predicates.compose(CardRulesPredicates.Presets.IS_INSTANT, PaperCard.FN_GET_RULES);
|
||||
cards = Lists.newArrayList(Iterables.filter(cards, cpp));
|
||||
}
|
||||
if (sa.hasParam("RandomCopied")) {
|
||||
List<CardPrinted> copysource = new ArrayList<CardPrinted>(cards);
|
||||
List<PaperCard> copysource = new ArrayList<PaperCard>(cards);
|
||||
List<Card> choice = new ArrayList<Card>();
|
||||
final String num = sa.hasParam("RandomNum") ? sa.getParam("RandomNum") : "1";
|
||||
int ncopied = AbilityUtils.calculateAmount(source, num, sa);
|
||||
while(ncopied > 0) {
|
||||
final CardPrinted cp = Aggregates.random(copysource);
|
||||
final PaperCard cp = Aggregates.random(copysource);
|
||||
if (cp.getMatchingForgeCard().isValid(valid, source.getController(), source)) {
|
||||
choice.add(cp.getMatchingForgeCard());
|
||||
copysource.remove(cp);
|
||||
|
||||
@@ -34,7 +34,7 @@ import forge.game.Game;
|
||||
import forge.game.event.GameEventTokenCreated;
|
||||
import forge.game.player.Player;
|
||||
import forge.gui.GuiChoose;
|
||||
import forge.item.CardToken;
|
||||
import forge.item.PaperToken;
|
||||
|
||||
public class TokenEffect extends SpellAbilityEffect {
|
||||
|
||||
@@ -71,7 +71,7 @@ public class TokenEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
if (mapParams.hasParam("TokenImage")) {
|
||||
image = CardToken.makeTokenFileName(mapParams.getParam("TokenImage"));
|
||||
image = PaperToken.makeTokenFileName(mapParams.getParam("TokenImage"));
|
||||
} else {
|
||||
image = "";
|
||||
}
|
||||
@@ -177,7 +177,7 @@ public class TokenEffect extends SpellAbilityEffect {
|
||||
|
||||
final String imageName;
|
||||
if (this.tokenImage.equals("")) {
|
||||
imageName = CardToken.makeTokenFileName(colorDesc.replace(" ", ""), tokenPower, tokenToughness, tokenName);
|
||||
imageName = PaperToken.makeTokenFileName(colorDesc.replace(" ", ""), tokenPower, tokenToughness, tokenName);
|
||||
} else {
|
||||
imageName = this.tokenImage;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ import forge.card.trigger.Trigger;
|
||||
import forge.card.trigger.TriggerHandler;
|
||||
import forge.game.player.Player;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.IPaperCard;
|
||||
|
||||
/**
|
||||
@@ -251,7 +251,7 @@ public class CardFactory {
|
||||
c.setState(CardCharacteristicName.Flipped);
|
||||
c.setImageKey(ImageCache.getImageKey(cp, true));
|
||||
}
|
||||
else if (c.isDoubleFaced() && cp instanceof CardPrinted) {
|
||||
else if (c.isDoubleFaced() && cp instanceof PaperCard) {
|
||||
c.setState(CardCharacteristicName.Transformed);
|
||||
c.setImageKey(ImageCache.getImageKey(cp, true));
|
||||
}
|
||||
|
||||
@@ -28,20 +28,20 @@ import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import forge.Card;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.ItemPool;
|
||||
|
||||
/**
|
||||
* Deck section.
|
||||
*
|
||||
*/
|
||||
public class CardPool extends ItemPool<CardPrinted> {
|
||||
public class CardPool extends ItemPool<PaperCard> {
|
||||
|
||||
/**
|
||||
* Instantiates a new deck section.
|
||||
*/
|
||||
public CardPool() {
|
||||
super(CardPrinted.class);
|
||||
super(PaperCard.class);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -49,7 +49,7 @@ public class CardPool extends ItemPool<CardPrinted> {
|
||||
*
|
||||
* @param cards the cards
|
||||
*/
|
||||
public CardPool(final Iterable<Entry<CardPrinted, Integer>> cards) {
|
||||
public CardPool(final Iterable<Entry<PaperCard, Integer>> cards) {
|
||||
this();
|
||||
this.addAll(cards);
|
||||
}
|
||||
@@ -84,7 +84,7 @@ public class CardPool extends ItemPool<CardPrinted> {
|
||||
* @param amount the amount
|
||||
*/
|
||||
public void add(final String cardName, final String setCode, final int amount) {
|
||||
CardPrinted cp = CardDb.instance().tryGetCard(cardName, setCode);
|
||||
PaperCard cp = CardDb.instance().tryGetCard(cardName, setCode);
|
||||
if ( cp == null )
|
||||
cp = CardDb.variants().tryGetCard(cardName, setCode);
|
||||
|
||||
@@ -112,8 +112,8 @@ public class CardPool extends ItemPool<CardPrinted> {
|
||||
* @param list
|
||||
* CardPrinteds to add
|
||||
*/
|
||||
public void add(final Iterable<CardPrinted> list) {
|
||||
for (CardPrinted cp : list) {
|
||||
public void add(final Iterable<PaperCard> list) {
|
||||
for (PaperCard cp : list) {
|
||||
this.add(cp);
|
||||
}
|
||||
}
|
||||
@@ -124,7 +124,7 @@ public class CardPool extends ItemPool<CardPrinted> {
|
||||
* @param cardName the card name
|
||||
*/
|
||||
public void add(final String cardName, int cnt) {
|
||||
CardPrinted cp = CardDb.instance().tryGetCard(cardName);
|
||||
PaperCard cp = CardDb.instance().tryGetCard(cardName);
|
||||
if ( cp == null )
|
||||
cp = CardDb.variants().tryGetCard(cardName);
|
||||
|
||||
@@ -139,8 +139,8 @@ public class CardPool extends ItemPool<CardPrinted> {
|
||||
* @param i
|
||||
* @return
|
||||
*/
|
||||
public CardPrinted get(int n) {
|
||||
for(Entry<CardPrinted, Integer> e : this)
|
||||
public PaperCard get(int n) {
|
||||
for(Entry<PaperCard, Integer> e : this)
|
||||
{
|
||||
n -= e.getValue();
|
||||
if ( n <= 0 ) return e.getKey();
|
||||
@@ -155,7 +155,7 @@ public class CardPool extends ItemPool<CardPrinted> {
|
||||
boolean isFirst = true;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append('[');
|
||||
for (Entry<CardPrinted, Integer> e : this) {
|
||||
for (Entry<PaperCard, Integer> e : this) {
|
||||
if ( isFirst ) isFirst = false;
|
||||
else sb.append(", ");
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ import forge.deck.io.DeckFileHeader;
|
||||
import forge.deck.io.DeckSerializer;
|
||||
import forge.gui.deckeditor.tables.TableSorter;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.IPaperCard;
|
||||
import forge.item.ItemPoolView;
|
||||
import forge.util.FileSection;
|
||||
@@ -197,17 +197,17 @@ public class Deck extends DeckBase implements Iterable<Entry<DeckSection, CardPo
|
||||
|
||||
|
||||
|
||||
private static List<String> writeCardPool(final ItemPoolView<CardPrinted> pool) {
|
||||
final List<Entry<CardPrinted, Integer>> main2sort = pool.getOrderedList();
|
||||
private static List<String> writeCardPool(final ItemPoolView<PaperCard> pool) {
|
||||
final List<Entry<PaperCard, Integer>> main2sort = pool.getOrderedList();
|
||||
Collections.sort(main2sort, TableSorter.BY_NAME_THEN_SET);
|
||||
final List<String> out = new ArrayList<String>();
|
||||
for (final Entry<CardPrinted, Integer> e : main2sort) {
|
||||
for (final Entry<PaperCard, Integer> e : main2sort) {
|
||||
out.add(serializeSingleCard(e.getKey(), e.getValue()));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
private static String serializeSingleCard(CardPrinted card, Integer n) {
|
||||
private static String serializeSingleCard(PaperCard card, Integer n) {
|
||||
|
||||
final boolean hasBadSetInfo = "???".equals(card.getEdition()) || StringUtils.isBlank(card.getEdition());
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
@@ -28,7 +28,7 @@ import forge.Singletons;
|
||||
import forge.card.CardCoreType;
|
||||
import forge.card.ColorSet;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.IPaperCard;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
import forge.util.Aggregates;
|
||||
@@ -149,9 +149,9 @@ public enum DeckFormat {
|
||||
}
|
||||
|
||||
ColorSet cmdCI = cmd.get(0).getRules().getColorIdentity();
|
||||
List<CardPrinted> erroneousCI = new ArrayList<CardPrinted>();
|
||||
List<PaperCard> erroneousCI = new ArrayList<PaperCard>();
|
||||
|
||||
for(Entry<CardPrinted, Integer> cp : deck.get(DeckSection.Main)) {
|
||||
for(Entry<PaperCard, Integer> cp : deck.get(DeckSection.Main)) {
|
||||
if(!cp.getKey().getRules().getColorIdentity().hasNoColorsExcept(cmdCI.getColor()))
|
||||
{
|
||||
erroneousCI.add(cp.getKey());
|
||||
@@ -159,7 +159,7 @@ public enum DeckFormat {
|
||||
}
|
||||
if(deck.has(DeckSection.Sideboard))
|
||||
{
|
||||
for(Entry<CardPrinted, Integer> cp : deck.get(DeckSection.Sideboard)) {
|
||||
for(Entry<PaperCard, Integer> cp : deck.get(DeckSection.Sideboard)) {
|
||||
if(!cp.getKey().getRules().getColorIdentity().hasNoColorsExcept(cmdCI.getColor()))
|
||||
{
|
||||
erroneousCI.add(cp.getKey());
|
||||
@@ -171,7 +171,7 @@ public enum DeckFormat {
|
||||
{
|
||||
StringBuilder sb = new StringBuilder("contains card that do not match the commanders color identity:");
|
||||
|
||||
for(CardPrinted cp : erroneousCI)
|
||||
for(PaperCard cp : erroneousCI)
|
||||
{
|
||||
sb.append("\n").append(cp.getName());
|
||||
}
|
||||
@@ -187,7 +187,7 @@ public enum DeckFormat {
|
||||
return "should have at least 10 planes";
|
||||
}
|
||||
int phenoms = 0;
|
||||
for (Entry<CardPrinted, Integer> cp : planes) {
|
||||
for (Entry<PaperCard, Integer> cp : planes) {
|
||||
|
||||
if (cp.getKey().getRules().getType().typeContains(CardCoreType.Phenomenon)) {
|
||||
phenoms++;
|
||||
@@ -208,7 +208,7 @@ public enum DeckFormat {
|
||||
return "must contain at least 20 schemes";
|
||||
}
|
||||
|
||||
for (Entry<CardPrinted, Integer> cp : schemes) {
|
||||
for (Entry<PaperCard, Integer> cp : schemes) {
|
||||
if (cp.getValue() > 2) {
|
||||
return String.format("must not contain more than 2 copies of any Scheme, but has %d of '%s'", cp.getValue(), cp.getKey().getName());
|
||||
}
|
||||
@@ -231,7 +231,7 @@ public enum DeckFormat {
|
||||
List<String> limitExceptions = Arrays.asList(new String[]{"Relentless Rats", "Shadowborn Apostle"});
|
||||
|
||||
// should group all cards by name, so that different editions of same card are really counted as the same card
|
||||
for (Entry<String, Integer> cp : Aggregates.groupSumBy(tmp, CardPrinted.FN_GET_NAME)) {
|
||||
for (Entry<String, Integer> cp : Aggregates.groupSumBy(tmp, PaperCard.FN_GET_NAME)) {
|
||||
|
||||
IPaperCard simpleCard = CardDb.instance().getCard(cp.getKey());
|
||||
boolean canHaveMultiple = simpleCard.getRules().getType().isBasicLand() || limitExceptions.contains(cp.getKey());
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.regex.Pattern;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -62,7 +62,7 @@ public class DeckRecognizer {
|
||||
*/
|
||||
public static class Token {
|
||||
private final TokenType type;
|
||||
private final CardPrinted card;
|
||||
private final PaperCard card;
|
||||
private final int number;
|
||||
private final String text;
|
||||
|
||||
@@ -75,7 +75,7 @@ public class DeckRecognizer {
|
||||
* the count
|
||||
* @return the token
|
||||
*/
|
||||
public static Token knownCard(final CardPrinted theCard, final int count) {
|
||||
public static Token knownCard(final PaperCard theCard, final int count) {
|
||||
return new Token(theCard, TokenType.KnownCard, count, null);
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public class DeckRecognizer {
|
||||
return new Token(null, TokenType.UnknownCard, count, cardNme);
|
||||
}
|
||||
|
||||
private Token(final CardPrinted knownCard, final TokenType type1, final int count, final String message) {
|
||||
private Token(final PaperCard knownCard, final TokenType type1, final int count, final String message) {
|
||||
this.card = knownCard;
|
||||
this.number = count;
|
||||
this.type = type1;
|
||||
@@ -130,7 +130,7 @@ public class DeckRecognizer {
|
||||
*
|
||||
* @return the card
|
||||
*/
|
||||
public final CardPrinted getCard() {
|
||||
public final PaperCard getCard() {
|
||||
return this.card;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import forge.deck.generate.GenerateColoredDeckBase;
|
||||
import forge.deck.generate.GenerateMonoColorDeck;
|
||||
import forge.deck.generate.GenerateThemeDeck;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.ItemPoolView;
|
||||
import forge.item.PreconDeck;
|
||||
import forge.quest.QuestController;
|
||||
@@ -75,7 +75,7 @@ public class DeckgenUtil {
|
||||
deckName = "5 colors";
|
||||
}
|
||||
|
||||
ItemPoolView<CardPrinted> cards = gen == null ? null : gen.getDeck(60, forAi);
|
||||
ItemPoolView<PaperCard> cards = gen == null ? null : gen.getDeck(60, forAi);
|
||||
|
||||
if(null == deckName)
|
||||
deckName = Lang.joinHomogenous(Arrays.asList(selection));
|
||||
@@ -247,7 +247,7 @@ public class DeckgenUtil {
|
||||
} else {
|
||||
deckList.append(nl);
|
||||
nLines++;
|
||||
for (final Entry<CardPrinted, Integer> ev : cp) {
|
||||
for (final Entry<PaperCard, Integer> ev : cp) {
|
||||
deckList.append(ev.getValue()).append(" x ").append(ev.getKey()).append(nl);
|
||||
nLines++;
|
||||
}
|
||||
@@ -302,8 +302,8 @@ public class DeckgenUtil {
|
||||
|
||||
public static CardPool generateSchemeDeck() {
|
||||
CardPool schemes = new CardPool();
|
||||
List<CardPrinted> allSchemes = new ArrayList<CardPrinted>();
|
||||
for (CardPrinted c : CardDb.variants().getAllCards()) {
|
||||
List<PaperCard> allSchemes = new ArrayList<PaperCard>();
|
||||
for (PaperCard c : CardDb.variants().getAllCards()) {
|
||||
if (c.getRules().getType().isScheme()) {
|
||||
allSchemes.add(c);
|
||||
}
|
||||
@@ -312,7 +312,7 @@ public class DeckgenUtil {
|
||||
int schemesToAdd = 20;
|
||||
int attemptsLeft = 100; // to avoid endless loop
|
||||
while (schemesToAdd > 0 && attemptsLeft > 0) {
|
||||
CardPrinted cp = Aggregates.random(allSchemes);
|
||||
PaperCard cp = Aggregates.random(allSchemes);
|
||||
int appearances = schemes.count(cp) + 1;
|
||||
if (appearances < 2) {
|
||||
schemes.add(cp);
|
||||
@@ -327,8 +327,8 @@ public class DeckgenUtil {
|
||||
|
||||
public static CardPool generatePlanarDeck() {
|
||||
CardPool res = new CardPool();
|
||||
List<CardPrinted> allPlanars = new ArrayList<CardPrinted>();
|
||||
for (CardPrinted c : CardDb.variants().getAllCards()) {
|
||||
List<PaperCard> allPlanars = new ArrayList<PaperCard>();
|
||||
for (PaperCard c : CardDb.variants().getAllCards()) {
|
||||
if (c.getRules().getType().isPlane() || c.getRules().getType().isPhenomenon()) {
|
||||
allPlanars.add(c);
|
||||
}
|
||||
@@ -338,7 +338,7 @@ public class DeckgenUtil {
|
||||
int targetsize = MyRandom.getRandom().nextInt(allPlanars.size()-10)+10;
|
||||
while(true)
|
||||
{
|
||||
CardPrinted rndPlane = Aggregates.random(allPlanars);
|
||||
PaperCard rndPlane = Aggregates.random(allPlanars);
|
||||
allPlanars.remove(rndPlane);
|
||||
|
||||
if(rndPlane.getRules().getType().isPhenomenon() && phenoms < 2)
|
||||
|
||||
@@ -26,7 +26,7 @@ import com.google.common.collect.Lists;
|
||||
import forge.card.ColorSet;
|
||||
import forge.card.MagicColor;
|
||||
import forge.deck.generate.GenerateDeckUtil.FilterCMC;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.ItemPoolView;
|
||||
|
||||
/**
|
||||
@@ -87,7 +87,7 @@ public class Generate2ColorDeck extends GenerateColoredDeckBase {
|
||||
|
||||
|
||||
@Override
|
||||
public final ItemPoolView<CardPrinted> getDeck(final int size, final boolean forAi) {
|
||||
public final ItemPoolView<PaperCard> getDeck(final int size, final boolean forAi) {
|
||||
addCreaturesAndSpells(size, cmcRelativeWeights, forAi);
|
||||
|
||||
// Add lands
|
||||
|
||||
@@ -26,7 +26,7 @@ import com.google.common.collect.Lists;
|
||||
import forge.card.ColorSet;
|
||||
import forge.card.MagicColor;
|
||||
import forge.deck.generate.GenerateDeckUtil.FilterCMC;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.ItemPoolView;
|
||||
import forge.util.MyRandom;
|
||||
|
||||
@@ -96,7 +96,7 @@ public class Generate3ColorDeck extends GenerateColoredDeckBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final ItemPoolView<CardPrinted> getDeck(final int size, final boolean forAi) {
|
||||
public final ItemPoolView<PaperCard> getDeck(final int size, final boolean forAi) {
|
||||
addCreaturesAndSpells(size, cmcLevels, forAi);
|
||||
|
||||
// Add lands
|
||||
|
||||
@@ -25,7 +25,7 @@ import com.google.common.collect.Lists;
|
||||
|
||||
import forge.card.ColorSet;
|
||||
import forge.deck.generate.GenerateDeckUtil.FilterCMC;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.ItemPoolView;
|
||||
|
||||
/**
|
||||
@@ -59,7 +59,7 @@ public class Generate5ColorDeck extends GenerateColoredDeckBase {
|
||||
|
||||
|
||||
@Override
|
||||
public final ItemPoolView<CardPrinted> getDeck(final int size, final boolean forAi) {
|
||||
public final ItemPoolView<PaperCard> getDeck(final int size, final boolean forAi) {
|
||||
addCreaturesAndSpells(size, cmcLevels, forAi);
|
||||
|
||||
// Add lands
|
||||
|
||||
@@ -39,7 +39,7 @@ import forge.card.ColorSet;
|
||||
import forge.card.MagicColor;
|
||||
import forge.deck.generate.GenerateDeckUtil.FilterCMC;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.ItemPool;
|
||||
import forge.item.ItemPoolView;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
@@ -60,7 +60,7 @@ public abstract class GenerateColoredDeckBase {
|
||||
protected int maxDuplicates;
|
||||
|
||||
protected ColorSet colors;
|
||||
protected final ItemPool<CardPrinted> tDeck;
|
||||
protected final ItemPool<PaperCard> tDeck;
|
||||
|
||||
// 2-colored deck generator has its own constants. The rest works fine with these ones
|
||||
protected float getLandsPercentage() { return 0.44f; }
|
||||
@@ -71,22 +71,22 @@ public abstract class GenerateColoredDeckBase {
|
||||
|
||||
public GenerateColoredDeckBase() {
|
||||
this.maxDuplicates = Singletons.getModel().getPreferences().getPrefBoolean(FPref.DECKGEN_SINGLETONS) ? 1 : 4;
|
||||
tDeck = new ItemPool<CardPrinted>(CardPrinted.class);
|
||||
tDeck = new ItemPool<PaperCard>(PaperCard.class);
|
||||
}
|
||||
|
||||
protected void addCreaturesAndSpells(int size, List<ImmutablePair<FilterCMC, Integer>> cmcLevels, boolean forAi) {
|
||||
tmpDeck.append("Building deck of ").append(size).append("cards\n");
|
||||
|
||||
final Iterable<CardPrinted> cards = selectCardsOfMatchingColorForPlayer(forAi);
|
||||
final Iterable<PaperCard> cards = selectCardsOfMatchingColorForPlayer(forAi);
|
||||
// build subsets based on type
|
||||
|
||||
final Iterable<CardPrinted> creatures = Iterables.filter(cards, Predicates.compose(CardRulesPredicates.Presets.IS_CREATURE, CardPrinted.FN_GET_RULES));
|
||||
final Iterable<PaperCard> creatures = Iterables.filter(cards, Predicates.compose(CardRulesPredicates.Presets.IS_CREATURE, PaperCard.FN_GET_RULES));
|
||||
final int creatCnt = (int) Math.ceil(getCreatPercentage() * size);
|
||||
tmpDeck.append("Creatures to add:").append(creatCnt).append("\n");
|
||||
addCmcAdjusted(creatures, creatCnt, cmcLevels);
|
||||
|
||||
Predicate<CardPrinted> preSpells = Predicates.compose(CardRulesPredicates.Presets.IS_NONCREATURE_SPELL_FOR_GENERATOR, CardPrinted.FN_GET_RULES);
|
||||
final Iterable<CardPrinted> spells = Iterables.filter(cards, preSpells);
|
||||
Predicate<PaperCard> preSpells = Predicates.compose(CardRulesPredicates.Presets.IS_NONCREATURE_SPELL_FOR_GENERATOR, PaperCard.FN_GET_RULES);
|
||||
final Iterable<PaperCard> spells = Iterables.filter(cards, preSpells);
|
||||
final int spellCnt = (int) Math.ceil(getSpellPercentage() * size);
|
||||
tmpDeck.append("Spells to add:").append(spellCnt).append("\n");
|
||||
addCmcAdjusted(spells, spellCnt, cmcLevels);
|
||||
@@ -94,13 +94,13 @@ public abstract class GenerateColoredDeckBase {
|
||||
tmpDeck.append(String.format("Current deck size: %d... should be %f%n", tDeck.countAll(), size * (getCreatPercentage() + getSpellPercentage())));
|
||||
}
|
||||
|
||||
public ItemPoolView<CardPrinted> getDeck(final int size, final boolean forAi) {
|
||||
public ItemPoolView<PaperCard> getDeck(final int size, final boolean forAi) {
|
||||
return null; // all but theme deck do override this method
|
||||
}
|
||||
|
||||
protected void addSome(int cnt, List<CardPrinted> source) {
|
||||
protected void addSome(int cnt, List<PaperCard> source) {
|
||||
for (int i = 0; i < cnt; i++) {
|
||||
CardPrinted cp;
|
||||
PaperCard cp;
|
||||
int lc = 0;
|
||||
int srcLen = source.size();
|
||||
do {
|
||||
@@ -132,7 +132,7 @@ public abstract class GenerateColoredDeckBase {
|
||||
} while ((this.cardCounts.get(s) > 3) && (lc <= 20));
|
||||
// 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);
|
||||
PaperCard cp = CardDb.instance().getCard(s);
|
||||
tDeck.add(CardDb.instance().getCard(cp.getName(), Aggregates.random(cp.getRules().getSets())));
|
||||
|
||||
final int n = this.cardCounts.get(s);
|
||||
@@ -169,7 +169,7 @@ public abstract class GenerateColoredDeckBase {
|
||||
// just to prevent a null exception by the deck size fixing code
|
||||
this.cardCounts.put(color, nLand);
|
||||
|
||||
CardPrinted cp = CardDb.instance().getCard(color);
|
||||
PaperCard cp = CardDb.instance().getCard(color);
|
||||
String basicLandSet = Aggregates.random(cp.getRules().getSets());
|
||||
|
||||
tDeck.add(CardDb.instance().getCard(cp.getName(), basicLandSet), nLand);
|
||||
@@ -185,14 +185,14 @@ public abstract class GenerateColoredDeckBase {
|
||||
addSome(diff, tDeck.toFlatList());
|
||||
} else if (actualSize > targetSize) {
|
||||
|
||||
Predicate<CardPrinted> exceptBasicLand = Predicates.not(Predicates.compose(CardRulesPredicates.Presets.IS_BASIC_LAND, CardPrinted.FN_GET_RULES));
|
||||
Predicate<PaperCard> exceptBasicLand = Predicates.not(Predicates.compose(CardRulesPredicates.Presets.IS_BASIC_LAND, PaperCard.FN_GET_RULES));
|
||||
|
||||
for (int i = 0; i < 3 && actualSize > targetSize; i++) {
|
||||
Iterable<CardPrinted> matchingCards = Iterables.filter(tDeck.toFlatList(), exceptBasicLand);
|
||||
List<CardPrinted> toRemove = Aggregates.random(matchingCards, actualSize - targetSize);
|
||||
Iterable<PaperCard> matchingCards = Iterables.filter(tDeck.toFlatList(), exceptBasicLand);
|
||||
List<PaperCard> toRemove = Aggregates.random(matchingCards, actualSize - targetSize);
|
||||
tDeck.removeAllFlat(toRemove);
|
||||
|
||||
for (CardPrinted c : toRemove) {
|
||||
for (PaperCard c : toRemove) {
|
||||
tmpDeck.append("Removed:").append(c.getName()).append("\n");
|
||||
}
|
||||
actualSize = tDeck.countAll();
|
||||
@@ -200,7 +200,7 @@ public abstract class GenerateColoredDeckBase {
|
||||
}
|
||||
}
|
||||
|
||||
protected void addCmcAdjusted(Iterable<CardPrinted> source, int cnt, List<ImmutablePair<FilterCMC, Integer>> cmcLevels) {
|
||||
protected void addCmcAdjusted(Iterable<PaperCard> source, int cnt, List<ImmutablePair<FilterCMC, Integer>> cmcLevels) {
|
||||
int totalWeight = 0;
|
||||
for (ImmutablePair<FilterCMC, Integer> pair : cmcLevels) {
|
||||
totalWeight += pair.getRight();
|
||||
@@ -212,17 +212,17 @@ public abstract class GenerateColoredDeckBase {
|
||||
float requestedOverTotal = (float)cnt / totalWeight;
|
||||
|
||||
for (ImmutablePair<FilterCMC, Integer> pair : cmcLevels) {
|
||||
Iterable<CardPrinted> matchingCards = Iterables.filter(source, Predicates.compose(pair.getLeft(), CardPrinted.FN_GET_RULES));
|
||||
Iterable<PaperCard> matchingCards = Iterables.filter(source, Predicates.compose(pair.getLeft(), PaperCard.FN_GET_RULES));
|
||||
int cmcCountForPool = (int) Math.ceil(pair.getRight().intValue() * desiredOverTotal);
|
||||
|
||||
int addOfThisCmc = Math.round(pair.getRight().intValue() * requestedOverTotal);
|
||||
tmpDeck.append(String.format("Adding %d cards for cmc range from a pool with %d cards:%n", addOfThisCmc, cmcCountForPool));
|
||||
|
||||
final List<CardPrinted> curved = Aggregates.random(matchingCards, cmcCountForPool);
|
||||
final List<CardPrinted> curvedRandomized = Lists.newArrayList();
|
||||
for (CardPrinted c : curved) {
|
||||
final List<PaperCard> curved = Aggregates.random(matchingCards, cmcCountForPool);
|
||||
final List<PaperCard> curvedRandomized = Lists.newArrayList();
|
||||
for (PaperCard c : curved) {
|
||||
this.cardCounts.put(c.getName(), 0);
|
||||
CardPrinted cpRandomSet = CardDb.instance().getCard(c.getName(), Aggregates.random(c.getRules().getSets()));
|
||||
PaperCard cpRandomSet = CardDb.instance().getCard(c.getName(), Aggregates.random(c.getRules().getSets()));
|
||||
curvedRandomized.add(cpRandomSet);
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ public abstract class GenerateColoredDeckBase {
|
||||
}
|
||||
}
|
||||
|
||||
protected Iterable<CardPrinted> selectCardsOfMatchingColorForPlayer(boolean forAi) {
|
||||
protected Iterable<PaperCard> selectCardsOfMatchingColorForPlayer(boolean forAi) {
|
||||
|
||||
// start with all cards
|
||||
// remove cards that generated decks don't like
|
||||
@@ -240,17 +240,17 @@ public abstract class GenerateColoredDeckBase {
|
||||
if (!Singletons.getModel().getPreferences().getPrefBoolean(FPref.DECKGEN_ARTIFACTS)) {
|
||||
hasColor = Predicates.or(hasColor, GenerateDeckUtil.COLORLESS_CARDS);
|
||||
}
|
||||
return Iterables.filter(CardDb.instance().getAllCards(), Predicates.compose(Predicates.and(canPlay, hasColor), CardPrinted.FN_GET_RULES));
|
||||
return Iterables.filter(CardDb.instance().getAllCards(), Predicates.compose(Predicates.and(canPlay, hasColor), PaperCard.FN_GET_RULES));
|
||||
}
|
||||
|
||||
protected static Map<String, Integer> countLands(ItemPool<CardPrinted> outList) {
|
||||
protected static Map<String, Integer> countLands(ItemPool<PaperCard> outList) {
|
||||
// attempt to optimize basic land counts according
|
||||
// to color representation
|
||||
|
||||
Map<String, Integer> res = new TreeMap<String, Integer>();
|
||||
// count each card color using mana costs
|
||||
// TODO: count hybrid mana differently?
|
||||
for (Entry<CardPrinted, Integer> cpe : outList) {
|
||||
for (Entry<PaperCard, Integer> cpe : outList) {
|
||||
|
||||
int profile = cpe.getKey().getRules().getManaCost().getColorProfile();
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import com.google.common.collect.Lists;
|
||||
import forge.card.ColorSet;
|
||||
import forge.card.MagicColor;
|
||||
import forge.deck.generate.GenerateDeckUtil.FilterCMC;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.ItemPoolView;
|
||||
|
||||
/**
|
||||
@@ -78,7 +78,7 @@ public class GenerateMonoColorDeck extends GenerateColoredDeckBase {
|
||||
|
||||
|
||||
@Override
|
||||
public final ItemPoolView<CardPrinted> getDeck(final int size, final boolean forAi) {
|
||||
public final ItemPoolView<PaperCard> getDeck(final int size, final boolean forAi) {
|
||||
addCreaturesAndSpells(size, cmcLevels, forAi);
|
||||
|
||||
// Add lands
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.Random;
|
||||
|
||||
import forge.error.BugReporter;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.ItemPoolView;
|
||||
import forge.util.FileUtil;
|
||||
import forge.util.MyRandom;
|
||||
@@ -93,7 +93,7 @@ public class GenerateThemeDeck extends GenerateColoredDeckBase {
|
||||
* a int.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public final ItemPoolView<CardPrinted> getThemeDeck(final String themeName, final int size) {
|
||||
public final ItemPoolView<PaperCard> getThemeDeck(final String themeName, final int size) {
|
||||
String s = "";
|
||||
|
||||
// read theme file
|
||||
|
||||
@@ -35,7 +35,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import forge.ImageCache;
|
||||
import forge.deck.Deck;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.properties.NewConstants;
|
||||
import forge.util.FileSection;
|
||||
import forge.util.FileSectionManual;
|
||||
@@ -136,17 +136,17 @@ public class DeckSerializer extends StorageReaderFolder<Deck> implements IItemSe
|
||||
final Map<String, Object> root = new HashMap<String, Object>();
|
||||
root.put("title", d.getName());
|
||||
final List<String> list = new ArrayList<String>();
|
||||
for (final Entry<CardPrinted, Integer> card : d.getMain()) {
|
||||
for (final Entry<PaperCard, Integer> card : d.getMain()) {
|
||||
// System.out.println(card.getSets().get(card.getSets().size() - 1).URL);
|
||||
for (int i = card.getValue().intValue(); i > 0; --i ) {
|
||||
CardPrinted r = card.getKey();
|
||||
PaperCard r = card.getKey();
|
||||
String url = NewConstants.URL_PIC_DOWNLOAD + ImageCache.getDownloadUrl(r, false);
|
||||
list.add(url);
|
||||
}
|
||||
}
|
||||
|
||||
final TreeMap<String, Integer> map = new TreeMap<String, Integer>();
|
||||
for (final Entry<CardPrinted, Integer> entry : d.getMain().getOrderedList()) {
|
||||
for (final Entry<PaperCard, Integer> entry : d.getMain().getOrderedList()) {
|
||||
map.put(entry.getKey().getName(), entry.getValue());
|
||||
// System.out.println(entry.getValue() + " " +
|
||||
// entry.getKey().getName());
|
||||
|
||||
@@ -27,7 +27,7 @@ import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import forge.card.CardRulesPredicates;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.IPaperCard;
|
||||
|
||||
|
||||
@@ -45,8 +45,8 @@ public class GameFormat implements Comparable<GameFormat> {
|
||||
protected final transient List<String> allowedSetCodes_ro;
|
||||
protected final transient List<String> bannedCardNames_ro;
|
||||
|
||||
protected final transient Predicate<CardPrinted> filterRules;
|
||||
protected final transient Predicate<CardPrinted> filterPrinted;
|
||||
protected final transient Predicate<PaperCard> filterRules;
|
||||
protected final transient Predicate<PaperCard> filterPrinted;
|
||||
|
||||
private final int index;
|
||||
|
||||
@@ -77,20 +77,20 @@ public class GameFormat implements Comparable<GameFormat> {
|
||||
this.filterPrinted = this.buildFilterPrinted();
|
||||
}
|
||||
|
||||
private Predicate<CardPrinted> buildFilterPrinted() {
|
||||
final Predicate<CardPrinted> banNames = Predicates.not(IPaperCard.Predicates.names(this.bannedCardNames));
|
||||
private Predicate<PaperCard> buildFilterPrinted() {
|
||||
final Predicate<PaperCard> banNames = Predicates.not(IPaperCard.Predicates.names(this.bannedCardNames));
|
||||
if (this.allowedSetCodes == null || this.allowedSetCodes.isEmpty()) {
|
||||
return banNames;
|
||||
}
|
||||
return Predicates.and(banNames, IPaperCard.Predicates.printedInSets(this.allowedSetCodes, true));
|
||||
}
|
||||
|
||||
private Predicate<CardPrinted> buildFilterRules() {
|
||||
final Predicate<CardPrinted> banNames = Predicates.not(IPaperCard.Predicates.names(this.bannedCardNames));
|
||||
private Predicate<PaperCard> buildFilterRules() {
|
||||
final Predicate<PaperCard> banNames = Predicates.not(IPaperCard.Predicates.names(this.bannedCardNames));
|
||||
if (this.allowedSetCodes == null || this.allowedSetCodes.isEmpty()) {
|
||||
return banNames;
|
||||
}
|
||||
return Predicates.and(banNames, Predicates.compose(CardRulesPredicates.wasPrintedInSets(this.allowedSetCodes), CardPrinted.FN_GET_RULES));
|
||||
return Predicates.and(banNames, Predicates.compose(CardRulesPredicates.wasPrintedInSets(this.allowedSetCodes), PaperCard.FN_GET_RULES));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -125,7 +125,7 @@ public class GameFormat implements Comparable<GameFormat> {
|
||||
*
|
||||
* @return the filter rules
|
||||
*/
|
||||
public Predicate<CardPrinted> getFilterRules() {
|
||||
public Predicate<PaperCard> getFilterRules() {
|
||||
return this.filterRules;
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ public class GameFormat implements Comparable<GameFormat> {
|
||||
*
|
||||
* @return the filter printed
|
||||
*/
|
||||
public Predicate<CardPrinted> getFilterPrinted() {
|
||||
public Predicate<PaperCard> getFilterPrinted() {
|
||||
return this.filterPrinted;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ import forge.game.zone.PlayerZone;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.gui.GuiDialog;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.IPaperCard;
|
||||
import forge.properties.ForgePreferences;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
@@ -95,17 +95,17 @@ public class GameNew {
|
||||
|
||||
}
|
||||
|
||||
private static Set<CardPrinted> getRemovedAnteCards(Deck toUse) {
|
||||
private static Set<PaperCard> getRemovedAnteCards(Deck toUse) {
|
||||
final String keywordToRemove = "Remove CARDNAME from your deck before playing if you're not playing for ante.";
|
||||
Set<CardPrinted> myRemovedAnteCards = new HashSet<CardPrinted>();
|
||||
Set<PaperCard> myRemovedAnteCards = new HashSet<PaperCard>();
|
||||
for ( Entry<DeckSection, CardPool> ds : toUse ) {
|
||||
for (Entry<CardPrinted, Integer> cp : ds.getValue()) {
|
||||
for (Entry<PaperCard, Integer> cp : ds.getValue()) {
|
||||
if ( Iterables.contains(cp.getKey().getRules().getMainPart().getKeywords(), keywordToRemove) )
|
||||
myRemovedAnteCards.add(cp.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
for(CardPrinted cp: myRemovedAnteCards) {
|
||||
for(PaperCard cp: myRemovedAnteCards) {
|
||||
for ( Entry<DeckSection, CardPool> ds : toUse ) {
|
||||
ds.getValue().remove(cp, Integer.MAX_VALUE);
|
||||
}
|
||||
@@ -115,18 +115,18 @@ public class GameNew {
|
||||
|
||||
private static void preparePlayerLibrary(Player player, final ZoneType zoneType, CardPool secion, boolean canRandomFoil, Random generator) {
|
||||
PlayerZone library = player.getZone(zoneType);
|
||||
for (final Entry<CardPrinted, Integer> stackOfCards : secion) {
|
||||
final CardPrinted cp = stackOfCards.getKey();
|
||||
for (final Entry<PaperCard, Integer> stackOfCards : secion) {
|
||||
final PaperCard cp = stackOfCards.getKey();
|
||||
for (int i = 0; i < stackOfCards.getValue(); i++) {
|
||||
|
||||
CardPrinted cpi = cp;
|
||||
PaperCard cpi = cp;
|
||||
// apply random pictures for cards
|
||||
if (preferences.getPrefBoolean(FPref.UI_RANDOM_CARD_ART)) {
|
||||
final int cntVariants = cp.getRules().getEditionInfo(cp.getEdition()).getCopiesCount();
|
||||
if (cntVariants > 1) {
|
||||
cpi = CardDb.instance().getCard(cp.getName(), cp.getEdition(), generator.nextInt(cntVariants));
|
||||
if ( cp.isFoil() )
|
||||
cpi = CardPrinted.makeFoiled(cpi);
|
||||
cpi = PaperCard.makeFoiled(cpi);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,11 +199,11 @@ public class GameNew {
|
||||
return library;
|
||||
} // smoothComputerManaCurve()
|
||||
|
||||
private static List<CardPrinted> getCardsAiCantPlayWell(final Deck toUse) {
|
||||
List<CardPrinted> result = new ArrayList<CardPrinted>();
|
||||
private static List<PaperCard> getCardsAiCantPlayWell(final Deck toUse) {
|
||||
List<PaperCard> result = new ArrayList<PaperCard>();
|
||||
|
||||
for ( Entry<DeckSection, CardPool> ds : toUse ) {
|
||||
for (Entry<CardPrinted, Integer> cp : ds.getValue()) {
|
||||
for (Entry<PaperCard, Integer> cp : ds.getValue()) {
|
||||
if ( cp.getKey().getRules().getAiHints().getRemAIDecks() )
|
||||
result.add(cp.getKey());
|
||||
}
|
||||
@@ -228,9 +228,9 @@ public class GameNew {
|
||||
trigHandler.clearDelayedTrigger();
|
||||
|
||||
// friendliness
|
||||
final Set<CardPrinted> rAICards = new HashSet<CardPrinted>();
|
||||
final Set<PaperCard> rAICards = new HashSet<PaperCard>();
|
||||
|
||||
MapOfLists<Player, CardPrinted> removedAnteCards = new HashMapOfLists<Player, CardPrinted>(CollectionSuppliers.<CardPrinted>hashSets());
|
||||
MapOfLists<Player, PaperCard> removedAnteCards = new HashMapOfLists<Player, PaperCard>(CollectionSuppliers.<PaperCard>hashSets());
|
||||
|
||||
GameType gameType = game.getType();
|
||||
boolean isFirstGame = game.getMatch().getPlayedGames().isEmpty();
|
||||
@@ -253,7 +253,7 @@ public class GameNew {
|
||||
Deck myDeck = psc.getCurrentDeck();
|
||||
boolean hasSideboard = myDeck.has(DeckSection.Sideboard);
|
||||
|
||||
Set<CardPrinted> myRemovedAnteCards = useAnte ? null : getRemovedAnteCards(myDeck);
|
||||
Set<PaperCard> myRemovedAnteCards = useAnte ? null : getRemovedAnteCards(myDeck);
|
||||
Random generator = MyRandom.getRandom();
|
||||
|
||||
preparePlayerLibrary(player, ZoneType.Library, myDeck.getMain(), canRandomFoil, generator);
|
||||
@@ -297,7 +297,7 @@ public class GameNew {
|
||||
|
||||
if (!removedAnteCards.isEmpty()) {
|
||||
StringBuilder ante = new StringBuilder("The following ante cards were removed:\n\n");
|
||||
for (Entry<Player, Collection<CardPrinted>> ants : removedAnteCards.entrySet()) {
|
||||
for (Entry<Player, Collection<PaperCard>> ants : removedAnteCards.entrySet()) {
|
||||
ante.append(TextUtil.buildFourColumnList("From the " + ants.getKey().getName() + "'s deck:", ants.getValue()));
|
||||
}
|
||||
GuiDialog.message(ante.toString());
|
||||
|
||||
@@ -8,7 +8,7 @@ import forge.deck.Deck;
|
||||
import forge.deck.DeckSection;
|
||||
import forge.game.player.LobbyPlayer;
|
||||
import forge.game.player.Player;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.IPaperCard;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ public class RegisteredPlayer {
|
||||
private final Deck originalDeck;
|
||||
private Deck currentDeck;
|
||||
|
||||
private static final Iterable<CardPrinted> EmptyList = Collections.unmodifiableList(new ArrayList<CardPrinted>());
|
||||
private static final Iterable<PaperCard> EmptyList = Collections.unmodifiableList(new ArrayList<PaperCard>());
|
||||
|
||||
private LobbyPlayer player = null;
|
||||
|
||||
@@ -25,7 +25,7 @@ public class RegisteredPlayer {
|
||||
private Iterable<IPaperCard> cardsOnBattlefield = null;
|
||||
private final List<IPaperCard> cardsInCommand = new ArrayList<IPaperCard>();
|
||||
private Iterable<? extends IPaperCard> schemes = null;
|
||||
private Iterable<CardPrinted> planes = null;
|
||||
private Iterable<PaperCard> planes = null;
|
||||
private int teamNumber = -1; // members of teams with negative id will play FFA.
|
||||
|
||||
public RegisteredPlayer(Deck deck0) {
|
||||
@@ -117,14 +117,14 @@ public class RegisteredPlayer {
|
||||
/**
|
||||
* @return the planes
|
||||
*/
|
||||
public Iterable<CardPrinted> getPlanes(final Player p) {
|
||||
public Iterable<PaperCard> getPlanes(final Player p) {
|
||||
return planes == null ? EmptyList : planes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param planes0 the planes to set
|
||||
*/
|
||||
public void setPlanes(Iterable<CardPrinted> planes0) {
|
||||
public void setPlanes(Iterable<PaperCard> planes0) {
|
||||
this.planes = planes0;
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ public class RegisteredPlayer {
|
||||
return new RegisteredPlayer(deck);
|
||||
}
|
||||
|
||||
public static RegisteredPlayer forVanguard(final Deck deck, final CardPrinted avatar) {
|
||||
public static RegisteredPlayer forVanguard(final Deck deck, final PaperCard avatar) {
|
||||
RegisteredPlayer start = fromDeck(deck);
|
||||
start.setStartingLife(start.getStartingLife() + avatar.getRules().getLife());
|
||||
start.setStartingHand(start.getStartingHand() + avatar.getRules().getHand());
|
||||
@@ -155,13 +155,13 @@ public class RegisteredPlayer {
|
||||
}
|
||||
|
||||
|
||||
public static RegisteredPlayer forArchenemy(final Deck deck, final Iterable<CardPrinted> schemes) {
|
||||
public static RegisteredPlayer forArchenemy(final Deck deck, final Iterable<PaperCard> schemes) {
|
||||
RegisteredPlayer start = fromDeck(deck);
|
||||
start.setSchemes(schemes);
|
||||
return start;
|
||||
}
|
||||
|
||||
public static RegisteredPlayer forPlanechase(final Deck deck, final Iterable<CardPrinted> planes) {
|
||||
public static RegisteredPlayer forPlanechase(final Deck deck, final Iterable<PaperCard> planes) {
|
||||
RegisteredPlayer start = fromDeck(deck);
|
||||
start.setPlanes(planes);
|
||||
return start;
|
||||
|
||||
@@ -29,7 +29,7 @@ import forge.deck.CardPool;
|
||||
import forge.deck.Deck;
|
||||
import forge.deck.DeckSection;
|
||||
import forge.game.player.Player;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.util.Aggregates;
|
||||
|
||||
/**
|
||||
@@ -813,7 +813,7 @@ public class ComputerUtilCard {
|
||||
@Override
|
||||
public boolean apply(Deck d) {
|
||||
for(Entry<DeckSection, CardPool> cp: d) {
|
||||
for(Entry<CardPrinted, Integer> e : cp.getValue()) {
|
||||
for(Entry<PaperCard, Integer> e : cp.getValue()) {
|
||||
if ( e.getKey().getRules().getAiHints().getRemAIDecks() )
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package forge.game.limited;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
|
||||
|
||||
/**
|
||||
@@ -20,7 +20,7 @@ public class BoosterDeckBuilder extends LimitedDeckBuilder {
|
||||
* @param pClrs
|
||||
* colors
|
||||
*/
|
||||
public BoosterDeckBuilder(List<CardPrinted> dList, DeckColors pClrs) {
|
||||
public BoosterDeckBuilder(List<PaperCard> dList, DeckColors pClrs) {
|
||||
super(dList, pClrs);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ import forge.card.UnOpenedProduct;
|
||||
import forge.deck.Deck;
|
||||
import forge.gui.GuiChoose;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.IPaperCard;
|
||||
import forge.item.ItemPool;
|
||||
import forge.item.ItemPoolView;
|
||||
@@ -66,13 +66,13 @@ public final class BoosterDraft implements IBoosterDraft {
|
||||
private int nextBoosterGroup = 0;
|
||||
private int currentBoosterSize = 0;
|
||||
private int currentBoosterPick = 0;
|
||||
private List<List<CardPrinted>> pack; // size 8
|
||||
private List<List<PaperCard>> pack; // size 8
|
||||
|
||||
/** The draft picks. */
|
||||
private final Map<String, Float> draftPicks = new TreeMap<String, Float>();
|
||||
private final LimitedPoolType draftFormat;
|
||||
|
||||
private final List<Supplier<List<CardPrinted>>> product = new ArrayList<Supplier<List<CardPrinted>>>();
|
||||
private final List<Supplier<List<PaperCard>>> product = new ArrayList<Supplier<List<PaperCard>>>();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -88,7 +88,7 @@ public final class BoosterDraft implements IBoosterDraft {
|
||||
|
||||
switch (draftType) {
|
||||
case Full: // Draft from all cards in Forge
|
||||
Supplier<List<CardPrinted>> s = new UnOpenedProduct(BoosterTemplate.genericBooster);
|
||||
Supplier<List<PaperCard>> s = new UnOpenedProduct(BoosterTemplate.genericBooster);
|
||||
|
||||
for (int i = 0; i < 3; i++) this.product.add(s);
|
||||
IBoosterDraft.LAND_SET_CODE[0] = CardDb.instance().getCard("Plains").getEdition();
|
||||
@@ -157,7 +157,7 @@ public final class BoosterDraft implements IBoosterDraft {
|
||||
}
|
||||
|
||||
private void setupCustomDraft(final CustomLimited draft) {
|
||||
final ItemPoolView<CardPrinted> dPool = draft.getCardPool();
|
||||
final ItemPoolView<PaperCard> dPool = draft.getCardPool();
|
||||
if (dPool == null) {
|
||||
throw new RuntimeException("BoosterGenerator : deck not found");
|
||||
}
|
||||
@@ -207,13 +207,13 @@ public final class BoosterDraft implements IBoosterDraft {
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
@Override
|
||||
public ItemPoolView<CardPrinted> nextChoice() {
|
||||
public ItemPoolView<PaperCard> nextChoice() {
|
||||
if (this.pack.get(this.getCurrentBoosterIndex()).size() == 0) {
|
||||
this.pack = this.get8BoosterPack();
|
||||
}
|
||||
|
||||
this.computerChoose();
|
||||
return ItemPool.createFrom(this.pack.get(this.getCurrentBoosterIndex()), CardPrinted.class);
|
||||
return ItemPool.createFrom(this.pack.get(this.getCurrentBoosterIndex()), PaperCard.class);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -223,12 +223,12 @@ public final class BoosterDraft implements IBoosterDraft {
|
||||
*
|
||||
* @return an array of {@link forge.CardList} objects.
|
||||
*/
|
||||
public List<List<CardPrinted>> get8BoosterPack() {
|
||||
public List<List<PaperCard>> get8BoosterPack() {
|
||||
if (this.nextBoosterGroup >= this.product.size()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final List<List<CardPrinted>> list = new ArrayList<List<CardPrinted>>();
|
||||
final List<List<PaperCard>> list = new ArrayList<List<PaperCard>>();
|
||||
for (int i = 0; i < 8; i++) {
|
||||
list.add(this.product.get(this.nextBoosterGroup).get());
|
||||
}
|
||||
@@ -260,12 +260,12 @@ public final class BoosterDraft implements IBoosterDraft {
|
||||
for (int i = 1; i < this.pack.size(); i++) {
|
||||
|
||||
final List<Card> forAi = new ArrayList<Card>();
|
||||
final List<CardPrinted> booster = this.pack.get((iHumansBooster + i) % this.pack.size());
|
||||
final List<PaperCard> booster = this.pack.get((iHumansBooster + i) % this.pack.size());
|
||||
for (final IPaperCard cr : booster) {
|
||||
forAi.add(cr.getMatchingForgeCard());
|
||||
}
|
||||
|
||||
final CardPrinted aiPick = this.draftAI.choose(booster, iPlayer++);
|
||||
final PaperCard aiPick = this.draftAI.choose(booster, iPlayer++);
|
||||
booster.remove(aiPick);
|
||||
}
|
||||
} // computerChoose()
|
||||
@@ -296,8 +296,8 @@ public final class BoosterDraft implements IBoosterDraft {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void setChoice(final CardPrinted c) {
|
||||
final List<CardPrinted> thisBooster = this.pack.get(this.getCurrentBoosterIndex());
|
||||
public void setChoice(final PaperCard c) {
|
||||
final List<PaperCard> thisBooster = this.pack.get(this.getCurrentBoosterIndex());
|
||||
|
||||
if (!thisBooster.contains(c)) {
|
||||
throw new RuntimeException("BoosterDraft : setChoice() error - card not found - " + c
|
||||
@@ -306,7 +306,7 @@ public final class BoosterDraft implements IBoosterDraft {
|
||||
|
||||
if (Preferences.UPLOAD_DRAFT) {
|
||||
for (int i = 0; i < thisBooster.size(); i++) {
|
||||
final CardPrinted cc = thisBooster.get(i);
|
||||
final PaperCard cc = thisBooster.get(i);
|
||||
final String cnBk = cc.getName() + "|" + cc.getEdition();
|
||||
|
||||
float pickValue = 0;
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.apache.commons.lang3.tuple.Pair;
|
||||
import forge.Constant.Preferences;
|
||||
import forge.card.ColorSet;
|
||||
import forge.deck.Deck;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.util.Aggregates;
|
||||
|
||||
/**
|
||||
@@ -48,7 +48,7 @@ public class BoosterDraftAI {
|
||||
private static final int N_DECKS = 7;
|
||||
|
||||
// holds all the cards for each of the computer's decks
|
||||
private final List<List<CardPrinted>> deck = new ArrayList<List<CardPrinted>>();
|
||||
private final List<List<PaperCard>> deck = new ArrayList<List<PaperCard>>();
|
||||
private final ArrayList<DeckColors> playerColors = new ArrayList<DeckColors>();
|
||||
|
||||
private ReadDraftRankings draftRankings;
|
||||
@@ -66,7 +66,7 @@ public class BoosterDraftAI {
|
||||
* a int.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public CardPrinted choose(final List<CardPrinted> chooseFrom, final int player) {
|
||||
public PaperCard choose(final List<PaperCard> chooseFrom, final int player) {
|
||||
if (Preferences.DEV_MODE) {
|
||||
System.out.println("Player[" + player + "] pack: " + chooseFrom.toString());
|
||||
}
|
||||
@@ -75,9 +75,9 @@ public class BoosterDraftAI {
|
||||
ColorSet currentChoice = deckCols.getChosenColors();
|
||||
boolean canAddMoreColors = deckCols.canChoseMoreColors();
|
||||
|
||||
List<Pair<CardPrinted, Double>> rankedCards = rankCards(chooseFrom);
|
||||
List<Pair<PaperCard, Double>> rankedCards = rankCards(chooseFrom);
|
||||
|
||||
for(Pair<CardPrinted, Double> p : rankedCards) {
|
||||
for(Pair<PaperCard, Double> p : rankedCards) {
|
||||
// If a card is not ai playable, somewhat decrease its rating
|
||||
if( p.getKey().getRules().getAiHints().getRemAIDecks() )
|
||||
p.setValue(p.getValue() + TAKE_BEST_THRESHOLD);
|
||||
@@ -89,8 +89,8 @@ public class BoosterDraftAI {
|
||||
|
||||
int cntBestCards = 0;
|
||||
double bestRanking = Double.MAX_VALUE;
|
||||
CardPrinted bestPick = null;
|
||||
for(Pair<CardPrinted, Double> p : rankedCards) {
|
||||
PaperCard bestPick = null;
|
||||
for(Pair<PaperCard, Double> p : rankedCards) {
|
||||
double rating = p.getValue();
|
||||
if( rating < bestRanking )
|
||||
{
|
||||
@@ -103,8 +103,8 @@ public class BoosterDraftAI {
|
||||
}
|
||||
|
||||
if (cntBestCards > 1) {
|
||||
final List<CardPrinted> possiblePick = new ArrayList<CardPrinted>();
|
||||
for(Pair<CardPrinted, Double> p : rankedCards) {
|
||||
final List<PaperCard> possiblePick = new ArrayList<PaperCard>();
|
||||
for(Pair<PaperCard, Double> p : rankedCards) {
|
||||
if ( p.getValue() == bestRanking )
|
||||
possiblePick.add(p.getKey());
|
||||
}
|
||||
@@ -129,9 +129,9 @@ public class BoosterDraftAI {
|
||||
* List of cards
|
||||
* @return map of rankings
|
||||
*/
|
||||
private List<Pair<CardPrinted, Double>> rankCards(final Iterable<CardPrinted> chooseFrom) {
|
||||
List<Pair<CardPrinted, Double>> rankedCards = new ArrayList<Pair<CardPrinted,Double>>();
|
||||
for (CardPrinted card : chooseFrom) {
|
||||
private List<Pair<PaperCard, Double>> rankCards(final Iterable<PaperCard> chooseFrom) {
|
||||
List<Pair<PaperCard, Double>> rankedCards = new ArrayList<Pair<PaperCard,Double>>();
|
||||
for (PaperCard card : chooseFrom) {
|
||||
Double rkg = draftRankings.getRanking(card.getName(), card.getEdition());
|
||||
if (rkg != null) {
|
||||
rankedCards.add(MutablePair.of(card, rkg));
|
||||
@@ -171,7 +171,7 @@ public class BoosterDraftAI {
|
||||
public BoosterDraftAI() {
|
||||
// Initialize deck array and playerColors list
|
||||
for (int i = 0; i < N_DECKS; i++) {
|
||||
this.deck.add(new ArrayList<CardPrinted>());
|
||||
this.deck.add(new ArrayList<PaperCard>());
|
||||
this.playerColors.add(new DeckColors());
|
||||
}
|
||||
|
||||
|
||||
@@ -4,15 +4,15 @@ import java.util.Comparator;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
|
||||
/**
|
||||
* Sorts cards by rank.
|
||||
*
|
||||
*/
|
||||
public class CardRankingComparator implements Comparator<Pair<Double, CardPrinted>> {
|
||||
public class CardRankingComparator implements Comparator<Pair<Double, PaperCard>> {
|
||||
@Override
|
||||
public int compare(final Pair<Double, CardPrinted> a, final Pair<Double, CardPrinted> b) {
|
||||
public int compare(final Pair<Double, PaperCard> a, final Pair<Double, PaperCard> b) {
|
||||
return a.getKey().compareTo(b.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import forge.card.SealedProductTemplate;
|
||||
import forge.deck.Deck;
|
||||
import forge.deck.DeckBase;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.ItemPool;
|
||||
import forge.item.ItemPoolView;
|
||||
import forge.util.FileSection;
|
||||
@@ -63,7 +63,7 @@ public class CustomLimited extends DeckBase {
|
||||
/** The Num packs. */
|
||||
private int numPacks = 3;
|
||||
|
||||
private transient ItemPoolView<CardPrinted> cardPool;
|
||||
private transient ItemPoolView<PaperCard> cardPool;
|
||||
|
||||
/** The Land set code. */
|
||||
private String landSetCode = CardDb.instance().getCard("Plains", true).getEdition();
|
||||
@@ -108,7 +108,7 @@ public class CustomLimited extends DeckBase {
|
||||
cd.numPacks = data.getInt("NumPacks");
|
||||
cd.singleton = data.getBoolean("Singleton");
|
||||
final Deck deckCube = cubes.get(data.get("DeckFile"));
|
||||
cd.cardPool = deckCube == null ? ItemPool.createFrom(CardDb.instance().getUniqueCards(), CardPrinted.class) : deckCube.getMain();
|
||||
cd.cardPool = deckCube == null ? ItemPool.createFrom(CardDb.instance().getUniqueCards(), PaperCard.class) : deckCube.getMain();
|
||||
|
||||
return cd;
|
||||
}
|
||||
@@ -148,7 +148,7 @@ public class CustomLimited extends DeckBase {
|
||||
*
|
||||
* @see forge.item.CardCollectionBase#getCardPool()
|
||||
*/
|
||||
public ItemPoolView<CardPrinted> getCardPool() {
|
||||
public ItemPoolView<PaperCard> getCardPool() {
|
||||
return this.cardPool;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
package forge.game.limited;
|
||||
|
||||
import forge.deck.Deck;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.ItemPoolView;
|
||||
|
||||
/**
|
||||
@@ -37,7 +37,7 @@ public interface IBoosterDraft {
|
||||
*
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
ItemPoolView<CardPrinted> nextChoice();
|
||||
ItemPoolView<PaperCard> nextChoice();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -47,7 +47,7 @@ public interface IBoosterDraft {
|
||||
* @param c
|
||||
* a {@link forge.Card} object.
|
||||
*/
|
||||
void setChoice(CardPrinted c);
|
||||
void setChoice(PaperCard c);
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
||||
@@ -31,7 +31,7 @@ import forge.deck.Deck;
|
||||
import forge.deck.DeckSection;
|
||||
import forge.deck.generate.GenerateDeckUtil;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.IPaperCard;
|
||||
import forge.util.MyRandom;
|
||||
|
||||
@@ -46,15 +46,15 @@ public class LimitedDeckBuilder {
|
||||
private ColorSet colors;
|
||||
private final DeckColors deckColors;
|
||||
private Predicate<CardRules> hasColor;
|
||||
private final List<CardPrinted> availableList;
|
||||
private final List<CardPrinted> aiPlayables;
|
||||
private List<CardPrinted> deckList = new ArrayList<CardPrinted>();
|
||||
private final List<PaperCard> availableList;
|
||||
private final List<PaperCard> aiPlayables;
|
||||
private List<PaperCard> deckList = new ArrayList<PaperCard>();
|
||||
private List<String> setsWithBasicLands = new ArrayList<String>();
|
||||
// Views for aiPlayable
|
||||
|
||||
private Iterable<CardPrinted> colorList;
|
||||
private Iterable<CardPrinted> onColorCreatures;
|
||||
private Iterable<CardPrinted> onColorNonCreatures;
|
||||
private Iterable<PaperCard> colorList;
|
||||
private Iterable<PaperCard> onColorCreatures;
|
||||
private Iterable<PaperCard> onColorNonCreatures;
|
||||
|
||||
private static ReadDraftRankings draftRankings = new ReadDraftRankings();
|
||||
|
||||
@@ -67,14 +67,14 @@ public class LimitedDeckBuilder {
|
||||
* @param pClrs
|
||||
* Chosen colors.
|
||||
*/
|
||||
public LimitedDeckBuilder(List<CardPrinted> dList, DeckColors pClrs) {
|
||||
public LimitedDeckBuilder(List<PaperCard> dList, DeckColors pClrs) {
|
||||
this.availableList = dList;
|
||||
this.deckColors = pClrs;
|
||||
this.colors = pClrs.getChosenColors();
|
||||
|
||||
// removeUnplayables();
|
||||
Iterable<CardPrinted> playables = Iterables.filter(availableList,
|
||||
Predicates.compose(CardRulesPredicates.IS_KEPT_IN_AI_DECKS, CardPrinted.FN_GET_RULES));
|
||||
Iterable<PaperCard> playables = Iterables.filter(availableList,
|
||||
Predicates.compose(CardRulesPredicates.IS_KEPT_IN_AI_DECKS, PaperCard.FN_GET_RULES));
|
||||
this.aiPlayables = Lists.newArrayList(playables);
|
||||
this.availableList.removeAll(getAiPlayables());
|
||||
|
||||
@@ -88,7 +88,7 @@ public class LimitedDeckBuilder {
|
||||
* @param list
|
||||
* Cards to build the deck from.
|
||||
*/
|
||||
public LimitedDeckBuilder(List<CardPrinted> list) {
|
||||
public LimitedDeckBuilder(List<PaperCard> list) {
|
||||
this(list, new DeckColors());
|
||||
}
|
||||
|
||||
@@ -102,19 +102,19 @@ public class LimitedDeckBuilder {
|
||||
public Deck buildDeck() {
|
||||
// 1. Prepare
|
||||
hasColor = Predicates.or(new GenerateDeckUtil.MatchColorIdentity(colors), GenerateDeckUtil.COLORLESS_CARDS);
|
||||
colorList = Iterables.filter(aiPlayables, Predicates.compose(hasColor, CardPrinted.FN_GET_RULES));
|
||||
colorList = Iterables.filter(aiPlayables, Predicates.compose(hasColor, PaperCard.FN_GET_RULES));
|
||||
onColorCreatures = Iterables.filter(colorList,
|
||||
Predicates.compose(CardRulesPredicates.Presets.IS_CREATURE, CardPrinted.FN_GET_RULES));
|
||||
Predicates.compose(CardRulesPredicates.Presets.IS_CREATURE, PaperCard.FN_GET_RULES));
|
||||
onColorNonCreatures = Iterables.filter(colorList,
|
||||
Predicates.compose(CardRulesPredicates.Presets.IS_NON_CREATURE_SPELL, CardPrinted.FN_GET_RULES));
|
||||
Predicates.compose(CardRulesPredicates.Presets.IS_NON_CREATURE_SPELL, PaperCard.FN_GET_RULES));
|
||||
// Guava iterables do not copy the collection contents, instead they act
|
||||
// as filters and iterate over _source_ collection each time. So even if
|
||||
// aiPlayable has changed, there is no need to create a new iterable.
|
||||
|
||||
// 2. Add any planeswalkers
|
||||
Iterable<CardPrinted> onColorWalkers = Iterables.filter(colorList,
|
||||
Predicates.compose(CardRulesPredicates.Presets.IS_PLANESWALKER, CardPrinted.FN_GET_RULES));
|
||||
List<CardPrinted> walkers = Lists.newArrayList(onColorWalkers);
|
||||
Iterable<PaperCard> onColorWalkers = Iterables.filter(colorList,
|
||||
Predicates.compose(CardRulesPredicates.Presets.IS_PLANESWALKER, PaperCard.FN_GET_RULES));
|
||||
List<PaperCard> walkers = Lists.newArrayList(onColorWalkers);
|
||||
deckList.addAll(walkers);
|
||||
aiPlayables.removeAll(walkers);
|
||||
|
||||
@@ -134,12 +134,12 @@ public class LimitedDeckBuilder {
|
||||
|
||||
// 6. If there are still on-color cards, and the average cmc is low, add
|
||||
// a 23rd card.
|
||||
Iterable<CardPrinted> nonLands = Iterables.filter(colorList,
|
||||
Predicates.compose(CardRulesPredicates.Presets.IS_NON_LAND, CardPrinted.FN_GET_RULES));
|
||||
Iterable<PaperCard> nonLands = Iterables.filter(colorList,
|
||||
Predicates.compose(CardRulesPredicates.Presets.IS_NON_LAND, PaperCard.FN_GET_RULES));
|
||||
if (deckList.size() == numSpellsNeeded && getAverageCMC(deckList) < 3) {
|
||||
List<Pair<Double, CardPrinted>> list = rankCards(nonLands);
|
||||
List<Pair<Double, PaperCard>> list = rankCards(nonLands);
|
||||
if (!list.isEmpty()) {
|
||||
CardPrinted c = list.get(0).getValue();
|
||||
PaperCard c = list.get(0).getValue();
|
||||
deckList.add(c);
|
||||
getAiPlayables().remove(c);
|
||||
landsNeeded--;
|
||||
@@ -201,19 +201,19 @@ public class LimitedDeckBuilder {
|
||||
private void debugFinalDeck() {
|
||||
int i = 0;
|
||||
System.out.println("DECK");
|
||||
for (CardPrinted c : deckList) {
|
||||
for (PaperCard c : deckList) {
|
||||
i++;
|
||||
System.out.println(i + ". " + c.toString() + ": " + c.getRules().getManaCost().toString());
|
||||
}
|
||||
i = 0;
|
||||
System.out.println("NOT PLAYABLE");
|
||||
for (CardPrinted c : availableList) {
|
||||
for (PaperCard c : availableList) {
|
||||
i++;
|
||||
System.out.println(i + ". " + c.toString() + ": " + c.getRules().getManaCost().toString());
|
||||
}
|
||||
i = 0;
|
||||
System.out.println("NOT PICKED");
|
||||
for (CardPrinted c : getAiPlayables()) {
|
||||
for (PaperCard c : getAiPlayables()) {
|
||||
i++;
|
||||
System.out.println(i + ". " + c.toString() + ": " + c.getRules().getManaCost().toString());
|
||||
}
|
||||
@@ -229,7 +229,7 @@ public class LimitedDeckBuilder {
|
||||
private void fixDeckSize(final CCnt[] clrCnts) {
|
||||
while (deckList.size() > 40) {
|
||||
System.out.println("WARNING: Fixing deck size, currently " + deckList.size() + " cards.");
|
||||
final CardPrinted c = deckList.get(MyRandom.getRandom().nextInt(deckList.size() - 1));
|
||||
final PaperCard c = deckList.get(MyRandom.getRandom().nextInt(deckList.size() - 1));
|
||||
deckList.remove(c);
|
||||
getAiPlayables().add(c);
|
||||
System.out.println(" - Removed " + c.getName() + " randomly.");
|
||||
@@ -238,12 +238,12 @@ public class LimitedDeckBuilder {
|
||||
while (deckList.size() < 40) {
|
||||
System.out.println("WARNING: Fixing deck size, currently " + deckList.size() + " cards.");
|
||||
if (getAiPlayables().size() > 1) {
|
||||
final CardPrinted c = getAiPlayables().get(MyRandom.getRandom().nextInt(getAiPlayables().size() - 1));
|
||||
final PaperCard c = getAiPlayables().get(MyRandom.getRandom().nextInt(getAiPlayables().size() - 1));
|
||||
deckList.add(c);
|
||||
getAiPlayables().remove(c);
|
||||
System.out.println(" - Added " + c.getName() + " randomly.");
|
||||
} else if (getAiPlayables().size() == 1) {
|
||||
final CardPrinted c = getAiPlayables().get(0);
|
||||
final PaperCard c = getAiPlayables().get(0);
|
||||
deckList.add(c);
|
||||
getAiPlayables().remove(c);
|
||||
System.out.println(" - Added " + c.getName() + " randomly.");
|
||||
@@ -251,7 +251,7 @@ public class LimitedDeckBuilder {
|
||||
// if no playable cards remain fill up with basic lands
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (clrCnts[i].getCount() > 0) {
|
||||
final CardPrinted cp = getBasicLand(clrCnts[i].getColor());
|
||||
final PaperCard cp = getBasicLand(clrCnts[i].getColor());
|
||||
deckList.add(cp);
|
||||
System.out.println(" - Added " + cp.getName() + " as last resort.");
|
||||
break;
|
||||
@@ -266,7 +266,7 @@ public class LimitedDeckBuilder {
|
||||
*/
|
||||
private void findBasicLandSets() {
|
||||
Set<String> sets = new HashSet<String>();
|
||||
for (CardPrinted cp : aiPlayables) {
|
||||
for (PaperCard cp : aiPlayables) {
|
||||
if (null != CardDb.instance().tryGetCard("Plains", cp.getEdition())) {
|
||||
sets.add(cp.getEdition());
|
||||
}
|
||||
@@ -321,7 +321,7 @@ public class LimitedDeckBuilder {
|
||||
int n = 0;
|
||||
while (landsNeeded > 0) {
|
||||
if (clrCnts[n].getCount() > 0) {
|
||||
final CardPrinted cp = getBasicLand(clrCnts[n].getColor());
|
||||
final PaperCard cp = getBasicLand(clrCnts[n].getColor());
|
||||
deckList.add(cp);
|
||||
landsNeeded--;
|
||||
|
||||
@@ -341,7 +341,7 @@ public class LimitedDeckBuilder {
|
||||
* @param basicLand
|
||||
* @return card
|
||||
*/
|
||||
private CardPrinted getBasicLand(String basicLand) {
|
||||
private PaperCard getBasicLand(String basicLand) {
|
||||
String set;
|
||||
if (setsWithBasicLands.size() > 1) {
|
||||
set = setsWithBasicLands.get(MyRandom.getRandom().nextInt(setsWithBasicLands.size() - 1));
|
||||
@@ -396,10 +396,10 @@ public class LimitedDeckBuilder {
|
||||
*/
|
||||
private void addNonBasicLands() {
|
||||
List<String> inverseDuals = GenerateDeckUtil.getInverseDualLandList(colors);
|
||||
Iterable<CardPrinted> lands = Iterables.filter(aiPlayables,
|
||||
Predicates.compose(CardRulesPredicates.Presets.IS_NONBASIC_LAND, CardPrinted.FN_GET_RULES));
|
||||
List<Pair<Double, CardPrinted>> ranked = rankCards(lands);
|
||||
for (Pair<Double, CardPrinted> bean : ranked) {
|
||||
Iterable<PaperCard> lands = Iterables.filter(aiPlayables,
|
||||
Predicates.compose(CardRulesPredicates.Presets.IS_NONBASIC_LAND, PaperCard.FN_GET_RULES));
|
||||
List<Pair<Double, PaperCard>> ranked = rankCards(lands);
|
||||
for (Pair<Double, PaperCard> bean : ranked) {
|
||||
if (landsNeeded > 0) {
|
||||
// Throw out any dual-lands for the wrong colors. Assume
|
||||
// everything else is either
|
||||
@@ -425,10 +425,10 @@ public class LimitedDeckBuilder {
|
||||
*/
|
||||
private void addThirdColorCards(int nCards) {
|
||||
if (nCards > 0) {
|
||||
Iterable<CardPrinted> others = Iterables.filter(aiPlayables,
|
||||
Predicates.compose(CardRulesPredicates.Presets.IS_NON_LAND, CardPrinted.FN_GET_RULES));
|
||||
List<Pair<Double, CardPrinted>> ranked = rankCards(others);
|
||||
for (Pair<Double, CardPrinted> bean : ranked) {
|
||||
Iterable<PaperCard> others = Iterables.filter(aiPlayables,
|
||||
Predicates.compose(CardRulesPredicates.Presets.IS_NON_LAND, PaperCard.FN_GET_RULES));
|
||||
List<Pair<Double, PaperCard>> ranked = rankCards(others);
|
||||
for (Pair<Double, PaperCard> bean : ranked) {
|
||||
// Want a card that has just one "off" color.
|
||||
ColorSet off = colors.getOffColors(bean.getValue().getRules().getColor());
|
||||
if (off.isMonoColor()) {
|
||||
@@ -439,10 +439,10 @@ public class LimitedDeckBuilder {
|
||||
|
||||
hasColor = Predicates.or(new GenerateDeckUtil.MatchColorIdentity(colors),
|
||||
GenerateDeckUtil.COLORLESS_CARDS);
|
||||
Iterable<CardPrinted> threeColorList = Iterables.filter(aiPlayables,
|
||||
Predicates.compose(hasColor, CardPrinted.FN_GET_RULES));
|
||||
Iterable<PaperCard> threeColorList = Iterables.filter(aiPlayables,
|
||||
Predicates.compose(hasColor, PaperCard.FN_GET_RULES));
|
||||
ranked = rankCards(threeColorList);
|
||||
for (Pair<Double, CardPrinted> bean : ranked) {
|
||||
for (Pair<Double, PaperCard> bean : ranked) {
|
||||
if (nCards > 0) {
|
||||
deckList.add(bean.getValue());
|
||||
aiPlayables.remove(bean.getValue());
|
||||
@@ -464,10 +464,10 @@ public class LimitedDeckBuilder {
|
||||
* @param nCards
|
||||
*/
|
||||
private void addRandomCards(int nCards) {
|
||||
Iterable<CardPrinted> others = Iterables.filter(aiPlayables,
|
||||
Predicates.compose(CardRulesPredicates.Presets.IS_NON_LAND, CardPrinted.FN_GET_RULES));
|
||||
List<Pair<Double, CardPrinted>> ranked = rankCards(others);
|
||||
for (Pair<Double, CardPrinted> bean : ranked) {
|
||||
Iterable<PaperCard> others = Iterables.filter(aiPlayables,
|
||||
Predicates.compose(CardRulesPredicates.Presets.IS_NON_LAND, PaperCard.FN_GET_RULES));
|
||||
List<Pair<Double, PaperCard>> ranked = rankCards(others);
|
||||
for (Pair<Double, PaperCard> bean : ranked) {
|
||||
if (nCards > 0) {
|
||||
deckList.add(bean.getValue());
|
||||
aiPlayables.remove(bean.getValue());
|
||||
@@ -489,10 +489,10 @@ public class LimitedDeckBuilder {
|
||||
* cards to choose from
|
||||
* @param num
|
||||
*/
|
||||
private void addNonCreatures(List<Pair<Double, CardPrinted>> nonCreatures, int num) {
|
||||
for (Pair<Double, CardPrinted> bean : nonCreatures) {
|
||||
private void addNonCreatures(List<Pair<Double, PaperCard>> nonCreatures, int num) {
|
||||
for (Pair<Double, PaperCard> bean : nonCreatures) {
|
||||
if (num > 0) {
|
||||
CardPrinted cardToAdd = bean.getValue();
|
||||
PaperCard cardToAdd = bean.getValue();
|
||||
deckList.add(cardToAdd);
|
||||
num--;
|
||||
getAiPlayables().remove(cardToAdd);
|
||||
@@ -516,22 +516,22 @@ public class LimitedDeckBuilder {
|
||||
* number of cards
|
||||
* @return number left after adding
|
||||
*/
|
||||
private int addDeckHintsCards(CardPrinted cardToAdd, int num) {
|
||||
private int addDeckHintsCards(PaperCard cardToAdd, int num) {
|
||||
// cards with DeckHints will try to grab additional cards from the pool
|
||||
DeckHints hints = cardToAdd.getRules().getAiHints().getDeckHints();
|
||||
if (hints != null && hints.getType() != DeckHints.Type.NONE) {
|
||||
Iterable<CardPrinted> onColor = Iterables.filter(aiPlayables, Predicates.compose(hasColor, CardPrinted.FN_GET_RULES));
|
||||
List<CardPrinted> comboCards = hints.filter(onColor);
|
||||
Iterable<PaperCard> onColor = Iterables.filter(aiPlayables, Predicates.compose(hasColor, PaperCard.FN_GET_RULES));
|
||||
List<PaperCard> comboCards = hints.filter(onColor);
|
||||
if (Preferences.DEV_MODE) {
|
||||
System.out.println("Found " + comboCards.size() + " cards for " + cardToAdd.getName());
|
||||
}
|
||||
for (Pair<Double, CardPrinted> comboBean : rankCards(comboCards)) {
|
||||
for (Pair<Double, PaperCard> comboBean : rankCards(comboCards)) {
|
||||
if (num > 0) {
|
||||
// This is not exactly right, because the
|
||||
// rankedComboCards could include creatures and
|
||||
// non-creatures.
|
||||
// This code could add too many of one or the other.
|
||||
CardPrinted combo = comboBean.getValue();
|
||||
PaperCard combo = comboBean.getValue();
|
||||
deckList.add(combo);
|
||||
num--;
|
||||
getAiPlayables().remove(combo);
|
||||
@@ -555,11 +555,11 @@ public class LimitedDeckBuilder {
|
||||
private void checkRemRandomDeckCards() {
|
||||
int numCreatures = 0;
|
||||
int numOthers = 0;
|
||||
for (ListIterator<CardPrinted> it = deckList.listIterator(); it.hasNext();) {
|
||||
CardPrinted card = it.next();
|
||||
for (ListIterator<PaperCard> it = deckList.listIterator(); it.hasNext();) {
|
||||
PaperCard card = it.next();
|
||||
CardAiHints ai = card.getRules().getAiHints();
|
||||
if (ai.getRemRandomDecks()) {
|
||||
List<CardPrinted> comboCards = new ArrayList<CardPrinted>();
|
||||
List<PaperCard> comboCards = new ArrayList<PaperCard>();
|
||||
if (ai.getDeckNeeds() != null
|
||||
&& ai.getDeckNeeds().getType() != DeckHints.Type.NONE) {
|
||||
DeckHints needs = ai.getDeckNeeds();
|
||||
@@ -609,10 +609,10 @@ public class LimitedDeckBuilder {
|
||||
* cards to choose from
|
||||
* @param num
|
||||
*/
|
||||
private void addCreatures(List<Pair<Double, CardPrinted>> creatures, int num) {
|
||||
for (Pair<Double, CardPrinted> bean : creatures) {
|
||||
private void addCreatures(List<Pair<Double, PaperCard>> creatures, int num) {
|
||||
for (Pair<Double, PaperCard> bean : creatures) {
|
||||
if (num > 0) {
|
||||
CardPrinted c = bean.getValue();
|
||||
PaperCard c = bean.getValue();
|
||||
deckList.add(c);
|
||||
num--;
|
||||
getAiPlayables().remove(c);
|
||||
@@ -635,13 +635,13 @@ public class LimitedDeckBuilder {
|
||||
* cards to choose from
|
||||
* @param num
|
||||
*/
|
||||
private void addManaCurveCreatures(List<Pair<Double, CardPrinted>> creatures, int num) {
|
||||
private void addManaCurveCreatures(List<Pair<Double, PaperCard>> creatures, int num) {
|
||||
Map<Integer, Integer> creatureCosts = new HashMap<Integer, Integer>();
|
||||
for (int i = 1; i < 7; i++) {
|
||||
creatureCosts.put(i, 0);
|
||||
}
|
||||
Predicate<CardPrinted> filter = Predicates.compose(CardRulesPredicates.Presets.IS_CREATURE,
|
||||
CardPrinted.FN_GET_RULES);
|
||||
Predicate<PaperCard> filter = Predicates.compose(CardRulesPredicates.Presets.IS_CREATURE,
|
||||
PaperCard.FN_GET_RULES);
|
||||
for (IPaperCard creature : Iterables.filter(deckList, filter)) {
|
||||
int cmc = creature.getRules().getManaCost().getCMC();
|
||||
if (cmc < 1) {
|
||||
@@ -652,8 +652,8 @@ public class LimitedDeckBuilder {
|
||||
creatureCosts.put(cmc, creatureCosts.get(cmc) + 1);
|
||||
}
|
||||
|
||||
for (Pair<Double, CardPrinted> bean : creatures) {
|
||||
CardPrinted c = bean.getValue();
|
||||
for (Pair<Double, PaperCard> bean : creatures) {
|
||||
PaperCard c = bean.getValue();
|
||||
int cmc = c.getRules().getManaCost().getCMC();
|
||||
if (cmc < 1) {
|
||||
cmc = 1;
|
||||
@@ -705,9 +705,9 @@ public class LimitedDeckBuilder {
|
||||
* CardPrinteds to rank
|
||||
* @return List of beans with card rankings
|
||||
*/
|
||||
protected List<Pair<Double, CardPrinted>> rankCards(Iterable<CardPrinted> cards) {
|
||||
List<Pair<Double, CardPrinted>> ranked = new ArrayList<Pair<Double, CardPrinted>>();
|
||||
for (CardPrinted card : cards) {
|
||||
protected List<Pair<Double, PaperCard>> rankCards(Iterable<PaperCard> cards) {
|
||||
List<Pair<Double, PaperCard>> ranked = new ArrayList<Pair<Double, PaperCard>>();
|
||||
for (PaperCard card : cards) {
|
||||
Double rkg = draftRankings.getRanking(card.getName(), card.getEdition());
|
||||
if (rkg != null) {
|
||||
ranked.add(Pair.of(rkg, card));
|
||||
@@ -725,7 +725,7 @@ public class LimitedDeckBuilder {
|
||||
* @param cards
|
||||
* @return the average
|
||||
*/
|
||||
private double getAverageCMC(List<CardPrinted> cards) {
|
||||
private double getAverageCMC(List<PaperCard> cards) {
|
||||
double sum = 0.0;
|
||||
for (IPaperCard cardPrinted : cards) {
|
||||
sum += cardPrinted.getRules().getManaCost().getCMC();
|
||||
@@ -751,7 +751,7 @@ public class LimitedDeckBuilder {
|
||||
/**
|
||||
* @return the aiPlayables
|
||||
*/
|
||||
public List<CardPrinted> getAiPlayables() {
|
||||
public List<PaperCard> getAiPlayables() {
|
||||
return aiPlayables;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ import forge.card.UnOpenedProduct;
|
||||
import forge.deck.CardPool;
|
||||
import forge.gui.GuiChoose;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.ItemPool;
|
||||
import forge.util.FileUtil;
|
||||
import forge.util.TextUtil;
|
||||
@@ -336,7 +336,7 @@ public class SealedCardPoolGenerator {
|
||||
* boolean, get pool for human (possible choices)
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public ItemPool<CardPrinted> getCardpool(final boolean isHuman) {
|
||||
public ItemPool<PaperCard> getCardpool(final boolean isHuman) {
|
||||
final CardPool pool = new CardPool();
|
||||
|
||||
for (IUnOpenedProduct prod : product) {
|
||||
|
||||
@@ -14,7 +14,7 @@ import forge.Constant.Color;
|
||||
import forge.card.CardRules;
|
||||
import forge.card.CardRulesPredicates;
|
||||
import forge.card.ColorSet;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.util.MyRandom;
|
||||
|
||||
/**
|
||||
@@ -23,7 +23,7 @@ import forge.util.MyRandom;
|
||||
*/
|
||||
public class SealedDeckBuilder extends LimitedDeckBuilder {
|
||||
|
||||
public SealedDeckBuilder(List<CardPrinted> list) {
|
||||
public SealedDeckBuilder(List<PaperCard> list) {
|
||||
super(list);
|
||||
this.setColors(chooseColors());
|
||||
}
|
||||
@@ -34,18 +34,18 @@ public class SealedDeckBuilder extends LimitedDeckBuilder {
|
||||
* @return DeckColors
|
||||
*/
|
||||
private ColorSet chooseColors() {
|
||||
List<Pair<Double, CardPrinted>> rankedCards = rankCards(getAiPlayables());
|
||||
List<Pair<Double, PaperCard>> rankedCards = rankCards(getAiPlayables());
|
||||
|
||||
// choose colors based on top 33% of cards
|
||||
final List<CardPrinted> colorChooserList = new ArrayList<CardPrinted>();
|
||||
final List<PaperCard> colorChooserList = new ArrayList<PaperCard>();
|
||||
double limit = rankedCards.size() * .33;
|
||||
for (int i = 0; i < limit; i++) {
|
||||
CardPrinted cp = rankedCards.get(i).getValue();
|
||||
PaperCard cp = rankedCards.get(i).getValue();
|
||||
colorChooserList.add(cp);
|
||||
//System.out.println(cp.getName() + " " + cp.getRules().getManaCost().toString());
|
||||
}
|
||||
|
||||
Iterable<CardRules> rules = Iterables.transform(colorChooserList, CardPrinted.FN_GET_RULES);
|
||||
Iterable<CardRules> rules = Iterables.transform(colorChooserList, PaperCard.FN_GET_RULES);
|
||||
|
||||
int white = Iterables.size(Iterables.filter(rules, CardRulesPredicates.Presets.IS_WHITE));
|
||||
int blue = Iterables.size(Iterables.filter(rules, CardRulesPredicates.Presets.IS_BLUE));
|
||||
|
||||
@@ -42,7 +42,7 @@ import forge.gui.input.InputSelectCards;
|
||||
import forge.gui.input.InputSelectCardsFromList;
|
||||
import forge.gui.input.InputSynchronized;
|
||||
import forge.gui.match.CMatchUI;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
import forge.util.TextUtil;
|
||||
|
||||
@@ -139,7 +139,7 @@ public class PlayerControllerHuman extends PlayerController {
|
||||
int sbMax = sbRange == null ? combinedDeckSize : sbRange.getMaximumInteger();
|
||||
|
||||
CardPool newSb = new CardPool();
|
||||
List<CardPrinted> newMain = null;
|
||||
List<PaperCard> newMain = null;
|
||||
|
||||
if (sbSize == 0 && mainSize == deckMinSize) {
|
||||
// Skip sideboard loop if there are no sideboarding opportunities
|
||||
@@ -163,7 +163,7 @@ public class PlayerControllerHuman extends PlayerController {
|
||||
newSb.clear();
|
||||
newSb.addAll(main);
|
||||
newSb.addAll(sideboard);
|
||||
for(CardPrinted c : newMain) {
|
||||
for(PaperCard c : newMain) {
|
||||
newSb.remove(c);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
|
||||
import forge.deck.CardPool;
|
||||
import forge.error.BugReporter;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.properties.NewConstants;
|
||||
import forge.util.IgnoringXStream;
|
||||
|
||||
@@ -138,7 +138,7 @@ public class GauntletIO {
|
||||
|
||||
@Override
|
||||
public void marshal(final Object source, final HierarchicalStreamWriter writer, final MarshallingContext context) {
|
||||
for (final Entry<CardPrinted, Integer> e : (CardPool) source) {
|
||||
for (final Entry<PaperCard, Integer> e : (CardPool) source) {
|
||||
this.writeCardPrinted(e.getKey(), e.getValue(), writer);
|
||||
}
|
||||
}
|
||||
@@ -163,7 +163,7 @@ public class GauntletIO {
|
||||
return result;
|
||||
}
|
||||
|
||||
private void writeCardPrinted(final CardPrinted cref, final Integer count, final HierarchicalStreamWriter writer) {
|
||||
private void writeCardPrinted(final PaperCard cref, final Integer count, final HierarchicalStreamWriter writer) {
|
||||
writer.startNode("card");
|
||||
writer.addAttribute("c", cref.getName());
|
||||
writer.addAttribute("s", cref.getEdition());
|
||||
@@ -177,14 +177,14 @@ public class GauntletIO {
|
||||
writer.endNode();
|
||||
}
|
||||
|
||||
private CardPrinted readCardPrinted(final HierarchicalStreamReader reader) {
|
||||
private PaperCard readCardPrinted(final HierarchicalStreamReader reader) {
|
||||
final String name = reader.getAttribute("c");
|
||||
final String set = reader.getAttribute("s");
|
||||
final String sIndex = reader.getAttribute("i");
|
||||
final short index = StringUtils.isNumeric(sIndex) ? Short.parseShort(sIndex) : 0;
|
||||
final boolean foil = "1".equals(reader.getAttribute("foil"));
|
||||
final CardPrinted card = CardDb.instance().getCard(name, set, index);
|
||||
return foil ? CardPrinted.makeFoiled(card) : card;
|
||||
final PaperCard card = CardDb.instance().getCard(name, set, index);
|
||||
return foil ? PaperCard.makeFoiled(card) : card;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ import javax.swing.JScrollPane;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
|
||||
/**
|
||||
* A simple class that shows a list of cards in a dialog with preview in its
|
||||
@@ -49,7 +49,7 @@ import forge.item.CardPrinted;
|
||||
public class CardListViewer {
|
||||
|
||||
// Data and number of choices for the list
|
||||
private final List<CardPrinted> list;
|
||||
private final List<PaperCard> list;
|
||||
|
||||
// Decoration
|
||||
private final String title;
|
||||
@@ -74,7 +74,7 @@ public class CardListViewer {
|
||||
* @param list
|
||||
* the list
|
||||
*/
|
||||
public CardListViewer(final String title, final List<CardPrinted> list) {
|
||||
public CardListViewer(final String title, final List<PaperCard> list) {
|
||||
this(title, "", list, null);
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public class CardListViewer {
|
||||
* @param list
|
||||
* the list
|
||||
*/
|
||||
public CardListViewer(final String title, final String message, final List<CardPrinted> list) {
|
||||
public CardListViewer(final String title, final String message, final List<PaperCard> list) {
|
||||
this(title, message, list, null);
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ public class CardListViewer {
|
||||
* @param dialogIcon
|
||||
* the dialog icon
|
||||
*/
|
||||
public CardListViewer(final String title, final String message, final List<CardPrinted> list, final Icon dialogIcon) {
|
||||
public CardListViewer(final String title, final String message, final List<PaperCard> list, final Icon dialogIcon) {
|
||||
this.title = title;
|
||||
this.list = Collections.unmodifiableList(list);
|
||||
this.jList = new JList(new ChooserListModel());
|
||||
@@ -200,7 +200,7 @@ public class CardListViewer {
|
||||
final int row = CardListViewer.this.jList.getSelectedIndex();
|
||||
// (String) jList.getSelectedValue();
|
||||
if ((row >= 0) && (row < CardListViewer.this.list.size())) {
|
||||
final CardPrinted cp = CardListViewer.this.list.get(row);
|
||||
final PaperCard cp = CardListViewer.this.list.get(row);
|
||||
CardListViewer.this.detail.setCard(cp.getMatchingForgeCard());
|
||||
CardListViewer.this.picture.setCard(cp);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import forge.gui.toolbox.FList;
|
||||
import forge.gui.toolbox.FPanel;
|
||||
import forge.gui.toolbox.FScrollPane;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.IPaperCard;
|
||||
|
||||
// An input box for handling the order of choices.
|
||||
@@ -315,7 +315,7 @@ public class DualListBox<T> extends FPanel {
|
||||
card = (Card) obj;
|
||||
} else if (obj instanceof SpellAbility) {
|
||||
card = ((SpellAbility) obj).getSourceCard();
|
||||
} else if (obj instanceof CardPrinted) {
|
||||
} else if (obj instanceof PaperCard) {
|
||||
card = ((IPaperCard) obj).getMatchingForgeCard();
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ import forge.game.player.Player;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.gui.input.InputSelectCardsFromList;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.IPaperCard;
|
||||
|
||||
public final class GuiDisplayUtil {
|
||||
@@ -375,7 +375,7 @@ public final class GuiDisplayUtil {
|
||||
return;
|
||||
}
|
||||
|
||||
final List<CardPrinted> cards = Lists.newArrayList(CardDb.instance().getUniqueCards());
|
||||
final List<PaperCard> cards = Lists.newArrayList(CardDb.instance().getUniqueCards());
|
||||
Collections.sort(cards);
|
||||
|
||||
// use standard forge's list selection dialog
|
||||
@@ -397,7 +397,7 @@ public final class GuiDisplayUtil {
|
||||
return;
|
||||
}
|
||||
|
||||
final List<CardPrinted> cards = Lists.newArrayList(CardDb.instance().getUniqueCards());
|
||||
final List<PaperCard> cards = Lists.newArrayList(CardDb.instance().getUniqueCards());
|
||||
Collections.sort(cards);
|
||||
|
||||
// use standard forge's list selection dialog
|
||||
@@ -471,8 +471,8 @@ public final class GuiDisplayUtil {
|
||||
if (game.getMatch().getGameType() != GameType.Planechase) { return; }
|
||||
final Player p = game.getPhaseHandler().getPlayerTurn();
|
||||
|
||||
final List<CardPrinted> allPlanars = new ArrayList<CardPrinted>();
|
||||
for (CardPrinted c : CardDb.variants().getAllCards()) {
|
||||
final List<PaperCard> allPlanars = new ArrayList<PaperCard>();
|
||||
for (PaperCard c : CardDb.variants().getAllCards()) {
|
||||
if (c.getRules().getType().isPlane() || c.getRules().getType().isPhenomenon()) {
|
||||
allPlanars.add(c);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ import forge.card.CardEdition;
|
||||
import forge.card.CardRules;
|
||||
import forge.card.EditionCollection;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.IPaperCard;
|
||||
import forge.properties.NewConstants;
|
||||
import forge.util.FileUtil;
|
||||
@@ -293,7 +293,7 @@ public class ImportSourceAnalyzer {
|
||||
return out.toString().toLowerCase();
|
||||
}
|
||||
|
||||
private void _addDefaultPicNames(CardPrinted c, boolean backFace) {
|
||||
private void _addDefaultPicNames(PaperCard c, boolean backFace) {
|
||||
CardRules card = c.getRules();
|
||||
String urls = card.getPictureUrl(backFace);
|
||||
if (StringUtils.isEmpty(urls)) { return; }
|
||||
@@ -323,13 +323,13 @@ public class ImportSourceAnalyzer {
|
||||
_defaultPicNames = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
|
||||
_defaultPicOldNameToCurrentName = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
|
||||
|
||||
for (CardPrinted c : CardDb.instance().getAllCards()) {
|
||||
for (PaperCard c : CardDb.instance().getAllCards()) {
|
||||
_addDefaultPicNames(c, false);
|
||||
if (ImageCache.hasBackFacePicture(c))
|
||||
_addDefaultPicNames(c, true);
|
||||
}
|
||||
|
||||
for (CardPrinted c : CardDb.variants().getAllCards()) {
|
||||
for (PaperCard c : CardDb.variants().getAllCards()) {
|
||||
_addDefaultPicNames(c, false);
|
||||
// variants never have backfaces
|
||||
}
|
||||
@@ -362,8 +362,8 @@ public class ImportSourceAnalyzer {
|
||||
// set card pics
|
||||
//
|
||||
|
||||
private static void _addSetCards(Map<String, String> cardFileNames, Iterable<CardPrinted> library, Predicate<CardPrinted> filter) {
|
||||
for (CardPrinted c : Iterables.filter(library, filter)) {
|
||||
private static void _addSetCards(Map<String, String> cardFileNames, Iterable<PaperCard> library, Predicate<PaperCard> filter) {
|
||||
for (PaperCard c : Iterables.filter(library, filter)) {
|
||||
String filename = ImageCache.getImageKey(c, false, true) + ".jpg";
|
||||
cardFileNames.put(filename, filename);
|
||||
if (ImageCache.hasBackFacePicture(c)) {
|
||||
@@ -380,7 +380,7 @@ public class ImportSourceAnalyzer {
|
||||
_cardFileNamesBySet = new TreeMap<String, Map<String, String>>(String.CASE_INSENSITIVE_ORDER);
|
||||
for (CardEdition ce : Singletons.getModel().getEditions()) {
|
||||
Map<String, String> cardFileNames = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
|
||||
Predicate<CardPrinted> filter = IPaperCard.Predicates.printedInSet(ce.getCode());
|
||||
Predicate<PaperCard> filter = IPaperCard.Predicates.printedInSet(ce.getCode());
|
||||
_addSetCards(cardFileNames, CardDb.instance().getAllCards(), filter);
|
||||
_addSetCards(cardFileNames, CardDb.variants().getAllCards(), filter);
|
||||
_cardFileNamesBySet.put(ce.getCode2(), cardFileNames);
|
||||
@@ -388,14 +388,14 @@ public class ImportSourceAnalyzer {
|
||||
|
||||
// planar cards now don't have the ".full" part in their filenames
|
||||
_nameUpdates = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
|
||||
Predicate<CardPrinted> predPlanes = new Predicate<CardPrinted>() {
|
||||
Predicate<PaperCard> predPlanes = new Predicate<PaperCard>() {
|
||||
@Override
|
||||
public boolean apply(CardPrinted arg0) {
|
||||
public boolean apply(PaperCard arg0) {
|
||||
return arg0.getRules().getType().isPlane() || arg0.getRules().getType().isPhenomenon();
|
||||
}
|
||||
};
|
||||
|
||||
for (CardPrinted c : Iterables.filter(CardDb.variants().getAllCards(), predPlanes)) {
|
||||
for (PaperCard c : Iterables.filter(CardDb.variants().getAllCards(), predPlanes)) {
|
||||
String baseName = ImageCache.getImageKey(c,false, true);
|
||||
_nameUpdates.put(baseName + ".full.jpg", baseName + ".jpg");
|
||||
if (ImageCache.hasBackFacePicture(c)) {
|
||||
|
||||
@@ -48,7 +48,7 @@ import forge.deck.DeckRecognizer.TokenType;
|
||||
import forge.deck.DeckSection;
|
||||
import forge.gui.GuiUtils;
|
||||
import forge.gui.deckeditor.controllers.ACEditorBase;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.InventoryItem;
|
||||
|
||||
/**
|
||||
@@ -231,7 +231,7 @@ public class DeckImport<TItem extends InventoryItem, TModel extends DeckBase> ex
|
||||
if (type != DeckRecognizer.TokenType.KnownCard) {
|
||||
continue;
|
||||
}
|
||||
final CardPrinted crd = t.getCard();
|
||||
final PaperCard crd = t.getCard();
|
||||
if (isMain) {
|
||||
result.getMain().add(crd, t.getNumber());
|
||||
} else {
|
||||
|
||||
@@ -14,7 +14,7 @@ import forge.gui.deckeditor.views.VCardCatalog;
|
||||
import forge.gui.deckeditor.views.VCurrentDeck;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.item.ItemPoolView;
|
||||
import forge.util.Aggregates;
|
||||
@@ -78,7 +78,7 @@ public final class SEditorUtil {
|
||||
return (int) Math.round((double) (x0 * 100) / (double) y0);
|
||||
}
|
||||
|
||||
private static final Predicate<Object> totalPred = Predicates.instanceOf(CardPrinted.class);
|
||||
private static final Predicate<Object> totalPred = Predicates.instanceOf(PaperCard.class);
|
||||
private static final Predicate<Object> packPred = Predicates.not(totalPred);
|
||||
|
||||
/**
|
||||
@@ -100,7 +100,7 @@ public final class SEditorUtil {
|
||||
Aggregates.sum(Iterables.filter(items, Predicates.compose(packPred, items.FN_GET_KEY)), items.FN_GET_COUNT)));
|
||||
break;
|
||||
default:
|
||||
view.getStatLabel(s).setText(String.valueOf(items.countAll(Predicates.compose(s.predicate, CardPrinted.FN_GET_RULES), CardPrinted.class)));
|
||||
view.getStatLabel(s).setText(String.valueOf(items.countAll(Predicates.compose(s.predicate, PaperCard.FN_GET_RULES), PaperCard.class)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import forge.gui.deckeditor.views.VCardCatalog;
|
||||
import forge.gui.deckeditor.views.VCardCatalog.RangeTypes;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
import forge.gui.toolbox.FSpinner;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.util.ComparableOp;
|
||||
import forge.util.PredicateString.StringOp;
|
||||
|
||||
@@ -31,7 +31,7 @@ public class SFilterUtil {
|
||||
* <br><br>
|
||||
* Handles "multicolor" label, which is quite tricky.
|
||||
*/
|
||||
public static Predicate<CardPrinted> buildColorAndTypeFilter(Map<SEditorUtil.StatTypes, FLabel> statLabels) {
|
||||
public static Predicate<PaperCard> buildColorAndTypeFilter(Map<SEditorUtil.StatTypes, FLabel> statLabels) {
|
||||
final List<Predicate<CardRules>> colors = new ArrayList<Predicate<CardRules>>();
|
||||
final List<Predicate<CardRules>> types = new ArrayList<Predicate<CardRules>>();
|
||||
|
||||
@@ -67,12 +67,12 @@ public class SFilterUtil {
|
||||
return Predicates.alwaysTrue();
|
||||
}
|
||||
|
||||
Predicate<CardPrinted> typesFinal = Predicates.compose(Predicates.or(types), CardPrinted.FN_GET_RULES);
|
||||
Predicate<PaperCard> typesFinal = Predicates.compose(Predicates.or(types), PaperCard.FN_GET_RULES);
|
||||
if (null == preFinal) {
|
||||
return typesFinal;
|
||||
}
|
||||
|
||||
Predicate<CardPrinted> colorFinal = Predicates.compose(preFinal, CardPrinted.FN_GET_RULES);
|
||||
Predicate<PaperCard> colorFinal = Predicates.compose(preFinal, PaperCard.FN_GET_RULES);
|
||||
if (7 == types.size()) {
|
||||
return colorFinal;
|
||||
}
|
||||
@@ -83,7 +83,7 @@ public class SFilterUtil {
|
||||
/**
|
||||
* builds a string search filter
|
||||
*/
|
||||
public static Predicate<CardPrinted> buildTextFilter(String text, boolean invert, boolean inName, boolean inType, boolean inText) {
|
||||
public static Predicate<PaperCard> buildTextFilter(String text, boolean invert, boolean inName, boolean inType, boolean inText) {
|
||||
if (text.trim().isEmpty()) {
|
||||
return Predicates.alwaysTrue();
|
||||
}
|
||||
@@ -102,7 +102,7 @@ public class SFilterUtil {
|
||||
}
|
||||
Predicate<CardRules> textFilter = invert ? Predicates.not(Predicates.or(terms)) : Predicates.and(terms);
|
||||
|
||||
return Predicates.compose(textFilter, CardPrinted.FN_GET_RULES);
|
||||
return Predicates.compose(textFilter, PaperCard.FN_GET_RULES);
|
||||
}
|
||||
|
||||
private static Predicate<CardRules> getCardRulesFieldPredicate(int min, int max, CardRulesPredicates.LeafNumber.CardField field) {
|
||||
@@ -123,7 +123,7 @@ public class SFilterUtil {
|
||||
/**
|
||||
* builds a filter for an interval on a card field
|
||||
*/
|
||||
public static Predicate<CardPrinted> buildIntervalFilter(
|
||||
public static Predicate<PaperCard> buildIntervalFilter(
|
||||
Map<RangeTypes, Pair<FSpinner, FSpinner>> spinners, VCardCatalog.RangeTypes field) {
|
||||
Pair<FSpinner, FSpinner> sPair = spinners.get(field);
|
||||
Predicate<CardRules> fieldFilter = getCardRulesFieldPredicate(
|
||||
@@ -138,7 +138,7 @@ public class SFilterUtil {
|
||||
if (fieldFilter == null) {
|
||||
return Predicates.alwaysTrue();
|
||||
} else {
|
||||
return Predicates.compose(fieldFilter, CardPrinted.FN_GET_RULES);
|
||||
return Predicates.compose(fieldFilter, PaperCard.FN_GET_RULES);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ import forge.gui.framework.ICDoc;
|
||||
import forge.gui.home.quest.DialogChooseSets;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
import forge.gui.toolbox.FSpinner;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.ItemPredicate;
|
||||
import forge.quest.QuestWorld;
|
||||
import forge.quest.data.GameFormatQuest;
|
||||
@@ -57,7 +57,7 @@ public enum CCardCatalog implements ICDoc {
|
||||
/** */
|
||||
SINGLETON_INSTANCE;
|
||||
|
||||
private final Set<Predicate<CardPrinted>> activePredicates = new HashSet<Predicate<CardPrinted>>();
|
||||
private final Set<Predicate<PaperCard>> activePredicates = new HashSet<Predicate<PaperCard>>();
|
||||
private final Set<GameFormat> activeFormats = new HashSet<GameFormat>();
|
||||
private final Set<QuestWorld> activeWorlds = new HashSet<QuestWorld>();
|
||||
private final Set<RangeTypes> activeRanges = EnumSet.noneOf(RangeTypes.class);
|
||||
@@ -321,8 +321,8 @@ public enum CCardCatalog implements ICDoc {
|
||||
// The main trick here is to apply a CardPrinted predicate
|
||||
// to the table. CardRules will lead to difficulties.
|
||||
|
||||
List<Predicate<? super CardPrinted>> cardPredicates = new ArrayList<Predicate<? super CardPrinted>>();
|
||||
cardPredicates.add(Predicates.instanceOf(CardPrinted.class));
|
||||
List<Predicate<? super PaperCard>> cardPredicates = new ArrayList<Predicate<? super PaperCard>>();
|
||||
cardPredicates.add(Predicates.instanceOf(PaperCard.class));
|
||||
cardPredicates.add(SFilterUtil.buildColorAndTypeFilter(VCardCatalog.SINGLETON_INSTANCE.getStatLabels()));
|
||||
cardPredicates.addAll(activePredicates);
|
||||
|
||||
@@ -341,12 +341,12 @@ public enum CCardCatalog implements ICDoc {
|
||||
VCardCatalog.SINGLETON_INSTANCE.getLblType().getSelected(),
|
||||
VCardCatalog.SINGLETON_INSTANCE.getLblText().getSelected()));
|
||||
|
||||
Predicate<CardPrinted> cardFilter = Predicates.and(cardPredicates);
|
||||
Predicate<PaperCard> cardFilter = Predicates.and(cardPredicates);
|
||||
|
||||
// show packs and decks in the card shop according to the toggle setting
|
||||
// this is special-cased apart from the buildColorAndTypeFilter() above
|
||||
if (VCardCatalog.SINGLETON_INSTANCE.getStatLabel(SEditorUtil.StatTypes.PACK).getSelected()) {
|
||||
List<Predicate<? super CardPrinted>> itemPredicates = new ArrayList<Predicate<? super CardPrinted>>();
|
||||
List<Predicate<? super PaperCard>> itemPredicates = new ArrayList<Predicate<? super PaperCard>>();
|
||||
itemPredicates.add(cardFilter);
|
||||
itemPredicates.add(ItemPredicate.Presets.IS_PACK);
|
||||
itemPredicates.add(ItemPredicate.Presets.IS_DECK);
|
||||
@@ -357,7 +357,7 @@ public enum CCardCatalog implements ICDoc {
|
||||
// TODO: is there really no way to make this type safe?
|
||||
ACEditorBase<?, ?> editor = CDeckEditorUI.SINGLETON_INSTANCE.getCurrentEditorController();
|
||||
if (null != editor) {
|
||||
((ACEditorBase<CardPrinted, DeckBase>)editor).getTableCatalog().setFilter(cardFilter);
|
||||
((ACEditorBase<PaperCard, DeckBase>)editor).getTableCatalog().setFilter(cardFilter);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -373,8 +373,8 @@ public enum CCardCatalog implements ICDoc {
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private <T> void addRestriction(Pair<? extends JComponent, Predicate<CardPrinted>> restriction, final Set<T> activeSet, final T key) {
|
||||
final Predicate<CardPrinted> predicate = restriction.getRight();
|
||||
private <T> void addRestriction(Pair<? extends JComponent, Predicate<PaperCard>> restriction, final Set<T> activeSet, final T key) {
|
||||
final Predicate<PaperCard> predicate = restriction.getRight();
|
||||
|
||||
if (null != predicate && activePredicates.contains(predicate)) {
|
||||
return;
|
||||
@@ -403,7 +403,7 @@ public enum CCardCatalog implements ICDoc {
|
||||
applyCurrentFilter();
|
||||
}
|
||||
|
||||
private Pair<JPanel, Predicate<CardPrinted>> buildRangeRestriction(RangeTypes t) {
|
||||
private Pair<JPanel, Predicate<PaperCard>> buildRangeRestriction(RangeTypes t) {
|
||||
final Pair<FSpinner, FSpinner> s = VCardCatalog.SINGLETON_INSTANCE.getSpinners().get(t);
|
||||
s.getLeft().setValue(0);
|
||||
s.getRight().setValue(10);
|
||||
@@ -431,7 +431,7 @@ public enum CCardCatalog implements ICDoc {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private Pair<FLabel, Predicate<CardPrinted>> buildSearchRestriction() {
|
||||
private Pair<FLabel, Predicate<PaperCard>> buildSearchRestriction() {
|
||||
boolean isInverse =
|
||||
VCardCatalog.SEARCH_MODE_INVERSE_INDEX == VCardCatalog.SINGLETON_INSTANCE.getCbSearchMode().getSelectedIndex();
|
||||
String text = VCardCatalog.SINGLETON_INSTANCE.getTxfSearch().getText();
|
||||
@@ -454,7 +454,7 @@ public enum CCardCatalog implements ICDoc {
|
||||
SFilterUtil.buildTextFilter(text, isInverse, wantName, wantType, wantText));
|
||||
}
|
||||
|
||||
private Pair<FLabel, Predicate<CardPrinted>> buildFormatRestriction(String displayName, GameFormat format, boolean allowReprints) {
|
||||
private Pair<FLabel, Predicate<PaperCard>> buildFormatRestriction(String displayName, GameFormat format, boolean allowReprints) {
|
||||
EditionCollection editions = Singletons.getModel().getEditions();
|
||||
StringBuilder tooltip = new StringBuilder("<html>Sets:");
|
||||
|
||||
@@ -515,7 +515,7 @@ public enum CCardCatalog implements ICDoc {
|
||||
allowReprints ? format.getFilterRules() : format.getFilterPrinted());
|
||||
}
|
||||
|
||||
private Pair<FLabel, Predicate<CardPrinted>> buildSetRestriction(String displayName, List<String> setCodes, boolean allowReprints) {
|
||||
private Pair<FLabel, Predicate<PaperCard>> buildSetRestriction(String displayName, List<String> setCodes, boolean allowReprints) {
|
||||
return buildFormatRestriction(displayName, new GameFormat(null, setCodes, null), allowReprints);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import forge.gui.deckeditor.views.VDeckgen;
|
||||
import forge.gui.framework.ICDoc;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.util.Aggregates;
|
||||
|
||||
@@ -79,8 +79,8 @@ public enum CDeckgen implements ICDoc {
|
||||
|
||||
final Deck randomDeck = new Deck();
|
||||
|
||||
Predicate<CardPrinted> notBasicLand = Predicates.not(Predicates.compose(CardRulesPredicates.Presets.IS_BASIC_LAND, CardPrinted.FN_GET_RULES));
|
||||
Iterable<CardPrinted> source = Iterables.filter(CardDb.instance().getUniqueCards(), notBasicLand);
|
||||
Predicate<PaperCard> notBasicLand = Predicates.not(Predicates.compose(CardRulesPredicates.Presets.IS_BASIC_LAND, PaperCard.FN_GET_RULES));
|
||||
Iterable<PaperCard> source = Iterables.filter(CardDb.instance().getUniqueCards(), notBasicLand);
|
||||
randomDeck.getMain().addAllFlat(Aggregates.random(source, 15 * 5));
|
||||
|
||||
randomDeck.getMain().add("Plains", 1);
|
||||
|
||||
@@ -42,7 +42,7 @@ import forge.gui.deckeditor.views.VCurrentDeck;
|
||||
import forge.gui.framework.EDocID;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.item.ItemPool;
|
||||
import forge.item.ItemPoolView;
|
||||
@@ -58,17 +58,17 @@ import forge.properties.ForgePreferences.FPref;
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public final class CEditorConstructed extends ACEditorBase<CardPrinted, Deck> {
|
||||
public final class CEditorConstructed extends ACEditorBase<PaperCard, Deck> {
|
||||
private final DeckController<Deck> controller;
|
||||
//private boolean sideboardMode = false;
|
||||
|
||||
private List<DeckSection> allSections = new ArrayList<DeckSection>();
|
||||
private DeckSection sectionMode = DeckSection.Main;
|
||||
|
||||
private final ItemPoolView<CardPrinted> avatarPool;
|
||||
private final ItemPoolView<CardPrinted> planePool;
|
||||
private final ItemPoolView<CardPrinted> schemePool;
|
||||
private final ItemPoolView<CardPrinted> commanderPool;
|
||||
private final ItemPoolView<PaperCard> avatarPool;
|
||||
private final ItemPoolView<PaperCard> planePool;
|
||||
private final ItemPoolView<PaperCard> schemePool;
|
||||
private final ItemPoolView<PaperCard> commanderPool;
|
||||
|
||||
//=========== Constructor
|
||||
/**
|
||||
@@ -87,15 +87,15 @@ public final class CEditorConstructed extends ACEditorBase<CardPrinted, Deck> {
|
||||
//allSections.add(DeckSection.Commander);
|
||||
|
||||
|
||||
avatarPool = ItemPool.createFrom(CardDb.variants().getAllCards(Predicates.compose(CardRulesPredicates.Presets.IS_VANGUARD, CardPrinted.FN_GET_RULES)),CardPrinted.class);
|
||||
planePool = ItemPool.createFrom(CardDb.variants().getAllCards(Predicates.compose(CardRulesPredicates.Presets.IS_PLANE_OR_PHENOMENON, CardPrinted.FN_GET_RULES)),CardPrinted.class);
|
||||
schemePool = ItemPool.createFrom(CardDb.variants().getAllCards(Predicates.compose(CardRulesPredicates.Presets.IS_SCHEME, CardPrinted.FN_GET_RULES)),CardPrinted.class);
|
||||
commanderPool = ItemPool.createFrom(CardDb.instance().getAllCards(Predicates.compose(Predicates.and(CardRulesPredicates.Presets.IS_CREATURE,CardRulesPredicates.Presets.IS_LEGENDARY), CardPrinted.FN_GET_RULES)),CardPrinted.class);
|
||||
avatarPool = ItemPool.createFrom(CardDb.variants().getAllCards(Predicates.compose(CardRulesPredicates.Presets.IS_VANGUARD, PaperCard.FN_GET_RULES)),PaperCard.class);
|
||||
planePool = ItemPool.createFrom(CardDb.variants().getAllCards(Predicates.compose(CardRulesPredicates.Presets.IS_PLANE_OR_PHENOMENON, PaperCard.FN_GET_RULES)),PaperCard.class);
|
||||
schemePool = ItemPool.createFrom(CardDb.variants().getAllCards(Predicates.compose(CardRulesPredicates.Presets.IS_SCHEME, PaperCard.FN_GET_RULES)),PaperCard.class);
|
||||
commanderPool = ItemPool.createFrom(CardDb.instance().getAllCards(Predicates.compose(Predicates.and(CardRulesPredicates.Presets.IS_CREATURE,CardRulesPredicates.Presets.IS_LEGENDARY), PaperCard.FN_GET_RULES)),PaperCard.class);
|
||||
|
||||
boolean wantUnique = SEditorIO.getPref(EditorPreference.display_unique_only);
|
||||
|
||||
final EditorTableView<CardPrinted> tblCatalog = new EditorTableView<CardPrinted>(wantUnique, CardPrinted.class);
|
||||
final EditorTableView<CardPrinted> tblDeck = new EditorTableView<CardPrinted>(wantUnique, CardPrinted.class);
|
||||
final EditorTableView<PaperCard> tblCatalog = new EditorTableView<PaperCard>(wantUnique, PaperCard.class);
|
||||
final EditorTableView<PaperCard> tblDeck = new EditorTableView<PaperCard>(wantUnique, PaperCard.class);
|
||||
|
||||
VCardCatalog.SINGLETON_INSTANCE.setTableView(tblCatalog.getTable());
|
||||
VCurrentDeck.SINGLETON_INSTANCE.setTableView(tblDeck.getTable());
|
||||
@@ -120,17 +120,17 @@ public final class CEditorConstructed extends ACEditorBase<CardPrinted, Deck> {
|
||||
*/
|
||||
@Override
|
||||
public void addCard(InventoryItem item, boolean toAlternate, int qty) {
|
||||
if ((item == null) || !(item instanceof CardPrinted)) {
|
||||
if ((item == null) || !(item instanceof PaperCard)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (sectionMode == DeckSection.Avatar || sectionMode == DeckSection.Commander) {
|
||||
for(Map.Entry<CardPrinted, Integer> cp : getTableDeck().getCards()) {
|
||||
for(Map.Entry<PaperCard, Integer> cp : getTableDeck().getCards()) {
|
||||
getTableDeck().removeCard(cp.getKey(), cp.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
final CardPrinted card = (CardPrinted) item;
|
||||
final PaperCard card = (PaperCard) item;
|
||||
if (toAlternate) {
|
||||
if (sectionMode != DeckSection.Sideboard) {
|
||||
controller.getModel().getOrCreate(DeckSection.Sideboard).add(card, qty);
|
||||
@@ -149,11 +149,11 @@ public final class CEditorConstructed extends ACEditorBase<CardPrinted, Deck> {
|
||||
*/
|
||||
@Override
|
||||
public void removeCard(InventoryItem item, boolean toAlternate, int qty) {
|
||||
if ((item == null) || !(item instanceof CardPrinted)) {
|
||||
if ((item == null) || !(item instanceof PaperCard)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final CardPrinted card = (CardPrinted) item;
|
||||
final PaperCard card = (PaperCard) item;
|
||||
if (toAlternate) {
|
||||
if (sectionMode != DeckSection.Sideboard) {
|
||||
controller.getModel().getOrCreate(DeckSection.Sideboard).add(card, qty);
|
||||
@@ -188,7 +188,7 @@ public final class CEditorConstructed extends ACEditorBase<CardPrinted, Deck> {
|
||||
@Override
|
||||
public void resetTables() {
|
||||
// Constructed mode can use all cards, no limitations.
|
||||
this.getTableCatalog().setDeck(ItemPool.createFrom(CardDb.instance().getAllCards(), CardPrinted.class), true);
|
||||
this.getTableCatalog().setDeck(ItemPool.createFrom(CardDb.instance().getAllCards(), PaperCard.class), true);
|
||||
this.getTableDeck().setDeck(this.controller.getModel().getMain());
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ public final class CEditorConstructed extends ACEditorBase<CardPrinted, Deck> {
|
||||
case Main:
|
||||
lstCatalogCols.remove(SColumnUtil.getColumn(ColumnName.CAT_QUANTITY));
|
||||
this.getTableCatalog().setAvailableColumns(lstCatalogCols);
|
||||
this.getTableCatalog().setDeck(ItemPool.createFrom(CardDb.instance().getAllCards(), CardPrinted.class), true);
|
||||
this.getTableCatalog().setDeck(ItemPool.createFrom(CardDb.instance().getAllCards(), PaperCard.class), true);
|
||||
this.getTableDeck().setDeck(this.controller.getModel().getMain());
|
||||
showOptions = true;
|
||||
title = "Title: ";
|
||||
|
||||
@@ -38,7 +38,7 @@ import forge.gui.deckeditor.views.VDeckgen;
|
||||
import forge.gui.framework.DragCell;
|
||||
import forge.gui.home.sanctioned.CSubmenuDraft;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.item.ItemPoolView;
|
||||
|
||||
@@ -50,7 +50,7 @@ import forge.item.ItemPoolView;
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class CEditorDraftingProcess extends ACEditorBase<CardPrinted, DeckGroup> {
|
||||
public class CEditorDraftingProcess extends ACEditorBase<PaperCard, DeckGroup> {
|
||||
private IBoosterDraft boosterDraft;
|
||||
|
||||
private String ccAddLabel = "Add card";
|
||||
@@ -63,8 +63,8 @@ public class CEditorDraftingProcess extends ACEditorBase<CardPrinted, DeckGroup>
|
||||
* Updates the deck editor UI as necessary draft selection mode.
|
||||
*/
|
||||
public CEditorDraftingProcess() {
|
||||
final EditorTableView<CardPrinted> tblCatalog = new EditorTableView<CardPrinted>(false, CardPrinted.class);
|
||||
final EditorTableView<CardPrinted> tblDeck = new EditorTableView<CardPrinted>(false, CardPrinted.class);
|
||||
final EditorTableView<PaperCard> tblCatalog = new EditorTableView<PaperCard>(false, PaperCard.class);
|
||||
final EditorTableView<PaperCard> tblDeck = new EditorTableView<PaperCard>(false, PaperCard.class);
|
||||
|
||||
VCardCatalog.SINGLETON_INSTANCE.setTableView(tblCatalog.getTable());
|
||||
VCurrentDeck.SINGLETON_INSTANCE.setTableView(tblDeck.getTable());
|
||||
@@ -104,11 +104,11 @@ public class CEditorDraftingProcess extends ACEditorBase<CardPrinted, DeckGroup>
|
||||
*/
|
||||
@Override
|
||||
public void addCard(InventoryItem item, boolean toAlternate, int qty) {
|
||||
if ((item == null) || !(item instanceof CardPrinted) || toAlternate) {
|
||||
if ((item == null) || !(item instanceof PaperCard) || toAlternate) {
|
||||
return;
|
||||
}
|
||||
|
||||
final CardPrinted card = (CardPrinted) item;
|
||||
final PaperCard card = (PaperCard) item;
|
||||
|
||||
// can only draft one at a time, regardless of the requested quantity
|
||||
this.getTableDeck().addCard(card, 1);
|
||||
@@ -150,7 +150,7 @@ public class CEditorDraftingProcess extends ACEditorBase<CardPrinted, DeckGroup>
|
||||
* @param list
|
||||
* a {@link forge.CardList} object.
|
||||
*/
|
||||
private void showChoices(final ItemPoolView<CardPrinted> list) {
|
||||
private void showChoices(final ItemPoolView<PaperCard> list) {
|
||||
VCardCatalog.SINGLETON_INSTANCE.getPnlHeader().setVisible(true);
|
||||
VCardCatalog.SINGLETON_INSTANCE.getLblTitle().setText("Select a card from pack number "
|
||||
+ (((BoosterDraft) boosterDraft).getCurrentBoosterIndex() + 1) + ".");
|
||||
|
||||
@@ -34,7 +34,7 @@ import forge.gui.deckeditor.views.VDeckgen;
|
||||
import forge.gui.framework.DragCell;
|
||||
import forge.gui.home.sanctioned.CSubmenuDraft;
|
||||
import forge.gui.home.sanctioned.CSubmenuSealed;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.util.storage.IStorage;
|
||||
|
||||
@@ -46,7 +46,7 @@ import forge.util.storage.IStorage;
|
||||
* @author Forge
|
||||
* @version $Id: DeckEditorCommon.java 12850 2011-12-26 14:55:09Z slapshot5 $
|
||||
*/
|
||||
public final class CEditorLimited extends ACEditorBase<CardPrinted, DeckGroup> {
|
||||
public final class CEditorLimited extends ACEditorBase<PaperCard, DeckGroup> {
|
||||
|
||||
private final DeckController<DeckGroup> controller;
|
||||
private DragCell allDecksParent = null;
|
||||
@@ -60,8 +60,8 @@ public final class CEditorLimited extends ACEditorBase<CardPrinted, DeckGroup> {
|
||||
* @param deckMap0   {@link forge.deck.DeckGroup}<{@link forge.util.storage.IStorage}>
|
||||
*/
|
||||
public CEditorLimited(final IStorage<DeckGroup> deckMap0) {
|
||||
final EditorTableView<CardPrinted> tblCatalog = new EditorTableView<CardPrinted>(false, CardPrinted.class);
|
||||
final EditorTableView<CardPrinted> tblDeck = new EditorTableView<CardPrinted>(false, CardPrinted.class);
|
||||
final EditorTableView<PaperCard> tblCatalog = new EditorTableView<PaperCard>(false, PaperCard.class);
|
||||
final EditorTableView<PaperCard> tblDeck = new EditorTableView<PaperCard>(false, PaperCard.class);
|
||||
|
||||
VCardCatalog.SINGLETON_INSTANCE.setTableView(tblCatalog.getTable());
|
||||
VCurrentDeck.SINGLETON_INSTANCE.setTableView(tblDeck.getTable());
|
||||
@@ -96,12 +96,12 @@ public final class CEditorLimited extends ACEditorBase<CardPrinted, DeckGroup> {
|
||||
*/
|
||||
@Override
|
||||
public void addCard(InventoryItem item, boolean toAlternate, int qty) {
|
||||
if ((item == null) || !(item instanceof CardPrinted) || toAlternate) {
|
||||
if ((item == null) || !(item instanceof PaperCard) || toAlternate) {
|
||||
return;
|
||||
}
|
||||
|
||||
// update view
|
||||
final CardPrinted card = (CardPrinted) item;
|
||||
final PaperCard card = (PaperCard) item;
|
||||
this.getTableDeck().addCard(card, qty);
|
||||
this.getTableCatalog().removeCard(card, qty);
|
||||
this.getDeckController().notifyModelChanged();
|
||||
@@ -112,12 +112,12 @@ public final class CEditorLimited extends ACEditorBase<CardPrinted, DeckGroup> {
|
||||
*/
|
||||
@Override
|
||||
public void removeCard(InventoryItem item, boolean toAlternate, int qty) {
|
||||
if ((item == null) || !(item instanceof CardPrinted) || toAlternate) {
|
||||
if ((item == null) || !(item instanceof PaperCard) || toAlternate) {
|
||||
return;
|
||||
}
|
||||
|
||||
// update view
|
||||
final CardPrinted card = (CardPrinted) item;
|
||||
final PaperCard card = (PaperCard) item;
|
||||
this.getTableCatalog().addCard(card, qty);
|
||||
this.getTableDeck().removeCard(card, qty);
|
||||
this.getDeckController().notifyModelChanged();
|
||||
|
||||
@@ -44,7 +44,7 @@ import forge.gui.deckeditor.views.VDeckgen;
|
||||
import forge.gui.framework.DragCell;
|
||||
import forge.gui.home.quest.CSubmenuQuestDecks;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.item.ItemPool;
|
||||
import forge.quest.QuestController;
|
||||
@@ -61,14 +61,14 @@ import forge.quest.QuestController;
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public final class CEditorQuest extends ACEditorBase<CardPrinted, Deck> {
|
||||
public final class CEditorQuest extends ACEditorBase<PaperCard, Deck> {
|
||||
private final QuestController questData;
|
||||
private final DeckController<Deck> controller;
|
||||
private DragCell allDecksParent = null;
|
||||
private DragCell deckGenParent = null;
|
||||
private boolean sideboardMode = false;
|
||||
|
||||
private Map<CardPrinted, Integer> decksUsingMyCards;
|
||||
private Map<PaperCard, Integer> decksUsingMyCards;
|
||||
|
||||
private final Function<Entry<InventoryItem, Integer>, Comparable<?>> fnDeckCompare = new Function<Entry<InventoryItem, Integer>, Comparable<?>>() {
|
||||
@Override
|
||||
@@ -96,8 +96,8 @@ public final class CEditorQuest extends ACEditorBase<CardPrinted, Deck> {
|
||||
public CEditorQuest(final QuestController questData0) {
|
||||
this.questData = questData0;
|
||||
|
||||
final EditorTableView<CardPrinted> tblCatalog = new EditorTableView<CardPrinted>(false, CardPrinted.class);
|
||||
final EditorTableView<CardPrinted> tblDeck = new EditorTableView<CardPrinted>(false, CardPrinted.class);
|
||||
final EditorTableView<PaperCard> tblCatalog = new EditorTableView<PaperCard>(false, PaperCard.class);
|
||||
final EditorTableView<PaperCard> tblDeck = new EditorTableView<PaperCard>(false, PaperCard.class);
|
||||
|
||||
tblCatalog.setAlwaysNonUnique(true);
|
||||
tblDeck.setAlwaysNonUnique(true);
|
||||
@@ -121,19 +121,19 @@ public final class CEditorQuest extends ACEditorBase<CardPrinted, Deck> {
|
||||
/**
|
||||
* Adds any card to the catalog and data pool.
|
||||
*
|
||||
* @param card {@link forge.item.CardPrinted}
|
||||
* @param card {@link forge.item.PaperCard}
|
||||
*/
|
||||
public void addCheatCard(final CardPrinted card, int qty) {
|
||||
public void addCheatCard(final PaperCard card, int qty) {
|
||||
this.getTableCatalog().addCard(card, qty);
|
||||
this.questData.getCards().getCardpool().add(card, qty);
|
||||
}
|
||||
|
||||
// fills number of decks using each card
|
||||
private Map<CardPrinted, Integer> countDecksForEachCard() {
|
||||
final Map<CardPrinted, Integer> result = new HashMap<CardPrinted, Integer>();
|
||||
private Map<PaperCard, Integer> countDecksForEachCard() {
|
||||
final Map<PaperCard, Integer> result = new HashMap<PaperCard, Integer>();
|
||||
for (final Deck deck : this.questData.getMyDecks()) {
|
||||
for (final Entry<CardPrinted, Integer> e : deck.getMain()) {
|
||||
final CardPrinted card = e.getKey();
|
||||
for (final Entry<PaperCard, Integer> e : deck.getMain()) {
|
||||
final PaperCard card = e.getKey();
|
||||
final Integer amount = result.get(card);
|
||||
result.put(card, Integer.valueOf(amount == null ? 1 : 1 + amount.intValue()));
|
||||
}
|
||||
@@ -148,11 +148,11 @@ public final class CEditorQuest extends ACEditorBase<CardPrinted, Deck> {
|
||||
*/
|
||||
@Override
|
||||
public void addCard(InventoryItem item, boolean toAlternate, int qty) {
|
||||
if ((item == null) || !(item instanceof CardPrinted)) {
|
||||
if ((item == null) || !(item instanceof PaperCard)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final CardPrinted card = (CardPrinted) item;
|
||||
final PaperCard card = (PaperCard) item;
|
||||
if (toAlternate) {
|
||||
// if we're in sideboard mode, the library will get adjusted properly when we call resetTables()
|
||||
if (!sideboardMode) {
|
||||
@@ -170,11 +170,11 @@ public final class CEditorQuest extends ACEditorBase<CardPrinted, Deck> {
|
||||
*/
|
||||
@Override
|
||||
public void removeCard(InventoryItem item, boolean toAlternate, int qty) {
|
||||
if ((item == null) || !(item instanceof CardPrinted)) {
|
||||
if ((item == null) || !(item instanceof PaperCard)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final CardPrinted card = (CardPrinted) item;
|
||||
final PaperCard card = (PaperCard) item;
|
||||
if (toAlternate) {
|
||||
// if we're in sideboard mode, the library will get adjusted properly when we call resetTables()
|
||||
if (!sideboardMode) {
|
||||
@@ -209,7 +209,7 @@ public final class CEditorQuest extends ACEditorBase<CardPrinted, Deck> {
|
||||
public void resetTables() {
|
||||
final Deck deck = this.controller.getModel();
|
||||
|
||||
final ItemPool<CardPrinted> cardpool = new ItemPool<CardPrinted>(CardPrinted.class);
|
||||
final ItemPool<PaperCard> cardpool = new ItemPool<PaperCard>(PaperCard.class);
|
||||
cardpool.addAll(this.questData.getCards().getCardpool());
|
||||
// remove bottom cards that are in the deck from the card pool
|
||||
cardpool.removeAll(deck.getMain());
|
||||
|
||||
@@ -55,7 +55,7 @@ import forge.gui.toolbox.FLabel;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.item.BoosterPack;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.FatPack;
|
||||
import forge.item.IPaperCard;
|
||||
import forge.item.InventoryItem;
|
||||
@@ -220,11 +220,11 @@ public final class CEditorQuestCardShop extends ACEditorBase<InventoryItem, Deck
|
||||
final ItemPool<InventoryItem> result = new ItemPool<InventoryItem>(InventoryItem.class);
|
||||
for (final Deck deck : this.questData.getMyDecks()) {
|
||||
CardPool main = deck.getMain();
|
||||
for (final Entry<CardPrinted, Integer> e : main) {
|
||||
for (final Entry<PaperCard, Integer> e : main) {
|
||||
result.add(e.getKey());
|
||||
}
|
||||
if (deck.has(DeckSection.Sideboard)) {
|
||||
for (final Entry<CardPrinted, Integer> e : deck.get(DeckSection.Sideboard)) {
|
||||
for (final Entry<PaperCard, Integer> e : deck.get(DeckSection.Sideboard)) {
|
||||
// only add card if we haven't already encountered it in main
|
||||
if (!main.contains(e.getKey())) {
|
||||
result.add(e.getKey());
|
||||
@@ -237,15 +237,15 @@ public final class CEditorQuestCardShop extends ACEditorBase<InventoryItem, Deck
|
||||
|
||||
private Integer getCardValue(final InventoryItem card) {
|
||||
String ns = null;
|
||||
if (card instanceof CardPrinted) {
|
||||
ns = card.getName() + "|" + ((CardPrinted) card).getEdition();
|
||||
if (card instanceof PaperCard) {
|
||||
ns = card.getName() + "|" + ((PaperCard) card).getEdition();
|
||||
} else {
|
||||
ns = card.getName();
|
||||
}
|
||||
|
||||
if (this.mapPrices.containsKey(ns)) {
|
||||
return this.mapPrices.get(ns);
|
||||
} else if (card instanceof CardPrinted) {
|
||||
} else if (card instanceof PaperCard) {
|
||||
switch (((IPaperCard) card).getRarity()) {
|
||||
case BasicLand:
|
||||
return Integer.valueOf(4);
|
||||
@@ -325,8 +325,8 @@ public final class CEditorQuestCardShop extends ACEditorBase<InventoryItem, Deck
|
||||
return;
|
||||
}
|
||||
|
||||
if (item instanceof CardPrinted) {
|
||||
final CardPrinted card = (CardPrinted) item;
|
||||
if (item instanceof PaperCard) {
|
||||
final PaperCard card = (PaperCard) item;
|
||||
this.getTableDeck().addCard(card, qty);
|
||||
this.getTableCatalog().removeCard(item, qty);
|
||||
this.questData.getCards().buyCard(card, qty, value);
|
||||
@@ -342,7 +342,7 @@ public final class CEditorQuestCardShop extends ACEditorBase<InventoryItem, Deck
|
||||
booster = (FatPack) ((FatPack) item).clone();
|
||||
}
|
||||
this.questData.getCards().buyPack(booster, value);
|
||||
final List<CardPrinted> newCards = booster.getCards();
|
||||
final List<PaperCard> newCards = booster.getCards();
|
||||
final List<InventoryItem> newInventory = new LinkedList<InventoryItem>(newCards);
|
||||
getTableDeck().addCards(newInventory);
|
||||
final CardListViewer c = new CardListViewer(booster.getName(),
|
||||
@@ -375,11 +375,11 @@ public final class CEditorQuestCardShop extends ACEditorBase<InventoryItem, Deck
|
||||
*/
|
||||
@Override
|
||||
public void removeCard(InventoryItem item, boolean toAlternate, int qty) {
|
||||
if ((item == null) || !(item instanceof CardPrinted) || showingFullCatalog || toAlternate) {
|
||||
if ((item == null) || !(item instanceof PaperCard) || showingFullCatalog || toAlternate) {
|
||||
return;
|
||||
}
|
||||
|
||||
final CardPrinted card = (CardPrinted) item;
|
||||
final PaperCard card = (PaperCard) item;
|
||||
this.getTableCatalog().addCard(card, qty);
|
||||
this.getTableDeck().removeCard(card, qty);
|
||||
|
||||
@@ -414,10 +414,10 @@ public final class CEditorQuestCardShop extends ACEditorBase<InventoryItem, Deck
|
||||
this.getTableDeck().removeCards(cardsToRemove);
|
||||
|
||||
for (Map.Entry<InventoryItem, Integer> item : cardsToRemove) {
|
||||
if (!(item.getKey() instanceof CardPrinted)) {
|
||||
if (!(item.getKey() instanceof PaperCard)) {
|
||||
continue;
|
||||
}
|
||||
CardPrinted card = (CardPrinted)item.getKey();
|
||||
PaperCard card = (PaperCard)item.getKey();
|
||||
final int price = Math.min((int) (this.multiplier * this.getCardValue(card)),
|
||||
this.questData.getCards().getSellPriceLimit());
|
||||
this.questData.getCards().sellCard(card, item.getValue(), price);
|
||||
@@ -470,7 +470,7 @@ public final class CEditorQuestCardShop extends ACEditorBase<InventoryItem, Deck
|
||||
public void run() {
|
||||
List<Map.Entry<InventoryItem, Integer>> cardsToRemove = new LinkedList<Map.Entry<InventoryItem,Integer>>();
|
||||
for (Map.Entry<InventoryItem, Integer> item : getTableDeck().getCards()) {
|
||||
CardPrinted card = (CardPrinted)item.getKey();
|
||||
PaperCard card = (PaperCard)item.getKey();
|
||||
int numToKeep = card.getRules().getType().isBasic() ? 50 : 4;
|
||||
if ("Relentless Rats".equals(card.getName())) {
|
||||
numToKeep = Integer.MAX_VALUE;
|
||||
|
||||
@@ -40,7 +40,7 @@ import forge.gui.deckeditor.views.VDeckgen;
|
||||
import forge.gui.framework.DragCell;
|
||||
import forge.gui.framework.EDocID;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.item.ItemPool;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
@@ -56,11 +56,11 @@ import forge.util.storage.IStorage;
|
||||
* @author Forge
|
||||
* @version $Id: CEditorConstructed.java 18430 2012-11-27 22:42:36Z Hellfish $
|
||||
*/
|
||||
public final class CEditorVariant extends ACEditorBase<CardPrinted, Deck> {
|
||||
public final class CEditorVariant extends ACEditorBase<PaperCard, Deck> {
|
||||
private final DeckController<Deck> controller;
|
||||
private DragCell allDecksParent = null;
|
||||
private DragCell deckGenParent = null;
|
||||
private final Predicate<CardPrinted> cardPoolCondition;
|
||||
private final Predicate<PaperCard> cardPoolCondition;
|
||||
private final EDocID exitToScreen;
|
||||
|
||||
//=========== Constructor
|
||||
@@ -69,14 +69,14 @@ public final class CEditorVariant extends ACEditorBase<CardPrinted, Deck> {
|
||||
* This is the least restrictive mode;
|
||||
* all cards are available.
|
||||
*/
|
||||
public CEditorVariant(final IStorage<Deck> folder, final Predicate<CardPrinted> poolCondition, final EDocID exitTo) {
|
||||
public CEditorVariant(final IStorage<Deck> folder, final Predicate<PaperCard> poolCondition, final EDocID exitTo) {
|
||||
super();
|
||||
|
||||
cardPoolCondition = poolCondition;
|
||||
exitToScreen = exitTo;
|
||||
|
||||
final EditorTableView<CardPrinted> tblCatalog = new EditorTableView<CardPrinted>(true, CardPrinted.class);
|
||||
final EditorTableView<CardPrinted> tblDeck = new EditorTableView<CardPrinted>(true, CardPrinted.class);
|
||||
final EditorTableView<PaperCard> tblCatalog = new EditorTableView<PaperCard>(true, PaperCard.class);
|
||||
final EditorTableView<PaperCard> tblDeck = new EditorTableView<PaperCard>(true, PaperCard.class);
|
||||
|
||||
VCardCatalog.SINGLETON_INSTANCE.setTableView(tblCatalog.getTable());
|
||||
VCurrentDeck.SINGLETON_INSTANCE.setTableView(tblDeck.getTable());
|
||||
@@ -100,11 +100,11 @@ public final class CEditorVariant extends ACEditorBase<CardPrinted, Deck> {
|
||||
*/
|
||||
@Override
|
||||
public void addCard(InventoryItem item, boolean toAlternate, int qty) {
|
||||
if ((item == null) || !(item instanceof CardPrinted) || toAlternate) {
|
||||
if ((item == null) || !(item instanceof PaperCard) || toAlternate) {
|
||||
return;
|
||||
}
|
||||
|
||||
final CardPrinted card = (CardPrinted) item;
|
||||
final PaperCard card = (PaperCard) item;
|
||||
this.getTableDeck().addCard(card, qty);
|
||||
this.controller.notifyModelChanged();
|
||||
}
|
||||
@@ -114,11 +114,11 @@ public final class CEditorVariant extends ACEditorBase<CardPrinted, Deck> {
|
||||
*/
|
||||
@Override
|
||||
public void removeCard(InventoryItem item, boolean toAlternate, int qty) {
|
||||
if ((item == null) || !(item instanceof CardPrinted) || toAlternate) {
|
||||
if ((item == null) || !(item instanceof PaperCard) || toAlternate) {
|
||||
return;
|
||||
}
|
||||
|
||||
final CardPrinted card = (CardPrinted) item;
|
||||
final PaperCard card = (PaperCard) item;
|
||||
this.getTableDeck().removeCard(card, qty);
|
||||
this.controller.notifyModelChanged();
|
||||
}
|
||||
@@ -141,10 +141,10 @@ public final class CEditorVariant extends ACEditorBase<CardPrinted, Deck> {
|
||||
*/
|
||||
@Override
|
||||
public void resetTables() {
|
||||
Iterable<CardPrinted> allNT = CardDb.variants().getAllCards();
|
||||
Iterable<PaperCard> allNT = CardDb.variants().getAllCards();
|
||||
allNT = Iterables.filter(allNT, cardPoolCondition);
|
||||
|
||||
this.getTableCatalog().setDeck(ItemPool.createFrom(allNT, CardPrinted.class), true);
|
||||
this.getTableCatalog().setDeck(ItemPool.createFrom(allNT, PaperCard.class), true);
|
||||
this.getTableDeck().setDeck(this.controller.getModel().getOrCreate(DeckSection.Sideboard));
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import forge.gui.deckeditor.CDeckEditorUI;
|
||||
import forge.gui.deckeditor.views.VProbabilities;
|
||||
import forge.gui.framework.ICDoc;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.item.ItemPool;
|
||||
import forge.item.ItemPoolView;
|
||||
@@ -63,24 +63,24 @@ public enum CProbabilities implements ICDoc {
|
||||
final ACEditorBase<T, TModel> ed = (ACEditorBase<T, TModel>)
|
||||
CDeckEditorUI.SINGLETON_INSTANCE.getCurrentEditorController();
|
||||
|
||||
final ItemPoolView<CardPrinted> deck = ItemPool.createFrom(ed.getTableDeck().getCards(), CardPrinted.class);
|
||||
final ItemPoolView<PaperCard> deck = ItemPool.createFrom(ed.getTableDeck().getCards(), PaperCard.class);
|
||||
|
||||
final List<String> cardProbabilities = new ArrayList<String>();
|
||||
|
||||
final List<CardPrinted> shuffled = deck.toFlatList();
|
||||
final List<PaperCard> shuffled = deck.toFlatList();
|
||||
Collections.shuffle(shuffled, MyRandom.getRandom());
|
||||
|
||||
// Log totals of each card for decrementing
|
||||
final Map<CardPrinted, Integer> cardTotals = new HashMap<CardPrinted, Integer>();
|
||||
for (final CardPrinted c : shuffled) {
|
||||
final Map<PaperCard, Integer> cardTotals = new HashMap<PaperCard, Integer>();
|
||||
for (final PaperCard c : shuffled) {
|
||||
if (cardTotals.containsKey(c)) { cardTotals.put(c, cardTotals.get(c) + 1); }
|
||||
else { cardTotals.put(c, 1); }
|
||||
}
|
||||
|
||||
// Run through shuffled deck and calculate probabilities.
|
||||
// Formulas is (remaining instances of this card / total cards remaining)
|
||||
final Iterator<CardPrinted> itr = shuffled.iterator();
|
||||
CardPrinted tmp;
|
||||
final Iterator<PaperCard> itr = shuffled.iterator();
|
||||
PaperCard tmp;
|
||||
// int prob;
|
||||
while (itr.hasNext()) {
|
||||
tmp = itr.next();
|
||||
|
||||
@@ -16,7 +16,7 @@ import forge.gui.deckeditor.CDeckEditorUI;
|
||||
import forge.gui.deckeditor.SEditorUtil;
|
||||
import forge.gui.deckeditor.views.VStatistics;
|
||||
import forge.gui.framework.ICDoc;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.item.ItemPool;
|
||||
import forge.item.ItemPoolView;
|
||||
@@ -57,8 +57,8 @@ public enum CStatistics implements ICDoc {
|
||||
analyze();
|
||||
}
|
||||
|
||||
private void setLabelValue(JLabel label, ItemPoolView<CardPrinted> deck, Predicate<CardRules> predicate, int total) {
|
||||
int tmp = deck.countAll(Predicates.compose(predicate, CardPrinted.FN_GET_RULES));
|
||||
private void setLabelValue(JLabel label, ItemPoolView<PaperCard> deck, Predicate<CardRules> predicate, int total) {
|
||||
int tmp = deck.countAll(Predicates.compose(predicate, PaperCard.FN_GET_RULES));
|
||||
label.setText(tmp + " (" + SEditorUtil.calculatePercentage(tmp, total) + "%)");
|
||||
|
||||
}
|
||||
@@ -71,7 +71,7 @@ public enum CStatistics implements ICDoc {
|
||||
|
||||
if (ed == null) { return; }
|
||||
|
||||
final ItemPoolView<CardPrinted> deck = ItemPool.createFrom(ed.getTableDeck().getCards(), CardPrinted.class);
|
||||
final ItemPoolView<PaperCard> deck = ItemPool.createFrom(ed.getTableDeck().getCards(), PaperCard.class);
|
||||
|
||||
int total = deck.countAll();
|
||||
|
||||
@@ -98,7 +98,7 @@ public enum CStatistics implements ICDoc {
|
||||
int cmc0 = 0, cmc1 = 0, cmc2 = 0, cmc3 = 0, cmc4 = 0, cmc5 = 0, cmc6 = 0;
|
||||
int tmc = 0;
|
||||
|
||||
for (final Entry<CardPrinted, Integer> e : deck) {
|
||||
for (final Entry<PaperCard, Integer> e : deck) {
|
||||
final CardRules cardRules = e.getKey().getRules();
|
||||
final int count = e.getValue();
|
||||
final int cmc = cardRules.getManaCost().getCMC();
|
||||
|
||||
@@ -41,7 +41,7 @@ import forge.game.limited.DraftRankCache;
|
||||
import forge.gui.deckeditor.CDeckEditorUI;
|
||||
import forge.gui.deckeditor.SEditorIO;
|
||||
import forge.gui.deckeditor.controllers.ACEditorBase;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.IPaperCard;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.item.InventoryItemFromSet;
|
||||
@@ -331,7 +331,7 @@ public final class SColumnUtil {
|
||||
|
||||
private static int toPower(final InventoryItem i) {
|
||||
int result = -1;
|
||||
if (i instanceof CardPrinted) {
|
||||
if (i instanceof PaperCard) {
|
||||
result = ((IPaperCard) i).getRules().getIntPower();
|
||||
if (result == -1) {
|
||||
result = ((IPaperCard) i).getRules().getInitialLoyalty();
|
||||
@@ -341,15 +341,15 @@ public final class SColumnUtil {
|
||||
}
|
||||
|
||||
private static int toToughness(final InventoryItem i) {
|
||||
return i instanceof CardPrinted ? ((IPaperCard) i).getRules().getIntToughness() : -1;
|
||||
return i instanceof PaperCard ? ((IPaperCard) i).getRules().getIntToughness() : -1;
|
||||
}
|
||||
|
||||
private static Integer toCMC(final InventoryItem i) {
|
||||
return i instanceof CardPrinted ? ((IPaperCard) i).getRules().getManaCost().getCMC() : -1;
|
||||
return i instanceof PaperCard ? ((IPaperCard) i).getRules().getManaCost().getCMC() : -1;
|
||||
}
|
||||
|
||||
private static CardRarity toRarity(final InventoryItem i) {
|
||||
return i instanceof CardPrinted ? ((IPaperCard) i).getRarity() : CardRarity.Unknown;
|
||||
return i instanceof PaperCard ? ((IPaperCard) i).getRarity() : CardRarity.Unknown;
|
||||
}
|
||||
|
||||
private static CardEdition toSetCmp(final InventoryItem i) {
|
||||
@@ -362,11 +362,11 @@ public final class SColumnUtil {
|
||||
}
|
||||
|
||||
private static Integer toAiCmp(final InventoryItem i) {
|
||||
return i instanceof CardPrinted ? ((IPaperCard) i).getRules().getAiHints().getAiStatusComparable() : Integer.valueOf(-1);
|
||||
return i instanceof PaperCard ? ((IPaperCard) i).getRules().getAiHints().getAiStatusComparable() : Integer.valueOf(-1);
|
||||
}
|
||||
|
||||
private static String toAiStr(final InventoryItem i) {
|
||||
if (!(i instanceof CardPrinted))
|
||||
if (!(i instanceof PaperCard))
|
||||
return "n/a";
|
||||
|
||||
IPaperCard cp = (IPaperCard) i;
|
||||
@@ -378,8 +378,8 @@ public final class SColumnUtil {
|
||||
|
||||
private static Double toRankingCmp(final InventoryItem i) {
|
||||
Double ranking = 500D;
|
||||
if (i != null && i instanceof CardPrinted){
|
||||
CardPrinted cp = (CardPrinted) i;
|
||||
if (i != null && i instanceof PaperCard){
|
||||
PaperCard cp = (PaperCard) i;
|
||||
ranking = DraftRankCache.getRanking(cp.getName(), cp.getEdition());
|
||||
if ( ranking == null )
|
||||
ranking = 500D;
|
||||
@@ -459,7 +459,7 @@ public final class SColumnUtil {
|
||||
@Override
|
||||
public Comparable<?> apply(final Entry<InventoryItem, Integer> from) {
|
||||
InventoryItem i = from.getKey();
|
||||
return i instanceof CardPrinted ? ((IPaperCard)i).getRules().getType().toString() : i.getItemType();
|
||||
return i instanceof PaperCard ? ((IPaperCard)i).getRules().getType().toString() : i.getItemType();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -468,7 +468,7 @@ public final class SColumnUtil {
|
||||
@Override
|
||||
public Object apply(final Entry<InventoryItem, Integer> from) {
|
||||
InventoryItem i = from.getKey();
|
||||
return i instanceof CardPrinted ? ((IPaperCard)i).getRules().getType().toString() : i.getItemType();
|
||||
return i instanceof PaperCard ? ((IPaperCard)i).getRules().getType().toString() : i.getItemType();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.Map.Entry;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -56,10 +56,10 @@ public class TableSorter<T> implements Comparator<Entry<T, Integer>> {
|
||||
}
|
||||
|
||||
/** The Constant byNameThenSet. */
|
||||
public static final TableSorter<CardPrinted> BY_NAME_THEN_SET = new TableSorter<CardPrinted>(
|
||||
new Function<Entry<CardPrinted, Integer>, Comparable<?>>() {
|
||||
public static final TableSorter<PaperCard> BY_NAME_THEN_SET = new TableSorter<PaperCard>(
|
||||
new Function<Entry<PaperCard, Integer>, Comparable<?>>() {
|
||||
@Override
|
||||
public Comparable<?> apply(final Entry<CardPrinted, Integer> from) {
|
||||
public Comparable<?> apply(final Entry<PaperCard, Integer> from) {
|
||||
return from.getKey();
|
||||
}
|
||||
}, true);
|
||||
|
||||
@@ -22,7 +22,7 @@ import forge.gui.framework.EDocID;
|
||||
import forge.gui.framework.IVDoc;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.InventoryItem;
|
||||
|
||||
/**
|
||||
@@ -170,11 +170,11 @@ public enum VProbabilities implements IVDoc<CProbabilities> {
|
||||
final ACEditorBase<T, TModel> ed = (ACEditorBase<T, TModel>)
|
||||
CDeckEditorUI.SINGLETON_INSTANCE.getCurrentEditorController();
|
||||
|
||||
final List<CardPrinted> cards = (List<CardPrinted>) ed.getTableDeck().getCards().toFlatList();
|
||||
final List<PaperCard> cards = (List<PaperCard>) ed.getTableDeck().getCards().toFlatList();
|
||||
final String name1 = lbl.getText();
|
||||
String name2;
|
||||
|
||||
for (CardPrinted c : cards) {
|
||||
for (PaperCard c : cards) {
|
||||
name2 = c.getName();
|
||||
if (name2.length() > name1.length()) { continue; }
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import forge.ImageCache;
|
||||
import forge.card.CardRules;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.properties.NewConstants;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@@ -39,13 +39,13 @@ public class GuiDownloadPicturesLQ extends GuiDownloader {
|
||||
protected final Map<String, String> getNeededImages() {
|
||||
Map<String, String> downloads = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
|
||||
|
||||
for (CardPrinted c : CardDb.instance().getAllCards()) {
|
||||
for (PaperCard c : CardDb.instance().getAllCards()) {
|
||||
addDLObject(c, downloads, false);
|
||||
if (ImageCache.hasBackFacePicture(c))
|
||||
addDLObject(c, downloads, true);
|
||||
}
|
||||
|
||||
for (CardPrinted c : CardDb.variants().getAllCards()) {
|
||||
for (PaperCard c : CardDb.variants().getAllCards()) {
|
||||
addDLObject(c, downloads, false);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class GuiDownloadPicturesLQ extends GuiDownloader {
|
||||
return downloads;
|
||||
}
|
||||
|
||||
private void addDLObject(CardPrinted c, Map<String, String> downloads, boolean backFace) {
|
||||
private void addDLObject(PaperCard c, Map<String, String> downloads, boolean backFace) {
|
||||
CardRules cardRules = c.getRules();
|
||||
String urls = cardRules.getPictureUrl(backFace);
|
||||
if (StringUtils.isEmpty(urls)) {
|
||||
|
||||
@@ -28,7 +28,7 @@ import com.google.common.collect.Iterables;
|
||||
import forge.ImageCache;
|
||||
import forge.card.CardEdition;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.properties.NewConstants;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@@ -41,7 +41,7 @@ public class GuiDownloadSetPicturesLQ extends GuiDownloader {
|
||||
protected final Map<String, String> getNeededImages() {
|
||||
Map<String, String> downloads = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
|
||||
|
||||
for (final CardPrinted c : Iterables.concat(CardDb.instance().getAllCards(), CardDb.variants().getAllCards())) {
|
||||
for (final PaperCard c : Iterables.concat(CardDb.instance().getAllCards(), CardDb.variants().getAllCards())) {
|
||||
final String setCode3 = c.getEdition();
|
||||
if (StringUtils.isBlank(setCode3) || CardEdition.UNKNOWN.getCode().equals(setCode3)) {
|
||||
// we don't want cards from unknown sets
|
||||
|
||||
@@ -19,7 +19,7 @@ import forge.deck.Deck;
|
||||
import forge.deck.DeckSection;
|
||||
import forge.game.GameFormat;
|
||||
import forge.gui.framework.ICDoc;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.properties.NewConstants;
|
||||
import forge.quest.QuestController;
|
||||
import forge.quest.QuestMode;
|
||||
@@ -212,11 +212,11 @@ public enum CSubmenuQuestData implements ICDoc {
|
||||
fmtPrizes = fmtStartPool;
|
||||
if (null == fmtPrizes && dckStartPool != null) { // build it form deck
|
||||
Set<String> sets = new HashSet<String>();
|
||||
for (Entry<CardPrinted, Integer> c : dckStartPool.getMain()) {
|
||||
for (Entry<PaperCard, Integer> c : dckStartPool.getMain()) {
|
||||
sets.add(c.getKey().getEdition());
|
||||
}
|
||||
if (dckStartPool.has(DeckSection.Sideboard))
|
||||
for (Entry<CardPrinted, Integer> c : dckStartPool.get(DeckSection.Sideboard)) {
|
||||
for (Entry<PaperCard, Integer> c : dckStartPool.get(DeckSection.Sideboard)) {
|
||||
sets.add(c.getKey().getEdition());
|
||||
}
|
||||
fmtPrizes = new GameFormat("From deck", sets, null);
|
||||
|
||||
@@ -32,7 +32,7 @@ import forge.gui.deckeditor.CDeckEditorUI;
|
||||
import forge.gui.deckeditor.controllers.ACEditorBase;
|
||||
import forge.gui.deckeditor.controllers.CEditorLimited;
|
||||
import forge.gui.framework.ICDoc;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.item.ItemPool;
|
||||
import forge.util.storage.IStorage;
|
||||
@@ -150,7 +150,7 @@ public enum CSubmenuSealed implements ICDoc {
|
||||
SealedCardPoolGenerator sd = new SealedCardPoolGenerator(o);
|
||||
if (sd.isEmpty()) return;
|
||||
|
||||
final ItemPool<CardPrinted> humanPool = sd.getCardpool(true);
|
||||
final ItemPool<PaperCard> humanPool = sd.getCardpool(true);
|
||||
|
||||
// System.out.println(humanPool);
|
||||
|
||||
@@ -235,8 +235,8 @@ public enum CSubmenuSealed implements ICDoc {
|
||||
|
||||
double best = 1.0;
|
||||
|
||||
for (Entry<CardPrinted, Integer> kv : d.getMain()) {
|
||||
CardPrinted evalCard = kv.getKey();
|
||||
for (Entry<PaperCard, Integer> kv : d.getMain()) {
|
||||
PaperCard evalCard = kv.getKey();
|
||||
int count = kv.getValue();
|
||||
if (ranker.getRanking(evalCard.getName(), evalCard.getEdition()) != null) {
|
||||
double add = ranker.getRanking(evalCard.getName(), evalCard.getEdition());
|
||||
|
||||
@@ -29,7 +29,7 @@ import forge.gui.framework.EDocID;
|
||||
import forge.gui.framework.ICDoc;
|
||||
import forge.gui.toolbox.FDeckChooser;
|
||||
import forge.gui.toolbox.FList;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.properties.ForgePreferences;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
import forge.util.Aggregates;
|
||||
@@ -87,9 +87,9 @@ public enum CSubmenuArchenemy implements ICDoc {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
Predicate<CardPrinted> predSchemes = new Predicate<CardPrinted>() {
|
||||
Predicate<PaperCard> predSchemes = new Predicate<PaperCard>() {
|
||||
@Override
|
||||
public boolean apply(CardPrinted arg0) {
|
||||
public boolean apply(PaperCard arg0) {
|
||||
if(arg0.getRules().getType().isScheme())
|
||||
{
|
||||
return true;
|
||||
@@ -172,7 +172,7 @@ public enum CSubmenuArchenemy implements ICDoc {
|
||||
playerDecks.add(d.getOriginalDeck());
|
||||
}
|
||||
|
||||
List<CardPrinted> schemes = null;
|
||||
List<PaperCard> schemes = null;
|
||||
Object obj = view.getArchenemySchemes().getSelectedValue();
|
||||
|
||||
boolean useDefault = VSubmenuArchenemy.SINGLETON_INSTANCE.getCbUseDefaultSchemes().isSelected();
|
||||
|
||||
@@ -30,7 +30,7 @@ import forge.gui.framework.EDocID;
|
||||
import forge.gui.framework.ICDoc;
|
||||
import forge.gui.toolbox.FDeckChooser;
|
||||
import forge.gui.toolbox.FList;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.properties.ForgePreferences;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
import forge.util.Aggregates;
|
||||
@@ -86,9 +86,9 @@ public enum CSubmenuPlanechase implements ICDoc {
|
||||
VSubmenuPlanechase.SINGLETON_INSTANCE.getLblEditor().setCommand(new Command() {
|
||||
@Override
|
||||
public void run() {
|
||||
Predicate<CardPrinted> predPlanes = new Predicate<CardPrinted>() {
|
||||
Predicate<PaperCard> predPlanes = new Predicate<PaperCard>() {
|
||||
@Override
|
||||
public boolean apply(CardPrinted arg0) {
|
||||
public boolean apply(PaperCard arg0) {
|
||||
return arg0.getRules().getType().isPlane() || arg0.getRules().getType().isPhenomenon();
|
||||
}
|
||||
};
|
||||
@@ -163,7 +163,7 @@ public enum CSubmenuPlanechase implements ICDoc {
|
||||
playerDecks.add(d.getOriginalDeck());
|
||||
|
||||
|
||||
List<CardPrinted> planes = null;
|
||||
List<PaperCard> planes = null;
|
||||
Object obj = view.getPlanarDeckLists().get(i).getSelectedValue();
|
||||
|
||||
boolean useDefault = VSubmenuPlanechase.SINGLETON_INSTANCE.getCbUseDefaultPlanes().isSelected();
|
||||
|
||||
@@ -24,7 +24,7 @@ import forge.gui.GuiDialog;
|
||||
import forge.gui.SOverlayUtils;
|
||||
import forge.gui.framework.ICDoc;
|
||||
import forge.gui.toolbox.FDeckChooser;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.properties.ForgePreferences;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
|
||||
@@ -131,9 +131,9 @@ public enum CSubmenuVanguard implements ICDoc {
|
||||
playerDecks.add(d.getOriginalDeck());
|
||||
}
|
||||
|
||||
List<CardPrinted> playerAvatars = new ArrayList<CardPrinted>();
|
||||
List<PaperCard> playerAvatars = new ArrayList<PaperCard>();
|
||||
for (int i = 0; i < view.getNumPlayers(); i++) {
|
||||
CardPrinted avatar = null;
|
||||
PaperCard avatar = null;
|
||||
Object obj = view.getAvatarLists().get(i).getSelectedValue();
|
||||
|
||||
boolean useDefault = VSubmenuVanguard.SINGLETON_INSTANCE.getCbDefaultAvatars().isSelected();
|
||||
@@ -156,7 +156,7 @@ public enum CSubmenuVanguard implements ICDoc {
|
||||
avatar = Iterables.get(view.getAllAiAvatars(), rnd.nextInt(Iterables.size(view.getNonRandomAiAvatars())));
|
||||
}
|
||||
} else {
|
||||
avatar = (CardPrinted) obj;
|
||||
avatar = (PaperCard) obj;
|
||||
}
|
||||
}
|
||||
if (avatar == null) {
|
||||
|
||||
@@ -36,7 +36,7 @@ import forge.gui.toolbox.FScrollPane;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.FTabbedPane;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.IPaperCard;
|
||||
|
||||
/**
|
||||
@@ -64,11 +64,11 @@ public enum VSubmenuVanguard implements IVSubmenu<CSubmenuVanguard> {
|
||||
private final JCheckBox cbArtifacts = new FCheckBox("Remove Artifacts");
|
||||
private final JCheckBox cbRemoveSmall = new FCheckBox("Remove Small Creatures");
|
||||
|
||||
private final List<CardPrinted> allAvatars = new ArrayList<CardPrinted>();
|
||||
private final List<PaperCard> allAvatars = new ArrayList<PaperCard>();
|
||||
|
||||
private final List<CardPrinted> allAiAvatars = new ArrayList<CardPrinted>();
|
||||
private final List<CardPrinted> nonRandomHumanAvatars = new ArrayList<CardPrinted>();
|
||||
private final List<CardPrinted> nonRandomAiAvatars = new ArrayList<CardPrinted>();
|
||||
private final List<PaperCard> allAiAvatars = new ArrayList<PaperCard>();
|
||||
private final List<PaperCard> nonRandomHumanAvatars = new ArrayList<PaperCard>();
|
||||
private final List<PaperCard> nonRandomAiAvatars = new ArrayList<PaperCard>();
|
||||
|
||||
//////////////////////////////
|
||||
|
||||
@@ -93,7 +93,7 @@ public enum VSubmenuVanguard implements IVSubmenu<CSubmenuVanguard> {
|
||||
Vector<Object> aiListData = new Vector<Object>();
|
||||
humanListData.add("Random");
|
||||
aiListData.add("Random");
|
||||
for (CardPrinted cp : getAllAvatars()) {
|
||||
for (PaperCard cp : getAllAvatars()) {
|
||||
humanListData.add(cp);
|
||||
if (!cp.getRules().getAiHints().getRemRandomDecks()) {
|
||||
nonRandomHumanAvatars.add(cp);
|
||||
@@ -131,7 +131,7 @@ public enum VSubmenuVanguard implements IVSubmenu<CSubmenuVanguard> {
|
||||
int index = avatarLists.indexOf(arg0.getSource());
|
||||
Object obj = avatarLists.get(index).getSelectedValue();
|
||||
|
||||
if (obj instanceof CardPrinted) {
|
||||
if (obj instanceof PaperCard) {
|
||||
cdpAvatarDetails.get(index).setCard(((IPaperCard) obj).getMatchingForgeCard());
|
||||
}
|
||||
}
|
||||
@@ -362,9 +362,9 @@ public enum VSubmenuVanguard implements IVSubmenu<CSubmenuVanguard> {
|
||||
/**
|
||||
* @return the allAvatars
|
||||
*/
|
||||
public Iterable<CardPrinted> getAllAvatars() {
|
||||
public Iterable<PaperCard> getAllAvatars() {
|
||||
if (allAvatars.isEmpty()) {
|
||||
for (CardPrinted c : CardDb.variants().getAllCards()) {
|
||||
for (PaperCard c : CardDb.variants().getAllCards()) {
|
||||
if (c.getRules().getType().isVanguard()) {
|
||||
allAvatars.add(c);
|
||||
}
|
||||
@@ -376,21 +376,21 @@ public enum VSubmenuVanguard implements IVSubmenu<CSubmenuVanguard> {
|
||||
/**
|
||||
* @return the allAiAvatars
|
||||
*/
|
||||
public List<CardPrinted> getAllAiAvatars() {
|
||||
public List<PaperCard> getAllAiAvatars() {
|
||||
return allAiAvatars;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the non-random human Avatars
|
||||
*/
|
||||
public List<CardPrinted> getNonRandomHumanAvatars() {
|
||||
public List<PaperCard> getNonRandomHumanAvatars() {
|
||||
return nonRandomHumanAvatars;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the non-random AI Avatars
|
||||
*/
|
||||
public List<CardPrinted> getNonRandomAiAvatars() {
|
||||
public List<PaperCard> getNonRandomAiAvatars() {
|
||||
return nonRandomAiAvatars;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import forge.game.zone.ZoneType;
|
||||
import forge.gui.GuiChoose;
|
||||
import forge.gui.SOverlayUtils;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
|
||||
/**
|
||||
@@ -119,7 +119,7 @@ public class ControlWinLose {
|
||||
}
|
||||
|
||||
// remove all the lost cards from owners' decks
|
||||
List<CardPrinted> losses = new ArrayList<CardPrinted>();
|
||||
List<PaperCard> losses = new ArrayList<PaperCard>();
|
||||
int cntPlayers = match.getPlayers().size();
|
||||
for (int i = 0; i < cntPlayers; i++ ) {
|
||||
Player fromGame = match.getCurrentGame().getRegisteredPlayers().get(i);
|
||||
@@ -132,7 +132,7 @@ public class ControlWinLose {
|
||||
Deck oDeck = psc.getOriginalDeck();
|
||||
|
||||
for (Card c : compAntes) {
|
||||
CardPrinted toRemove = CardDb.getCard(c);
|
||||
PaperCard toRemove = CardDb.getCard(c);
|
||||
cDeck.getMain().remove(toRemove);
|
||||
if ( cDeck != oDeck )
|
||||
oDeck.getMain().remove(toRemove);
|
||||
@@ -146,12 +146,12 @@ public class ControlWinLose {
|
||||
|
||||
// offer to winner, if he is local human
|
||||
if (fromGame.isHuman()) {
|
||||
List<CardPrinted> chosen = GuiChoose.noneOrMany("Select cards to add to your deck", losses);
|
||||
List<PaperCard> chosen = GuiChoose.noneOrMany("Select cards to add to your deck", losses);
|
||||
if (null != chosen) {
|
||||
RegisteredPlayer psc = match.getPlayers().get(i);
|
||||
Deck cDeck = psc.getCurrentDeck();
|
||||
//Deck oDeck = psc.getOriginalDeck();
|
||||
for (CardPrinted c : chosen) {
|
||||
for (PaperCard c : chosen) {
|
||||
cDeck.getMain().add(c);
|
||||
//oDeck.getMain().add(c);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ import forge.gui.home.quest.CSubmenuDuels;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.item.BoosterPack;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.item.OpenablePack;
|
||||
import forge.item.TournamentPack;
|
||||
@@ -136,7 +136,7 @@ public class QuestWinLose extends ControlWinLose {
|
||||
// Ante returns to owners in a draw
|
||||
if (!outcome.isDraw()) {
|
||||
boolean isHumanWinner = outcome.getWinner().equals(questPlayer);
|
||||
final List<CardPrinted> anteCards = new ArrayList<CardPrinted>();
|
||||
final List<PaperCard> anteCards = new ArrayList<PaperCard>();
|
||||
for (Player p : match.getCurrentGame().getRegisteredPlayers()) {
|
||||
if (p.getLobbyPlayer().equals(questPlayer) == isHumanWinner) {
|
||||
continue;
|
||||
@@ -150,7 +150,7 @@ public class QuestWinLose extends ControlWinLose {
|
||||
qc.getCards().addAllCards(anteCards);
|
||||
this.anteWon(anteCards);
|
||||
} else {
|
||||
for (CardPrinted c : anteCards) {
|
||||
for (PaperCard c : anteCards) {
|
||||
qc.getCards().loseCard(c, 1);
|
||||
}
|
||||
this.anteLost(anteCards);
|
||||
@@ -228,7 +228,7 @@ public class QuestWinLose extends ControlWinLose {
|
||||
* Displays cards lost to ante this game.
|
||||
*
|
||||
*/
|
||||
private void anteLost(final List<CardPrinted> antesLost) {
|
||||
private void anteLost(final List<PaperCard> antesLost) {
|
||||
// Generate Swing components and attach.
|
||||
this.lblTemp1 = new TitleLabel("Ante Lost: You lost the following cards in Ante:");
|
||||
|
||||
@@ -244,7 +244,7 @@ public class QuestWinLose extends ControlWinLose {
|
||||
* Displays cards won in ante this game (which will be added to your Card Pool).
|
||||
*
|
||||
*/
|
||||
private void anteWon(final List<CardPrinted> antesWon) {
|
||||
private void anteWon(final List<PaperCard> antesWon) {
|
||||
final StringBuilder str = new StringBuilder();
|
||||
str.append("Ante Won: These cards will be available in your card pool after this match.");
|
||||
// Generate Swing components and attach.
|
||||
@@ -494,8 +494,8 @@ public class QuestWinLose extends ControlWinLose {
|
||||
*
|
||||
*/
|
||||
private void awardRandomRare(final String message) {
|
||||
final CardPrinted c = qData.getCards().addRandomRare();
|
||||
final List<CardPrinted> cardsWon = new ArrayList<CardPrinted>();
|
||||
final PaperCard c = qData.getCards().addRandomRare();
|
||||
final List<PaperCard> cardsWon = new ArrayList<PaperCard>();
|
||||
cardsWon.add(c);
|
||||
|
||||
// Generate Swing components and attach.
|
||||
@@ -515,7 +515,7 @@ public class QuestWinLose extends ControlWinLose {
|
||||
*
|
||||
*/
|
||||
private void awardJackpot() {
|
||||
final List<CardPrinted> cardsWon = qData.getCards().addRandomRare(10);
|
||||
final List<PaperCard> cardsWon = qData.getCards().addRandomRare(10);
|
||||
|
||||
// Generate Swing components and attach.
|
||||
this.lblTemp1 = new TitleLabel("You just won 10 random rares!");
|
||||
@@ -534,7 +534,7 @@ public class QuestWinLose extends ControlWinLose {
|
||||
*/
|
||||
private void awardBooster() {
|
||||
|
||||
List<CardPrinted> cardsWon = null;
|
||||
List<PaperCard> cardsWon = null;
|
||||
|
||||
if (qData.getFormat() == null) {
|
||||
final List<GameFormat> formats = new ArrayList<GameFormat>();
|
||||
@@ -653,13 +653,13 @@ public class QuestWinLose extends ControlWinLose {
|
||||
return;
|
||||
}
|
||||
|
||||
final List<CardPrinted> cardsWon = new ArrayList<CardPrinted>();
|
||||
final List<PaperCard> cardsWon = new ArrayList<PaperCard>();
|
||||
|
||||
for (InventoryItem ii : itemsWon) {
|
||||
if (ii instanceof CardPrinted) {
|
||||
cardsWon.add((CardPrinted) ii);
|
||||
if (ii instanceof PaperCard) {
|
||||
cardsWon.add((PaperCard) ii);
|
||||
} else if (ii instanceof TournamentPack || ii instanceof BoosterPack) {
|
||||
List<CardPrinted> boosterCards = new ArrayList<CardPrinted>();
|
||||
List<PaperCard> boosterCards = new ArrayList<PaperCard>();
|
||||
OpenablePack booster = null;
|
||||
if (ii instanceof BoosterPack) {
|
||||
booster = (BoosterPack) ((BoosterPack) ii).clone();
|
||||
@@ -676,8 +676,8 @@ public class QuestWinLose extends ControlWinLose {
|
||||
}
|
||||
}
|
||||
else if (ii instanceof IQuestRewardCard) {
|
||||
final List<CardPrinted> cardChoices = ((IQuestRewardCard) ii).getChoices();
|
||||
final CardPrinted chosenCard = (null == cardChoices ? null : GuiChoose.one("Choose " + ((IQuestRewardCard) ii).getName() + ":", cardChoices));
|
||||
final List<PaperCard> cardChoices = ((IQuestRewardCard) ii).getChoices();
|
||||
final PaperCard chosenCard = (null == cardChoices ? null : GuiChoose.one("Choose " + ((IQuestRewardCard) ii).getName() + ":", cardChoices));
|
||||
if (null != chosenCard) {
|
||||
cardsWon.add(chosenCard);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import forge.gui.toolbox.FList;
|
||||
import forge.gui.toolbox.FPanel;
|
||||
import forge.gui.toolbox.FScrollPane;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
|
||||
/**
|
||||
* A simple JPanel that shows three columns: card list, pic, and description..
|
||||
@@ -44,7 +44,7 @@ import forge.item.CardPrinted;
|
||||
public class QuestWinLoseCardViewer extends FPanel {
|
||||
|
||||
// Data and number of choices for the list
|
||||
private final List<CardPrinted> list;
|
||||
private final List<PaperCard> list;
|
||||
|
||||
// initialized before; listeners may be added to it
|
||||
private final JList jList;
|
||||
@@ -58,7 +58,7 @@ public class QuestWinLoseCardViewer extends FPanel {
|
||||
* @param list
|
||||
* the list
|
||||
*/
|
||||
public QuestWinLoseCardViewer(final List<CardPrinted> list) {
|
||||
public QuestWinLoseCardViewer(final List<PaperCard> list) {
|
||||
this.list = Collections.unmodifiableList(list);
|
||||
this.jList = new FList(new ChooserListModel());
|
||||
this.detail = new CardDetailPanel(null);
|
||||
@@ -102,7 +102,7 @@ public class QuestWinLoseCardViewer extends FPanel {
|
||||
final int row = QuestWinLoseCardViewer.this.jList.getSelectedIndex();
|
||||
// (String) jList.getSelectedValue();
|
||||
if ((row >= 0) && (row < QuestWinLoseCardViewer.this.list.size())) {
|
||||
final CardPrinted cp = QuestWinLoseCardViewer.this.list.get(row);
|
||||
final PaperCard cp = QuestWinLoseCardViewer.this.list.get(row);
|
||||
QuestWinLoseCardViewer.this.detail.setCard(cp.getMatchingForgeCard());
|
||||
QuestWinLoseCardViewer.this.picture.setCard(cp);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ import forge.gui.toolbox.FOverlay;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.SaveOpenDialog;
|
||||
import forge.gui.toolbox.SaveOpenDialog.Filetypes;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.model.FModel;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
import forge.view.FView;
|
||||
@@ -228,7 +228,7 @@ public enum CDock implements ICDoc {
|
||||
|
||||
final TreeMap<String, Integer> deckMap = new TreeMap<String, Integer>();
|
||||
|
||||
for (final Entry<CardPrinted, Integer> s : targetDeck.getMain()) {
|
||||
for (final Entry<PaperCard, Integer> s : targetDeck.getMain()) {
|
||||
deckMap.put(s.getKey().getName(), s.getValue());
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import javax.swing.event.ListSelectionListener;
|
||||
|
||||
import forge.gui.CardDetailPanel;
|
||||
import forge.gui.CardPicturePanel;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
|
||||
/**
|
||||
* A simple JPanel that shows three columns: card list, pic, and description..
|
||||
@@ -41,7 +41,7 @@ import forge.item.CardPrinted;
|
||||
public class CardViewer extends JPanel {
|
||||
|
||||
// Data and number of choices for the list
|
||||
private final List<CardPrinted> list;
|
||||
private final List<PaperCard> list;
|
||||
|
||||
// initialized before; listeners may be added to it
|
||||
private JList jList = null;
|
||||
@@ -54,7 +54,7 @@ public class CardViewer extends JPanel {
|
||||
* @param list
|
||||
* the list
|
||||
*/
|
||||
public CardViewer(final List<CardPrinted> list) {
|
||||
public CardViewer(final List<PaperCard> list) {
|
||||
this.list = Collections.unmodifiableList(list);
|
||||
this.jList = new JList(new ChooserListModel());
|
||||
this.detail = new CardDetailPanel(null);
|
||||
@@ -91,7 +91,7 @@ public class CardViewer extends JPanel {
|
||||
final int row = CardViewer.this.jList.getSelectedIndex();
|
||||
// (String) jList.getSelectedValue();
|
||||
if ((row >= 0) && (row < CardViewer.this.list.size())) {
|
||||
final CardPrinted cp = CardViewer.this.list.get(row);
|
||||
final PaperCard cp = CardViewer.this.list.get(row);
|
||||
CardViewer.this.detail.setCard(cp.getMatchingForgeCard());
|
||||
CardViewer.this.picture.setCard(cp);
|
||||
}
|
||||
|
||||
@@ -72,24 +72,24 @@ public final class CardDb {
|
||||
}
|
||||
|
||||
// Here are refs, get them by name
|
||||
private final Map<String, CardPrinted> uniqueCards;
|
||||
private final Map<String, PaperCard> uniqueCards;
|
||||
|
||||
|
||||
// need this to obtain cardReference by name+set+artindex
|
||||
private final Map<String, Map<String, CardPrinted[]>> allCardsBySet;
|
||||
private final Map<String, Map<String, PaperCard[]>> allCardsBySet;
|
||||
// this is the same list in flat storage
|
||||
private final List<CardPrinted> allCardsFlat;
|
||||
private final List<PaperCard> allCardsFlat;
|
||||
|
||||
// Lambda to get rules for selects from list of printed cards
|
||||
/** The Constant fnGetCardPrintedByForgeCard. */
|
||||
public static final Function<Card, CardPrinted> FN_GET_CARD_PRINTED_BY_FORGE_CARD = new Function<Card, CardPrinted>() {
|
||||
public static final Function<Card, PaperCard> FN_GET_CARD_PRINTED_BY_FORGE_CARD = new Function<Card, PaperCard>() {
|
||||
@Override
|
||||
public CardPrinted apply(final Card from) {
|
||||
public PaperCard apply(final Card from) {
|
||||
return CardDb.instance().getCard(from.getName());
|
||||
}
|
||||
};
|
||||
|
||||
private CardDb(Map<String, CardPrinted> uniqueCards, List<CardPrinted> cardsFlat, Map<String, Map<String, CardPrinted[]>> cardsBySet) {
|
||||
private CardDb(Map<String, PaperCard> uniqueCards, List<PaperCard> cardsFlat, Map<String, Map<String, PaperCard[]>> cardsBySet) {
|
||||
this.uniqueCards = Collections.unmodifiableMap(uniqueCards);
|
||||
this.allCardsFlat = Collections.unmodifiableList(cardsFlat);
|
||||
this.allCardsBySet = cardsBySet;
|
||||
@@ -130,7 +130,7 @@ public final class CardDb {
|
||||
/**
|
||||
* Checks if is card supported.
|
||||
*/
|
||||
public CardPrinted tryGetCard(final String cardName0) {
|
||||
public PaperCard tryGetCard(final String cardName0) {
|
||||
if (null == cardName0) {
|
||||
return null; // obviously
|
||||
}
|
||||
@@ -142,48 +142,48 @@ public final class CardDb {
|
||||
return this.uniqueCards.get(nameWithSet.left);
|
||||
}
|
||||
|
||||
CardPrinted res = tryGetCard(nameWithSet.left, nameWithSet.right);
|
||||
PaperCard res = tryGetCard(nameWithSet.left, nameWithSet.right);
|
||||
if ( null != res && isFoil )
|
||||
return CardPrinted.makeFoiled(res);
|
||||
return PaperCard.makeFoiled(res);
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
public CardPrinted tryGetCard(final String cardName, String setName) {
|
||||
public PaperCard tryGetCard(final String cardName, String setName) {
|
||||
return tryGetCard(cardName, setName, 0);
|
||||
}
|
||||
|
||||
public CardPrinted tryGetCard(final String cardName, String setName, int index) {
|
||||
public PaperCard tryGetCard(final String cardName, String setName, int index) {
|
||||
// Set exists?
|
||||
final Map<String, CardPrinted[]> cardsFromset = this.allCardsBySet.get(setName);
|
||||
final Map<String, PaperCard[]> cardsFromset = this.allCardsBySet.get(setName);
|
||||
if (cardsFromset == null) {
|
||||
return null;
|
||||
}
|
||||
// Card exists?
|
||||
final CardPrinted[] cardCopies = cardsFromset.get(cardName);
|
||||
final PaperCard[] cardCopies = cardsFromset.get(cardName);
|
||||
return cardCopies != null && index < cardCopies.length ? cardCopies[index] : null;
|
||||
}
|
||||
|
||||
// Single fetch
|
||||
public CardPrinted getCard(final String name) {
|
||||
public PaperCard getCard(final String name) {
|
||||
return this.getCard(name, false);
|
||||
}
|
||||
|
||||
// Advanced fetch by name+set
|
||||
public CardPrinted getCard(final String name, final String set) {
|
||||
public PaperCard getCard(final String name, final String set) {
|
||||
return this.getCard(name, set, 0);
|
||||
}
|
||||
|
||||
public CardPrinted getCard(final String name, final String set, final int artIndex) {
|
||||
public PaperCard getCard(final String name, final String set, final int artIndex) {
|
||||
// 1. get set
|
||||
final Map<String, CardPrinted[]> cardsFromset = this.allCardsBySet.get(set.toUpperCase());
|
||||
final Map<String, PaperCard[]> cardsFromset = this.allCardsBySet.get(set.toUpperCase());
|
||||
if (null == cardsFromset) {
|
||||
final String err = String
|
||||
.format("Asked for card '%s' from set '%s': that set was not found. :(", name, set);
|
||||
throw new NoSuchElementException(err);
|
||||
}
|
||||
// 2. Find the card itself
|
||||
final CardPrinted[] cardCopies = cardsFromset.get(name.toLowerCase());
|
||||
final PaperCard[] cardCopies = cardsFromset.get(name.toLowerCase());
|
||||
if (null == cardCopies) {
|
||||
final String err = String.format("Asked for card '%s' from '%s': set found, but the card wasn't. :(", name,
|
||||
set);
|
||||
@@ -200,40 +200,40 @@ public final class CardDb {
|
||||
|
||||
// Fetch from Forge's Card instance. Well, there should be no errors, but
|
||||
// we'll still check
|
||||
public static CardPrinted getCard(final Card forgeCard) {
|
||||
public static PaperCard getCard(final Card forgeCard) {
|
||||
final String name = forgeCard.getName();
|
||||
final String set = forgeCard.getCurSetCode();
|
||||
|
||||
if (StringUtils.isNotBlank(set)) {
|
||||
CardPrinted cp = variants().tryGetCard(name, set);
|
||||
PaperCard cp = variants().tryGetCard(name, set);
|
||||
|
||||
return cp == null ? instance().getCard(name, set) : cp;
|
||||
}
|
||||
CardPrinted cp = variants().tryGetCard(name);
|
||||
PaperCard cp = variants().tryGetCard(name);
|
||||
return cp == null ? instance().getCard(name) : cp;
|
||||
}
|
||||
|
||||
// returns a list of all cards from their respective latest editions
|
||||
public Collection<CardPrinted> getUniqueCards() {
|
||||
public Collection<PaperCard> getUniqueCards() {
|
||||
return this.uniqueCards.values();
|
||||
}
|
||||
|
||||
public List<CardPrinted> getAllCards() {
|
||||
public List<PaperCard> getAllCards() {
|
||||
return this.allCardsFlat;
|
||||
}
|
||||
|
||||
/** Returns a modifiable list of cards matching the given predicate */
|
||||
public List<CardPrinted> getAllCards(Predicate<CardPrinted> predicate) {
|
||||
public List<PaperCard> getAllCards(Predicate<PaperCard> predicate) {
|
||||
return Lists.newArrayList(Iterables.filter(this.allCardsFlat, predicate));
|
||||
}
|
||||
|
||||
public CardPrinted getCard(final String name0, final boolean fromLatestSet) {
|
||||
public PaperCard getCard(final String name0, final boolean fromLatestSet) {
|
||||
// Sometimes they read from decks things like "CardName|Set" - but we
|
||||
// can handle it
|
||||
|
||||
final boolean isFoil = this.isFoil(name0);
|
||||
final String name = isFoil ? this.removeFoilSuffix(name0) : name0;
|
||||
CardPrinted result = null;
|
||||
PaperCard result = null;
|
||||
|
||||
final ImmutablePair<String, String> nameWithSet = CardDb.splitCardName(name);
|
||||
if (nameWithSet.right != null) {
|
||||
@@ -246,48 +246,48 @@ public final class CardDb {
|
||||
}
|
||||
} else {
|
||||
// OK, plain name here
|
||||
final Predicate<CardPrinted> predicate = IPaperCard.Predicates.name(nameWithSet.left);
|
||||
final Iterable<CardPrinted> namedCards = Iterables.filter(this.allCardsFlat, predicate);
|
||||
final Predicate<PaperCard> predicate = IPaperCard.Predicates.name(nameWithSet.left);
|
||||
final Iterable<PaperCard> namedCards = Iterables.filter(this.allCardsFlat, predicate);
|
||||
// Find card with maximal set index
|
||||
result = Aggregates.itemWithMax(namedCards, CardPrinted.FN_GET_EDITION_INDEX);
|
||||
result = Aggregates.itemWithMax(namedCards, PaperCard.FN_GET_EDITION_INDEX);
|
||||
if (null == result) {
|
||||
throw new NoSuchElementException(String.format("Card '%s' not found in our database.", name));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isFoil) {
|
||||
result = CardPrinted.makeFoiled(result);
|
||||
result = PaperCard.makeFoiled(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static class CardSorter{
|
||||
// need this to obtain cardReference by name+set+artindex
|
||||
public final Map<String, Map<String, CardPrinted[]>> allCommonCardsBySet = new TreeMap<String, Map<String, CardPrinted[]>>(String.CASE_INSENSITIVE_ORDER);
|
||||
public final Map<String, Map<String, CardPrinted[]>> allSpecialCardsBySet = new TreeMap<String, Map<String, CardPrinted[]>>(String.CASE_INSENSITIVE_ORDER);
|
||||
public final Map<String, Map<String, PaperCard[]>> allCommonCardsBySet = new TreeMap<String, Map<String, PaperCard[]>>(String.CASE_INSENSITIVE_ORDER);
|
||||
public final Map<String, Map<String, PaperCard[]>> allSpecialCardsBySet = new TreeMap<String, Map<String, PaperCard[]>>(String.CASE_INSENSITIVE_ORDER);
|
||||
// Here are refs, get them by name
|
||||
public final Map<String, CardPrinted> uniqueCommonCards = new TreeMap<String, CardPrinted>(String.CASE_INSENSITIVE_ORDER);
|
||||
public final Map<String, CardPrinted> uniqueSpecialCards = new TreeMap<String, CardPrinted>(String.CASE_INSENSITIVE_ORDER);
|
||||
public final Map<String, PaperCard> uniqueCommonCards = new TreeMap<String, PaperCard>(String.CASE_INSENSITIVE_ORDER);
|
||||
public final Map<String, PaperCard> uniqueSpecialCards = new TreeMap<String, PaperCard>(String.CASE_INSENSITIVE_ORDER);
|
||||
// this is the same list in flat storage
|
||||
public final List<CardPrinted> allCommonCardsFlat = new ArrayList<CardPrinted>();
|
||||
public final List<CardPrinted> allSpecialCardsFlat = new ArrayList<CardPrinted>();
|
||||
public final List<PaperCard> allCommonCardsFlat = new ArrayList<PaperCard>();
|
||||
public final List<PaperCard> allSpecialCardsFlat = new ArrayList<PaperCard>();
|
||||
|
||||
public CardPrinted addToLists(final CardRules card, final String cardName, final String set, CardInSet cs) {
|
||||
CardPrinted lastAdded = null;
|
||||
public PaperCard addToLists(final CardRules card, final String cardName, final String set, CardInSet cs) {
|
||||
PaperCard lastAdded = null;
|
||||
|
||||
final Map<String, Map<String, CardPrinted[]>> allCardsBySet = card.isTraditional() ? allCommonCardsBySet : allSpecialCardsBySet;
|
||||
final Map<String, Map<String, PaperCard[]>> allCardsBySet = card.isTraditional() ? allCommonCardsBySet : allSpecialCardsBySet;
|
||||
// get this set storage, if not found, create it!
|
||||
Map<String, CardPrinted[]> setMap = allCardsBySet.get(set);
|
||||
Map<String, PaperCard[]> setMap = allCardsBySet.get(set);
|
||||
if (null == setMap) {
|
||||
setMap = new TreeMap<String, CardPrinted[]>(String.CASE_INSENSITIVE_ORDER);
|
||||
setMap = new TreeMap<String, PaperCard[]>(String.CASE_INSENSITIVE_ORDER);
|
||||
allCardsBySet.put(set, setMap);
|
||||
}
|
||||
|
||||
final int count = cs.getCopiesCount();
|
||||
final CardPrinted[] cardCopies = new CardPrinted[count];
|
||||
final PaperCard[] cardCopies = new PaperCard[count];
|
||||
setMap.put(cardName, cardCopies);
|
||||
for (int i = 0; i < count; i++) {
|
||||
lastAdded = CardPrinted.build(card, set, cs.getRarity(), i);
|
||||
lastAdded = PaperCard.build(card, set, cs.getRarity(), i);
|
||||
if (card.isTraditional()) {
|
||||
this.allCommonCardsFlat.add(lastAdded);
|
||||
} else {
|
||||
@@ -311,7 +311,7 @@ public final class CardDb {
|
||||
|
||||
// 2. Save refs into two lists: one flat and other keyed with sets &
|
||||
// name
|
||||
CardPrinted lastAdded = null;
|
||||
PaperCard lastAdded = null;
|
||||
for (final String s : card.getSets()) {
|
||||
lastAdded = this.addToLists(card, cardName, s, card.getEditionInfo(s));
|
||||
}
|
||||
|
||||
@@ -55,8 +55,8 @@ public class FatPack extends OpenablePack {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<CardPrinted> generate() {
|
||||
List<CardPrinted> result = new ArrayList<CardPrinted>();
|
||||
protected List<PaperCard> generate() {
|
||||
List<PaperCard> result = new ArrayList<PaperCard>();
|
||||
for (int i = 0; i < fpData.getCntBoosters(); i++) {
|
||||
result.addAll(super.generate());
|
||||
}
|
||||
|
||||
@@ -22,45 +22,45 @@ public interface IPaperCard extends InventoryItem {
|
||||
*/
|
||||
public abstract static class Predicates {
|
||||
|
||||
public static Predicate<CardPrinted> rarity(final boolean isEqual, final CardRarity value) {
|
||||
public static Predicate<PaperCard> rarity(final boolean isEqual, final CardRarity value) {
|
||||
return new PredicateRarity(value, isEqual);
|
||||
}
|
||||
public static Predicate<CardPrinted> printedInSets(final String[] sets) {
|
||||
public static Predicate<PaperCard> printedInSets(final String[] sets) {
|
||||
return printedInSets(Lists.newArrayList(sets), true);
|
||||
}
|
||||
|
||||
public static Predicate<CardPrinted> printedInSets(final List<String> value, final boolean shouldContain) {
|
||||
public static Predicate<PaperCard> printedInSets(final List<String> value, final boolean shouldContain) {
|
||||
if ((value == null) || value.isEmpty()) {
|
||||
return com.google.common.base.Predicates.alwaysTrue();
|
||||
}
|
||||
return new PredicateSets(value, shouldContain);
|
||||
}
|
||||
|
||||
public static Predicate<CardPrinted> printedInSet(final String value) {
|
||||
public static Predicate<PaperCard> printedInSet(final String value) {
|
||||
if (StringUtils.isEmpty(value)) {
|
||||
return com.google.common.base.Predicates.alwaysTrue();
|
||||
}
|
||||
return new PredicateSets(Lists.newArrayList(value), true);
|
||||
}
|
||||
|
||||
public static Predicate<CardPrinted> name(final String what) {
|
||||
public static Predicate<PaperCard> name(final String what) {
|
||||
return new PredicateName(PredicateString.StringOp.EQUALS_IC, what);
|
||||
}
|
||||
|
||||
public static Predicate<CardPrinted> name(final PredicateString.StringOp op, final String what) {
|
||||
public static Predicate<PaperCard> name(final PredicateString.StringOp op, final String what) {
|
||||
return new PredicateName(op, what);
|
||||
}
|
||||
|
||||
public static Predicate<CardPrinted> names(final List<String> what) {
|
||||
public static Predicate<PaperCard> names(final List<String> what) {
|
||||
return new PredicateNames(what);
|
||||
}
|
||||
|
||||
private static class PredicateRarity implements Predicate<CardPrinted> {
|
||||
private static class PredicateRarity implements Predicate<PaperCard> {
|
||||
private final CardRarity operand;
|
||||
private final boolean shouldBeEqual;
|
||||
|
||||
@Override
|
||||
public boolean apply(final CardPrinted card) {
|
||||
public boolean apply(final PaperCard card) {
|
||||
return (card.getRarity() == this.operand) == this.shouldBeEqual;
|
||||
}
|
||||
|
||||
@@ -70,12 +70,12 @@ public interface IPaperCard extends InventoryItem {
|
||||
}
|
||||
}
|
||||
|
||||
private static class PredicateSets implements Predicate<CardPrinted> {
|
||||
private static class PredicateSets implements Predicate<PaperCard> {
|
||||
private final Set<String> sets;
|
||||
private final boolean mustContain;
|
||||
|
||||
@Override
|
||||
public boolean apply(final CardPrinted card) {
|
||||
public boolean apply(final PaperCard card) {
|
||||
return this.sets.contains(card.getEdition()) == this.mustContain;
|
||||
}
|
||||
|
||||
@@ -85,11 +85,11 @@ public interface IPaperCard extends InventoryItem {
|
||||
}
|
||||
}
|
||||
|
||||
private static class PredicateName extends PredicateString<CardPrinted> {
|
||||
private static class PredicateName extends PredicateString<PaperCard> {
|
||||
private final String operand;
|
||||
|
||||
@Override
|
||||
public boolean apply(final CardPrinted card) {
|
||||
public boolean apply(final PaperCard card) {
|
||||
return this.op(card.getName(), this.operand);
|
||||
}
|
||||
|
||||
@@ -99,11 +99,11 @@ public interface IPaperCard extends InventoryItem {
|
||||
}
|
||||
}
|
||||
|
||||
private static class PredicateNames extends PredicateString<CardPrinted> {
|
||||
private static class PredicateNames extends PredicateString<PaperCard> {
|
||||
private final List<String> operand;
|
||||
|
||||
@Override
|
||||
public boolean apply(final CardPrinted card) {
|
||||
public boolean apply(final PaperCard card) {
|
||||
final String cardName = card.getName();
|
||||
for (final String element : this.operand) {
|
||||
if (this.op(cardName, element)) {
|
||||
@@ -127,26 +127,26 @@ public interface IPaperCard extends InventoryItem {
|
||||
// Think twice before using these, since rarity is a prop of printed
|
||||
// card.
|
||||
/** The Constant isCommon. */
|
||||
public static final Predicate<CardPrinted> IS_COMMON = Predicates.rarity(true, CardRarity.Common);
|
||||
public static final Predicate<PaperCard> IS_COMMON = Predicates.rarity(true, CardRarity.Common);
|
||||
|
||||
/** The Constant isUncommon. */
|
||||
public static final Predicate<CardPrinted> IS_UNCOMMON = Predicates.rarity(true, CardRarity.Uncommon);
|
||||
public static final Predicate<PaperCard> IS_UNCOMMON = Predicates.rarity(true, CardRarity.Uncommon);
|
||||
|
||||
/** The Constant isRare. */
|
||||
public static final Predicate<CardPrinted> IS_RARE = Predicates.rarity(true, CardRarity.Rare);
|
||||
public static final Predicate<PaperCard> IS_RARE = Predicates.rarity(true, CardRarity.Rare);
|
||||
|
||||
/** The Constant isMythicRare. */
|
||||
public static final Predicate<CardPrinted> IS_MYTHIC_RARE = Predicates.rarity(true, CardRarity.MythicRare);
|
||||
public static final Predicate<PaperCard> IS_MYTHIC_RARE = Predicates.rarity(true, CardRarity.MythicRare);
|
||||
|
||||
/** The Constant isRareOrMythic. */
|
||||
public static final Predicate<CardPrinted> IS_RARE_OR_MYTHIC = com.google.common.base.Predicates.or(Presets.IS_RARE,
|
||||
public static final Predicate<PaperCard> IS_RARE_OR_MYTHIC = com.google.common.base.Predicates.or(Presets.IS_RARE,
|
||||
Presets.IS_MYTHIC_RARE);
|
||||
|
||||
/** The Constant isSpecial. */
|
||||
public static final Predicate<CardPrinted> IS_SPECIAL = Predicates.rarity(true, CardRarity.Special);
|
||||
public static final Predicate<PaperCard> IS_SPECIAL = Predicates.rarity(true, CardRarity.Special);
|
||||
|
||||
/** The Constant exceptLands. */
|
||||
public static final Predicate<CardPrinted> IS_BASIC_LAND = Predicates.rarity(true, CardRarity.BasicLand);
|
||||
public static final Predicate<PaperCard> IS_BASIC_LAND = Predicates.rarity(true, CardRarity.BasicLand);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public abstract class OpenablePack implements InventoryItemFromSet {
|
||||
protected final BoosterTemplate contents;
|
||||
protected final String name;
|
||||
private final int hash;
|
||||
private List<CardPrinted> cards = null;
|
||||
private List<PaperCard> cards = null;
|
||||
|
||||
public OpenablePack(String name0, BoosterTemplate boosterData) {
|
||||
if (null == name0) { throw new NullArgumentException("name0"); }
|
||||
@@ -59,7 +59,7 @@ public abstract class OpenablePack implements InventoryItemFromSet {
|
||||
return contents.getEdition();
|
||||
}
|
||||
|
||||
public final List<CardPrinted> getCards() {
|
||||
public final List<PaperCard> getCards() {
|
||||
if (null == cards) {
|
||||
cards = generate();
|
||||
}
|
||||
@@ -91,18 +91,18 @@ public abstract class OpenablePack implements InventoryItemFromSet {
|
||||
return hash;
|
||||
}
|
||||
|
||||
protected List<CardPrinted> generate() {
|
||||
protected List<PaperCard> generate() {
|
||||
return BoosterGenerator.getBoosterPack(contents);
|
||||
}
|
||||
|
||||
protected CardPrinted getRandomBasicLand(final String setCode) {
|
||||
protected PaperCard getRandomBasicLand(final String setCode) {
|
||||
return this.getRandomBasicLands(setCode, 1).get(0);
|
||||
}
|
||||
|
||||
protected List<CardPrinted> getRandomBasicLands(final String setCode, final int count) {
|
||||
Predicate<CardPrinted> cardsRule = Predicates.and(
|
||||
protected List<PaperCard> getRandomBasicLands(final String setCode, final int count) {
|
||||
Predicate<PaperCard> cardsRule = Predicates.and(
|
||||
IPaperCard.Predicates.printedInSet(setCode),
|
||||
Predicates.compose(CardRulesPredicates.Presets.IS_BASIC_LAND, CardPrinted.FN_GET_RULES));
|
||||
Predicates.compose(CardRulesPredicates.Presets.IS_BASIC_LAND, PaperCard.FN_GET_RULES));
|
||||
return Aggregates.random(Iterables.filter(CardDb.instance().getAllCards(), cardsRule), count);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ import forge.game.player.Player;
|
||||
* @author Forge
|
||||
* @version $Id: CardReference.java 9708 2011-08-09 19:34:12Z jendave $
|
||||
*/
|
||||
public final class CardPrinted implements Comparable<IPaperCard>, InventoryItemFromSet, IPaperCard {
|
||||
public final class PaperCard implements Comparable<IPaperCard>, InventoryItemFromSet, IPaperCard {
|
||||
// Reference to rules
|
||||
private final transient CardRules card;
|
||||
|
||||
@@ -104,28 +104,28 @@ public final class CardPrinted implements Comparable<IPaperCard>, InventoryItemF
|
||||
/**
|
||||
* Lambda to get rules for selects from list of printed cards.
|
||||
*/
|
||||
public static final Function<CardPrinted, CardRules> FN_GET_RULES = new Function<CardPrinted, CardRules>() {
|
||||
public static final Function<PaperCard, CardRules> FN_GET_RULES = new Function<PaperCard, CardRules>() {
|
||||
@Override
|
||||
public CardRules apply(final CardPrinted from) {
|
||||
public CardRules apply(final PaperCard from) {
|
||||
return from.card;
|
||||
}
|
||||
};
|
||||
public static final Function<CardPrinted, String> FN_GET_NAME = new Function<CardPrinted, String>() {
|
||||
public static final Function<PaperCard, String> FN_GET_NAME = new Function<PaperCard, String>() {
|
||||
@Override
|
||||
public String apply(final CardPrinted from) {
|
||||
public String apply(final PaperCard from) {
|
||||
return from.getName();
|
||||
}
|
||||
};
|
||||
|
||||
public static final Function<CardPrinted, Integer> FN_GET_EDITION_INDEX = new Function<CardPrinted, Integer>() {
|
||||
public static final Function<PaperCard, Integer> FN_GET_EDITION_INDEX = new Function<PaperCard, Integer>() {
|
||||
@Override
|
||||
public Integer apply(final CardPrinted from) {
|
||||
public Integer apply(final PaperCard from) {
|
||||
return Integer.valueOf(Singletons.getModel().getEditions().get(from.getEdition()).getIndex());
|
||||
}
|
||||
};
|
||||
|
||||
// Constructor is private. All non-foiled instances are stored in CardDb
|
||||
private CardPrinted(final CardRules c, final String edition0, final CardRarity rare, final int index, final boolean foil) {
|
||||
private PaperCard(final CardRules c, final String edition0, final CardRarity rare, final int index, final boolean foil) {
|
||||
this.card = c;
|
||||
this.name = c.getName();
|
||||
this.edition = edition0;
|
||||
@@ -148,8 +148,8 @@ public final class CardPrinted implements Comparable<IPaperCard>, InventoryItemF
|
||||
* the index
|
||||
* @return the card printed
|
||||
*/
|
||||
static CardPrinted build(final CardRules c, final String edition, final CardRarity rare, final int index) {
|
||||
return new CardPrinted(c, edition, rare, index, false);
|
||||
static PaperCard build(final CardRules c, final String edition, final CardRarity rare, final int index) {
|
||||
return new PaperCard(c, edition, rare, index, false);
|
||||
}
|
||||
|
||||
/* foiled don't need to stay in CardDb's structures, so u'r free to create */
|
||||
@@ -160,8 +160,8 @@ public final class CardPrinted implements Comparable<IPaperCard>, InventoryItemF
|
||||
* the c
|
||||
* @return the card printed
|
||||
*/
|
||||
public static CardPrinted makeFoiled(final CardPrinted c) {
|
||||
return new CardPrinted(c.card, c.edition, c.rarity, c.artIndex, true);
|
||||
public static PaperCard makeFoiled(final PaperCard c) {
|
||||
return new PaperCard(c.card, c.edition, c.rarity, c.artIndex, true);
|
||||
}
|
||||
|
||||
// Want this class to be a key for HashTable
|
||||
@@ -182,7 +182,7 @@ public final class CardPrinted implements Comparable<IPaperCard>, InventoryItemF
|
||||
return false;
|
||||
}
|
||||
|
||||
final CardPrinted other = (CardPrinted) obj;
|
||||
final PaperCard other = (PaperCard) obj;
|
||||
if (!this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
@@ -227,7 +227,7 @@ public final class CardPrinted implements Comparable<IPaperCard>, InventoryItemF
|
||||
*
|
||||
* @return the card
|
||||
*/
|
||||
private static final Map<CardPrinted, Card> cp2card = new HashMap<CardPrinted, Card>();
|
||||
private static final Map<PaperCard, Card> cp2card = new HashMap<PaperCard, Card>();
|
||||
/* (non-Javadoc)
|
||||
* @see forge.item.ICardPrinted#getMatchingForgeCard()
|
||||
*/
|
||||
@@ -9,7 +9,7 @@ import forge.card.CardRules;
|
||||
import forge.card.cardfactory.CardFactory;
|
||||
import forge.game.player.Player;
|
||||
|
||||
public class CardToken implements InventoryItemFromSet, IPaperCard {
|
||||
public class PaperToken implements InventoryItemFromSet, IPaperCard {
|
||||
private String name;
|
||||
private CardEdition edition;
|
||||
private String imageFileName;
|
||||
@@ -40,7 +40,7 @@ public class CardToken implements InventoryItemFromSet, IPaperCard {
|
||||
return makeTokenFileName(fileName.toString());
|
||||
}
|
||||
|
||||
public CardToken(final CardRules c, CardEdition edition0, final String imageFileName) {
|
||||
public PaperToken(final CardRules c, CardEdition edition0, final String imageFileName) {
|
||||
this.card = c;
|
||||
this.name = c.getName();
|
||||
this.edition = edition0;
|
||||
@@ -22,7 +22,7 @@ public class PrintSheet {
|
||||
};
|
||||
|
||||
|
||||
private final ItemPool<CardPrinted> cardsWithWeights;
|
||||
private final ItemPool<PaperCard> cardsWithWeights;
|
||||
|
||||
|
||||
private final String name;
|
||||
@@ -30,39 +30,39 @@ public class PrintSheet {
|
||||
this(name0, null);
|
||||
}
|
||||
|
||||
private PrintSheet(String name0, ItemPool<CardPrinted> pool) {
|
||||
private PrintSheet(String name0, ItemPool<PaperCard> pool) {
|
||||
name = name0;
|
||||
cardsWithWeights = pool != null ? pool : new ItemPool<CardPrinted>(CardPrinted.class);
|
||||
cardsWithWeights = pool != null ? pool : new ItemPool<PaperCard>(PaperCard.class);
|
||||
}
|
||||
|
||||
public void add(CardPrinted card) {
|
||||
public void add(PaperCard card) {
|
||||
add(card,1);
|
||||
}
|
||||
|
||||
public void add(CardPrinted card, int weight) {
|
||||
public void add(PaperCard card, int weight) {
|
||||
cardsWithWeights.add(card, weight);
|
||||
}
|
||||
|
||||
public void addAll(Iterable<CardPrinted> cards) {
|
||||
public void addAll(Iterable<PaperCard> cards) {
|
||||
addAll(cards, 1);
|
||||
}
|
||||
|
||||
public void addAll(Iterable<CardPrinted> cards, int weight) {
|
||||
for(CardPrinted card : cards)
|
||||
public void addAll(Iterable<PaperCard> cards, int weight) {
|
||||
for(PaperCard card : cards)
|
||||
cardsWithWeights.add(card, weight);
|
||||
}
|
||||
|
||||
/** Cuts cards out of a sheet - they won't be printed again.
|
||||
* Please use mutable sheets for cubes only.*/
|
||||
public void removeAll(Iterable<CardPrinted> cards) {
|
||||
for(CardPrinted card : cards)
|
||||
public void removeAll(Iterable<PaperCard> cards) {
|
||||
for(PaperCard card : cards)
|
||||
cardsWithWeights.remove(card);
|
||||
}
|
||||
|
||||
private CardPrinted fetchRoulette(int start, int roulette, Collection<CardPrinted> toSkip) {
|
||||
private PaperCard fetchRoulette(int start, int roulette, Collection<PaperCard> toSkip) {
|
||||
int sum = start;
|
||||
boolean isSecondRun = start > 0;
|
||||
for(Entry<CardPrinted, Integer> cc : cardsWithWeights ) {
|
||||
for(Entry<PaperCard, Integer> cc : cardsWithWeights ) {
|
||||
sum += cc.getValue().intValue();
|
||||
if( sum > roulette ) {
|
||||
if( toSkip != null && toSkip.contains(cc.getKey()))
|
||||
@@ -76,8 +76,8 @@ public class PrintSheet {
|
||||
return fetchRoulette(sum + 1, roulette, toSkip); // start over from beginning, in case last cards were to skip
|
||||
}
|
||||
|
||||
public List<CardPrinted> random(int number, boolean wantUnique) {
|
||||
List<CardPrinted> result = new ArrayList<CardPrinted>();
|
||||
public List<PaperCard> random(int number, boolean wantUnique) {
|
||||
List<PaperCard> result = new ArrayList<PaperCard>();
|
||||
|
||||
int totalWeight = cardsWithWeights.countAll();
|
||||
if( totalWeight == 0) {
|
||||
@@ -88,16 +88,16 @@ public class PrintSheet {
|
||||
// If they ask for 40 unique basic lands (to make a fatpack) out of 20 distinct possible, add the whole print run N times.
|
||||
int uniqueCards = cardsWithWeights.countDistinct();
|
||||
while ( number >= uniqueCards ) {
|
||||
for(Entry<CardPrinted, Integer> kv : cardsWithWeights) {
|
||||
for(Entry<PaperCard, Integer> kv : cardsWithWeights) {
|
||||
result.add(kv.getKey());
|
||||
}
|
||||
number -= uniqueCards;
|
||||
}
|
||||
|
||||
List<CardPrinted> uniques = wantUnique ? new ArrayList<CardPrinted>() : null;
|
||||
List<PaperCard> uniques = wantUnique ? new ArrayList<PaperCard>() : null;
|
||||
for(int iC = 0; iC < number; iC++) {
|
||||
int index = MyRandom.getRandom().nextInt(totalWeight);
|
||||
CardPrinted toAdd = fetchRoulette(0, index, wantUnique ? uniques : null);
|
||||
PaperCard toAdd = fetchRoulette(0, index, wantUnique ? uniques : null);
|
||||
result.add(toAdd);
|
||||
if( wantUnique )
|
||||
uniques.add(toAdd);
|
||||
@@ -121,7 +121,7 @@ public class PrintSheet {
|
||||
return cardsWithWeights.isEmpty();
|
||||
}
|
||||
|
||||
public Iterable<CardPrinted> toFlatList() {
|
||||
public Iterable<PaperCard> toFlatList() {
|
||||
return cardsWithWeights.toFlatList();
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public class TournamentPack extends OpenablePack {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<CardPrinted> generate() {
|
||||
protected List<PaperCard> generate() {
|
||||
return BoosterGenerator.getBoosterPack(this.contents);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ import forge.card.CardRulesPredicates;
|
||||
import forge.card.MagicColor;
|
||||
import forge.item.BoosterPack;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.IPaperCard;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.item.PrintSheet;
|
||||
@@ -66,9 +66,9 @@ public final class BoosterUtils {
|
||||
* the num rare
|
||||
* @return the quest starter deck
|
||||
*/
|
||||
public static List<CardPrinted> getQuestStarterDeck(final Predicate<CardPrinted> filter, final int numCommon,
|
||||
public static List<PaperCard> getQuestStarterDeck(final Predicate<PaperCard> filter, final int numCommon,
|
||||
final int numUncommon, final int numRare) {
|
||||
final ArrayList<CardPrinted> cards = new ArrayList<CardPrinted>();
|
||||
final ArrayList<PaperCard> cards = new ArrayList<PaperCard>();
|
||||
|
||||
// Each color should have around the same amount of monocolored cards
|
||||
// There should be 3 Colorless cards for every 4 cards in a single color
|
||||
@@ -90,16 +90,16 @@ public final class BoosterUtils {
|
||||
}
|
||||
|
||||
// This will save CPU time when sets are limited
|
||||
final List<CardPrinted> cardpool = Lists.newArrayList(Iterables.filter(CardDb.instance().getAllCards(), filter));
|
||||
final List<PaperCard> cardpool = Lists.newArrayList(Iterables.filter(CardDb.instance().getAllCards(), filter));
|
||||
|
||||
final Predicate<CardPrinted> pCommon = IPaperCard.Predicates.Presets.IS_COMMON;
|
||||
final Predicate<PaperCard> pCommon = IPaperCard.Predicates.Presets.IS_COMMON;
|
||||
cards.addAll(BoosterUtils.generateDefinetlyColouredCards(cardpool, pCommon, numCommon, colorFilters));
|
||||
|
||||
final Predicate<CardPrinted> pUncommon = IPaperCard.Predicates.Presets.IS_UNCOMMON;
|
||||
final Predicate<PaperCard> pUncommon = IPaperCard.Predicates.Presets.IS_UNCOMMON;
|
||||
cards.addAll(BoosterUtils.generateDefinetlyColouredCards(cardpool, pUncommon, numUncommon, colorFilters));
|
||||
|
||||
int nRares = numRare, nMythics = 0;
|
||||
final Predicate<CardPrinted> filterMythics = IPaperCard.Predicates.Presets.IS_MYTHIC_RARE;
|
||||
final Predicate<PaperCard> filterMythics = IPaperCard.Predicates.Presets.IS_MYTHIC_RARE;
|
||||
final boolean haveMythics = Iterables.any(cardpool, filterMythics);
|
||||
for (int iSlot = 0; haveMythics && (iSlot < numRare); iSlot++) {
|
||||
if (MyRandom.getRandom().nextInt(10) < 1) {
|
||||
@@ -109,7 +109,7 @@ public final class BoosterUtils {
|
||||
}
|
||||
}
|
||||
|
||||
final Predicate<CardPrinted> pRare = IPaperCard.Predicates.Presets.IS_RARE;
|
||||
final Predicate<PaperCard> pRare = IPaperCard.Predicates.Presets.IS_RARE;
|
||||
cards.addAll(BoosterUtils.generateDefinetlyColouredCards(cardpool, pRare, nRares, colorFilters));
|
||||
if (nMythics > 0) {
|
||||
cards.addAll(BoosterUtils.generateDefinetlyColouredCards(cardpool, filterMythics, nMythics, colorFilters));
|
||||
@@ -130,10 +130,10 @@ public final class BoosterUtils {
|
||||
* a List<Predicate<CardRules>>
|
||||
* @return a list of card names
|
||||
*/
|
||||
private static ArrayList<CardPrinted> generateDefinetlyColouredCards(final Iterable<CardPrinted> source,
|
||||
final Predicate<CardPrinted> filter, final int cntNeeded, final List<Predicate<CardRules>> allowedColors) {
|
||||
private static ArrayList<PaperCard> generateDefinetlyColouredCards(final Iterable<PaperCard> source,
|
||||
final Predicate<PaperCard> filter, final int cntNeeded, final List<Predicate<CardRules>> allowedColors) {
|
||||
// If color is null, use colorOrder progression to grab cards
|
||||
final ArrayList<CardPrinted> result = new ArrayList<CardPrinted>();
|
||||
final ArrayList<PaperCard> result = new ArrayList<PaperCard>();
|
||||
|
||||
final int size = allowedColors == null ? 0 : allowedColors.size();
|
||||
Collections.shuffle(allowedColors);
|
||||
@@ -145,12 +145,12 @@ public final class BoosterUtils {
|
||||
// constant!
|
||||
|
||||
while ((cntMade < cntNeeded) && (allowedMisses > 0)) {
|
||||
CardPrinted card = null;
|
||||
PaperCard card = null;
|
||||
|
||||
if (size > 0) {
|
||||
final Predicate<CardRules> color2 = allowedColors.get(iAttempt % size);
|
||||
if (color2 != null) {
|
||||
Predicate<CardPrinted> color2c = Predicates.compose(color2, CardPrinted.FN_GET_RULES);
|
||||
Predicate<PaperCard> color2c = Predicates.compose(color2, PaperCard.FN_GET_RULES);
|
||||
card = Aggregates.random(Iterables.filter(source, Predicates.and(filter, color2c)));
|
||||
}
|
||||
}
|
||||
@@ -218,13 +218,13 @@ public final class BoosterUtils {
|
||||
// Type 1: 'n [color] rares'
|
||||
final int qty = Integer.parseInt(temp[0]);
|
||||
|
||||
List<Predicate<CardPrinted>> preds = new ArrayList<Predicate<CardPrinted>>();
|
||||
List<Predicate<PaperCard>> preds = new ArrayList<Predicate<PaperCard>>();
|
||||
preds.add(IPaperCard.Predicates.Presets.IS_RARE_OR_MYTHIC); // Determine rarity
|
||||
|
||||
if (temp.length > 2) {
|
||||
Predicate<CardRules> cr = parseRulesLimitation(temp[1]);
|
||||
if(Predicates.alwaysTrue() != (Object)cr) // guava has a single instance for always-const predicates
|
||||
preds.add(Predicates.compose(cr, CardPrinted.FN_GET_RULES));
|
||||
preds.add(Predicates.compose(cr, PaperCard.FN_GET_RULES));
|
||||
}
|
||||
|
||||
if (Singletons.getModel().getQuest().getFormat() != null) {
|
||||
@@ -232,7 +232,7 @@ public final class BoosterUtils {
|
||||
}
|
||||
|
||||
PrintSheet ps = new PrintSheet("Quest rewards");
|
||||
Predicate<CardPrinted> predicate = preds.size() == 1 ? preds.get(0) : Predicates.and(preds);
|
||||
Predicate<PaperCard> predicate = preds.size() == 1 ? preds.get(0) : Predicates.and(preds);
|
||||
ps.addAll(Iterables.filter(CardDb.instance().getAllCards(), predicate));
|
||||
rewards.addAll(ps.random(qty, true));
|
||||
} else if (temp.length == 2 && temp[0].equalsIgnoreCase("duplicate") && temp[1].equalsIgnoreCase("card")) {
|
||||
@@ -250,7 +250,7 @@ public final class BoosterUtils {
|
||||
}
|
||||
else if (temp.length > 0) {
|
||||
// default: assume we are asking for a single copy of a specific card
|
||||
final CardPrinted specific = CardDb.instance().getCard(s);
|
||||
final PaperCard specific = CardDb.instance().getCard(s);
|
||||
if (specific != null) {
|
||||
rewards.add(specific);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package forge.quest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.InventoryItem;
|
||||
|
||||
/**
|
||||
@@ -17,6 +17,6 @@ public interface IQuestRewardCard extends InventoryItem {
|
||||
* Returns an unmodifiable list of card choices.
|
||||
* @return List<CardPrinted>, an umodifiable list of cards.
|
||||
*/
|
||||
List<CardPrinted> getChoices();
|
||||
List<PaperCard> getChoices();
|
||||
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ import forge.deck.Deck;
|
||||
import forge.game.GameFormat;
|
||||
import forge.game.event.GameEvent;
|
||||
import forge.game.event.GameEventMulligan;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.PreconDeck;
|
||||
import forge.properties.NewConstants;
|
||||
import forge.quest.bazaar.QuestBazaarManager;
|
||||
@@ -236,7 +236,7 @@ public class QuestController {
|
||||
if (null != startingCards) {
|
||||
this.myCards.addDeck(startingCards);
|
||||
} else {
|
||||
Predicate<CardPrinted> filter = Predicates.alwaysTrue();
|
||||
Predicate<PaperCard> filter = Predicates.alwaysTrue();
|
||||
if (formatStartingPool != null) {
|
||||
filter = formatStartingPool.getFilterPrinted();
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.google.common.base.Predicates;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.card.CardRules;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.IPaperCard;
|
||||
import forge.item.InventoryItem;
|
||||
|
||||
@@ -49,14 +49,14 @@ public abstract class QuestRewardCard implements InventoryItem, IQuestRewardCard
|
||||
return defaultDescription;
|
||||
}
|
||||
|
||||
protected Predicate<CardPrinted> buildPredicates(final String [] input) {
|
||||
protected Predicate<PaperCard> buildPredicates(final String [] input) {
|
||||
if (input == null || input.length < 1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Predicate<CardPrinted> filters = Singletons.getModel().getQuest().getFormat().getFilterPrinted();
|
||||
Predicate<PaperCard> filters = Singletons.getModel().getQuest().getFormat().getFilterPrinted();
|
||||
Predicate<CardRules> filterRules = null;
|
||||
Predicate<CardPrinted> filterRarity = null;
|
||||
Predicate<PaperCard> filterRarity = null;
|
||||
|
||||
for (String s : input) {
|
||||
if (s.startsWith("sets:") || s.startsWith("Sets:")) {
|
||||
@@ -112,7 +112,7 @@ public abstract class QuestRewardCard implements InventoryItem, IQuestRewardCard
|
||||
}
|
||||
|
||||
if (filterRules != null) {
|
||||
final Predicate<CardPrinted> rulesPrinted = Predicates.compose(filterRules, CardPrinted.FN_GET_RULES);
|
||||
final Predicate<PaperCard> rulesPrinted = Predicates.compose(filterRules, PaperCard.FN_GET_RULES);
|
||||
filters = Predicates.and(filters, rulesPrinted);
|
||||
}
|
||||
if (filterRarity != null) {
|
||||
@@ -121,6 +121,6 @@ public abstract class QuestRewardCard implements InventoryItem, IQuestRewardCard
|
||||
return filters;
|
||||
}
|
||||
|
||||
public abstract List<CardPrinted> getChoices();
|
||||
public abstract List<PaperCard> getChoices();
|
||||
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import com.google.common.collect.Iterables;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.item.ItemPool;
|
||||
|
||||
@@ -33,7 +33,7 @@ public class QuestRewardCardChooser extends QuestRewardCard implements Inventory
|
||||
|
||||
private poolType type;
|
||||
private final String description;
|
||||
private final Predicate<CardPrinted> predicates;
|
||||
private final Predicate<PaperCard> predicates;
|
||||
|
||||
/**
|
||||
* The constructor.
|
||||
@@ -91,13 +91,13 @@ public class QuestRewardCardChooser extends QuestRewardCard implements Inventory
|
||||
* @return a List<CardPrinted> or null if could not create a list.
|
||||
*/
|
||||
@Override
|
||||
public final List<CardPrinted> getChoices() {
|
||||
public final List<PaperCard> getChoices() {
|
||||
if (type == poolType.playerCards) {
|
||||
final ItemPool<CardPrinted> playerCards = Singletons.getModel().getQuest().getAssets().getCardPool();
|
||||
final ItemPool<PaperCard> playerCards = Singletons.getModel().getQuest().getAssets().getCardPool();
|
||||
if (!playerCards.isEmpty()) { // Maybe a redundant check since it's hard to win a duel without any cards...
|
||||
|
||||
List<CardPrinted> cardChoices = new ArrayList<CardPrinted>();
|
||||
for (final Map.Entry<CardPrinted, Integer> card : playerCards) {
|
||||
List<PaperCard> cardChoices = new ArrayList<PaperCard>();
|
||||
for (final Map.Entry<PaperCard, Integer> card : playerCards) {
|
||||
cardChoices.add(card.getKey());
|
||||
}
|
||||
Collections.sort(cardChoices);
|
||||
@@ -106,9 +106,9 @@ public class QuestRewardCardChooser extends QuestRewardCard implements Inventory
|
||||
}
|
||||
|
||||
} else if (type == poolType.predicateFilter) {
|
||||
List<CardPrinted> cardChoices = new ArrayList<CardPrinted>();
|
||||
List<PaperCard> cardChoices = new ArrayList<PaperCard>();
|
||||
|
||||
for (final CardPrinted card : Iterables.filter(CardDb.instance().getAllCards(), predicates)) {
|
||||
for (final PaperCard card : Iterables.filter(CardDb.instance().getAllCards(), predicates)) {
|
||||
cardChoices.add(card);
|
||||
}
|
||||
Collections.sort(cardChoices);
|
||||
|
||||
@@ -6,7 +6,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.ItemPool;
|
||||
|
||||
/**
|
||||
@@ -51,12 +51,12 @@ public class QuestRewardCardDuplicate implements IQuestRewardCard {
|
||||
*
|
||||
* @return a List<CardPrinted> or null if could not create a list.
|
||||
*/
|
||||
public final List<CardPrinted> getChoices() {
|
||||
final ItemPool<CardPrinted> playerCards = Singletons.getModel().getQuest().getAssets().getCardPool();
|
||||
public final List<PaperCard> getChoices() {
|
||||
final ItemPool<PaperCard> playerCards = Singletons.getModel().getQuest().getAssets().getCardPool();
|
||||
if (!playerCards.isEmpty()) { // Maybe a redundant check since it's hard to win a duel without any cards...
|
||||
|
||||
List<CardPrinted> cardChoices = new ArrayList<CardPrinted>();
|
||||
for (final Map.Entry<CardPrinted, Integer> card : playerCards) {
|
||||
List<PaperCard> cardChoices = new ArrayList<PaperCard>();
|
||||
for (final Map.Entry<PaperCard, Integer> card : playerCards) {
|
||||
cardChoices.add(card.getKey());
|
||||
}
|
||||
Collections.sort(cardChoices);
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
|
||||
/**
|
||||
* Allows the player to choose a card from a predicate-filtered list of cards.
|
||||
@@ -17,7 +17,7 @@ import forge.item.CardPrinted;
|
||||
public class QuestRewardCardFiltered extends QuestRewardCard implements IQuestRewardCard {
|
||||
|
||||
private final String description;
|
||||
private final Predicate<CardPrinted> predicates;
|
||||
private final Predicate<PaperCard> predicates;
|
||||
|
||||
/**
|
||||
* The constructor.
|
||||
@@ -56,9 +56,9 @@ public class QuestRewardCardFiltered extends QuestRewardCard implements IQuestRe
|
||||
* @return a List<CardPrinted> or null if could not create a list.
|
||||
*/
|
||||
@Override
|
||||
public final List<CardPrinted> getChoices() {
|
||||
List<CardPrinted> cardChoices = new ArrayList<CardPrinted>();
|
||||
for (final CardPrinted card : Iterables.filter(CardDb.instance().getAllCards(), predicates)) {
|
||||
public final List<PaperCard> getChoices() {
|
||||
List<PaperCard> cardChoices = new ArrayList<PaperCard>();
|
||||
for (final PaperCard card : Iterables.filter(CardDb.instance().getAllCards(), predicates)) {
|
||||
cardChoices.add(card);
|
||||
}
|
||||
Collections.sort(cardChoices);
|
||||
|
||||
@@ -24,7 +24,7 @@ import forge.Card;
|
||||
import forge.card.CardEdition;
|
||||
import forge.card.CardRulesReader;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardToken;
|
||||
import forge.item.PaperToken;
|
||||
import forge.item.IPaperCard;
|
||||
import forge.quest.bazaar.QuestPetController;
|
||||
|
||||
@@ -133,7 +133,7 @@ public class QuestUtil {
|
||||
* (TOKEN;W;1;1;sheep;type;type;type...)
|
||||
* @return token Card
|
||||
*/
|
||||
public static CardToken createToken(final String s) {
|
||||
public static PaperToken createToken(final String s) {
|
||||
final String[] properties = s.split(";", 6);
|
||||
|
||||
List<String> script = new ArrayList<String>();
|
||||
@@ -142,8 +142,8 @@ public class QuestUtil {
|
||||
script.add("PT:"+ properties[2] + "/" + properties[3]);
|
||||
script.add("Types:" + properties[5].replace(';', ' '));
|
||||
script.add("Oracle:"); // tokens don't have texts yet
|
||||
String fileName = CardToken.makeTokenFileName(properties[1], properties[2], properties[3], properties[4]);
|
||||
final CardToken c = new CardToken(CardRulesReader.parseSingleCard(script), CardEdition.UNKNOWN, fileName);
|
||||
String fileName = PaperToken.makeTokenFileName(properties[1], properties[2], properties[3], properties[4]);
|
||||
final PaperToken c = new PaperToken(CardRulesReader.parseSingleCard(script), CardEdition.UNKNOWN, fileName);
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ import forge.deck.Deck;
|
||||
import forge.deck.DeckSection;
|
||||
import forge.item.BoosterPack;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.FatPack;
|
||||
import forge.item.IPaperCard;
|
||||
import forge.item.InventoryItem;
|
||||
@@ -88,9 +88,9 @@ public final class QuestUtilCards {
|
||||
* @param usedFormat currently enforced game format, if any
|
||||
* @return the item pool view
|
||||
*/
|
||||
public static ItemPoolView<CardPrinted> generateBasicLands(final int nBasic, final int nSnow, final GameFormatQuest usedFormat) {
|
||||
public static ItemPoolView<PaperCard> generateBasicLands(final int nBasic, final int nSnow, final GameFormatQuest usedFormat) {
|
||||
final CardDb db = CardDb.instance();
|
||||
final ItemPool<CardPrinted> pool = new ItemPool<CardPrinted>(CardPrinted.class);
|
||||
final ItemPool<PaperCard> pool = new ItemPool<PaperCard>(PaperCard.class);
|
||||
|
||||
List<String> landCodes = new ArrayList<String>();
|
||||
List<String> snowLandCodes = new ArrayList<String>();
|
||||
@@ -148,7 +148,7 @@ public final class QuestUtilCards {
|
||||
* the f sets
|
||||
* @return the array list
|
||||
*/
|
||||
public List<CardPrinted> generateQuestBooster(final Predicate<CardPrinted> fSets) {
|
||||
public List<PaperCard> generateQuestBooster(final Predicate<PaperCard> fSets) {
|
||||
UnOpenedProduct unopened = new UnOpenedProduct(getBoosterTemplate(), fSets);
|
||||
return unopened.get();
|
||||
}
|
||||
@@ -159,8 +159,8 @@ public final class QuestUtilCards {
|
||||
* @param newCards
|
||||
* the new cards
|
||||
*/
|
||||
public void addAllCards(final Iterable<CardPrinted> newCards) {
|
||||
for (final CardPrinted card : newCards) {
|
||||
public void addAllCards(final Iterable<PaperCard> newCards) {
|
||||
for (final PaperCard card : newCards) {
|
||||
this.addSingleCard(card, 1);
|
||||
}
|
||||
}
|
||||
@@ -171,14 +171,14 @@ public final class QuestUtilCards {
|
||||
* @param card
|
||||
* the card
|
||||
*/
|
||||
public void addSingleCard(final CardPrinted card, int qty) {
|
||||
public void addSingleCard(final PaperCard card, int qty) {
|
||||
this.qa.getCardPool().add(card, qty);
|
||||
|
||||
// register card into that list so that it would appear as a new one.
|
||||
this.qa.getNewCardList().add(card, qty);
|
||||
}
|
||||
|
||||
private static final Predicate<CardPrinted> RARE_PREDICATE = IPaperCard.Predicates.Presets.IS_RARE_OR_MYTHIC;
|
||||
private static final Predicate<PaperCard> RARE_PREDICATE = IPaperCard.Predicates.Presets.IS_RARE_OR_MYTHIC;
|
||||
|
||||
|
||||
/**
|
||||
@@ -187,7 +187,7 @@ public final class QuestUtilCards {
|
||||
* the predicate to be added to the format predicate.
|
||||
* @return the composite predicate.
|
||||
*/
|
||||
public Predicate<CardPrinted> applyFormatFilter(Predicate<CardPrinted> source) {
|
||||
public Predicate<PaperCard> applyFormatFilter(Predicate<PaperCard> source) {
|
||||
return qc.getFormat() == null ? source : Predicates.and(source, qc.getFormat().getFilterPrinted());
|
||||
}
|
||||
|
||||
@@ -196,11 +196,11 @@ public final class QuestUtilCards {
|
||||
*
|
||||
* @return the card printed
|
||||
*/
|
||||
public CardPrinted addRandomRare() {
|
||||
public PaperCard addRandomRare() {
|
||||
|
||||
final Predicate<CardPrinted> myFilter = applyFormatFilter(QuestUtilCards.RARE_PREDICATE);
|
||||
final Predicate<PaperCard> myFilter = applyFormatFilter(QuestUtilCards.RARE_PREDICATE);
|
||||
|
||||
final CardPrinted card = Aggregates.random(Iterables.filter(CardDb.instance().getAllCards(), myFilter));
|
||||
final PaperCard card = Aggregates.random(Iterables.filter(CardDb.instance().getAllCards(), myFilter));
|
||||
this.addSingleCard(card, 1);
|
||||
return card;
|
||||
}
|
||||
@@ -212,10 +212,10 @@ public final class QuestUtilCards {
|
||||
* the n
|
||||
* @return the list
|
||||
*/
|
||||
public List<CardPrinted> addRandomRare(final int n) {
|
||||
final Predicate<CardPrinted> myFilter = applyFormatFilter(QuestUtilCards.RARE_PREDICATE);
|
||||
public List<PaperCard> addRandomRare(final int n) {
|
||||
final Predicate<PaperCard> myFilter = applyFormatFilter(QuestUtilCards.RARE_PREDICATE);
|
||||
|
||||
final List<CardPrinted> newCards = Aggregates.random(Iterables.filter(CardDb.instance().getAllCards(), myFilter), n);
|
||||
final List<PaperCard> newCards = Aggregates.random(Iterables.filter(CardDb.instance().getAllCards(), myFilter), n);
|
||||
this.addAllCards(newCards);
|
||||
return newCards;
|
||||
}
|
||||
@@ -228,7 +228,7 @@ public final class QuestUtilCards {
|
||||
* @param idxDifficulty
|
||||
* the idx difficulty
|
||||
*/
|
||||
public void setupNewGameCardPool(final Predicate<CardPrinted> filter, final int idxDifficulty) {
|
||||
public void setupNewGameCardPool(final Predicate<PaperCard> filter, final int idxDifficulty) {
|
||||
final int nC = this.qpref.getPrefInt(DifficultyPrefs.STARTING_COMMONS, idxDifficulty);
|
||||
final int nU = this.qpref.getPrefInt(DifficultyPrefs.STARTING_UNCOMMONS, idxDifficulty);
|
||||
final int nR = this.qpref.getPrefInt(DifficultyPrefs.STARTING_RARES, idxDifficulty);
|
||||
@@ -244,7 +244,7 @@ public final class QuestUtilCards {
|
||||
* @param value
|
||||
* the value
|
||||
*/
|
||||
public void buyCard(final CardPrinted card, int qty, final int value) {
|
||||
public void buyCard(final PaperCard card, int qty, final int value) {
|
||||
int totalCost = qty * value;
|
||||
if (this.qa.getCredits() >= totalCost) {
|
||||
this.qa.setCredits(this.qa.getCredits() - totalCost);
|
||||
@@ -309,11 +309,11 @@ public final class QuestUtilCards {
|
||||
* @param price
|
||||
* the price
|
||||
*/
|
||||
public void sellCard(final CardPrinted card, int qty, final int pricePerCard) {
|
||||
public void sellCard(final PaperCard card, int qty, final int pricePerCard) {
|
||||
this.sellCard(card, qty, pricePerCard, true);
|
||||
}
|
||||
|
||||
public void loseCard(final CardPrinted card, int qty) {
|
||||
public void loseCard(final PaperCard card, int qty) {
|
||||
this.sellCard(card, qty, 0, false);
|
||||
}
|
||||
|
||||
@@ -327,7 +327,7 @@ public final class QuestUtilCards {
|
||||
* @param addToShop
|
||||
* true if this card should be added to the shop, false otherwise
|
||||
*/
|
||||
private void sellCard(final CardPrinted card, int qty, final int pricePerCard, final boolean addToShop) {
|
||||
private void sellCard(final PaperCard card, int qty, final int pricePerCard, final boolean addToShop) {
|
||||
if (pricePerCard > 0) {
|
||||
this.qa.setCredits(this.qa.getCredits() + (qty * pricePerCard));
|
||||
}
|
||||
@@ -558,7 +558,7 @@ public final class QuestUtilCards {
|
||||
*
|
||||
* @return the cardpool
|
||||
*/
|
||||
public ItemPool<CardPrinted> getCardpool() {
|
||||
public ItemPool<PaperCard> getCardpool() {
|
||||
return this.qa.getCardPool();
|
||||
}
|
||||
|
||||
@@ -632,14 +632,14 @@ public final class QuestUtilCards {
|
||||
|
||||
public int getCompletionPercent(String edition) {
|
||||
// get all cards in the specified edition
|
||||
Predicate<CardPrinted> filter = IPaperCard.Predicates.printedInSet(edition);
|
||||
Iterable<CardPrinted> editionCards = Iterables.filter(CardDb.instance().getAllCards(), filter);
|
||||
Predicate<PaperCard> filter = IPaperCard.Predicates.printedInSet(edition);
|
||||
Iterable<PaperCard> editionCards = Iterables.filter(CardDb.instance().getAllCards(), filter);
|
||||
|
||||
ItemPool<CardPrinted> ownedCards = qa.getCardPool();
|
||||
ItemPool<PaperCard> ownedCards = qa.getCardPool();
|
||||
// 100% means at least one of every basic land and at least 4 of every other card in the set
|
||||
int completeCards = 0;
|
||||
int numOwnedCards = 0;
|
||||
for (CardPrinted card : editionCards) {
|
||||
for (PaperCard card : editionCards) {
|
||||
final int target = CardRarity.BasicLand == card.getRarity() ? 1 : 4;
|
||||
|
||||
completeCards += target;
|
||||
@@ -655,8 +655,8 @@ public final class QuestUtilCards {
|
||||
@Override
|
||||
public Comparable<?> apply(final Entry<InventoryItem, Integer> from) {
|
||||
InventoryItem i = from.getKey();
|
||||
if (i instanceof CardPrinted) {
|
||||
return QuestUtilCards.this.qa.getCardPool().count((CardPrinted)i);
|
||||
if (i instanceof PaperCard) {
|
||||
return QuestUtilCards.this.qa.getCardPool().count((PaperCard)i);
|
||||
} else if (i instanceof PreconDeck) {
|
||||
PreconDeck pDeck = (PreconDeck)i;
|
||||
return Singletons.getModel().getQuest().getMyDecks().contains(pDeck.getName()) ? -1 : -2;
|
||||
@@ -673,8 +673,8 @@ public final class QuestUtilCards {
|
||||
@Override
|
||||
public Object apply(final Entry<InventoryItem, Integer> from) {
|
||||
InventoryItem i = from.getKey();
|
||||
if (i instanceof CardPrinted) {
|
||||
return QuestUtilCards.this.qa.getCardPool().count((CardPrinted)i);
|
||||
if (i instanceof PaperCard) {
|
||||
return QuestUtilCards.this.qa.getCardPool().count((PaperCard)i);
|
||||
} else if (i instanceof PreconDeck) {
|
||||
PreconDeck pDeck = (PreconDeck)i;
|
||||
return Singletons.getModel().getQuest().getMyDecks().contains(pDeck.getName()) ? "YES" : "NO";
|
||||
|
||||
@@ -36,7 +36,7 @@ import forge.card.CardEdition;
|
||||
import forge.card.UnOpenedProduct;
|
||||
import forge.gui.CardListViewer;
|
||||
import forge.gui.GuiChoose;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.quest.io.ReadPriceList;
|
||||
import forge.util.storage.IStorageView;
|
||||
|
||||
@@ -188,7 +188,7 @@ public class QuestUtilUnlockSets {
|
||||
IStorageView<BoosterTemplate> boosters = Singletons.getModel().getBoosters();
|
||||
qData.getFormat().unlockSet(unlockedSet.getCode());
|
||||
|
||||
List<CardPrinted> cardsWon = new ArrayList<CardPrinted>();
|
||||
List<PaperCard> cardsWon = new ArrayList<PaperCard>();
|
||||
|
||||
if (starters.contains(unlockedSet.getCode())) {
|
||||
UnOpenedProduct starter = new UnOpenedProduct(starters.get(unlockedSet.getCode()));
|
||||
|
||||
@@ -25,7 +25,7 @@ import javax.swing.ImageIcon;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
|
||||
import forge.item.CardToken;
|
||||
import forge.item.PaperToken;
|
||||
import forge.properties.NewConstants;
|
||||
import forge.quest.data.QuestAssets;
|
||||
|
||||
@@ -76,7 +76,7 @@ public class QuestPetController implements IQuestBazaarItem {
|
||||
* @return a {@link forge.Card} object.
|
||||
*/
|
||||
|
||||
public CardToken getPetCard(final QuestAssets qA) {
|
||||
public PaperToken getPetCard(final QuestAssets qA) {
|
||||
return this.levels.get(this.getPetLevel(qA)).getCard();
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
import forge.card.CardEdition;
|
||||
import forge.card.CardRules;
|
||||
import forge.card.CardRulesReader;
|
||||
import forge.item.CardToken;
|
||||
import forge.item.PaperToken;
|
||||
import forge.properties.NewConstants;
|
||||
import forge.util.FileUtil;
|
||||
|
||||
@@ -40,7 +40,7 @@ public class QuestPetStats {
|
||||
@XStreamAsAttribute()
|
||||
private String nextLevel;
|
||||
|
||||
private transient CardToken petCard = null;
|
||||
private transient PaperToken petCard = null;
|
||||
|
||||
private QuestPetStats() { }
|
||||
|
||||
@@ -56,11 +56,11 @@ public class QuestPetStats {
|
||||
return stats;
|
||||
}
|
||||
|
||||
public final CardToken getCard() {
|
||||
public final PaperToken getCard() {
|
||||
if (null == petCard) {
|
||||
List<String> cardLines = FileUtil.readFile(new File(NewConstants.CARD_DATA_PETS_DIR, cardFile));
|
||||
CardRules rules = CardRulesReader.parseSingleCard(cardLines);
|
||||
petCard = new CardToken(rules, CardEdition.UNKNOWN, picture);
|
||||
petCard = new PaperToken(rules, CardEdition.UNKNOWN, picture);
|
||||
}
|
||||
return petCard;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.Map;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.deck.Deck;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.item.ItemPool;
|
||||
import forge.item.ItemPoolView;
|
||||
@@ -38,7 +38,7 @@ public class QuestAssets {
|
||||
|
||||
// Cards associated with quest
|
||||
/** The card pool. */
|
||||
private final ItemPool<CardPrinted> cardPool = new ItemPool<CardPrinted>(CardPrinted.class); // player's
|
||||
private final ItemPool<PaperCard> cardPool = new ItemPool<PaperCard>(PaperCard.class); // player's
|
||||
/** The credits. */
|
||||
private long credits; // this money is good for all modes
|
||||
// game
|
||||
@@ -171,7 +171,7 @@ public class QuestAssets {
|
||||
if (useFormat != null && !useFormat.hasSnowLands()) {
|
||||
snowLands = 0;
|
||||
}
|
||||
final ItemPoolView<CardPrinted> lands = QuestUtilCards.generateBasicLands(
|
||||
final ItemPoolView<PaperCard> lands = QuestUtilCards.generateBasicLands(
|
||||
prefs.getPrefInt(QPref.STARTING_BASIC_LANDS), snowLands, useFormat);
|
||||
this.getCardPool().addAll(lands);
|
||||
}
|
||||
@@ -243,7 +243,7 @@ public class QuestAssets {
|
||||
*
|
||||
* @return the cardPool
|
||||
*/
|
||||
public ItemPool<CardPrinted> getCardPool() {
|
||||
public ItemPool<PaperCard> getCardPool() {
|
||||
return this.cardPool;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ import forge.deck.DeckSection;
|
||||
import forge.error.BugReporter;
|
||||
import forge.item.BoosterPack;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.FatPack;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.item.ItemPool;
|
||||
@@ -507,7 +507,7 @@ public class QuestDataIO {
|
||||
|
||||
for( Entry<DeckSection, CardPool> ds : d ) {
|
||||
writer.startNode(ds.getKey().toString());
|
||||
for (final Entry<CardPrinted, Integer> e : ds.getValue()) {
|
||||
for (final Entry<PaperCard, Integer> e : ds.getValue()) {
|
||||
this.write(e.getKey(), e.getValue(), writer);
|
||||
}
|
||||
writer.endNode();
|
||||
@@ -559,7 +559,7 @@ public class QuestDataIO {
|
||||
return clasz.equals(ItemPool.class);
|
||||
}
|
||||
|
||||
protected void write(final CardPrinted cref, final Integer count, final HierarchicalStreamWriter writer) {
|
||||
protected void write(final PaperCard cref, final Integer count, final HierarchicalStreamWriter writer) {
|
||||
writer.startNode("card");
|
||||
writer.addAttribute("c", cref.getName());
|
||||
writer.addAttribute("s", cref.getEdition());
|
||||
@@ -608,8 +608,8 @@ public class QuestDataIO {
|
||||
for (final Entry<InventoryItem, Integer> e : pool) {
|
||||
final InventoryItem item = e.getKey();
|
||||
final Integer count = e.getValue();
|
||||
if (item instanceof CardPrinted) {
|
||||
this.write((CardPrinted) item, count, writer);
|
||||
if (item instanceof PaperCard) {
|
||||
this.write((PaperCard) item, count, writer);
|
||||
} else if (item instanceof BoosterPack) {
|
||||
this.write((BoosterPack) item, count, writer);
|
||||
} else if (item instanceof TournamentPack) {
|
||||
@@ -676,15 +676,15 @@ public class QuestDataIO {
|
||||
return FatPack.FN_FROM_SET.apply(ed);
|
||||
}
|
||||
|
||||
protected CardPrinted readCardPrinted(final HierarchicalStreamReader reader) {
|
||||
protected PaperCard readCardPrinted(final HierarchicalStreamReader reader) {
|
||||
final String name = reader.getAttribute("c");
|
||||
final String set = reader.getAttribute("s");
|
||||
final String sIndex = reader.getAttribute("i");
|
||||
final short index = StringUtils.isNumeric(sIndex) ? Short.parseShort(sIndex) : 0;
|
||||
final boolean foil = "1".equals(reader.getAttribute("foil"));
|
||||
CardPrinted c = CardDb.instance().tryGetCard(name, set, index);
|
||||
PaperCard c = CardDb.instance().tryGetCard(name, set, index);
|
||||
if ( null == c ) c = CardDb.instance().getCard(name);
|
||||
return foil ? CardPrinted.makeFoiled(c) : c;
|
||||
return foil ? PaperCard.makeFoiled(c) : c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.Map.Entry;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
|
||||
/**
|
||||
* TODO: Write javadoc for this type.
|
||||
@@ -108,10 +108,10 @@ public class TextUtil {
|
||||
val.toString().substring(1).toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
public static String buildFourColumnList(String firstLine, Iterable<CardPrinted> cAnteRemoved) {
|
||||
public static String buildFourColumnList(String firstLine, Iterable<PaperCard> cAnteRemoved) {
|
||||
StringBuilder sb = new StringBuilder(firstLine);
|
||||
int i = 0;
|
||||
for(CardPrinted cp: cAnteRemoved) {
|
||||
for(PaperCard cp: cAnteRemoved) {
|
||||
if ( i != 0 ) sb.append(", ");
|
||||
if ( i % 4 == 0 ) sb.append("\n");
|
||||
sb.append(cp);
|
||||
|
||||
@@ -4,7 +4,7 @@ import org.testng.annotations.Test;
|
||||
|
||||
import forge.game.limited.BoosterDraft;
|
||||
import forge.game.limited.LimitedPoolType;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.ItemPoolView;
|
||||
|
||||
/**
|
||||
@@ -23,7 +23,7 @@ public class BoosterDraft1Test {
|
||||
public void boosterDraft1Test1() throws Exception {
|
||||
final BoosterDraft draft = new BoosterDraft(LimitedPoolType.Full);
|
||||
while (draft.hasNextChoice()) {
|
||||
final ItemPoolView<CardPrinted> list = draft.nextChoice();
|
||||
final ItemPoolView<PaperCard> list = draft.nextChoice();
|
||||
System.out.println(list.countAll());
|
||||
draft.setChoice(list.toFlatList().get(0));
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import forge.card.BoosterTemplate;
|
||||
import forge.card.BoosterGenerator;
|
||||
import forge.deck.Deck;
|
||||
import forge.game.limited.IBoosterDraft;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.ItemPool;
|
||||
import forge.item.ItemPoolView;
|
||||
|
||||
@@ -47,15 +47,15 @@ public class BoosterDraftTest implements IBoosterDraft {
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
@Override
|
||||
public ItemPoolView<CardPrinted> nextChoice() {
|
||||
public ItemPoolView<PaperCard> nextChoice() {
|
||||
this.n--;
|
||||
BoosterTemplate booster = Singletons.getModel().getBoosters().get("M11");
|
||||
return ItemPool.createFrom(BoosterGenerator.getBoosterPack(booster), CardPrinted.class);
|
||||
return ItemPool.createFrom(BoosterGenerator.getBoosterPack(booster), PaperCard.class);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void setChoice(final CardPrinted c) {
|
||||
public void setChoice(final PaperCard c) {
|
||||
System.out.println(c.getName());
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package forge.deck.generate;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.ItemPoolView;
|
||||
|
||||
/**
|
||||
@@ -18,7 +18,7 @@ public class Generate2ColorDeckTest {
|
||||
@Test(enabled = false)
|
||||
public void generate2ColorDeckTest1() {
|
||||
final Generate2ColorDeck gen = new Generate2ColorDeck("white", "blue");
|
||||
final ItemPoolView<CardPrinted> cardList = gen.getDeck(60, false);
|
||||
final ItemPoolView<PaperCard> cardList = gen.getDeck(60, false);
|
||||
Assert.assertNotNull(cardList);
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user