adjusted default booster template,

fixed some crashes in quest mode shop content generation
This commit is contained in:
Maxmtg
2013-04-26 02:05:07 +00:00
parent 86d07620c4
commit 8591a63721
3 changed files with 6 additions and 7 deletions

View File

@@ -73,6 +73,8 @@ public class BoosterGenerator {
public static final List<CardPrinted> getBoosterPack(SealedProductTemplate booster, Iterable<CardPrinted> sourcePool) { public static final List<CardPrinted> getBoosterPack(SealedProductTemplate booster, Iterable<CardPrinted> sourcePool) {
if(sourcePool == CardDb.instance().getAllCards()) if(sourcePool == CardDb.instance().getAllCards())
throw new IllegalArgumentException("Do not use this overload to obtain boosters based on complete cardDb"); throw new IllegalArgumentException("Do not use this overload to obtain boosters based on complete cardDb");
if(null == sourcePool)
return getBoosterPack(booster);
List<CardPrinted> result = new ArrayList<CardPrinted>(); List<CardPrinted> result = new ArrayList<CardPrinted>();
for(Pair<String, Integer> slot : booster.getSlots()) { for(Pair<String, Integer> slot : booster.getSlots()) {

View File

@@ -16,7 +16,7 @@ public class BoosterTemplate extends SealedProductTemplate {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public final static BoosterTemplate genericBooster = new BoosterTemplate(null, 1, Lists.newArrayList( public final static BoosterTemplate genericBooster = new BoosterTemplate(null, 1, Lists.newArrayList(
Pair.of("Common", 10), Pair.of("Uncommon", 3), Pair.of("Rare", 1), Pair.of("BasicLand", 1) Pair.of("Common", 10), Pair.of("Uncommon", 3), Pair.of("RareMythic", 1), Pair.of("BasicLand", 1)
)); ));
private final int foilRate = 68; private final int foilRate = 68;

View File

@@ -518,11 +518,8 @@ public final class QuestUtilCards {
*/ */
private void generateCardsInShop() { private void generateCardsInShop() {
Iterable<CardPrinted> cardList = null; Iterable<CardPrinted> cardList = null;
if (qc.getFormat() == null) { if (qc.getFormat() != null) {
cardList = CardDb.instance().getAllCards(); } cardList = Iterables.filter(CardDb.instance().getAllCards(), qc.getFormat().getFilterPrinted());
else {
cardList = Iterables.filter(CardDb.instance().getAllCards(),
qc.getFormat().getFilterPrinted());
} }
int nLevel = this.qc.getAchievements().getLevel(); int nLevel = this.qc.getAchievements().getLevel();
@@ -541,7 +538,7 @@ public final class QuestUtilCards {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
SealedProductTemplate template = new SealedProductTemplate(Lists.newArrayList( SealedProductTemplate template = new SealedProductTemplate(Lists.newArrayList(
Pair.of("Commmon", common), Pair.of("uncommmon", uncommon), Pair.of("Rare", rare) Pair.of("Commmon", common), Pair.of("uncommmon", uncommon), Pair.of("RareMythic", rare)
)); ));
for (int i = 0; i < totalPacks; i++) { for (int i = 0; i < totalPacks; i++) {