mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
Changes to RTR/GTC guild sealed: now there's only 1 guild booster, both promos are inside.
File format for cubes adjusted
This commit is contained in:
@@ -78,10 +78,7 @@ public class BoosterGenerator {
|
||||
String slotType = slot.getLeft(); // add expansion symbol here?
|
||||
int numCards = slot.getRight().intValue();
|
||||
|
||||
String[] sType = TextUtil.splitWithParenthesis(slotType, ' ', '(', ')');
|
||||
String sheetKey = sType.length == 1 ? slotType.trim() + " " + booster.getEdition() : slotType.trim();
|
||||
|
||||
PrintSheet ps = makeSheet(sheetKey, sourcePool);
|
||||
PrintSheet ps = makeSheet(slotType, sourcePool);
|
||||
result.addAll(ps.random(numCards, true));
|
||||
}
|
||||
return result;
|
||||
@@ -98,11 +95,17 @@ public class BoosterGenerator {
|
||||
if(mainCode.endsWith("s"))
|
||||
mainCode = mainCode.substring(0, mainCode.length()-1);
|
||||
|
||||
String sets = sKey[1];
|
||||
Predicate<CardPrinted> setPred = IPaperCard.Predicates.printedInSets(sets.split(" "));
|
||||
Predicate<CardPrinted> setPred = (Predicate<CardPrinted>) (sKey.length > 1 ? IPaperCard.Predicates.printedInSets(sKey[1].split(" ")) : Predicates.alwaysTrue());
|
||||
|
||||
// Pre-defined sheets:
|
||||
if( mainCode.equalsIgnoreCase("any") ) {
|
||||
if (mainCode.startsWith("promo(")) { // get exactly the named cards, nevermind any restrictions
|
||||
String list = StringUtils.strip(mainCode.substring(5), "() ");
|
||||
String[] cardNames = TextUtil.splitWithParenthesis(list, ',', '"', '"');
|
||||
for(String cardName: cardNames) {
|
||||
ps.add(CardDb.instance().getCard(cardName));
|
||||
}
|
||||
|
||||
} else if( mainCode.equalsIgnoreCase("any") ) { // no restriction on rarity
|
||||
Predicate<CardPrinted> predicate = Predicates.and(setPred, extraPred);
|
||||
ps.addAll(Iterables.filter(src, predicate));
|
||||
|
||||
|
||||
@@ -19,11 +19,16 @@ package forge.card;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.IPaperCard;
|
||||
import forge.util.TextUtil;
|
||||
import forge.util.storage.StorageReaderFile;
|
||||
|
||||
// import forge.deck.Deck;
|
||||
@@ -37,7 +42,7 @@ public final class CardBlock implements Comparable<CardBlock> {
|
||||
private final int orderNum;
|
||||
private final String name;
|
||||
private final CardEdition[] sets;
|
||||
private final ArrayList<MetaSet> metaSets;
|
||||
private final Map<String, MetaSet> metaSets = new TreeMap<String, MetaSet>();
|
||||
private final CardEdition landSet;
|
||||
private final int cntBoostersDraft;
|
||||
private final int cntBoostersSealed;
|
||||
@@ -61,12 +66,14 @@ public final class CardBlock implements Comparable<CardBlock> {
|
||||
* @param cntBoostersSealed
|
||||
* the cnt boosters sealed
|
||||
*/
|
||||
public CardBlock(final int index, final String name, final List<CardEdition> sets, final ArrayList<MetaSet> metas,
|
||||
public CardBlock(final int index, final String name, final List<CardEdition> sets, final List<MetaSet> metas,
|
||||
final CardEdition landSet, final int cntBoostersDraft, final int cntBoostersSealed) {
|
||||
this.orderNum = index;
|
||||
this.name = name;
|
||||
this.sets = sets.toArray(CardBlock.EMPTY_SET_ARRAY);
|
||||
this.metaSets = metas;
|
||||
for(MetaSet m : metas) {
|
||||
this.metaSets.put(m.getCode(), m);
|
||||
}
|
||||
this.landSet = landSet;
|
||||
this.cntBoostersDraft = cntBoostersDraft;
|
||||
this.cntBoostersSealed = cntBoostersSealed;
|
||||
@@ -195,9 +202,9 @@ public final class CardBlock implements Comparable<CardBlock> {
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
if (this.getNumberMetaSets() + this.getNumberSets() < 1) {
|
||||
if (this.metaSets.isEmpty() && this.sets.length < 1) {
|
||||
return this.name + " (empty)";
|
||||
} else if (this.getNumberMetaSets() + this.getNumberSets() < 2) {
|
||||
} else if (this.metaSets.size() + this.getNumberSets() < 2) {
|
||||
return this.name + " (set)";
|
||||
}
|
||||
return this.name + " (block)";
|
||||
@@ -229,39 +236,30 @@ public final class CardBlock implements Comparable<CardBlock> {
|
||||
*/
|
||||
@Override
|
||||
protected CardBlock read(String line, int i) {
|
||||
final String[] sParts = line.trim().split("\\|");
|
||||
final String[] sParts = TextUtil.splitWithParenthesis(line.trim(), ',', '(', ')', 3);
|
||||
String name = sParts[0];
|
||||
|
||||
String name = null;
|
||||
int index = 1+i;
|
||||
final List<CardEdition> sets = new ArrayList<CardEdition>(9); // add support for up to 9 different sets in a block!
|
||||
final ArrayList<MetaSet> metas = new ArrayList<MetaSet>();
|
||||
CardEdition landSet = null;
|
||||
int draftBoosters = 3;
|
||||
int sealedBoosters = 6;
|
||||
String[] numbers = sParts[1].trim().split("/");
|
||||
int draftBoosters = Integer.parseInt(numbers[0]);
|
||||
int sealedBoosters = Integer.parseInt(numbers[1]);
|
||||
CardEdition landSet = editions.getEditionByCodeOrThrow(numbers[2]);
|
||||
|
||||
for (final String sPart : sParts) {
|
||||
final String[] kv = sPart.split(":", 2);
|
||||
final String key = kv[0].toLowerCase();
|
||||
if ("name".equals(key)) {
|
||||
name = kv[1];
|
||||
} else if ("set0".equals(key) || "set1".equals(key) || "set2".equals(key) || "set3".equals(key)
|
||||
|| "set4".equals(key) || "set5".equals(key) || "set6".equals(key) || "set7".equals(key)
|
||||
|| "set8".equals(key)) {
|
||||
sets.add(editions.getEditionByCodeOrThrow(kv[1]));
|
||||
} else if ("meta0".equals(key) || "meta1".equals(key) || "meta2".equals(key) || "meta3".equals(key)
|
||||
|| "meta4".equals(key) || "meta5".equals(key) || "meta6".equals(key) || "meta7".equals(key)
|
||||
|| "meta8".equals(key)) {
|
||||
metas.add(new MetaSet(kv[1]));
|
||||
} else if ("landsetcode".equals(key)) {
|
||||
landSet = editions.getEditionByCodeOrThrow(kv[1]);
|
||||
} else if ("draftpacks".equals(key)) {
|
||||
draftBoosters = Integer.parseInt(kv[1]);
|
||||
} else if ("sealedpacks".equals(key)) {
|
||||
sealedBoosters = Integer.parseInt(kv[1]);
|
||||
List<CardEdition> sets = new ArrayList<CardEdition>();
|
||||
List<MetaSet> metas = new ArrayList<MetaSet>();
|
||||
|
||||
String[] setNames = TextUtil.splitWithParenthesis(sParts[2], ' ', '(', ')' );
|
||||
for(final String set : setNames ) {
|
||||
if(set.startsWith("Meta-")) {
|
||||
String metaSpec = set.substring(5);
|
||||
boolean noDraft = metaSpec.startsWith("NoDraft-");
|
||||
if( noDraft ) metaSpec = metaSpec.substring(8);
|
||||
metas.add(new MetaSet(metaSpec, noDraft));
|
||||
} else {
|
||||
sets.add(editions.getEditionByCodeOrThrow(set));
|
||||
}
|
||||
|
||||
}
|
||||
return new CardBlock(index, name, sets, metas, landSet, draftBoosters, sealedBoosters);
|
||||
|
||||
return new CardBlock(i+1, name, sets, metas, landSet, draftBoosters, sealedBoosters);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -280,56 +278,15 @@ public final class CardBlock implements Comparable<CardBlock> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of meta-sets in the block.
|
||||
*
|
||||
* @return int, number of meta-sets.
|
||||
*/
|
||||
public int getNumberMetaSets() {
|
||||
if (metaSets == null || metaSets.size() < 1) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
return metaSets.size();
|
||||
}
|
||||
public Iterable<String> getMetaSetNames() {
|
||||
return metaSets.keySet();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the requested meta-set.
|
||||
*
|
||||
* @param index
|
||||
* int, the requested index
|
||||
* @return MetaSet, the requested meta-set.
|
||||
*/
|
||||
public MetaSet getMetaSet(final int index) {
|
||||
if (index < 0 || index > this.getNumberMetaSets() - 1) {
|
||||
throw new RuntimeException("Illegal MetaSet requested: " + index);
|
||||
}
|
||||
else {
|
||||
return metaSets.get(index);
|
||||
}
|
||||
|
||||
public MetaSet getMetaSet(String key) {
|
||||
return metaSets.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if there is a meta-set of the requested type.
|
||||
*
|
||||
* @param compare
|
||||
* String, the requested the requested type
|
||||
* @return boolean, the requsted type was found
|
||||
*/
|
||||
public boolean hasMetaSetType(final String compare) {
|
||||
|
||||
if (this.getNumberMetaSets() < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (MetaSet mSet : metaSets) {
|
||||
if (mSet.getType().equalsIgnoreCase(compare)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to create a booster for the selected meta-set code.
|
||||
@@ -338,18 +295,8 @@ public final class CardBlock implements Comparable<CardBlock> {
|
||||
* String, the MetaSet code
|
||||
* @return UnOpenedProduct, the created booster.
|
||||
*/
|
||||
public UnOpenedProduct getBooster(final String code) {
|
||||
|
||||
if (this.getNumberMetaSets() < 1) {
|
||||
throw new RuntimeException("Attempted to get a booster pack for empty metasets.");
|
||||
}
|
||||
else {
|
||||
for (int i = 0; i < this.getNumberMetaSets(); i++) {
|
||||
if (code.equals(metaSets.get(i).getCode())) {
|
||||
return metaSets.get(i).getBooster();
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("Could not find metaset " + code + " for booster generation.");
|
||||
}
|
||||
public IUnOpenedProduct getBooster(final String code) {
|
||||
MetaSet ms = metaSets.get(code);
|
||||
return ms == null ? new UnOpenedProduct(Singletons.getModel().getBoosters().get(code)) : ms.getBooster();
|
||||
}
|
||||
}
|
||||
|
||||
16
src/main/java/forge/card/IUnOpenedProduct.java
Normal file
16
src/main/java/forge/card/IUnOpenedProduct.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package forge.card;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
|
||||
import forge.item.CardPrinted;
|
||||
|
||||
/**
|
||||
* TODO: Write javadoc for this type.
|
||||
*
|
||||
*/
|
||||
|
||||
public interface IUnOpenedProduct extends Supplier<List<CardPrinted>> {
|
||||
public List<CardPrinted> get();
|
||||
}
|
||||
@@ -19,14 +19,16 @@
|
||||
package forge.card;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.game.limited.CustomLimited;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.ItemPool;
|
||||
import forge.item.IPaperCard;
|
||||
import forge.util.FileUtil;
|
||||
|
||||
/**
|
||||
@@ -90,10 +92,21 @@ import forge.util.FileUtil;
|
||||
*
|
||||
*/
|
||||
public class MetaSet {
|
||||
|
||||
private enum MetaSetType {
|
||||
Full,
|
||||
Cube,
|
||||
JoinedSet,
|
||||
Choose,
|
||||
Random,
|
||||
Booster,
|
||||
Pack
|
||||
}
|
||||
|
||||
private final String type;
|
||||
private final MetaSetType type;
|
||||
private final String data;
|
||||
private final String code;
|
||||
private final boolean draftable;
|
||||
// private BoosterGenerator boosterGen;
|
||||
|
||||
/**
|
||||
@@ -103,48 +116,26 @@ public class MetaSet {
|
||||
* @param creationString
|
||||
* a {@link java.lang.String} object.
|
||||
*/
|
||||
public MetaSet(final String creationString) {
|
||||
public MetaSet(final String creationString, boolean canDraft) {
|
||||
int idxFirstPar = creationString.indexOf('(');
|
||||
int idxLastPar = creationString.lastIndexOf(')');
|
||||
|
||||
draftable = canDraft;
|
||||
type = MetaSetType.valueOf(creationString.substring(0, idxFirstPar).trim());
|
||||
data = creationString.substring(idxFirstPar + 1, idxLastPar);
|
||||
String description = creationString.substring(idxLastPar + 1);
|
||||
|
||||
String[] kv = new String [3];
|
||||
kv[0] = creationString.substring(0, creationString.indexOf('/'));
|
||||
kv[1] = creationString.substring(creationString.indexOf('/') + 1, creationString.lastIndexOf('/'));
|
||||
kv[2] = creationString.substring(creationString.lastIndexOf('/') + 1);
|
||||
// Display the parse results:
|
||||
// System.out.println("KV = '" + kv[0] + "', '" + kv[1] + "', '" + kv[2] + "'");
|
||||
switch (type) {
|
||||
case Cube: code = "*C:" + description; break;
|
||||
case Full: code = "*FULL"; break;
|
||||
case JoinedSet: code = "*B:" + description; break;
|
||||
case Choose: code = "*!:" + description; break;
|
||||
case Random: code = "*?:" + description; break;
|
||||
case Booster: code = "*" + description; break;
|
||||
case Pack: code = "*" + description + "(S)"; break;
|
||||
|
||||
type = kv[0];
|
||||
data = kv[1];
|
||||
|
||||
if ("cube".equalsIgnoreCase(type)) {
|
||||
code = "*C:" + kv[2];
|
||||
default: throw new RuntimeException("Invalid MetaSet type: " + type);
|
||||
}
|
||||
else if ("full".equalsIgnoreCase(type)) {
|
||||
code = "*FULL";
|
||||
}
|
||||
else if ("meta".equalsIgnoreCase(type)) {
|
||||
code = "*B:" + kv[2];
|
||||
}
|
||||
else if ("choose1".equalsIgnoreCase(type)) {
|
||||
code = "*!:" + kv[2];
|
||||
}
|
||||
else if ("random1".equalsIgnoreCase(type)) {
|
||||
code = "*?:" + kv[2];
|
||||
}
|
||||
else if ("combo".equalsIgnoreCase(type)) {
|
||||
code = "*+:" + kv[2];
|
||||
}
|
||||
else if ("booster".equalsIgnoreCase(type)) {
|
||||
code = "*" + kv[2];
|
||||
}
|
||||
else if ("pack".equalsIgnoreCase(type)) {
|
||||
code = "*" + kv[2] + "(S)";
|
||||
}
|
||||
else {
|
||||
code = null;
|
||||
throw new RuntimeException("Invalid MetaSet type: " + type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -157,152 +148,57 @@ public class MetaSet {
|
||||
return code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the type.
|
||||
*
|
||||
* @return
|
||||
* String, type
|
||||
*/
|
||||
public final String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Attempt to get a booster.
|
||||
*
|
||||
* @return UnOpenedProduct, the generated booster.
|
||||
*/
|
||||
public UnOpenedProduct getBooster() {
|
||||
public IUnOpenedProduct getBooster() {
|
||||
|
||||
ItemPool<CardPrinted> cardPool = null;
|
||||
switch(type) {
|
||||
case Full:
|
||||
return new UnOpenedProduct(BoosterTemplate.genericBooster);
|
||||
|
||||
if ("meta".equalsIgnoreCase(type) || "choose1".equalsIgnoreCase(type)
|
||||
|| "random1".equalsIgnoreCase(type) || "combo".equalsIgnoreCase(type)) {
|
||||
cardPool = new ItemPool<CardPrinted>(CardPrinted.class);
|
||||
}
|
||||
case Booster:
|
||||
return new UnOpenedProduct(Singletons.getModel().getBoosters().get(data));
|
||||
|
||||
if ("cube".equalsIgnoreCase(type)) {
|
||||
case Pack:
|
||||
return new UnOpenedProduct(Singletons.getModel().getTournamentPacks().get(data));
|
||||
|
||||
final File dFolder = new File("res/sealed/");
|
||||
case JoinedSet:
|
||||
Predicate<CardPrinted> predicate = IPaperCard.Predicates.printedInSets(data.split(" "));
|
||||
Iterable<CardPrinted> pool = Iterables.filter(CardDb.instance().getAllCards(), predicate);
|
||||
return new UnOpenedProduct(BoosterTemplate.genericBooster, pool);
|
||||
|
||||
if (!dFolder.exists()) {
|
||||
throw new RuntimeException("GenerateSealed : folder not found -- folder is " + dFolder.getAbsolutePath());
|
||||
}
|
||||
case Choose:
|
||||
return new UnOpenedMeta(data, true);
|
||||
|
||||
if (!dFolder.isDirectory()) {
|
||||
throw new RuntimeException("GenerateSealed : not a folder -- " + dFolder.getAbsolutePath());
|
||||
}
|
||||
case Random:
|
||||
return new UnOpenedMeta(data, false);
|
||||
|
||||
List<String> dfData = FileUtil.readFile("res/sealed/" + data + ".sealed");
|
||||
final CustomLimited myCube = CustomLimited.parse(dfData, Singletons.getModel().getDecks().getCubes());
|
||||
|
||||
SealedProductTemplate fnPick = myCube.getIgnoreRarity() ? myCube.getSealedProductTemplate() : BoosterTemplate.genericBooster;
|
||||
return new UnOpenedProduct(fnPick, myCube.getCardPool());
|
||||
}
|
||||
else if ("full".equalsIgnoreCase(type)) {
|
||||
return new UnOpenedProduct(BoosterTemplate.genericBooster);
|
||||
}
|
||||
else if ("meta".equalsIgnoreCase(type)) {
|
||||
|
||||
// NOTE: The following code is far from ideal in a number of ways. If someone can
|
||||
// think of a way to improve it, please do so. --BBU
|
||||
// ItemPool<CardPrinted> cardPool = new ItemPool<CardPrinted>(CardPrinted.class);
|
||||
for (CardPrinted aCard : CardDb.instance().getAllCards()) {
|
||||
if (data.indexOf(aCard.getEdition()) > -1) {
|
||||
cardPool.add(aCard);
|
||||
// System.out.println("Added card" + aCard.getName());
|
||||
}
|
||||
}
|
||||
return new UnOpenedProduct(BoosterTemplate.genericBooster, cardPool);
|
||||
} else if ("booster".equalsIgnoreCase(type)) {
|
||||
return new UnOpenedProduct(Singletons.getModel().getBoosters().get(data));
|
||||
} else if ("pack".equalsIgnoreCase(type)) {
|
||||
return new UnOpenedProduct(Singletons.getModel().getTournamentPacks().get(data));
|
||||
} else if ("choose1".equalsIgnoreCase(type)) {
|
||||
return new UnOpenedMeta(data, true);
|
||||
} else if ("random1".equalsIgnoreCase(type)) {
|
||||
return new UnOpenedMeta(data, false);
|
||||
} else if ("combo".equalsIgnoreCase(type)) {
|
||||
final BoosterGenerator bpSets = new BoosterGenerator();
|
||||
return new UnOpenedProduct(BoosterTemplate.genericBooster, buildPool(data));
|
||||
}
|
||||
else {
|
||||
throw new RuntimeException("Cannot initialize boosters for: " + type);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a cardpool for the 'combo' special MetaSet type.
|
||||
*
|
||||
* @param creationString
|
||||
* the data that contains a collection of semicolon-separated metaset definitions
|
||||
* @return ItemPool<CardPrinted>
|
||||
* the collection of cards
|
||||
*
|
||||
*/
|
||||
private ItemPool<CardPrinted> buildPool(final String creationString) {
|
||||
|
||||
ItemPool<CardPrinted> cardPool = new ItemPool<CardPrinted>(CardPrinted.class);
|
||||
|
||||
List<MetaSet> metaSets = new ArrayList<MetaSet>();
|
||||
final String[] metas = creationString.split(";");
|
||||
|
||||
for (int i = 0; i < metas.length; i++) {
|
||||
|
||||
final String [] typeTest = metas[i].split("/");
|
||||
if (typeTest[0].equalsIgnoreCase("choose1") || typeTest[0].equalsIgnoreCase("random1")
|
||||
|| typeTest[0].equalsIgnoreCase("combo")) {
|
||||
System.out.println("WARNING - MetaSet type '" + typeTest[0] + "' ignored in pool creation.");
|
||||
}
|
||||
else if (typeTest[0].equalsIgnoreCase("full")) {
|
||||
for (CardPrinted aCard : CardDb.instance().getUniqueCards()) {
|
||||
cardPool.add(aCard);
|
||||
}
|
||||
return cardPool;
|
||||
}
|
||||
final MetaSet addMeta = new MetaSet(metas[i]);
|
||||
metaSets.add(addMeta);
|
||||
}
|
||||
|
||||
if (metaSets.size() < 1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (MetaSet mSet : metaSets) {
|
||||
if (mSet.type.equalsIgnoreCase("meta") || mSet.type.equalsIgnoreCase("booster")
|
||||
|| mSet.type.equalsIgnoreCase("pack")) {
|
||||
final String mData = new String(mSet.data);
|
||||
for (CardPrinted aCard : CardDb.instance().getAllCards()) {
|
||||
if (mData.indexOf(aCard.getEdition()) > -1) {
|
||||
if (!cardPool.contains(aCard)) {
|
||||
cardPool.add(aCard);
|
||||
// System.out.println(mSet.type + " " + mData + ": Added card: " + aCard.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (mSet.type.equalsIgnoreCase("cube")) {
|
||||
case Cube:
|
||||
final File dFolder = new File("res/sealed/");
|
||||
|
||||
if (!dFolder.exists()) {
|
||||
throw new RuntimeException("GenerateSealed : folder not found -- folder is "
|
||||
+ dFolder.getAbsolutePath());
|
||||
throw new RuntimeException("GenerateSealed : folder not found -- folder is " + dFolder.getAbsolutePath());
|
||||
}
|
||||
|
||||
if (!dFolder.isDirectory()) {
|
||||
throw new RuntimeException("GenerateSealed : not a folder -- " + dFolder.getAbsolutePath());
|
||||
}
|
||||
|
||||
List<String> dfData = FileUtil.readFile("res/sealed/" + mSet.data + ".sealed");
|
||||
List<String> dfData = FileUtil.readFile("res/sealed/" + data + ".sealed");
|
||||
final CustomLimited myCube = CustomLimited.parse(dfData, Singletons.getModel().getDecks().getCubes());
|
||||
for (CardPrinted aCard : myCube.getCardPool().toFlatList()) {
|
||||
if (!cardPool.contains(aCard)) {
|
||||
cardPool.add(aCard);
|
||||
// System.out.println(mSet.type + " " + mSet.data + ": Added card: " + aCard.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SealedProductTemplate fnPick = myCube.getSealedProductTemplate();
|
||||
return new UnOpenedProduct(fnPick, myCube.getCardPool());
|
||||
|
||||
default: return null;
|
||||
}
|
||||
return cardPool;
|
||||
}
|
||||
|
||||
public boolean isDraftable() {
|
||||
return draftable;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.gui.GuiChoose;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.util.MyRandom;
|
||||
@@ -30,14 +29,12 @@ import forge.util.MyRandom;
|
||||
/**
|
||||
* This type extends UnOpenedProduct to support booster choice or random boosters
|
||||
* in sealed deck games. See MetaSet.java for further information.
|
||||
*
|
||||
*/
|
||||
public class UnOpenedMeta extends UnOpenedProduct {
|
||||
|
||||
public class UnOpenedMeta implements IUnOpenedProduct {
|
||||
|
||||
private final ArrayList<MetaSet> metaSets;
|
||||
private final boolean choice;
|
||||
private List<String> partiality;
|
||||
private final int partialityPreference = 100; // Otherwise guild sealed will result in silly combinations
|
||||
private final boolean canChoose;
|
||||
private final Random generator = MyRandom.getRandom();
|
||||
|
||||
/**
|
||||
@@ -48,60 +45,23 @@ public class UnOpenedMeta extends UnOpenedProduct {
|
||||
* sets the random/choice status.
|
||||
*/
|
||||
public UnOpenedMeta(final String creationString, final boolean choose) {
|
||||
// NOTE: we need to call the super constructor with something non-null,
|
||||
// but it doesn't matter with what exactly, since we are overriding it
|
||||
// in open() anyway. I'm using Portal because that makes it easier to
|
||||
// spot if the code is misbehaving in certain ways. --BBU
|
||||
super(Singletons.getModel().getBoosters().get("POR"));
|
||||
metaSets = new ArrayList<MetaSet>();
|
||||
choice = choose;
|
||||
final String[] metas = creationString.split(";");
|
||||
partiality = null;
|
||||
for (int i = 0; i < metas.length; i++) {
|
||||
final MetaSet addMeta = new MetaSet(metas[i]);
|
||||
metaSets.add(addMeta);
|
||||
canChoose = choose;
|
||||
|
||||
|
||||
for(String m : creationString.split(";")) {
|
||||
metaSets.add(new MetaSet(m, true));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Adds to partiality info.
|
||||
* @param addString
|
||||
* String, add partiality for this String.
|
||||
*/
|
||||
private void addPartiality(final String addString) {
|
||||
if (!hasPartiality(addString)) {
|
||||
partiality.add(addString);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the AI has a partiality for this set.
|
||||
* @param partialString
|
||||
* String, check partiality for this.
|
||||
*/
|
||||
private boolean hasPartiality(final String partialString) {
|
||||
|
||||
if (partiality.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (final String cmp : partiality) {
|
||||
if (partialString.equals(cmp)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the booster pack, return contents.
|
||||
* @return List, list of cards.
|
||||
*/
|
||||
@Override
|
||||
public List<CardPrinted> get() {
|
||||
return this.open(true, null);
|
||||
return this.open(true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,14 +73,13 @@ public class UnOpenedMeta extends UnOpenedProduct {
|
||||
* @return List, list of cards.
|
||||
*/
|
||||
|
||||
public List<CardPrinted> open(final boolean isHuman, List<String> partialities) {
|
||||
public List<CardPrinted> open(final boolean isHuman) {
|
||||
|
||||
if (metaSets.size() < 1) {
|
||||
throw new RuntimeException("Empty UnOpenedMetaset, cannot generate booster.");
|
||||
}
|
||||
|
||||
if (choice) {
|
||||
|
||||
if (canChoose) {
|
||||
if (isHuman) {
|
||||
final List<String> choices = new ArrayList<String>();
|
||||
|
||||
@@ -131,7 +90,7 @@ public class UnOpenedMeta extends UnOpenedProduct {
|
||||
|
||||
for (int i = 0; i < metaSets.size(); i++) {
|
||||
if (o.toString().equals(metaSets.get(i).getCode())) {
|
||||
final UnOpenedProduct newBooster = metaSets.get(i).getBooster();
|
||||
final IUnOpenedProduct newBooster = metaSets.get(i).getBooster();
|
||||
return newBooster.get();
|
||||
}
|
||||
}
|
||||
@@ -139,50 +98,14 @@ public class UnOpenedMeta extends UnOpenedProduct {
|
||||
throw new RuntimeException("Could not find MetaSet " + o.toString());
|
||||
}
|
||||
else {
|
||||
partiality = partialities;
|
||||
int selected = -1;
|
||||
|
||||
if (partiality == null || partiality.isEmpty()) {
|
||||
// System.out.println("No partiality yet");
|
||||
selected = generator.nextInt(metaSets.size());
|
||||
// System.out.println("AI randomly chose " + metaSets.get(selected).getCode());
|
||||
if (partiality != null) {
|
||||
addPartiality(metaSets.get(selected).getCode());
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int i = 0; i < metaSets.size(); i++) {
|
||||
if (hasPartiality(metaSets.get(i).getCode()) && MyRandom.percentTrue(partialityPreference)) {
|
||||
// System.out.println("AI chose " + metaSets.get(i).getCode() + " because of partiality.");
|
||||
selected = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (selected == -1) {
|
||||
selected = generator.nextInt(metaSets.size());
|
||||
if (partiality != null) {
|
||||
addPartiality(metaSets.get(selected).getCode());
|
||||
}
|
||||
// System.out.println("AI chose " + metaSets.get(selected).getCode() + " because partiality not established or failed percentage test.");
|
||||
}
|
||||
final UnOpenedProduct newBooster = metaSets.get(selected).getBooster();
|
||||
int selected = generator.nextInt(metaSets.size());
|
||||
final IUnOpenedProduct newBooster = metaSets.get(selected).getBooster();
|
||||
return newBooster.get();
|
||||
}
|
||||
}
|
||||
else {
|
||||
int selected = generator.nextInt(metaSets.size());
|
||||
// System.out.println("RANDOMLY got " + metaSets.get(selected).getCode());
|
||||
|
||||
// It may actually seem slightly unfair to allow the computer change its partialities based
|
||||
// on the random sets it gets since the player can't do the same...but, OTOH, this could also
|
||||
// work against the computer, if this results in a bad partiality choice. --BBU
|
||||
if (!isHuman && partiality != null && MyRandom.percentTrue(partialityPreference)) {
|
||||
addPartiality(metaSets.get(selected).getCode());
|
||||
// System.out.println("AI decided to add " + metaSets.get(selected).getCode() + " to partialities.");
|
||||
}
|
||||
final UnOpenedProduct newBooster = metaSets.get(selected).getBooster();
|
||||
final IUnOpenedProduct newBooster = metaSets.get(selected).getBooster();
|
||||
return newBooster.get();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,16 +2,11 @@ package forge.card;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.ItemPoolView;
|
||||
|
||||
/**
|
||||
* TODO: Write javadoc for this type.
|
||||
*
|
||||
*/
|
||||
public class UnOpenedProduct implements Supplier<List<CardPrinted>> {
|
||||
public class UnOpenedProduct implements IUnOpenedProduct {
|
||||
|
||||
private final ItemPoolView<CardPrinted> cards;
|
||||
private final Iterable<CardPrinted> cardPoolFlat;
|
||||
|
||||
@@ -19,19 +19,13 @@ package forge.card.cardfactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
import forge.Card;
|
||||
import forge.CardLists;
|
||||
import forge.CardPredicates;
|
||||
import forge.FThreads;
|
||||
import forge.CardPredicates.Presets;
|
||||
import forge.Constant;
|
||||
import forge.card.CardType;
|
||||
import forge.card.cost.Cost;
|
||||
import forge.card.mana.ManaCost;
|
||||
import forge.card.spellability.Spell;
|
||||
|
||||
@@ -24,10 +24,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Stack;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
|
||||
import forge.Card;
|
||||
@@ -37,6 +40,7 @@ import forge.card.BoosterGenerator;
|
||||
import forge.card.BoosterTemplate;
|
||||
import forge.card.CardBlock;
|
||||
import forge.card.CardEdition;
|
||||
import forge.card.IUnOpenedProduct;
|
||||
import forge.card.SealedProductTemplate;
|
||||
import forge.card.UnOpenedProduct;
|
||||
import forge.deck.Deck;
|
||||
@@ -96,63 +100,37 @@ public final class BoosterDraft implements IBoosterDraft {
|
||||
case Block: case FantasyBlock: // Draft from cards by block or set
|
||||
|
||||
List<CardBlock> blocks = new ArrayList<CardBlock>();
|
||||
|
||||
IStorageView<CardBlock> storage = draftType == CardPoolLimitation.Block
|
||||
? Singletons.getModel().getBlocks() : Singletons.getModel().getFantasyBlocks();
|
||||
|
||||
for (CardBlock b : storage) {
|
||||
if (b.hasMetaSetType("choose1") || b.hasMetaSetType("random1")) {
|
||||
System.out.println("Ignoring block " + b.getName() + " because its MetaSet types are not supported in Draft.");
|
||||
} else {
|
||||
blocks.add(b);
|
||||
}
|
||||
blocks.add(b);
|
||||
}
|
||||
|
||||
|
||||
final CardBlock block = GuiChoose.one("Choose Block", blocks);
|
||||
|
||||
final CardEdition[] cardSets = block.getSets();
|
||||
final String[] sets = new String[cardSets.length + block.getNumberMetaSets()];
|
||||
final Stack<String> sets = new Stack<String>();
|
||||
for (int k = cardSets.length - 1; k >= 0; --k) {
|
||||
sets[k] = cardSets[k].getCode();
|
||||
sets.add(cardSets[k].getCode());
|
||||
}
|
||||
|
||||
if (block.getNumberMetaSets() > 0) {
|
||||
|
||||
int j = cardSets.length;
|
||||
|
||||
for (int k = 0; k < block.getNumberMetaSets(); k++) {
|
||||
sets[j + k] = block.getMetaSet(k).getCode();
|
||||
}
|
||||
for(String setCode : block.getMetaSetNames() ) {
|
||||
if ( block.getMetaSet(setCode).isDraftable() )
|
||||
sets.push(setCode); // to the beginning
|
||||
}
|
||||
|
||||
final int nPacks = block.getCntBoostersDraft();
|
||||
final List<String> setCombos = getSetCombos(sets);
|
||||
|
||||
while (setCombos == null) {
|
||||
throw new RuntimeException("Unsupported amount of packs (" + nPacks + ") in a Draft block!");
|
||||
}
|
||||
|
||||
if (sets.length > 1) {
|
||||
final Object p = GuiChoose.one("Choose Set Combination", setCombos);
|
||||
if (sets.size() > 1) {
|
||||
final Object p = GuiChoose.one("Choose Set Combination", getSetCombos(sets));
|
||||
final String[] pp = p.toString().split("/");
|
||||
for (int i = 0; i < nPacks; i++) {
|
||||
if (pp[i].charAt(0) == '*') {
|
||||
this.product.add(block.getBooster(pp[i]));
|
||||
}
|
||||
else {
|
||||
this.product.add(
|
||||
new UnOpenedProduct(Singletons.getModel().getBoosters().get(pp[i])));
|
||||
}
|
||||
this.product.add(block.getBooster(pp[i]));
|
||||
}
|
||||
} else {
|
||||
UnOpenedProduct product1;
|
||||
if (sets[0].charAt(0) == '*') {
|
||||
product1 = block.getBooster(sets[0]);
|
||||
}
|
||||
else {
|
||||
product1 = new UnOpenedProduct(Singletons.getModel().getBoosters().get(sets[0]));
|
||||
}
|
||||
IUnOpenedProduct product1 = block.getBooster(sets.get(0));
|
||||
|
||||
for (int i = 0; i < nPacks; i++) {
|
||||
this.product.add(product1);
|
||||
}
|
||||
@@ -368,8 +346,9 @@ public final class BoosterDraft implements IBoosterDraft {
|
||||
HttpUtil.upload(NewConstants.URL_DRAFT_UPLOAD + "?fmt=" + draftFormat, outDraftData);
|
||||
}
|
||||
|
||||
private ArrayList<String> getSetCombos(final String[] sets) {
|
||||
ArrayList<String> setCombos = new ArrayList<String>();
|
||||
private List<String> getSetCombos(final List<String> setz) {
|
||||
String[] sets = setz.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
|
||||
List<String> setCombos = new ArrayList<String>();
|
||||
if (sets.length >= 2) {
|
||||
setCombos.add(String.format("%s/%s/%s", sets[0], sets[0], sets[0]));
|
||||
setCombos.add(String.format("%s/%s/%s", sets[0], sets[0], sets[1]));
|
||||
|
||||
@@ -60,13 +60,6 @@ public class CustomLimited extends DeckBase {
|
||||
|
||||
private static final long serialVersionUID = 7435640939026612173L;
|
||||
|
||||
/** The Ignore rarity. */
|
||||
private boolean ignoreRarity;
|
||||
|
||||
/** The Singleton. */
|
||||
private boolean singleton = false;
|
||||
|
||||
|
||||
/** The Num packs. */
|
||||
private int numPacks = 3;
|
||||
|
||||
@@ -109,8 +102,6 @@ public class CustomLimited extends DeckBase {
|
||||
slots = BoosterTemplate.genericBooster.getSlots();
|
||||
|
||||
final CustomLimited cd = new CustomLimited(data.get("Name"), slots);
|
||||
cd.setIgnoreRarity(data.getBoolean("IgnoreRarity"));
|
||||
cd.setSingleton(data.getBoolean("Singleton"));
|
||||
cd.landSetCode = data.get("LandSetCode");
|
||||
cd.numPacks = data.getInt("NumPacks");
|
||||
final Deck deckCube = cubes.get(data.get("DeckFile"));
|
||||
@@ -140,44 +131,6 @@ public class CustomLimited extends DeckBase {
|
||||
this.numPacks = numPacksIn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the singleton.
|
||||
*
|
||||
* @return the singleton
|
||||
*/
|
||||
public boolean getSingleton() {
|
||||
return this.singleton;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the singleton.
|
||||
*
|
||||
* @param singletonIn
|
||||
* the singleton to set
|
||||
*/
|
||||
public void setSingleton(final boolean singletonIn) {
|
||||
this.singleton = singletonIn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ignore rarity.
|
||||
*
|
||||
* @return the ignoreRarity
|
||||
*/
|
||||
public boolean getIgnoreRarity() {
|
||||
return this.ignoreRarity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the ignore rarity.
|
||||
*
|
||||
* @param ignoreRarityIn
|
||||
* the ignoreRarity to set
|
||||
*/
|
||||
public void setIgnoreRarity(final boolean ignoreRarityIn) {
|
||||
this.ignoreRarity = ignoreRarityIn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the land set code.
|
||||
*
|
||||
|
||||
@@ -20,13 +20,17 @@ package forge.game.limited;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.card.BoosterTemplate;
|
||||
import forge.card.CardBlock;
|
||||
import forge.card.CardEdition;
|
||||
import forge.card.IUnOpenedProduct;
|
||||
import forge.card.UnOpenedMeta;
|
||||
import forge.card.UnOpenedProduct;
|
||||
import forge.gui.GuiChoose;
|
||||
@@ -45,8 +49,7 @@ import forge.util.FileUtil;
|
||||
* @since 1.0.15
|
||||
*/
|
||||
public class SealedDeckFormat {
|
||||
private final ArrayList<UnOpenedProduct> product = new ArrayList<UnOpenedProduct>();
|
||||
private List<String> partiality;
|
||||
private final ArrayList<IUnOpenedProduct> product = new ArrayList<IUnOpenedProduct>();
|
||||
|
||||
/** The Land set code. */
|
||||
private String[] landSetCode = { "" };
|
||||
@@ -60,9 +63,6 @@ public class SealedDeckFormat {
|
||||
* a {@link java.lang.String} object.
|
||||
*/
|
||||
public SealedDeckFormat(final String sealedType) {
|
||||
|
||||
partiality = new ArrayList<String>();
|
||||
|
||||
if (sealedType.equals("Full")) {
|
||||
// Choose number of boosters
|
||||
final Integer[] integers = new Integer[10];
|
||||
@@ -96,20 +96,16 @@ public class SealedDeckFormat {
|
||||
final CardBlock block = GuiChoose.one("Choose Block", blocks);
|
||||
|
||||
final CardEdition[] cardSets = block.getSets();
|
||||
final String[] sets = new String[cardSets.length + block.getNumberMetaSets()];
|
||||
final Stack<String> sets = new Stack<String>();
|
||||
|
||||
for (int k = cardSets.length - 1; k >= 0; --k) {
|
||||
sets[k] = cardSets[k].getCode();
|
||||
sets.add(cardSets[k].getCode());
|
||||
}
|
||||
|
||||
final int nPacks = block.getCntBoostersSealed();
|
||||
|
||||
if (block.getNumberMetaSets() > 0) {
|
||||
|
||||
int j = cardSets.length;
|
||||
|
||||
for (int k = 0; k < block.getNumberMetaSets(); k++) {
|
||||
sets[j + k] = block.getMetaSet(k).getCode();
|
||||
}
|
||||
for(String ms : block.getMetaSetNames()) {
|
||||
sets.push(ms);
|
||||
}
|
||||
|
||||
final List<String> setCombos = getSetCombos(sets, nPacks);
|
||||
@@ -118,7 +114,7 @@ public class SealedDeckFormat {
|
||||
throw new RuntimeException("Unsupported amount of packs (" + nPacks + ") in a Sealed Deck block!");
|
||||
}
|
||||
|
||||
if (sets.length > 1) {
|
||||
if (sets.size() > 1) {
|
||||
final Object p = GuiChoose.one("Choose Set Combination", setCombos);
|
||||
|
||||
final String[] pp = p.toString().split("/");
|
||||
@@ -210,13 +206,8 @@ public class SealedDeckFormat {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
UnOpenedProduct product1;
|
||||
if (sets[0].charAt(0) == '*') {
|
||||
product1 = block.getBooster(sets[0]);
|
||||
}
|
||||
else {
|
||||
product1 = new UnOpenedProduct(Singletons.getModel().getBoosters().get(sets[0]));
|
||||
}
|
||||
IUnOpenedProduct product1;
|
||||
product1 = block.getBooster(sets.get(0));
|
||||
|
||||
// Choose number of boosters
|
||||
final Integer[] integers = new Integer[10];
|
||||
@@ -296,7 +287,8 @@ public class SealedDeckFormat {
|
||||
*
|
||||
* @return an ArrayList of the set choices.
|
||||
*/
|
||||
private ArrayList<String> getSetCombos(final String[] sets, final int nPacks) {
|
||||
private ArrayList<String> getSetCombos(final List<String> setz, final int nPacks) {
|
||||
String[] sets = setz.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
|
||||
ArrayList<String> setCombos = new ArrayList<String>();
|
||||
|
||||
if (nPacks == 3) {
|
||||
@@ -398,24 +390,24 @@ public class SealedDeckFormat {
|
||||
setCombos.add(String.format("%s/%s/%s/%s/%s/%s/%s/%s/%s", sets[0], sets[0], sets[0], sets[0], sets[0], sets[0], sets[0], sets[0], sets[0]));
|
||||
}
|
||||
else { // Default to 6 packs
|
||||
if (sets.length >= 2) {
|
||||
setCombos.add(String.format("%s/%s/%s/%s/%s/%s", sets[0], sets[0], sets[0], sets[0], sets[0], sets[0]));
|
||||
setCombos.add(String.format("%s/%s/%s/%s/%s/%s", sets[1], sets[1], sets[0], sets[0], sets[0], sets[0]));
|
||||
setCombos.add(String.format("%s/%s/%s/%s/%s/%s", sets[1], sets[1], sets[1], sets[0], sets[0], sets[0]));
|
||||
if (sets.length >= 6) {
|
||||
setCombos.add(String.format("%s/%s/%s/%s/%s/%s", sets[5], sets[4], sets[3], sets[2], sets[1], sets[0]));
|
||||
}
|
||||
if (sets.length >= 3) {
|
||||
setCombos.add(String.format("%s/%s/%s/%s/%s/%s", sets[2], sets[2], sets[2], sets[0], sets[0], sets[0]));
|
||||
setCombos.add(String.format("%s/%s/%s/%s/%s/%s", sets[2], sets[2], sets[1], sets[1], sets[0], sets[0]));
|
||||
if (sets.length >= 5) {
|
||||
setCombos.add(String.format("%s/%s/%s/%s/%s/%s", sets[4], sets[3], sets[2], sets[1], sets[0], sets[0]));
|
||||
}
|
||||
if (sets.length >= 4) {
|
||||
setCombos.add(String.format("%s/%s/%s/%s/%s/%s", sets[3], sets[2], sets[1], sets[0], sets[0], sets[0]));
|
||||
setCombos.add(String.format("%s/%s/%s/%s/%s/%s", sets[3], sets[2], sets[1], sets[1], sets[0], sets[0]));
|
||||
}
|
||||
if (sets.length >= 5) {
|
||||
setCombos.add(String.format("%s/%s/%s/%s/%s/%s", sets[4], sets[3], sets[2], sets[1], sets[0], sets[0]));
|
||||
if (sets.length >= 3) {
|
||||
setCombos.add(String.format("%s/%s/%s/%s/%s/%s", sets[2], sets[2], sets[2], sets[0], sets[0], sets[0]));
|
||||
setCombos.add(String.format("%s/%s/%s/%s/%s/%s", sets[2], sets[2], sets[1], sets[1], sets[0], sets[0]));
|
||||
}
|
||||
if (sets.length >= 6) {
|
||||
setCombos.add(String.format("%s/%s/%s/%s/%s/%s", sets[5], sets[4], sets[3], sets[2], sets[1], sets[0]));
|
||||
if (sets.length >= 2) {
|
||||
setCombos.add(String.format("%s/%s/%s/%s/%s/%s", sets[1], sets[1], sets[1], sets[0], sets[0], sets[0]));
|
||||
setCombos.add(String.format("%s/%s/%s/%s/%s/%s", sets[1], sets[1], sets[0], sets[0], sets[0], sets[0]));
|
||||
setCombos.add(String.format("%s/%s/%s/%s/%s/%s", sets[0], sets[0], sets[0], sets[0], sets[0], sets[0]));
|
||||
}
|
||||
}
|
||||
return setCombos;
|
||||
@@ -443,16 +435,12 @@ public class SealedDeckFormat {
|
||||
*/
|
||||
public ItemPool<CardPrinted> getCardpool(final boolean isHuman) {
|
||||
|
||||
if (!isHuman) {
|
||||
if (!partiality.isEmpty()) {
|
||||
partiality.clear();
|
||||
}
|
||||
}
|
||||
|
||||
final ItemPool<CardPrinted> pool = new ItemPool<CardPrinted>(CardPrinted.class);
|
||||
|
||||
for (UnOpenedProduct prod : product) {
|
||||
for (IUnOpenedProduct prod : product) {
|
||||
if( prod instanceof UnOpenedMeta )
|
||||
pool.addAllFlat(((UnOpenedMeta) prod).open(isHuman, partiality));
|
||||
pool.addAllFlat(((UnOpenedMeta) prod).open(isHuman));
|
||||
else
|
||||
pool.addAllFlat(prod.get());
|
||||
}
|
||||
|
||||
@@ -150,27 +150,6 @@ public class HumanPlayer extends Player {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean payManaCostIfNeeded(final SpellAbility sa) {
|
||||
final ManaCostBeingPaid manaCost;
|
||||
if (sa.getSourceCard().isCopiedSpell() && sa.isSpell()) {
|
||||
manaCost = new ManaCostBeingPaid(ManaCost.ZERO);
|
||||
} else {
|
||||
manaCost = new ManaCostBeingPaid(sa.getPayCosts().getTotalMana());
|
||||
manaCost.applySpellCostChange(sa);
|
||||
}
|
||||
|
||||
boolean isPaid = manaCost.isPaid();
|
||||
|
||||
if( !isPaid ) {
|
||||
InputPayManaBase inputPay = new InputPayManaSimple(game, sa, manaCost);
|
||||
FThreads.setInputAndWait(inputPay);
|
||||
isPaid = inputPay.isPaid();
|
||||
}
|
||||
return isPaid;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* playSpellAbility_NoStack.
|
||||
@@ -199,6 +178,25 @@ public class HumanPlayer extends Player {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean payManaCostIfNeeded(final SpellAbility sa) {
|
||||
final ManaCostBeingPaid manaCost;
|
||||
if (sa.getSourceCard().isCopiedSpell() && sa.isSpell()) {
|
||||
manaCost = new ManaCostBeingPaid(ManaCost.ZERO);
|
||||
} else {
|
||||
manaCost = new ManaCostBeingPaid(sa.getPayCosts().getTotalMana());
|
||||
manaCost.applySpellCostChange(sa);
|
||||
}
|
||||
|
||||
boolean isPaid = manaCost.isPaid();
|
||||
|
||||
if( !isPaid ) {
|
||||
InputPayManaBase inputPay = new InputPayManaSimple(game, sa, manaCost);
|
||||
FThreads.setInputAndWait(inputPay);
|
||||
isPaid = inputPay.isPaid();
|
||||
}
|
||||
return isPaid;
|
||||
}
|
||||
|
||||
/**
|
||||
* choose optional additional costs. For HUMAN only
|
||||
* @param activator
|
||||
|
||||
Reference in New Issue
Block a user