mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
Prerelease standardization
This commit is contained in:
@@ -553,6 +553,23 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
|
|||||||
return Lists.newArrayList(Iterables.filter(this.roAllCards, predicate));
|
return Lists.newArrayList(Iterables.filter(this.roAllCards, predicate));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do I want a foiled version of these cards?
|
||||||
|
@Override
|
||||||
|
public List<PaperCard> getAllCardsFromEdition(CardEdition edition) {
|
||||||
|
List<PaperCard> cards = Lists.newArrayList();
|
||||||
|
|
||||||
|
for(CardInSet cis : edition.getCards()) {
|
||||||
|
PaperCard card = this.getCard(cis.name, edition.getCode());
|
||||||
|
if (card == null) {
|
||||||
|
// Just in case the card is listed in the edition file but Forge doesn't support it
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
cards.add(card);
|
||||||
|
}
|
||||||
|
return cards;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean contains(String name) {
|
public boolean contains(String name) {
|
||||||
return allCardsByName.containsKey(getName(name));
|
return allCardsByName.containsKey(getName(name));
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
|||||||
private Type type;
|
private Type type;
|
||||||
private String name;
|
private String name;
|
||||||
private String alias = null;
|
private String alias = null;
|
||||||
|
private String prerelease = null;
|
||||||
private boolean whiteBorder = false;
|
private boolean whiteBorder = false;
|
||||||
private FoilType foilType = FoilType.NOT_SUPPORTED;
|
private FoilType foilType = FoilType.NOT_SUPPORTED;
|
||||||
private double foilChanceInBooster = 0;
|
private double foilChanceInBooster = 0;
|
||||||
@@ -178,6 +179,7 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
|||||||
public Type getType() { return type; }
|
public Type getType() { return type; }
|
||||||
public String getName() { return name; }
|
public String getName() { return name; }
|
||||||
public String getAlias() { return alias; }
|
public String getAlias() { return alias; }
|
||||||
|
public String getPrerelease() { return prerelease; }
|
||||||
public FoilType getFoilType() { return foilType; }
|
public FoilType getFoilType() { return foilType; }
|
||||||
public double getFoilChanceInBooster() { return foilChanceInBooster; }
|
public double getFoilChanceInBooster() { return foilChanceInBooster; }
|
||||||
public boolean getFoilAlwaysInCommonSlot() { return foilAlwaysInCommonSlot; }
|
public boolean getFoilAlwaysInCommonSlot() { return foilAlwaysInCommonSlot; }
|
||||||
@@ -333,6 +335,7 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
res.type = enumType;
|
res.type = enumType;
|
||||||
|
res.prerelease = section.get("Prerelease", null);
|
||||||
|
|
||||||
switch(section.get("foil", "newstyle").toLowerCase()) {
|
switch(section.get("foil", "newstyle").toLowerCase()) {
|
||||||
case "notsupported":
|
case "notsupported":
|
||||||
@@ -413,6 +416,16 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Iterable<CardEdition> getPrereleaseEditions() {
|
||||||
|
List<CardEdition> res = Lists.newArrayList(this);
|
||||||
|
return Iterables.filter(res, new Predicate<CardEdition>() {
|
||||||
|
@Override
|
||||||
|
public boolean apply(final CardEdition edition) {
|
||||||
|
return edition.getPrerelease() != null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public CardEdition getEditionByCodeOrThrow(final String code) {
|
public CardEdition getEditionByCodeOrThrow(final String code) {
|
||||||
final CardEdition set = this.get(code);
|
final CardEdition set = this.get(code);
|
||||||
if (null == set) {
|
if (null == set) {
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ public interface ICardDatabase extends Iterable<PaperCard> {
|
|||||||
List<PaperCard> getAllCards(String cardName);
|
List<PaperCard> getAllCards(String cardName);
|
||||||
List<PaperCard> getAllCards(Predicate<PaperCard> predicate);
|
List<PaperCard> getAllCards(Predicate<PaperCard> predicate);
|
||||||
|
|
||||||
|
List<PaperCard> getAllCardsFromEdition(CardEdition edition);
|
||||||
|
|
||||||
Predicate<? super PaperCard> wasPrintedInSets(List<String> allowedSetCodes);
|
Predicate<? super PaperCard> wasPrintedInSets(List<String> allowedSetCodes);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,7 @@ MciCode=thb
|
|||||||
Type=Expansion
|
Type=Expansion
|
||||||
BoosterCovers=5
|
BoosterCovers=5
|
||||||
Booster=10 Common, 3 Uncommon, 1 RareMythic, 1 BasicLand
|
Booster=10 Common, 3 Uncommon, 1 RareMythic, 1 BasicLand
|
||||||
|
Prerelease=6 Boosters, 1 RareMythic+
|
||||||
|
|
||||||
[cards]
|
[cards]
|
||||||
4 U Banishing Light
|
4 U Banishing Light
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ MciCode=eld
|
|||||||
Type=Expansion
|
Type=Expansion
|
||||||
BoosterCovers=5
|
BoosterCovers=5
|
||||||
Booster=10 Common:!fromSheet("ELD Secret Cards"), 3 Uncommon:!fromSheet("ELD Secret Cards"), 1 RareMythic:!fromSheet("ELD Secret Cards"), 1 BasicLand
|
Booster=10 Common:!fromSheet("ELD Secret Cards"), 3 Uncommon:!fromSheet("ELD Secret Cards"), 1 RareMythic:!fromSheet("ELD Secret Cards"), 1 BasicLand
|
||||||
|
Prerelease=6 Boosters, 1 RareMythic+
|
||||||
|
|
||||||
[cards]
|
[cards]
|
||||||
1 R Acclaimed Contender
|
1 R Acclaimed Contender
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package forge.limited;
|
|||||||
public enum LimitedPoolType {
|
public enum LimitedPoolType {
|
||||||
Full("Full Cardpool"),
|
Full("Full Cardpool"),
|
||||||
Block("Block / Set"),
|
Block("Block / Set"),
|
||||||
|
Prerelease("Prerelease"),
|
||||||
FantasyBlock("Fantasy Block"),
|
FantasyBlock("Fantasy Block"),
|
||||||
Custom("Custom Cube"),
|
Custom("Custom Cube"),
|
||||||
Chaos("Chaos Draft");
|
Chaos("Chaos Draft");
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
package forge.limited;
|
package forge.limited;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import forge.StaticData;
|
||||||
import forge.assets.FSkinProp;
|
import forge.assets.FSkinProp;
|
||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
import forge.card.MagicColor;
|
import forge.card.MagicColor;
|
||||||
@@ -39,12 +41,13 @@ import forge.util.TextUtil;
|
|||||||
import forge.util.gui.SGuiChoose;
|
import forge.util.gui.SGuiChoose;
|
||||||
import forge.util.gui.SOptionPane;
|
import forge.util.gui.SOptionPane;
|
||||||
import forge.util.storage.IStorage;
|
import forge.util.storage.IStorage;
|
||||||
|
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
|
|
||||||
@@ -166,6 +169,67 @@ public class SealedCardPoolGenerator {
|
|||||||
landSetCode = CardEdition.Predicates.getRandomSetWithAllBasicLands(FModel.getMagicDb().getEditions()).getCode();
|
landSetCode = CardEdition.Predicates.getRandomSetWithAllBasicLands(FModel.getMagicDb().getEditions()).getCode();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Prerelease:
|
||||||
|
ArrayList<CardEdition> editions = Lists.newArrayList(StaticData.instance().getEditions().getPrereleaseEditions());
|
||||||
|
Collections.sort(editions);
|
||||||
|
Collections.reverse(editions);
|
||||||
|
|
||||||
|
CardEdition chosenEdition = SGuiChoose.oneOrNone("Choose an edition", editions);
|
||||||
|
if (chosenEdition == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String bundle = chosenEdition.getPrerelease();
|
||||||
|
|
||||||
|
// Parse prerelease bundle.
|
||||||
|
// More recent sets are like 6 boosters of this edition + 1 Promo RareMythic from this edition
|
||||||
|
|
||||||
|
// Expecting to see things like
|
||||||
|
// # <Edition> Boosters, # Rarity+
|
||||||
|
|
||||||
|
String[] parts = bundle.split(", ");
|
||||||
|
for(String part : parts) {
|
||||||
|
boolean promo = part.endsWith("+");
|
||||||
|
if (promo) {
|
||||||
|
part = part.substring(0, part.length() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] pieces = part.split(" ");
|
||||||
|
int num = Integer.parseInt(pieces[0]);
|
||||||
|
String thing = pieces[pieces.length - 1];
|
||||||
|
|
||||||
|
// Booster, Rarity, Named, SpecialBooster?
|
||||||
|
|
||||||
|
if (thing.equalsIgnoreCase("Booster") || thing.equalsIgnoreCase("Boosters")) {
|
||||||
|
// Normal Boosters of this or block editions
|
||||||
|
String code = chosenEdition.getCode();
|
||||||
|
if (pieces.length > 2) {
|
||||||
|
// 2 USG Boosters
|
||||||
|
code = pieces[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate boosters
|
||||||
|
for(int i = 0; i < num; i++) {
|
||||||
|
this.product.add(new UnOpenedProduct(FModel.getMagicDb().getBoosters().get(code)));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Rarity
|
||||||
|
List<Pair<String, Integer>> promoSlot = new ArrayList<>();
|
||||||
|
promoSlot.add(Pair.of(pieces[1], num));
|
||||||
|
|
||||||
|
SealedProduct.Template promoProduct = new SealedProduct.Template("Prerelease Promo", promoSlot);
|
||||||
|
|
||||||
|
// Create a "booster" with just the promo card. Rarity + Edition into a Template
|
||||||
|
this.product.add(new UnOpenedProduct(promoProduct, FModel.getMagicDb().getCommonCards().getAllCardsFromEdition(chosenEdition)));
|
||||||
|
// TODO This product should be Foiled only. How do I do that?
|
||||||
|
}
|
||||||
|
// TODO Add support for special boosters like GuildPacks
|
||||||
|
}
|
||||||
|
|
||||||
|
//chosenEdition but really it should be defined by something in the edition file?
|
||||||
|
landSetCode = chosenEdition.getCode();
|
||||||
|
|
||||||
|
break;
|
||||||
case Block:
|
case Block:
|
||||||
case FantasyBlock:
|
case FantasyBlock:
|
||||||
List<CardBlock> blocks = new ArrayList<>();
|
List<CardBlock> blocks = new ArrayList<>();
|
||||||
@@ -439,7 +503,6 @@ public class SealedCardPoolGenerator {
|
|||||||
*
|
*
|
||||||
* @param isHuman
|
* @param isHuman
|
||||||
* boolean, get pool for human (possible choices)
|
* boolean, get pool for human (possible choices)
|
||||||
* @return a {@link forge.CardList} object.
|
|
||||||
*/
|
*/
|
||||||
public CardPool getCardPool(final boolean isHuman) {
|
public CardPool getCardPool(final boolean isHuman) {
|
||||||
final CardPool pool = new CardPool();
|
final CardPool pool = new CardPool();
|
||||||
|
|||||||
Reference in New Issue
Block a user