mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Boosters collection now uses data from cardeditions/setname.txt
BoosterTemplate.java class turned unneeded
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -13919,7 +13919,6 @@ src/main/java/forge/StaticEffect.java svneol=native#text/plain
|
|||||||
src/main/java/forge/StaticEffects.java svneol=native#text/plain
|
src/main/java/forge/StaticEffects.java svneol=native#text/plain
|
||||||
src/main/java/forge/card/AggregationMethod.java -text
|
src/main/java/forge/card/AggregationMethod.java -text
|
||||||
src/main/java/forge/card/BoosterGenerator.java svneol=native#text/plain
|
src/main/java/forge/card/BoosterGenerator.java svneol=native#text/plain
|
||||||
src/main/java/forge/card/BoosterTemplate.java -text
|
|
||||||
src/main/java/forge/card/CardAiHints.java -text
|
src/main/java/forge/card/CardAiHints.java -text
|
||||||
src/main/java/forge/card/CardBlock.java -text
|
src/main/java/forge/card/CardBlock.java -text
|
||||||
src/main/java/forge/card/CardCharacteristics.java -text
|
src/main/java/forge/card/CardCharacteristics.java -text
|
||||||
|
|||||||
@@ -222,7 +222,8 @@ public class ImageCache {
|
|||||||
return ImageCache.TOURNAMENTPACK_PREFIX + ((TournamentPack)ii).getEdition();
|
return ImageCache.TOURNAMENTPACK_PREFIX + ((TournamentPack)ii).getEdition();
|
||||||
if ( ii instanceof BoosterPack ) {
|
if ( ii instanceof BoosterPack ) {
|
||||||
BoosterPack bp = (BoosterPack)ii;
|
BoosterPack bp = (BoosterPack)ii;
|
||||||
String suffix = (1 >= bp.getBoosterData().getArtIndices()) ? "" : ("_" + bp.getArtIndex());
|
int cntPics = Singletons.getModel().getEditions().get(bp.getEdition()).getCntBoosterPictures();
|
||||||
|
String suffix = (1 >= cntPics) ? "" : ("_" + bp.getArtIndex());
|
||||||
return ImageCache.BOOSTER_PREFIX + bp.getEdition() + suffix;
|
return ImageCache.BOOSTER_PREFIX + bp.getEdition() + suffix;
|
||||||
}
|
}
|
||||||
if ( ii instanceof FatPack )
|
if ( ii instanceof FatPack )
|
||||||
@@ -248,7 +249,7 @@ public class ImageCache {
|
|||||||
final int cntPictures;
|
final int cntPictures;
|
||||||
final boolean hasManyPictures;
|
final boolean hasManyPictures;
|
||||||
if (includeSet) {
|
if (includeSet) {
|
||||||
cntPictures = card.isTraditional() ? CardDb.instance().getPrintCount(card.getName(), edition) : CardDb.variants().getPrintCount(card.getName(), edition);
|
cntPictures = !card.isVariant() ? CardDb.instance().getPrintCount(card.getName(), edition) : CardDb.variants().getPrintCount(card.getName(), edition);
|
||||||
hasManyPictures = cntPictures > 1;
|
hasManyPictures = cntPictures > 1;
|
||||||
} else {
|
} else {
|
||||||
// without set number of pictures equals number of urls provided in Svar:Picture
|
// without set number of pictures equals number of urls provided in Svar:Picture
|
||||||
@@ -256,7 +257,7 @@ public class ImageCache {
|
|||||||
cntPictures = StringUtils.countMatches(urls, "\\") + 1;
|
cntPictures = StringUtils.countMatches(urls, "\\") + 1;
|
||||||
|
|
||||||
// raise the art index limit to the maximum of the sets this card was printed in
|
// raise the art index limit to the maximum of the sets this card was printed in
|
||||||
int maxCntPictures = card.isTraditional() ? CardDb.instance().getMaxPrintCount(card.getName()) : CardDb.variants().getMaxPrintCount(card.getName());
|
int maxCntPictures = !card.isVariant() ? CardDb.instance().getMaxPrintCount(card.getName()) : CardDb.variants().getMaxPrintCount(card.getName());
|
||||||
hasManyPictures = maxCntPictures > 1;
|
hasManyPictures = maxCntPictures > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,85 +0,0 @@
|
|||||||
package forge.card;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
|
|
||||||
import forge.util.TextUtil;
|
|
||||||
import forge.util.storage.StorageReaderFile;
|
|
||||||
|
|
||||||
public class BoosterTemplate extends SealedProductTemplate {
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public final static BoosterTemplate genericBooster = new BoosterTemplate(null, 1, Lists.newArrayList(
|
|
||||||
Pair.of(BoosterGenerator.COMMON, 10), Pair.of(BoosterGenerator.UNCOMMON, 3),
|
|
||||||
Pair.of(BoosterGenerator.RARE_MYTHIC, 1), Pair.of(BoosterGenerator.BASIC_LAND, 1)
|
|
||||||
));
|
|
||||||
|
|
||||||
private final int foilRate = 68;
|
|
||||||
private final int artIndices;
|
|
||||||
|
|
||||||
private BoosterTemplate(String edition, int artIndices0, Iterable<Pair<String, Integer>> itrSlots) {
|
|
||||||
super(edition, itrSlots);
|
|
||||||
artIndices = artIndices0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final int getFoilChance() {
|
|
||||||
return this.foilRate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getArtIndices() {
|
|
||||||
return artIndices;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder s = new StringBuilder();
|
|
||||||
|
|
||||||
|
|
||||||
s.append("consisting of ");
|
|
||||||
for(Pair<String, Integer> p : slots) {
|
|
||||||
s.append(p.getRight()).append(" ").append(p.getLeft()).append(", ");
|
|
||||||
}
|
|
||||||
|
|
||||||
// trim the last comma and space
|
|
||||||
s.replace(s.length() - 2, s.length(), "");
|
|
||||||
|
|
||||||
// put an 'and' before the previous comma
|
|
||||||
int lastCommaIdx = s.lastIndexOf(",");
|
|
||||||
if (0 < lastCommaIdx) {
|
|
||||||
s.replace(lastCommaIdx+1, lastCommaIdx+1, " and");
|
|
||||||
}
|
|
||||||
|
|
||||||
return s.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final class Reader extends StorageReaderFile<BoosterTemplate> {
|
|
||||||
public Reader(String pathname) {
|
|
||||||
super(pathname, BoosterTemplate.FN_GET_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BoosterTemplate read(String line, int i) {
|
|
||||||
String[] headAndData = TextUtil.split(line, ':', 2);
|
|
||||||
final String edition = headAndData[0];
|
|
||||||
final String[] data = TextUtil.splitWithParenthesis(headAndData[1], ',');
|
|
||||||
int nCovers = 1;
|
|
||||||
|
|
||||||
List<Pair<String, Integer>> slots = new ArrayList<Pair<String,Integer>>();
|
|
||||||
for(String slotDesc : data) {
|
|
||||||
String[] kv = TextUtil.splitWithParenthesis(slotDesc, ' ', 2);
|
|
||||||
if (kv[1].startsWith("cover"))
|
|
||||||
nCovers = Integer.parseInt(kv[0]);
|
|
||||||
else
|
|
||||||
slots.add(ImmutablePair.of(kv[1], Integer.parseInt(kv[0])));
|
|
||||||
}
|
|
||||||
|
|
||||||
return new BoosterTemplate(edition, nCovers, slots);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -41,7 +41,6 @@ import forge.util.MyRandom;
|
|||||||
import forge.util.maps.CollectionSuppliers;
|
import forge.util.maps.CollectionSuppliers;
|
||||||
import forge.util.maps.MapOfLists;
|
import forge.util.maps.MapOfLists;
|
||||||
import forge.util.maps.TreeMapOfLists;
|
import forge.util.maps.TreeMapOfLists;
|
||||||
import forge.view.arcane.CardPanel;
|
|
||||||
|
|
||||||
public final class CardDb implements ICardDatabase {
|
public final class CardDb implements ICardDatabase {
|
||||||
private static volatile CardDb commonCards = null; // 'volatile' keyword makes this working
|
private static volatile CardDb commonCards = null; // 'volatile' keyword makes this working
|
||||||
@@ -233,8 +232,8 @@ public final class CardDb implements ICardDatabase {
|
|||||||
candidates[cnt++] = pc;
|
candidates[cnt++] = pc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (candidates.length == 0 ) return null;
|
if (cnt == 0 ) return null;
|
||||||
if (candidates.length == 1 ) return candidates[0];
|
if (cnt == 1 ) return candidates[0];
|
||||||
return candidates[MyRandom.getRandom().nextInt(cnt)];
|
return candidates[MyRandom.getRandom().nextInt(cnt)];
|
||||||
} else
|
} else
|
||||||
for( PaperCard pc : cards ) {
|
for( PaperCard pc : cards ) {
|
||||||
@@ -315,23 +314,16 @@ public final class CardDb implements ICardDatabase {
|
|||||||
public final Map<String, CardRules> regularCards = new TreeMap<String, CardRules>(String.CASE_INSENSITIVE_ORDER);
|
public final Map<String, CardRules> regularCards = new TreeMap<String, CardRules>(String.CASE_INSENSITIVE_ORDER);
|
||||||
public final Map<String, CardRules> variantsCards = new TreeMap<String, CardRules>(String.CASE_INSENSITIVE_ORDER);
|
public final Map<String, CardRules> variantsCards = new TreeMap<String, CardRules>(String.CASE_INSENSITIVE_ORDER);
|
||||||
|
|
||||||
private void addNewCard(final CardRules card) {
|
|
||||||
if (null == card) {
|
|
||||||
return;
|
|
||||||
} // consider that a success
|
|
||||||
// System.out.println(card.getName());
|
|
||||||
final String cardName = card.getName();
|
|
||||||
|
|
||||||
|
|
||||||
if ( card.isTraditional() )
|
|
||||||
regularCards.put(cardName, card);
|
|
||||||
else
|
|
||||||
variantsCards.put(cardName, card);
|
|
||||||
}
|
|
||||||
|
|
||||||
CardSorter(final Iterable<CardRules> parser) {
|
CardSorter(final Iterable<CardRules> parser) {
|
||||||
for (CardRules cr : parser) {
|
for (CardRules card : parser) {
|
||||||
this.addNewCard(cr);
|
if (null == card) continue;
|
||||||
|
|
||||||
|
final String cardName = card.getName();
|
||||||
|
if ( card.isVariant() )
|
||||||
|
variantsCards.put(cardName, card);
|
||||||
|
else
|
||||||
|
regularCards.put(cardName, card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,17 +79,25 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
|||||||
/** The Constant unknown. */
|
/** The Constant unknown. */
|
||||||
private final static SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
private final static SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
|
||||||
public static final CardEdition UNKNOWN = new CardEdition("1990-01-01", "??", "???", Type.UNKNOWN, "Undefined", null, false, new CardInSet[]{});
|
public static final CardEdition UNKNOWN = new CardEdition("1990-01-01", "??", "???", Type.UNKNOWN, "Undefined", new CardInSet[]{});
|
||||||
|
|
||||||
private Date date;
|
private Date date;
|
||||||
private final String code2;
|
private String code2;
|
||||||
private final String code;
|
private String code;
|
||||||
private final Type type;
|
private Type type;
|
||||||
private final String name;
|
private String name;
|
||||||
private final String alias;
|
private String alias = null;
|
||||||
private final boolean whiteBorder;
|
private boolean whiteBorder = false;
|
||||||
private final CardInSet[] cards;
|
private final CardInSet[] cards;
|
||||||
|
|
||||||
|
|
||||||
|
private int boosterArts = 1;
|
||||||
|
private SealedProductTemplate boosterTpl = null;
|
||||||
|
|
||||||
|
private CardEdition(CardInSet[] cards) {
|
||||||
|
this.cards = cards;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new card set.
|
* Instantiates a new card set.
|
||||||
*
|
*
|
||||||
@@ -103,20 +111,23 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
|||||||
* @param name the name of the set
|
* @param name the name of the set
|
||||||
* @param an optional secondary code alias for the set
|
* @param an optional secondary code alias for the set
|
||||||
*/
|
*/
|
||||||
private CardEdition(String date, String code2, String code, Type type, String name, String alias, boolean whiteBorder, CardInSet[] cards) {
|
private CardEdition(String date, String code2, String code, Type type, String name, CardInSet[] cards) {
|
||||||
|
this(cards);
|
||||||
this.code2 = code2;
|
this.code2 = code2;
|
||||||
this.code = code;
|
this.code = code;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.alias = alias;
|
this.date = parseDate(date);
|
||||||
this.whiteBorder = whiteBorder;
|
|
||||||
this.cards = cards;
|
}
|
||||||
|
|
||||||
|
private static Date parseDate(String date) {
|
||||||
if( date.length() <= 7 )
|
if( date.length() <= 7 )
|
||||||
date = date + "-01";
|
date = date + "-01";
|
||||||
try {
|
try {
|
||||||
this.date = formatter.parse(date);
|
return formatter.parse(date);
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
this.date = new Date();
|
return new Date();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,7 +201,7 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
|||||||
private static class CanMakeBooster implements Predicate<CardEdition> {
|
private static class CanMakeBooster implements Predicate<CardEdition> {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(final CardEdition subject) {
|
public boolean apply(final CardEdition subject) {
|
||||||
return Singletons.getModel().getBoosters().contains(subject.getCode());
|
return subject.boosterTpl != null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,7 +247,7 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
|||||||
public static final Predicate<CardEdition> hasBasicLands = new Predicate<CardEdition>() {
|
public static final Predicate<CardEdition> hasBasicLands = new Predicate<CardEdition>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(CardEdition ed) {
|
public boolean apply(CardEdition ed) {
|
||||||
return null != CardDb.instance().tryGetCard("Plains", ed.getCode());
|
return null != CardDb.instance().tryGetCard("Plains", ed.getCode(), 0);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -253,28 +264,6 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
|||||||
protected CardEdition read(File file) {
|
protected CardEdition read(File file) {
|
||||||
final Map<String, List<String>> contents = FileSection.parseSections(FileUtil.readFile(file));
|
final Map<String, List<String>> contents = FileSection.parseSections(FileUtil.readFile(file));
|
||||||
|
|
||||||
FileSection section = FileSection.parse(contents.get("metadata"), "=");
|
|
||||||
String name = section.get("name");
|
|
||||||
String date = section.get("date");
|
|
||||||
String code = section.get("code");
|
|
||||||
String code2 = section.get("code2");
|
|
||||||
if( code2 == null )
|
|
||||||
code2 = code;
|
|
||||||
|
|
||||||
String type = section.get("type");
|
|
||||||
String alias = section.get("alias");
|
|
||||||
boolean borderWhite = "white".equalsIgnoreCase(section.get("border"));
|
|
||||||
|
|
||||||
Type enumType = Type.UNKNOWN;
|
|
||||||
if (null != type && !type.isEmpty()) {
|
|
||||||
try {
|
|
||||||
enumType = Type.valueOf(type.toUpperCase(Locale.ENGLISH));
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
// ignore; type will get UNKNOWN
|
|
||||||
System.err.println(String.format("Ignoring unknown type in set definitions: name: %s; type: %s", name, type));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
List<CardEdition.CardInSet> processedCards = new ArrayList<CardEdition.CardInSet>();
|
List<CardEdition.CardInSet> processedCards = new ArrayList<CardEdition.CardInSet>();
|
||||||
for(String line : contents.get("cards")) {
|
for(String line : contents.get("cards")) {
|
||||||
if (StringUtils.isBlank(line))
|
if (StringUtils.isBlank(line))
|
||||||
@@ -288,7 +277,35 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
|||||||
processedCards.add(cis);
|
processedCards.add(cis);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new CardEdition(date, code2, code, enumType, name, alias, borderWhite, processedCards.toArray(arrCards));
|
CardEdition res = new CardEdition(processedCards.toArray(arrCards));
|
||||||
|
|
||||||
|
|
||||||
|
FileSection section = FileSection.parse(contents.get("metadata"), "=");
|
||||||
|
res.name = section.get("name");
|
||||||
|
res.date = parseDate(section.get("date"));
|
||||||
|
res.code = section.get("code");
|
||||||
|
res.code2 = section.get("code2");
|
||||||
|
if( res.code2 == null )
|
||||||
|
res.code2 = res.code;
|
||||||
|
|
||||||
|
res.boosterArts = section.getInt("BoosterCovers", 1);
|
||||||
|
String boosterDesc = section.get("Booster");
|
||||||
|
res.boosterTpl = boosterDesc == null ? null : new SealedProductTemplate(res.code, SealedProductTemplate.Reader.parseSlots(boosterDesc));
|
||||||
|
|
||||||
|
res.alias = section.get("alias");
|
||||||
|
res.whiteBorder = "white".equalsIgnoreCase(section.get("border"));
|
||||||
|
String type = section.get("type");
|
||||||
|
Type enumType = Type.UNKNOWN;
|
||||||
|
if (null != type && !type.isEmpty()) {
|
||||||
|
try {
|
||||||
|
enumType = Type.valueOf(type.toUpperCase(Locale.ENGLISH));
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
// ignore; type will get UNKNOWN
|
||||||
|
System.err.println(String.format("Ignoring unknown type in set definitions: name: %s; type: %s", res.name, type));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
res.type = enumType;
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -304,4 +321,20 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: Write javadoc for this method.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int getCntBoosterPictures() {
|
||||||
|
return boosterArts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: Write javadoc for this method.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public SealedProductTemplate getBoosterTemplate() {
|
||||||
|
return boosterTpl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
package forge.card;
|
package forge.card;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import forge.card.mana.ManaCost;
|
import forge.card.mana.ManaCost;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -96,8 +95,9 @@ public final class CardRules implements ICardCharacteristics {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isTraditional() {
|
public boolean isVariant() {
|
||||||
return !(getType().isVanguard() || getType().isScheme() || getType().isPlane() || getType().isPhenomenon());
|
CardType t = getType();
|
||||||
|
return t.isVanguard() || t.isScheme() || t.isPlane() || t.isPhenomenon();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CardSplitType getSplitType() {
|
public CardSplitType getSplitType() {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import java.util.TreeMap;
|
|||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
|
||||||
|
import forge.util.IItemReader;
|
||||||
import forge.util.storage.StorageView;
|
import forge.util.storage.StorageView;
|
||||||
|
|
||||||
public final class EditionCollection extends StorageView<CardEdition> {
|
public final class EditionCollection extends StorageView<CardEdition> {
|
||||||
@@ -88,5 +89,29 @@ public final class EditionCollection extends StorageView<CardEdition> {
|
|||||||
return EditionCollection.this.get(code);
|
return EditionCollection.this.get(code);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: Write javadoc for this method.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public IItemReader<SealedProductTemplate> getBoosterGenerator() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return new IItemReader<SealedProductTemplate>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, SealedProductTemplate> readAll() {
|
||||||
|
Map<String, SealedProductTemplate> map = new TreeMap<String, SealedProductTemplate>(String.CASE_INSENSITIVE_ORDER);
|
||||||
|
for(CardEdition ce : EditionCollection.this) {
|
||||||
|
map.put(ce.getCode(), ce.getBoosterTemplate());
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getItemKey(SealedProductTemplate item) {
|
||||||
|
return item.getEdition();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ public class MetaSet {
|
|||||||
|
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case Full:
|
case Full:
|
||||||
return new UnOpenedProduct(BoosterTemplate.genericBooster);
|
return new UnOpenedProduct(SealedProductTemplate.genericBooster);
|
||||||
|
|
||||||
case Booster:
|
case Booster:
|
||||||
return new UnOpenedProduct(Singletons.getModel().getBoosters().get(data));
|
return new UnOpenedProduct(Singletons.getModel().getBoosters().get(data));
|
||||||
@@ -174,7 +174,7 @@ public class MetaSet {
|
|||||||
|
|
||||||
case JoinedSet:
|
case JoinedSet:
|
||||||
Predicate<PaperCard> predicate = IPaperCard.Predicates.printedInSets(data.split(" "));
|
Predicate<PaperCard> predicate = IPaperCard.Predicates.printedInSets(data.split(" "));
|
||||||
return new UnOpenedProduct(BoosterTemplate.genericBooster, predicate);
|
return new UnOpenedProduct(SealedProductTemplate.genericBooster, predicate);
|
||||||
|
|
||||||
case Choose: return UnOpenedMeta.choose(data);
|
case Choose: return UnOpenedMeta.choose(data);
|
||||||
case Random: return UnOpenedMeta.random(data);
|
case Random: return UnOpenedMeta.random(data);
|
||||||
|
|||||||
@@ -32,6 +32,13 @@ import forge.util.storage.StorageReaderFile;
|
|||||||
|
|
||||||
public class SealedProductTemplate {
|
public class SealedProductTemplate {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public final static SealedProductTemplate genericBooster = new SealedProductTemplate(null, Lists.newArrayList(
|
||||||
|
Pair.of(BoosterGenerator.COMMON, 10), Pair.of(BoosterGenerator.UNCOMMON, 3),
|
||||||
|
Pair.of(BoosterGenerator.RARE_MYTHIC, 1), Pair.of(BoosterGenerator.BASIC_LAND, 1)
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
protected final List<Pair<String, Integer>> slots;
|
protected final List<Pair<String, Integer>> slots;
|
||||||
protected final String name;
|
protected final String name;
|
||||||
|
|
||||||
@@ -69,24 +76,47 @@ public class SealedProductTemplate {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder s = new StringBuilder();
|
||||||
|
|
||||||
|
|
||||||
|
s.append("consisting of ");
|
||||||
|
for(Pair<String, Integer> p : slots) {
|
||||||
|
s.append(p.getRight()).append(" ").append(p.getLeft()).append(", ");
|
||||||
|
}
|
||||||
|
|
||||||
|
// trim the last comma and space
|
||||||
|
s.replace(s.length() - 2, s.length(), "");
|
||||||
|
|
||||||
|
// put an 'and' before the previous comma
|
||||||
|
int lastCommaIdx = s.lastIndexOf(",");
|
||||||
|
if (0 < lastCommaIdx) {
|
||||||
|
s.replace(lastCommaIdx+1, lastCommaIdx+1, " and");
|
||||||
|
}
|
||||||
|
|
||||||
|
return s.toString();
|
||||||
|
}
|
||||||
|
|
||||||
public static final class Reader extends StorageReaderFile<SealedProductTemplate> {
|
public static final class Reader extends StorageReaderFile<SealedProductTemplate> {
|
||||||
public Reader(String pathname) {
|
public Reader(String pathname) {
|
||||||
super(pathname, SealedProductTemplate.FN_GET_NAME);
|
super(pathname, SealedProductTemplate.FN_GET_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public static List<Pair<String, Integer>> parseSlots(String data) {
|
||||||
protected SealedProductTemplate read(String line, int i) {
|
final String[] dataz = TextUtil.splitWithParenthesis(data, ',');
|
||||||
String[] headAndData = TextUtil.split(line, ':', 2);
|
|
||||||
final String edition = headAndData[0];
|
|
||||||
final String[] data = TextUtil.splitWithParenthesis(headAndData[1], ',');
|
|
||||||
|
|
||||||
List<Pair<String, Integer>> slots = new ArrayList<Pair<String,Integer>>();
|
List<Pair<String, Integer>> slots = new ArrayList<Pair<String,Integer>>();
|
||||||
for(String slotDesc : data) {
|
for(String slotDesc : dataz) {
|
||||||
String[] kv = TextUtil.splitWithParenthesis(slotDesc, ' ', 2);
|
String[] kv = TextUtil.splitWithParenthesis(slotDesc, ' ', 2);
|
||||||
slots.add(ImmutablePair.of(kv[1], Integer.parseInt(kv[0])));
|
slots.add(ImmutablePair.of(kv[1], Integer.parseInt(kv[0])));
|
||||||
}
|
}
|
||||||
|
return slots;
|
||||||
|
}
|
||||||
|
|
||||||
return new SealedProductTemplate(edition, slots);
|
@Override
|
||||||
|
protected SealedProductTemplate read(String line, int i) {
|
||||||
|
String[] headAndData = TextUtil.split(line, ':', 2);
|
||||||
|
return new SealedProductTemplate(headAndData[0], parseSlots(headAndData[1]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import com.google.common.base.Predicates;
|
|||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import forge.card.CardDb;
|
import forge.card.CardDb;
|
||||||
import forge.card.CardRulesPredicates;
|
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
import forge.item.IPaperCard;
|
import forge.item.IPaperCard;
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ import com.google.common.base.Supplier;
|
|||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.Constant.Preferences;
|
import forge.Constant.Preferences;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.card.BoosterTemplate;
|
|
||||||
import forge.card.CardBlock;
|
import forge.card.CardBlock;
|
||||||
import forge.card.CardDb;
|
import forge.card.CardDb;
|
||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
@@ -88,7 +87,7 @@ public final class BoosterDraft implements IBoosterDraft {
|
|||||||
|
|
||||||
switch (draftType) {
|
switch (draftType) {
|
||||||
case Full: // Draft from all cards in Forge
|
case Full: // Draft from all cards in Forge
|
||||||
Supplier<List<PaperCard>> s = new UnOpenedProduct(BoosterTemplate.genericBooster);
|
Supplier<List<PaperCard>> s = new UnOpenedProduct(SealedProductTemplate.genericBooster);
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++) this.product.add(s);
|
for (int i = 0; i < 3; i++) this.product.add(s);
|
||||||
IBoosterDraft.LAND_SET_CODE[0] = CardDb.instance().getCard("Plains").getEdition();
|
IBoosterDraft.LAND_SET_CODE[0] = CardDb.instance().getCard("Plains").getEdition();
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
import forge.card.BoosterTemplate;
|
|
||||||
import forge.card.CardDb;
|
import forge.card.CardDb;
|
||||||
import forge.card.SealedProductTemplate;
|
import forge.card.SealedProductTemplate;
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
@@ -101,7 +100,7 @@ public class CustomLimited extends DeckBase {
|
|||||||
slots.add(ImmutablePair.of(kv[1], Integer.parseInt(kv[0])));
|
slots.add(ImmutablePair.of(kv[1], Integer.parseInt(kv[0])));
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
slots = BoosterTemplate.genericBooster.getSlots();
|
slots = SealedProductTemplate.genericBooster.getSlots();
|
||||||
|
|
||||||
final CustomLimited cd = new CustomLimited(data.get("Name"), slots);
|
final CustomLimited cd = new CustomLimited(data.get("Name"), slots);
|
||||||
cd.landSetCode = data.get("LandSetCode");
|
cd.landSetCode = data.get("LandSetCode");
|
||||||
|
|||||||
@@ -27,11 +27,11 @@ import javax.swing.JOptionPane;
|
|||||||
import org.apache.commons.lang.ArrayUtils;
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
|
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.card.BoosterTemplate;
|
|
||||||
import forge.card.CardBlock;
|
import forge.card.CardBlock;
|
||||||
import forge.card.CardDb;
|
import forge.card.CardDb;
|
||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
import forge.card.IUnOpenedProduct;
|
import forge.card.IUnOpenedProduct;
|
||||||
|
import forge.card.SealedProductTemplate;
|
||||||
import forge.card.UnOpenedMeta;
|
import forge.card.UnOpenedMeta;
|
||||||
import forge.card.UnOpenedProduct;
|
import forge.card.UnOpenedProduct;
|
||||||
import forge.deck.CardPool;
|
import forge.deck.CardPool;
|
||||||
@@ -71,7 +71,7 @@ public class SealedCardPoolGenerator {
|
|||||||
case Full:
|
case Full:
|
||||||
// Choose number of boosters
|
// Choose number of boosters
|
||||||
|
|
||||||
chooseNumberOfBoosters(new UnOpenedProduct(BoosterTemplate.genericBooster));
|
chooseNumberOfBoosters(new UnOpenedProduct(SealedProductTemplate.genericBooster));
|
||||||
landSetCode = CardDb.instance().getCard("Plains").getEdition();
|
landSetCode = CardDb.instance().getCard("Plains").getEdition();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -34,10 +34,10 @@ import org.apache.commons.lang.StringUtils;
|
|||||||
|
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.card.BoosterTemplate;
|
|
||||||
import forge.card.CardDb;
|
import forge.card.CardDb;
|
||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
import forge.card.IUnOpenedProduct;
|
import forge.card.IUnOpenedProduct;
|
||||||
|
import forge.card.SealedProductTemplate;
|
||||||
import forge.card.UnOpenedProduct;
|
import forge.card.UnOpenedProduct;
|
||||||
import forge.control.FControl;
|
import forge.control.FControl;
|
||||||
import forge.game.GameEndReason;
|
import forge.game.GameEndReason;
|
||||||
@@ -562,7 +562,7 @@ public class QuestWinLose extends ControlWinLose {
|
|||||||
} else {
|
} else {
|
||||||
final List<String> sets = new ArrayList<String>();
|
final List<String> sets = new ArrayList<String>();
|
||||||
|
|
||||||
for (BoosterTemplate bd : Singletons.getModel().getBoosters()) {
|
for (SealedProductTemplate bd : Singletons.getModel().getBoosters()) {
|
||||||
if (qData.getFormat().isSetLegal(bd.getEdition())) {
|
if (qData.getFormat().isSetLegal(bd.getEdition())) {
|
||||||
sets.add(bd.getEdition());
|
sets.add(bd.getEdition());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ package forge.item;
|
|||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.card.BoosterTemplate;
|
|
||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
|
import forge.card.SealedProductTemplate;
|
||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
|
|
||||||
public class BoosterPack extends OpenablePack {
|
public class BoosterPack extends OpenablePack {
|
||||||
@@ -32,14 +32,15 @@ public class BoosterPack extends OpenablePack {
|
|||||||
public static final Function<CardEdition, BoosterPack> FN_FROM_SET = new Function<CardEdition, BoosterPack>() {
|
public static final Function<CardEdition, BoosterPack> FN_FROM_SET = new Function<CardEdition, BoosterPack>() {
|
||||||
@Override
|
@Override
|
||||||
public BoosterPack apply(final CardEdition arg1) {
|
public BoosterPack apply(final CardEdition arg1) {
|
||||||
BoosterTemplate d = Singletons.getModel().getBoosters().get(arg1.getCode());
|
SealedProductTemplate d = Singletons.getModel().getBoosters().get(arg1.getCode());
|
||||||
return new BoosterPack(arg1.getName(), d);
|
return new BoosterPack(arg1.getName(), d);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public BoosterPack(final String name0, final BoosterTemplate boosterData) {
|
public BoosterPack(final String name0, final SealedProductTemplate boosterData) {
|
||||||
super(name0, boosterData);
|
super(name0, boosterData);
|
||||||
artIndex = MyRandom.getRandom().nextInt(boosterData.getArtIndices()) + 1;
|
int maxIdx = Singletons.getModel().getEditions().get(boosterData.getEdition()).getCntBoosterPictures();
|
||||||
|
artIndex = MyRandom.getRandom().nextInt(maxIdx) + 1;
|
||||||
hash = super.hashCode() ^ artIndex;
|
hash = super.hashCode() ^ artIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,7 +58,7 @@ public class BoosterPack extends OpenablePack {
|
|||||||
return new BoosterPack(name, contents);
|
return new BoosterPack(name, contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BoosterTemplate getBoosterData() {
|
public SealedProductTemplate getBoosterData() {
|
||||||
return contents;
|
return contents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,19 +26,19 @@ import com.google.common.base.Predicate;
|
|||||||
import com.google.common.base.Predicates;
|
import com.google.common.base.Predicates;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
|
|
||||||
import forge.card.BoosterTemplate;
|
|
||||||
import forge.card.BoosterGenerator;
|
import forge.card.BoosterGenerator;
|
||||||
import forge.card.CardDb;
|
import forge.card.CardDb;
|
||||||
import forge.card.CardRulesPredicates;
|
import forge.card.CardRulesPredicates;
|
||||||
|
import forge.card.SealedProductTemplate;
|
||||||
import forge.util.Aggregates;
|
import forge.util.Aggregates;
|
||||||
|
|
||||||
public abstract class OpenablePack implements InventoryItemFromSet {
|
public abstract class OpenablePack implements InventoryItemFromSet {
|
||||||
protected final BoosterTemplate contents;
|
protected final SealedProductTemplate contents;
|
||||||
protected final String name;
|
protected final String name;
|
||||||
private final int hash;
|
private final int hash;
|
||||||
private List<PaperCard> cards = null;
|
private List<PaperCard> cards = null;
|
||||||
|
|
||||||
public OpenablePack(String name0, BoosterTemplate boosterData) {
|
public OpenablePack(String name0, SealedProductTemplate boosterData) {
|
||||||
if (null == name0) { throw new NullArgumentException("name0"); }
|
if (null == name0) { throw new NullArgumentException("name0"); }
|
||||||
if (null == boosterData) { throw new NullArgumentException("boosterData"); }
|
if (null == boosterData) { throw new NullArgumentException("boosterData"); }
|
||||||
contents = boosterData;
|
contents = boosterData;
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import java.util.Map;
|
|||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.Singletons;
|
|
||||||
import forge.card.CardRarity;
|
import forge.card.CardRarity;
|
||||||
import forge.card.CardRules;
|
import forge.card.CardRules;
|
||||||
import forge.card.cardfactory.CardFactory;
|
import forge.card.cardfactory.CardFactory;
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ import java.util.List;
|
|||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.card.BoosterTemplate;
|
|
||||||
import forge.card.BoosterGenerator;
|
import forge.card.BoosterGenerator;
|
||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
|
import forge.card.SealedProductTemplate;
|
||||||
|
|
||||||
public class TournamentPack extends OpenablePack {
|
public class TournamentPack extends OpenablePack {
|
||||||
|
|
||||||
@@ -32,12 +32,12 @@ public class TournamentPack extends OpenablePack {
|
|||||||
public static final Function<CardEdition, TournamentPack> FN_FROM_SET = new Function<CardEdition, TournamentPack>() {
|
public static final Function<CardEdition, TournamentPack> FN_FROM_SET = new Function<CardEdition, TournamentPack>() {
|
||||||
@Override
|
@Override
|
||||||
public TournamentPack apply(final CardEdition arg1) {
|
public TournamentPack apply(final CardEdition arg1) {
|
||||||
BoosterTemplate d = Singletons.getModel().getTournamentPacks().get(arg1.getCode());
|
SealedProductTemplate d = Singletons.getModel().getTournamentPacks().get(arg1.getCode());
|
||||||
return new TournamentPack(arg1.getName(), d);
|
return new TournamentPack(arg1.getName(), d);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public TournamentPack(final String name0, final BoosterTemplate boosterData) {
|
public TournamentPack(final String name0, final SealedProductTemplate boosterData) {
|
||||||
super(name0, boosterData);
|
super(name0, boosterData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ import java.util.List;
|
|||||||
import forge.Constant;
|
import forge.Constant;
|
||||||
import forge.Constant.Preferences;
|
import forge.Constant.Preferences;
|
||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
import forge.card.BoosterTemplate;
|
|
||||||
import forge.card.CardBlock;
|
import forge.card.CardBlock;
|
||||||
import forge.card.CardDb;
|
import forge.card.CardDb;
|
||||||
import forge.card.EditionCollection;
|
import forge.card.EditionCollection;
|
||||||
@@ -37,7 +36,6 @@ import forge.card.FormatCollection;
|
|||||||
import forge.card.SealedProductTemplate;
|
import forge.card.SealedProductTemplate;
|
||||||
import forge.card.cardfactory.CardStorageReader;
|
import forge.card.cardfactory.CardStorageReader;
|
||||||
import forge.deck.CardCollections;
|
import forge.deck.CardCollections;
|
||||||
import forge.error.BugReporter;
|
|
||||||
import forge.error.ExceptionHandler;
|
import forge.error.ExceptionHandler;
|
||||||
import forge.game.limited.GauntletMini;
|
import forge.game.limited.GauntletMini;
|
||||||
import forge.gauntlet.GauntletData;
|
import forge.gauntlet.GauntletData;
|
||||||
@@ -81,9 +79,9 @@ public enum FModel {
|
|||||||
|
|
||||||
private final EditionCollection editions;
|
private final EditionCollection editions;
|
||||||
private final FormatCollection formats;
|
private final FormatCollection formats;
|
||||||
private final IStorageView<BoosterTemplate> boosters;
|
private final IStorageView<SealedProductTemplate> boosters;
|
||||||
private final IStorageView<SealedProductTemplate> specialBoosters;
|
private final IStorageView<SealedProductTemplate> specialBoosters;
|
||||||
private final IStorageView<BoosterTemplate> tournaments;
|
private final IStorageView<SealedProductTemplate> tournaments;
|
||||||
private final IStorageView<FatPackTemplate> fatPacks;
|
private final IStorageView<FatPackTemplate> fatPacks;
|
||||||
private final IStorageView<CardBlock> blocks;
|
private final IStorageView<CardBlock> blocks;
|
||||||
private final IStorageView<CardBlock> fantasyBlocks;
|
private final IStorageView<CardBlock> fantasyBlocks;
|
||||||
@@ -152,9 +150,9 @@ public enum FModel {
|
|||||||
|
|
||||||
|
|
||||||
this.formats = new FormatCollection("res/blockdata/formats.txt");
|
this.formats = new FormatCollection("res/blockdata/formats.txt");
|
||||||
this.boosters = new StorageView<BoosterTemplate>(new BoosterTemplate.Reader("res/blockdata/boosters.txt"));
|
this.boosters = new StorageView<SealedProductTemplate>(editions.getBoosterGenerator());
|
||||||
this.specialBoosters = new StorageView<SealedProductTemplate>(new SealedProductTemplate.Reader("res/blockdata/boosters-special.txt"));
|
this.specialBoosters = new StorageView<SealedProductTemplate>(new SealedProductTemplate.Reader("res/blockdata/boosters-special.txt"));
|
||||||
this.tournaments = new StorageView<BoosterTemplate>(new BoosterTemplate.Reader("res/blockdata/starters.txt"));
|
this.tournaments = new StorageView<SealedProductTemplate>(new SealedProductTemplate.Reader("res/blockdata/starters.txt"));
|
||||||
this.fatPacks = new StorageView<FatPackTemplate>(new FatPackTemplate.Reader("res/blockdata/fatpacks.txt"));
|
this.fatPacks = new StorageView<FatPackTemplate>(new FatPackTemplate.Reader("res/blockdata/fatpacks.txt"));
|
||||||
this.blocks = new StorageView<CardBlock>(new CardBlock.Reader("res/blockdata/blocks.txt", editions));
|
this.blocks = new StorageView<CardBlock>(new CardBlock.Reader("res/blockdata/blocks.txt", editions));
|
||||||
this.fantasyBlocks = new StorageView<CardBlock>(new CardBlock.Reader("res/blockdata/fantasyblocks.txt", editions));
|
this.fantasyBlocks = new StorageView<CardBlock>(new CardBlock.Reader("res/blockdata/fantasyblocks.txt", editions));
|
||||||
@@ -363,12 +361,12 @@ public enum FModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @return {@link forge.util.storage.IStorageView}<{@link forge.card.BoosterTemplate}> */
|
/** @return {@link forge.util.storage.IStorageView}<{@link forge.card.BoosterTemplate}> */
|
||||||
public final IStorageView<BoosterTemplate> getTournamentPacks() {
|
public final IStorageView<SealedProductTemplate> getTournamentPacks() {
|
||||||
return tournaments;
|
return tournaments;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return {@link forge.util.storage.IStorageView}<{@link forge.card.BoosterTemplate}> */
|
/** @return {@link forge.util.storage.IStorageView}<{@link forge.card.BoosterTemplate}> */
|
||||||
public final IStorageView<BoosterTemplate> getBoosters() {
|
public final IStorageView<SealedProductTemplate> getBoosters() {
|
||||||
return boosters;
|
return boosters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ import com.google.common.collect.Iterables;
|
|||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.card.BoosterTemplate;
|
|
||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
|
import forge.card.SealedProductTemplate;
|
||||||
import forge.card.UnOpenedProduct;
|
import forge.card.UnOpenedProduct;
|
||||||
import forge.gui.CardListViewer;
|
import forge.gui.CardListViewer;
|
||||||
import forge.gui.GuiChoose;
|
import forge.gui.GuiChoose;
|
||||||
@@ -184,8 +184,8 @@ public class QuestUtilUnlockSets {
|
|||||||
*/
|
*/
|
||||||
public static void doUnlock(QuestController qData, final CardEdition unlockedSet) {
|
public static void doUnlock(QuestController qData, final CardEdition unlockedSet) {
|
||||||
|
|
||||||
IStorageView<BoosterTemplate> starters = Singletons.getModel().getTournamentPacks();
|
IStorageView<SealedProductTemplate> starters = Singletons.getModel().getTournamentPacks();
|
||||||
IStorageView<BoosterTemplate> boosters = Singletons.getModel().getBoosters();
|
IStorageView<SealedProductTemplate> boosters = Singletons.getModel().getBoosters();
|
||||||
qData.getFormat().unlockSet(unlockedSet.getCode());
|
qData.getFormat().unlockSet(unlockedSet.getCode());
|
||||||
|
|
||||||
List<PaperCard> cardsWon = new ArrayList<PaperCard>();
|
List<PaperCard> cardsWon = new ArrayList<PaperCard>();
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import forge.card.BoosterTemplate;
|
|
||||||
import forge.card.BoosterGenerator;
|
import forge.card.BoosterGenerator;
|
||||||
|
import forge.card.SealedProductTemplate;
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.game.limited.IBoosterDraft;
|
import forge.game.limited.IBoosterDraft;
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
@@ -49,7 +49,7 @@ public class BoosterDraftTest implements IBoosterDraft {
|
|||||||
@Override
|
@Override
|
||||||
public ItemPoolView<PaperCard> nextChoice() {
|
public ItemPoolView<PaperCard> nextChoice() {
|
||||||
this.n--;
|
this.n--;
|
||||||
BoosterTemplate booster = Singletons.getModel().getBoosters().get("M11");
|
SealedProductTemplate booster = Singletons.getModel().getBoosters().get("M11");
|
||||||
return ItemPool.createFrom(BoosterGenerator.getBoosterPack(booster), PaperCard.class);
|
return ItemPool.createFrom(BoosterGenerator.getBoosterPack(booster), PaperCard.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user