mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Removed/renamed excessive booster classes
BoosterPacks in cardshop are functional. Need to discuss and balance their appearance CardListViewer is caching Card objects to create them a single time. Set of cards shown now exactly matches CardPrinted.
This commit is contained in:
6
.gitattributes
vendored
6
.gitattributes
vendored
@@ -9655,6 +9655,7 @@ src/main/java/forge/UndoCommand.java svneol=native#text/plain
|
|||||||
src/main/java/forge/Upkeep.java svneol=native#text/plain
|
src/main/java/forge/Upkeep.java svneol=native#text/plain
|
||||||
src/main/java/forge/ZCTrigger.java svneol=native#text/plain
|
src/main/java/forge/ZCTrigger.java svneol=native#text/plain
|
||||||
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/BoosterUtils.java svneol=native#text/plain
|
||||||
src/main/java/forge/card/CardBlock.java -text
|
src/main/java/forge/card/CardBlock.java -text
|
||||||
src/main/java/forge/card/CardColor.java -text
|
src/main/java/forge/card/CardColor.java -text
|
||||||
src/main/java/forge/card/CardCoreType.java -text
|
src/main/java/forge/card/CardCoreType.java -text
|
||||||
@@ -9668,8 +9669,6 @@ src/main/java/forge/card/CardSet.java -text
|
|||||||
src/main/java/forge/card/CardSuperType.java -text
|
src/main/java/forge/card/CardSuperType.java -text
|
||||||
src/main/java/forge/card/CardType.java -text
|
src/main/java/forge/card/CardType.java -text
|
||||||
src/main/java/forge/card/MtgDataParser.java -text
|
src/main/java/forge/card/MtgDataParser.java -text
|
||||||
src/main/java/forge/card/QuestBoosterPack.java svneol=native#text/plain
|
|
||||||
src/main/java/forge/card/ReadBoosterPack.java svneol=native#text/plain
|
|
||||||
src/main/java/forge/card/abilityFactory/AbilityFactory.java svneol=native#text/plain
|
src/main/java/forge/card/abilityFactory/AbilityFactory.java svneol=native#text/plain
|
||||||
src/main/java/forge/card/abilityFactory/AbilityFactory_AlterLife.java svneol=native#text/plain
|
src/main/java/forge/card/abilityFactory/AbilityFactory_AlterLife.java svneol=native#text/plain
|
||||||
src/main/java/forge/card/abilityFactory/AbilityFactory_Animate.java svneol=native#text/plain
|
src/main/java/forge/card/abilityFactory/AbilityFactory_Animate.java svneol=native#text/plain
|
||||||
@@ -9874,7 +9873,7 @@ src/main/java/forge/gui/input/Input_PayManaCostUtil.java svneol=native#text/plai
|
|||||||
src/main/java/forge/gui/input/Input_PayManaCost_Ability.java svneol=native#text/plain
|
src/main/java/forge/gui/input/Input_PayManaCost_Ability.java svneol=native#text/plain
|
||||||
src/main/java/forge/gui/input/package-info.java svneol=native#text/plain
|
src/main/java/forge/gui/input/package-info.java svneol=native#text/plain
|
||||||
src/main/java/forge/gui/package-info.java svneol=native#text/plain
|
src/main/java/forge/gui/package-info.java svneol=native#text/plain
|
||||||
src/main/java/forge/item/Booster.java -text
|
src/main/java/forge/item/BoosterPack.java -text
|
||||||
src/main/java/forge/item/CardDb.java -text
|
src/main/java/forge/item/CardDb.java -text
|
||||||
src/main/java/forge/item/CardPrinted.java -text
|
src/main/java/forge/item/CardPrinted.java -text
|
||||||
src/main/java/forge/item/InventoryItem.java -text
|
src/main/java/forge/item/InventoryItem.java -text
|
||||||
@@ -9995,7 +9994,6 @@ src/test/java/forge/GuiQuestOptionsTest.java svneol=native#text/plain
|
|||||||
src/test/java/forge/GuiWinLoseTest.java svneol=native#text/plain
|
src/test/java/forge/GuiWinLoseTest.java svneol=native#text/plain
|
||||||
src/test/java/forge/PanelTest.java svneol=native#text/plain
|
src/test/java/forge/PanelTest.java svneol=native#text/plain
|
||||||
src/test/java/forge/PhaseTest.java svneol=native#text/plain
|
src/test/java/forge/PhaseTest.java svneol=native#text/plain
|
||||||
src/test/java/forge/ReadBoosterPackTest.java svneol=native#text/plain
|
|
||||||
src/test/java/forge/ReadQuestAssignmentTest.java svneol=native#text/plain
|
src/test/java/forge/ReadQuestAssignmentTest.java svneol=native#text/plain
|
||||||
src/test/java/forge/RunTest.java svneol=native#text/plain
|
src/test/java/forge/RunTest.java svneol=native#text/plain
|
||||||
src/test/java/forge/TinyTest.java svneol=native#text/plain
|
src/test/java/forge/TinyTest.java svneol=native#text/plain
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ public class BoosterGenerator {
|
|||||||
private final List<CardPrinted> mythics = new ArrayList<CardPrinted>();
|
private final List<CardPrinted> mythics = new ArrayList<CardPrinted>();
|
||||||
private final List<CardPrinted> specials = new ArrayList<CardPrinted>();
|
private final List<CardPrinted> specials = new ArrayList<CardPrinted>();
|
||||||
|
|
||||||
private List<CardPrinted> commonCreatures;
|
//private List<CardPrinted> commonCreatures;
|
||||||
private List<CardPrinted> commonNonCreatures;
|
//private List<CardPrinted> commonNonCreatures;
|
||||||
|
|
||||||
private static final List<CardPrinted> emptyList = Collections.unmodifiableList( new ArrayList<CardPrinted>(0) );
|
private static final List<CardPrinted> emptyList = Collections.unmodifiableList( new ArrayList<CardPrinted>(0) );
|
||||||
|
|
||||||
@@ -70,14 +70,6 @@ public class BoosterGenerator {
|
|||||||
|
|
||||||
public BoosterGenerator(Deck dPool)
|
public BoosterGenerator(Deck dPool)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
//DeckManager dio = new DeckManager(ForgeProps.getFile(NewConstants.NEW_DECKS));
|
|
||||||
DeckManager dio = AllZone.getDeckManager();
|
|
||||||
Deck dPool = dio.getDeck(deckFile);
|
|
||||||
if (dPool == null) {
|
|
||||||
throw new RuntimeException("BoosterGenerator : deck not found - " + deckFile);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
for (Entry<CardPrinted, Integer> e : dPool.getMain()) { addToRarity(e.getKey()); }
|
for (Entry<CardPrinted, Integer> e : dPool.getMain()) { addToRarity(e.getKey()); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,19 +169,18 @@ public class BoosterGenerator {
|
|||||||
|
|
||||||
|
|
||||||
public final List<CardPrinted> getBoosterPack() {
|
public final List<CardPrinted> getBoosterPack() {
|
||||||
return getBoosterPack(numCommons, 0, 0, numUncommons, numRareSlots, 0, 0, numSpecials, 0);
|
return getBoosterPack(numCommons, numUncommons, numRareSlots, 0, 0, numSpecials, 0);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* <p>getBoosterPack.</p>
|
* So many parameters needed for custom limited cardpools,
|
||||||
*
|
|
||||||
* @return a {@link forge.CardList} object.
|
|
||||||
*/
|
*/
|
||||||
public final List<CardPrinted> getBoosterPack(final int nCom, final int nComCreat, final int nComNonCr, final int nUnc,
|
public final List<CardPrinted> getBoosterPack(final int nCom, final int nUnc, final int nRareSlots,
|
||||||
final int nRareSlots, final int nRares, final int nMythics, final int nSpecs, final int nAnyCard) {
|
final int nRares, final int nMythics, final int nSpecs, final int nAnyCard) {
|
||||||
|
|
||||||
List<CardPrinted> temp = new ArrayList<CardPrinted>();
|
List<CardPrinted> temp = new ArrayList<CardPrinted>();
|
||||||
|
|
||||||
temp.addAll(pickRandomCards(commons, nCom));
|
temp.addAll(pickRandomCards(commons, nCom));
|
||||||
|
/*
|
||||||
if( nComCreat > 0 || nComNonCr > 0) {
|
if( nComCreat > 0 || nComNonCr > 0) {
|
||||||
if (commonNonCreatures.isEmpty()) {
|
if (commonNonCreatures.isEmpty()) {
|
||||||
CardRules.Predicates.Presets.isCreature.split(commons, CardPrinted.fnGetRules, commonCreatures, commonNonCreatures);
|
CardRules.Predicates.Presets.isCreature.split(commons, CardPrinted.fnGetRules, commonCreatures, commonNonCreatures);
|
||||||
@@ -197,6 +188,7 @@ public class BoosterGenerator {
|
|||||||
temp.addAll(pickRandomCards(commonCreatures, nComCreat));
|
temp.addAll(pickRandomCards(commonCreatures, nComCreat));
|
||||||
temp.addAll(pickRandomCards(commonNonCreatures, nComNonCr));
|
temp.addAll(pickRandomCards(commonNonCreatures, nComNonCr));
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
temp.addAll(pickRandomCards(uncommons, nUnc));
|
temp.addAll(pickRandomCards(uncommons, nUnc));
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package forge.card;
|
package forge.card;
|
||||||
|
|
||||||
|
import forge.Constant;
|
||||||
|
import forge.MyRandom;
|
||||||
import forge.item.CardDb;
|
import forge.item.CardDb;
|
||||||
import forge.item.CardPrinted;
|
import forge.item.CardPrinted;
|
||||||
|
|
||||||
@@ -18,7 +20,7 @@ import net.slightlymagic.maxmtg.Predicate;
|
|||||||
* @author Forge
|
* @author Forge
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public final class QuestBoosterPack {
|
public final class BoosterUtils {
|
||||||
|
|
||||||
public static List<CardPrinted> getQuestStarterDeck(final Predicate<CardPrinted> filter,
|
public static List<CardPrinted> getQuestStarterDeck(final Predicate<CardPrinted> filter,
|
||||||
final int numCommon, final int numUncommon, final int numRare)
|
final int numCommon, final int numUncommon, final int numRare)
|
||||||
@@ -106,7 +108,7 @@ public final class QuestBoosterPack {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Left if only for backwards compatibility
|
// Left if only for backwards compatibility
|
||||||
public List<CardPrinted> generateCards(final int num, final CardRarity rarity, final String color) {
|
public static List<CardPrinted> generateCards(final int num, final CardRarity rarity, final String color) {
|
||||||
Predicate<CardPrinted> whatYouWant = getPredicateForConditions(rarity, color);
|
Predicate<CardPrinted> whatYouWant = getPredicateForConditions(rarity, color);
|
||||||
return generateDistinctCards(CardDb.instance().getAllUniqueCards(), whatYouWant, num);
|
return generateDistinctCards(CardDb.instance().getAllUniqueCards(), whatYouWant, num);
|
||||||
}
|
}
|
||||||
@@ -176,6 +178,23 @@ public final class QuestBoosterPack {
|
|||||||
return Predicate.and(rFilter, colorFilter, CardPrinted.fnGetRules);
|
return Predicate.and(rFilter, colorFilter, CardPrinted.fnGetRules);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//return List<CardPrinted> of 5 or 6 cards, one for each color and maybe an artifact
|
||||||
|
public static List<CardPrinted> getVariety(List<CardPrinted> in) {
|
||||||
|
List<CardPrinted> out = new ArrayList<CardPrinted>();
|
||||||
|
Collections.shuffle(in, MyRandom.random);
|
||||||
|
|
||||||
|
for (int i = 0; i < Constant.Color.Colors.length; i++) {
|
||||||
|
CardPrinted check = findCardOfColor(in, i);
|
||||||
|
if (check != null) { out.add(check); }
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}//getVariety()
|
||||||
|
|
||||||
|
public static CardPrinted findCardOfColor(final List<CardPrinted> in, final int color) {
|
||||||
|
Predicate<CardRules> filter = CardRules.Predicates.Presets.colors.get(color);
|
||||||
|
if (null == filter) { return null; }
|
||||||
|
return filter.first(in, CardPrinted.fnGetRules);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,180 +0,0 @@
|
|||||||
package forge.card;
|
|
||||||
|
|
||||||
|
|
||||||
//import java.io.BufferedReader;
|
|
||||||
//import java.io.File;
|
|
||||||
//import java.io.FileReader;
|
|
||||||
|
|
||||||
import forge.Constant;
|
|
||||||
import forge.MyRandom;
|
|
||||||
import forge.item.CardDb;
|
|
||||||
import forge.item.CardPrinted;
|
|
||||||
import forge.item.ItemPool;
|
|
||||||
import forge.item.ItemPoolView;
|
|
||||||
import forge.properties.NewConstants;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.slightlymagic.maxmtg.Predicate;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>ReadBoosterPack class.</p>
|
|
||||||
*
|
|
||||||
* @author Forge
|
|
||||||
* @version $Id$
|
|
||||||
*/
|
|
||||||
public class ReadBoosterPack implements NewConstants {
|
|
||||||
|
|
||||||
|
|
||||||
//private List<CardPrinted> mythics;
|
|
||||||
private List<CardPrinted> rares;
|
|
||||||
private List<CardPrinted> uncommons;
|
|
||||||
private List<CardPrinted> commons;
|
|
||||||
|
|
||||||
private List<CardPrinted> commonCreatures;
|
|
||||||
private List<CardPrinted> commonNonCreatures;
|
|
||||||
/**
|
|
||||||
* <p>Constructor for ReadBoosterPack.</p>
|
|
||||||
*/
|
|
||||||
public ReadBoosterPack() {
|
|
||||||
//mythics = CardPrinted.Predicates.Presets.isMythicRare.select(CardDb.instance().getAllUniqueCards());
|
|
||||||
rares = CardPrinted.Predicates.Presets.isRare.select(CardDb.instance().getAllUniqueCards());
|
|
||||||
commons = CardPrinted.Predicates.Presets.isCommon.select(CardDb.instance().getAllUniqueCards());
|
|
||||||
uncommons = CardPrinted.Predicates.Presets.isUncommon.select(CardDb.instance().getAllUniqueCards());
|
|
||||||
|
|
||||||
commonCreatures = new ArrayList<CardPrinted>();
|
|
||||||
commonNonCreatures = new ArrayList<CardPrinted>();
|
|
||||||
CardRules.Predicates.Presets.isCreature.split(commons, CardPrinted.fnGetRules, commonCreatures, commonNonCreatures);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>getBoosterPack5.</p>
|
|
||||||
*
|
|
||||||
* @return a {@link forge.CardList} object.
|
|
||||||
*/
|
|
||||||
public ItemPoolView<CardPrinted> getBoosterPack5() {
|
|
||||||
ItemPool<CardPrinted> list = new ItemPool<CardPrinted>(CardPrinted.class);
|
|
||||||
for (int i = 0; i < 5; i++) { list.addAll(getBoosterPack()); }
|
|
||||||
|
|
||||||
addBasicLands(list, 20);
|
|
||||||
addBasicSnowLands(list, 20);
|
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
|
||||||
list.add(CardDb.instance().getCard("Terramorphic Expanse", "M10"));
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}//getBoosterPack5()
|
|
||||||
|
|
||||||
public static final void addBasicLands(final ItemPool<CardPrinted> pool, final int count) {
|
|
||||||
for (int i = 0; i < count; i++) {
|
|
||||||
pool.add(CardDb.instance().getCard("Forest", "M10"));
|
|
||||||
pool.add(CardDb.instance().getCard("Island", "M10"));
|
|
||||||
pool.add(CardDb.instance().getCard("Plains", "M10"));
|
|
||||||
pool.add(CardDb.instance().getCard("Mountain", "M10"));
|
|
||||||
pool.add(CardDb.instance().getCard("Swamp", "M10"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static final void addBasicSnowLands(final ItemPool<CardPrinted> pool, final int count) {
|
|
||||||
for (int i = 0; i < count; i++) {
|
|
||||||
pool.add(CardDb.instance().getCard("Snow-Covered Forest", "ICE"));
|
|
||||||
pool.add(CardDb.instance().getCard("Snow-Covered Island", "ICE"));
|
|
||||||
pool.add(CardDb.instance().getCard("Snow-Covered Plains", "ICE"));
|
|
||||||
pool.add(CardDb.instance().getCard("Snow-Covered Mountain", "ICE"));
|
|
||||||
pool.add(CardDb.instance().getCard("Snow-Covered Swamp", "ICE"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>getBoosterPack.</p>
|
|
||||||
*
|
|
||||||
* @return a {@link forge.CardList} object.
|
|
||||||
*/
|
|
||||||
public ItemPoolView<CardPrinted> getBoosterPack() {
|
|
||||||
ItemPool<CardPrinted> pack = new ItemPool<CardPrinted>(CardPrinted.class);
|
|
||||||
|
|
||||||
pack.add(getRandomCard(rares));
|
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++)
|
|
||||||
pack.add(getRandomCard(uncommons));
|
|
||||||
|
|
||||||
//11 commons, 7 creature 4 noncreature
|
|
||||||
List<CardPrinted> variety;
|
|
||||||
for (int i = 0; i < 7; i++) {
|
|
||||||
variety = getVariety(commonCreatures);
|
|
||||||
pack.add(getRandomCard(variety));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++) {
|
|
||||||
variety = getVariety(commonNonCreatures);
|
|
||||||
pack.add(getRandomCard(variety));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pack.countAll() != 15)
|
|
||||||
throw new RuntimeException("ReadBoosterPack : getBoosterPack() error, pack is not 15 card - "
|
|
||||||
+ pack.countAll());
|
|
||||||
|
|
||||||
return pack;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>getShopCards.</p>
|
|
||||||
*
|
|
||||||
* @param numberWins a int.
|
|
||||||
* @param questLevel a int.
|
|
||||||
* @return a {@link forge.CardList} object.
|
|
||||||
*/
|
|
||||||
public ItemPoolView<CardPrinted> getShopCards(int totalPacks) {
|
|
||||||
ItemPool<CardPrinted> list = new ItemPool<CardPrinted>(CardPrinted.class);
|
|
||||||
|
|
||||||
// Number of Packs granted
|
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < totalPacks; i++) {
|
|
||||||
// TODO: Balance CardPool Availability
|
|
||||||
// Each "Pack" yields 1 Rare, 3 Uncommon, 7 Commons
|
|
||||||
list.add(getRandomCard(rares));
|
|
||||||
for (int j = 0; j < 7; j++) {
|
|
||||||
if (j < 3)
|
|
||||||
list.add(getRandomCard(uncommons));
|
|
||||||
|
|
||||||
list.add(getRandomCard(commons));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
addBasicLands(list, 10);
|
|
||||||
addBasicSnowLands(list, 5);
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
//return CardList of 5 or 6 cards, one for each color and maybe an artifact
|
|
||||||
private List<CardPrinted> getVariety(List<CardPrinted> in) {
|
|
||||||
List<CardPrinted> out = new ArrayList<CardPrinted>();
|
|
||||||
Collections.shuffle(in, MyRandom.random);
|
|
||||||
|
|
||||||
for (int i = 0; i < Constant.Color.Colors.length; i++) {
|
|
||||||
CardPrinted check = findCardOfColor(in, i);
|
|
||||||
if (check != null) { out.add(check); }
|
|
||||||
}
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}//getVariety()
|
|
||||||
|
|
||||||
private CardPrinted findCardOfColor(final List<CardPrinted> in, final int color) {
|
|
||||||
Predicate<CardRules> filter = CardRules.Predicates.Presets.colors.get(color);
|
|
||||||
if (null == filter) { return null; }
|
|
||||||
return filter.first(in, CardPrinted.fnGetRules);
|
|
||||||
}
|
|
||||||
|
|
||||||
private CardPrinted getRandomCard(final List<CardPrinted> list) {
|
|
||||||
Collections.shuffle(list, MyRandom.random);
|
|
||||||
int index = MyRandom.random.nextInt(list.size());
|
|
||||||
Collections.shuffle(list, MyRandom.random);
|
|
||||||
return list.get(index);
|
|
||||||
}//getRandomCard()
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -144,9 +144,9 @@ public final class BoosterDraft_1 implements BoosterDraft {
|
|||||||
Lambda1<List<CardPrinted>, BoosterGenerator> fnPick = new Lambda1<List<CardPrinted>, BoosterGenerator>() {
|
Lambda1<List<CardPrinted>, BoosterGenerator> fnPick = new Lambda1<List<CardPrinted>, BoosterGenerator>() {
|
||||||
@Override public List<CardPrinted> apply(BoosterGenerator pack) {
|
@Override public List<CardPrinted> apply(BoosterGenerator pack) {
|
||||||
if ( draft.IgnoreRarity ) {
|
if ( draft.IgnoreRarity ) {
|
||||||
return pack.getBoosterPack(0, 0, 0, 0, 0, 0, 0, 0, draft.NumCards);
|
return pack.getBoosterPack(0, 0, 0, 0, 0, 0, draft.NumCards);
|
||||||
}
|
}
|
||||||
return pack.getBoosterPack(draft.NumCommons, 0, 0, draft.NumUncommons, 0, draft.NumRares, draft.NumMythics, draft.NumSpecials, 0);
|
return pack.getBoosterPack(draft.NumCommons, draft.NumUncommons, 0, draft.NumRares, draft.NumMythics, draft.NumSpecials, 0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -303,7 +303,7 @@ public final class BoosterDraft_1 implements BoosterDraft {
|
|||||||
} //setChoice()
|
} //setChoice()
|
||||||
|
|
||||||
/** This will upload drafting picks to cardforge HQ */
|
/** This will upload drafting picks to cardforge HQ */
|
||||||
@Override public void finishedDrafting() {
|
public void finishedDrafting() {
|
||||||
if (Constant.Runtime.UpldDrft[0]) {
|
if (Constant.Runtime.UpldDrft[0]) {
|
||||||
if (draftPicks.size() > 1) {
|
if (draftPicks.size() > 1) {
|
||||||
ArrayList<String> outDraftData = new ArrayList<String>();
|
ArrayList<String> outDraftData = new ArrayList<String>();
|
||||||
|
|||||||
@@ -133,9 +133,9 @@ public class SealedDeck {
|
|||||||
Lambda1<List<CardPrinted>, BoosterGenerator> fnPick = new Lambda1<List<CardPrinted>, BoosterGenerator>() {
|
Lambda1<List<CardPrinted>, BoosterGenerator> fnPick = new Lambda1<List<CardPrinted>, BoosterGenerator>() {
|
||||||
@Override public List<CardPrinted> apply(BoosterGenerator pack) {
|
@Override public List<CardPrinted> apply(BoosterGenerator pack) {
|
||||||
if ( draft.IgnoreRarity ) {
|
if ( draft.IgnoreRarity ) {
|
||||||
return pack.getBoosterPack(0, 0, 0, 0, 0, 0, 0, 0, draft.NumCards);
|
return pack.getBoosterPack(0, 0, 0, 0, 0, 0, draft.NumCards);
|
||||||
}
|
}
|
||||||
return pack.getBoosterPack(draft.NumCommons, 0, 0, draft.NumUncommons, 0, draft.NumRares, draft.NumMythics, draft.NumSpecials, 0);
|
return pack.getBoosterPack(draft.NumCommons, draft.NumUncommons, 0, draft.NumRares, draft.NumMythics, draft.NumSpecials, 0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -142,18 +142,28 @@ public class CardListViewer {
|
|||||||
|
|
||||||
|
|
||||||
private class SelListener implements ListSelectionListener {
|
private class SelListener implements ListSelectionListener {
|
||||||
|
private Card[] cache = null;
|
||||||
|
|
||||||
public void valueChanged(final ListSelectionEvent e) {
|
public void valueChanged(final ListSelectionEvent e) {
|
||||||
int row = jList.getSelectedIndex();
|
int row = jList.getSelectedIndex();
|
||||||
// (String) jList.getSelectedValue();
|
// (String) jList.getSelectedValue();
|
||||||
if (row >= 0 && row < list.size()) {
|
if (row >= 0 && row < list.size()) {
|
||||||
Card card = AllZone.getCardFactory().getCard(list.get(row).getName(), null);
|
CardPrinted cp = list.get(row);
|
||||||
card.setRandomSetCode();
|
ensureCacheHas(row, cp);
|
||||||
card.setImageFilename(CardUtil.buildFilename(card));
|
detail.setCard(cache[row]);
|
||||||
detail.setCard(card);
|
picture.setCard(cp);
|
||||||
picture.setCard(card);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ensureCacheHas(int row, CardPrinted cp) {
|
||||||
|
if (cache == null) { cache = new Card[list.size()]; }
|
||||||
|
if (null == cache[row]) {
|
||||||
|
Card card = AllZone.getCardFactory().getCard(cp.getName(), null);
|
||||||
|
card.setCurSetCode(cp.getSet());
|
||||||
|
card.setImageFilename(CardUtil.buildFilename(card));
|
||||||
|
cache[row] = card;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,9 @@ import forge.Singletons;
|
|||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.error.ErrorViewer;
|
import forge.error.ErrorViewer;
|
||||||
import forge.game.GameType;
|
import forge.game.GameType;
|
||||||
|
import forge.gui.CardListViewer;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiUtils;
|
||||||
|
import forge.item.BoosterPack;
|
||||||
import forge.item.CardPrinted;
|
import forge.item.CardPrinted;
|
||||||
import forge.item.InventoryItem;
|
import forge.item.InventoryItem;
|
||||||
import forge.item.ItemPoolView;
|
import forge.item.ItemPoolView;
|
||||||
@@ -259,17 +261,28 @@ public final class DeckEditorShop extends DeckEditorBase {
|
|||||||
|
|
||||||
private void buyButton_actionPerformed(ActionEvent e) {
|
private void buyButton_actionPerformed(ActionEvent e) {
|
||||||
InventoryItem item = top.getSelectedCard();
|
InventoryItem item = top.getSelectedCard();
|
||||||
if (item == null || !( item instanceof CardPrinted )) { return; }
|
if (item == null ) { return; }
|
||||||
|
|
||||||
CardPrinted card = (CardPrinted) item;
|
int value = getCardValue(item);
|
||||||
|
|
||||||
int value = getCardValue(card);
|
|
||||||
|
|
||||||
if (value <= questData.getCredits()) {
|
if (value <= questData.getCredits()) {
|
||||||
bottom.addCard(card);
|
if (item instanceof CardPrinted) {
|
||||||
top.removeCard(card);
|
CardPrinted card = (CardPrinted) item;
|
||||||
|
bottom.addCard(card);
|
||||||
|
top.removeCard(card);
|
||||||
|
|
||||||
questData.getCards().buyCard(card, value);
|
questData.getCards().buyCard(card, value);
|
||||||
|
} else if (item instanceof BoosterPack) {
|
||||||
|
top.removeCard(item);
|
||||||
|
BoosterPack booster = (BoosterPack) item;
|
||||||
|
|
||||||
|
List<CardPrinted> newCards = booster.getCards();
|
||||||
|
for (CardPrinted card : newCards) { bottom.addCard(card); }
|
||||||
|
CardListViewer c = new CardListViewer(booster.getName(), "You have found the following new cards inside booster", newCards);
|
||||||
|
c.show();
|
||||||
|
|
||||||
|
questData.getCards().buyBooster(booster, value);
|
||||||
|
}
|
||||||
|
|
||||||
creditsLabel.setText("Total credits: " + questData.getCredits());
|
creditsLabel.setText("Total credits: " + questData.getCredits());
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import net.slightlymagic.maxmtg.Predicate;
|
|||||||
import forge.Constant;
|
import forge.Constant;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.card.CardRules;
|
import forge.card.CardRules;
|
||||||
import forge.item.CardPrinted;
|
|
||||||
import forge.item.InventoryItem;
|
import forge.item.InventoryItem;
|
||||||
import forge.item.ItemPool;
|
import forge.item.ItemPool;
|
||||||
import forge.item.ItemPoolView;
|
import forge.item.ItemPoolView;
|
||||||
@@ -151,14 +150,14 @@ public final class TableWithCards {
|
|||||||
updateView(true);
|
updateView(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addCard(final CardPrinted card) {
|
public void addCard(final InventoryItem card) {
|
||||||
//int n = table.getSelectedRow();
|
//int n = table.getSelectedRow();
|
||||||
pool.add(card);
|
pool.add(card);
|
||||||
if (isUnfiltered()) { model.addCard(card); }
|
if (isUnfiltered()) { model.addCard(card); }
|
||||||
updateView(false);
|
updateView(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeCard(final CardPrinted card) {
|
public void removeCard(final InventoryItem card) {
|
||||||
int n = table.getSelectedRow();
|
int n = table.getSelectedRow();
|
||||||
pool.remove(card);
|
pool.remove(card);
|
||||||
if (isUnfiltered()) { model.removeCard(card); }
|
if (isUnfiltered()) { model.removeCard(card); }
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
package forge.item;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import forge.SetUtils;
|
|
||||||
import forge.card.BoosterGenerator;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: Write javadoc for this type.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class Booster implements InventoryItemFromSet {
|
|
||||||
|
|
||||||
private final String cardSet;
|
|
||||||
private final String name;
|
|
||||||
|
|
||||||
private List<CardPrinted> cards = null;
|
|
||||||
|
|
||||||
public Booster(String set) {
|
|
||||||
cardSet = set;
|
|
||||||
name = SetUtils.getSetByCodeOrThrow(set).getName() + " booster";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public String getSet() { return cardSet; }
|
|
||||||
@Override public String getName() { return name; }
|
|
||||||
|
|
||||||
@Override public String getImageFilename() {
|
|
||||||
// TODO: images for boosters
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<CardPrinted> getCards() {
|
|
||||||
if (null == cards)
|
|
||||||
{
|
|
||||||
BoosterGenerator gen = new BoosterGenerator(cardSet);
|
|
||||||
cards = gen.getBoosterPack();
|
|
||||||
// TODO: Add land here!
|
|
||||||
}
|
|
||||||
return cards;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
70
src/main/java/forge/item/BoosterPack.java
Normal file
70
src/main/java/forge/item/BoosterPack.java
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
package forge.item;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import forge.SetUtils;
|
||||||
|
import forge.card.BoosterGenerator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: Write javadoc for this type.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class BoosterPack implements InventoryItemFromSet {
|
||||||
|
|
||||||
|
private final String cardSet;
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
private List<CardPrinted> cards = null;
|
||||||
|
|
||||||
|
public BoosterPack(String set) {
|
||||||
|
cardSet = set;
|
||||||
|
name = SetUtils.getSetByCodeOrThrow(set).getName() + " booster";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public String getSet() { return cardSet; }
|
||||||
|
@Override public String getName() { return name; }
|
||||||
|
|
||||||
|
@Override public String getImageFilename() {
|
||||||
|
// TODO: need images for boosters
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<CardPrinted> getCards() {
|
||||||
|
if (null == cards)
|
||||||
|
{
|
||||||
|
BoosterGenerator gen = new BoosterGenerator(cardSet);
|
||||||
|
cards = gen.getBoosterPack();
|
||||||
|
// TODO: Add land here!
|
||||||
|
}
|
||||||
|
return cards;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + ((cardSet == null) ? 0 : cardSet.hashCode());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null)
|
||||||
|
return false;
|
||||||
|
if (getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
BoosterPack other = (BoosterPack) obj;
|
||||||
|
if (cardSet == null) {
|
||||||
|
if (other.cardSet != null)
|
||||||
|
return false;
|
||||||
|
} else if (!cardSet.equals(other.cardSet))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -62,8 +62,10 @@ public final class ItemPool<T extends InventoryItem> extends ItemPoolView<T> {
|
|||||||
cards.put(card, amount);
|
cards.put(card, amount);
|
||||||
isListInSync = false;
|
isListInSync = false;
|
||||||
}
|
}
|
||||||
public void addAllCards(final Iterable<T> cards) {
|
|
||||||
for (T cr : cards) { add(cr); }
|
@SuppressWarnings("unchecked")
|
||||||
|
public <U extends InventoryItem> void addAllCards(final Iterable<U> cards) {
|
||||||
|
for (U cr : cards) { if (myClass.isInstance(cr)) { add((T) cr); } }
|
||||||
isListInSync = false;
|
isListInSync = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ public final class QuestData {
|
|||||||
*/
|
*/
|
||||||
public QuestData() {
|
public QuestData() {
|
||||||
initTransients();
|
initTransients();
|
||||||
myCards.generateBasicLands(QuestPreferences.getStartingBasic(), QuestPreferences.getStartingSnowBasic());
|
myCards.addBasicLands(cardPool, QuestPreferences.getStartingBasic(), QuestPreferences.getStartingSnowBasic());
|
||||||
randomizeOpponents();
|
randomizeOpponents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import com.thoughtworks.xstream.converters.UnmarshallingContext;
|
|||||||
|
|
||||||
import forge.error.ErrorViewer;
|
import forge.error.ErrorViewer;
|
||||||
import forge.game.GameType;
|
import forge.game.GameType;
|
||||||
import forge.item.Booster;
|
import forge.item.BoosterPack;
|
||||||
import forge.item.CardDb;
|
import forge.item.CardDb;
|
||||||
import forge.item.CardPrinted;
|
import forge.item.CardPrinted;
|
||||||
import forge.item.InventoryItem;
|
import forge.item.InventoryItem;
|
||||||
@@ -234,7 +234,7 @@ public class QuestDataIO {
|
|||||||
writer.endNode();
|
writer.endNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void write(Booster booster, Integer count, HierarchicalStreamWriter writer)
|
private void write(BoosterPack booster, Integer count, HierarchicalStreamWriter writer)
|
||||||
{
|
{
|
||||||
writer.startNode("booster");
|
writer.startNode("booster");
|
||||||
writer.addAttribute("s", booster.getSet());
|
writer.addAttribute("s", booster.getSet());
|
||||||
@@ -252,8 +252,8 @@ public class QuestDataIO {
|
|||||||
Integer count = e.getValue();
|
Integer count = e.getValue();
|
||||||
if (item instanceof CardPrinted) {
|
if (item instanceof CardPrinted) {
|
||||||
write((CardPrinted) item, count, writer);
|
write((CardPrinted) item, count, writer);
|
||||||
} else if (item instanceof Booster) {
|
} else if (item instanceof BoosterPack) {
|
||||||
write((Booster) item, count, writer);
|
write((BoosterPack) item, count, writer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,10 +280,10 @@ public class QuestDataIO {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Booster readBooster(final HierarchicalStreamReader reader)
|
private BoosterPack readBooster(final HierarchicalStreamReader reader)
|
||||||
{
|
{
|
||||||
String set = reader.getAttribute("s");
|
String set = reader.getAttribute("s");
|
||||||
return new Booster(set);
|
return new BoosterPack(set);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CardPrinted readCardPrinted(final HierarchicalStreamReader reader)
|
private CardPrinted readCardPrinted(final HierarchicalStreamReader reader)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import forge.CardList;
|
|||||||
import forge.Constant;
|
import forge.Constant;
|
||||||
import forge.Quest_Assignment;
|
import forge.Quest_Assignment;
|
||||||
import forge.card.CardRarity;
|
import forge.card.CardRarity;
|
||||||
import forge.card.QuestBoosterPack;
|
import forge.card.BoosterUtils;
|
||||||
import forge.item.CardPrinted;
|
import forge.item.CardPrinted;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -127,7 +127,6 @@ public class QuestUtil {
|
|||||||
* @return CardList
|
* @return CardList
|
||||||
*/
|
*/
|
||||||
public static List<CardPrinted> generateCardRewardList(String s) {
|
public static List<CardPrinted> generateCardRewardList(String s) {
|
||||||
QuestBoosterPack pack = new QuestBoosterPack();
|
|
||||||
String[] temp = s.split(" ");
|
String[] temp = s.split(" ");
|
||||||
|
|
||||||
int qty = Integer.parseInt(temp[0]);
|
int qty = Integer.parseInt(temp[0]);
|
||||||
@@ -162,7 +161,7 @@ public class QuestUtil {
|
|||||||
col = Constant.Color.White;
|
col = Constant.Color.White;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pack.generateCards(qty, rar, col);
|
return BoosterUtils.generateCards(qty, rar, col);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ import java.util.Map.Entry;
|
|||||||
import net.slightlymagic.braids.util.lambda.Lambda1;
|
import net.slightlymagic.braids.util.lambda.Lambda1;
|
||||||
import net.slightlymagic.maxmtg.Predicate;
|
import net.slightlymagic.maxmtg.Predicate;
|
||||||
|
|
||||||
|
import forge.card.BoosterGenerator;
|
||||||
import forge.card.CardRarity;
|
import forge.card.CardRarity;
|
||||||
import forge.card.QuestBoosterPack;
|
import forge.card.BoosterUtils;
|
||||||
import forge.card.ReadBoosterPack;
|
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.item.Booster;
|
import forge.item.BoosterPack;
|
||||||
import forge.item.CardDb;
|
import forge.item.CardDb;
|
||||||
import forge.item.CardPrinted;
|
import forge.item.CardPrinted;
|
||||||
import forge.item.InventoryItem;
|
import forge.item.InventoryItem;
|
||||||
@@ -26,19 +26,19 @@ public final class QuestUtilCards {
|
|||||||
private QuestData q;
|
private QuestData q;
|
||||||
public QuestUtilCards(final QuestData qd) { q = qd; }
|
public QuestUtilCards(final QuestData qd) { q = qd; }
|
||||||
|
|
||||||
public void generateBasicLands(final int nBasic, final int nSnow) {
|
public void addBasicLands(ItemPool<InventoryItem> pool, final int nBasic, final int nSnow) {
|
||||||
CardDb db = CardDb.instance();
|
CardDb db = CardDb.instance();
|
||||||
q.cardPool.add(db.getCard("Forest", "M10"), nBasic);
|
pool.add(db.getCard("Forest", "M10"), nBasic);
|
||||||
q.cardPool.add(db.getCard("Mountain", "M10"), nBasic);
|
pool.add(db.getCard("Mountain", "M10"), nBasic);
|
||||||
q.cardPool.add(db.getCard("Swamp", "M10"), nBasic);
|
pool.add(db.getCard("Swamp", "M10"), nBasic);
|
||||||
q.cardPool.add(db.getCard("Island", "M10"), nBasic);
|
pool.add(db.getCard("Island", "M10"), nBasic);
|
||||||
q.cardPool.add(db.getCard("Plains", "M10"), nBasic);
|
pool.add(db.getCard("Plains", "M10"), nBasic);
|
||||||
|
|
||||||
q.cardPool.add(db.getCard("Snow-Covered Forest", "ICE"), nSnow);
|
pool.add(db.getCard("Snow-Covered Forest", "ICE"), nSnow);
|
||||||
q.cardPool.add(db.getCard("Snow-Covered Mountain", "ICE"), nSnow);
|
pool.add(db.getCard("Snow-Covered Mountain", "ICE"), nSnow);
|
||||||
q.cardPool.add(db.getCard("Snow-Covered Swamp", "ICE"), nSnow);
|
pool.add(db.getCard("Snow-Covered Swamp", "ICE"), nSnow);
|
||||||
q.cardPool.add(db.getCard("Snow-Covered Island", "ICE"), nSnow);
|
pool.add(db.getCard("Snow-Covered Island", "ICE"), nSnow);
|
||||||
q.cardPool.add(db.getCard("Snow-Covered Plains", "ICE"), nSnow);
|
pool.add(db.getCard("Snow-Covered Plains", "ICE"), nSnow);
|
||||||
}
|
}
|
||||||
|
|
||||||
//adds 11 cards, to the current card pool
|
//adds 11 cards, to the current card pool
|
||||||
@@ -53,9 +53,9 @@ public final class QuestUtilCards {
|
|||||||
int nRare = QuestPreferences.getNumRare();
|
int nRare = QuestPreferences.getNumRare();
|
||||||
|
|
||||||
ArrayList<CardPrinted> newCards = new ArrayList<CardPrinted>();
|
ArrayList<CardPrinted> newCards = new ArrayList<CardPrinted>();
|
||||||
newCards.addAll(QuestBoosterPack.generateCards(fSets, nCommon, CardRarity.Common, null));
|
newCards.addAll(BoosterUtils.generateCards(fSets, nCommon, CardRarity.Common, null));
|
||||||
newCards.addAll(QuestBoosterPack.generateCards(fSets, nUncommon, CardRarity.Uncommon, null));
|
newCards.addAll(BoosterUtils.generateCards(fSets, nUncommon, CardRarity.Uncommon, null));
|
||||||
newCards.addAll(QuestBoosterPack.generateCards(fSets, nRare, CardRarity.Rare, null));
|
newCards.addAll(BoosterUtils.generateCards(fSets, nRare, CardRarity.Rare, null));
|
||||||
|
|
||||||
addAllCards(newCards);
|
addAllCards(newCards);
|
||||||
return newCards;
|
return newCards;
|
||||||
@@ -92,7 +92,7 @@ public final class QuestUtilCards {
|
|||||||
int nU = QuestPreferences.getStartingUncommons(idxDifficulty);
|
int nU = QuestPreferences.getStartingUncommons(idxDifficulty);
|
||||||
int nR = QuestPreferences.getStartingRares(idxDifficulty);
|
int nR = QuestPreferences.getStartingRares(idxDifficulty);
|
||||||
|
|
||||||
addAllCards(QuestBoosterPack.getQuestStarterDeck(filter, nC, nU, nR));
|
addAllCards(BoosterUtils.getQuestStarterDeck(filter, nC, nU, nR));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void buyCard(final CardPrinted card, final int value) {
|
public void buyCard(final CardPrinted card, final int value) {
|
||||||
@@ -103,6 +103,14 @@ public final class QuestUtilCards {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void buyBooster(final BoosterPack booster, final int value) {
|
||||||
|
if (q.credits >= value) {
|
||||||
|
q.credits -= value;
|
||||||
|
q.shopList.remove(booster);
|
||||||
|
addAllCards(booster.getCards());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void sellCard(final CardPrinted card, final int price) {
|
public void sellCard(final CardPrinted card, final int price) {
|
||||||
if (price > 0) { q.credits += price; }
|
if (price > 0) { q.credits += price; }
|
||||||
q.cardPool.remove(card);
|
q.cardPool.remove(card);
|
||||||
@@ -142,16 +150,20 @@ public final class QuestUtilCards {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void generateCardsInShop() {
|
public void generateCardsInShop() {
|
||||||
ReadBoosterPack pack = new ReadBoosterPack();
|
BoosterGenerator pack = new BoosterGenerator(CardDb.instance().getAllCards());
|
||||||
|
|
||||||
int levelPacks = q.getLevel() > 0 ? 4 / q.getLevel() : 4;
|
int levelPacks = q.getLevel() > 0 ? 4 / q.getLevel() : 4;
|
||||||
int winPacks = q.getWin() / 10;
|
int winPacks = q.getWin() / 10;
|
||||||
int totalPacks = Math.min(levelPacks + winPacks, 6);
|
int totalPacks = Math.min(levelPacks + winPacks, 6);
|
||||||
|
|
||||||
ItemPoolView<CardPrinted> fromBoosters = pack.getShopCards(totalPacks);
|
|
||||||
q.shopList.clear();
|
q.shopList.clear();
|
||||||
q.shopList.addAll(fromBoosters);
|
for (int i = 0; i < totalPacks; i++) {
|
||||||
q.shopList.add(new Booster("M10"));
|
q.shopList.addAllCards(pack.getBoosterPack(7, 3, 1, 0, 0, 0, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
addBasicLands(q.shopList, 10, 5);
|
||||||
|
|
||||||
|
q.shopList.add(new BoosterPack("M10"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemPool<InventoryItem> getCardpool() {
|
public ItemPool<InventoryItem> getCardpool() {
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
package forge;
|
|
||||||
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
import forge.card.ReadBoosterPack;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by IntelliJ IDEA.
|
|
||||||
* User: dhudson
|
|
||||||
*/
|
|
||||||
@Test(groups = {"UnitTest"}, timeOut = 10000, enabled = false)
|
|
||||||
public class ReadBoosterPackTest {
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Test(timeOut = 10000, enabled = false)
|
|
||||||
public void ReadBoosterPackTest1() {
|
|
||||||
//testing
|
|
||||||
ReadBoosterPack r = new ReadBoosterPack();
|
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < 1000; i++) {
|
|
||||||
r.getBoosterPack5();
|
|
||||||
}
|
|
||||||
}//main()
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user