mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
Prerelease standardization
This commit is contained in:
@@ -3,6 +3,7 @@ package forge.limited;
|
||||
public enum LimitedPoolType {
|
||||
Full("Full Cardpool"),
|
||||
Block("Block / Set"),
|
||||
Prerelease("Prerelease"),
|
||||
FantasyBlock("Fantasy Block"),
|
||||
Custom("Custom Cube"),
|
||||
Chaos("Chaos Draft");
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*/
|
||||
package forge.limited;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import forge.StaticData;
|
||||
import forge.assets.FSkinProp;
|
||||
import forge.card.CardEdition;
|
||||
import forge.card.MagicColor;
|
||||
@@ -39,12 +41,13 @@ import forge.util.TextUtil;
|
||||
import forge.util.gui.SGuiChoose;
|
||||
import forge.util.gui.SOptionPane;
|
||||
import forge.util.storage.IStorage;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
|
||||
@@ -166,6 +169,67 @@ public class SealedCardPoolGenerator {
|
||||
landSetCode = CardEdition.Predicates.getRandomSetWithAllBasicLands(FModel.getMagicDb().getEditions()).getCode();
|
||||
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 FantasyBlock:
|
||||
List<CardBlock> blocks = new ArrayList<>();
|
||||
@@ -439,7 +503,6 @@ public class SealedCardPoolGenerator {
|
||||
*
|
||||
* @param isHuman
|
||||
* boolean, get pool for human (possible choices)
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public CardPool getCardPool(final boolean isHuman) {
|
||||
final CardPool pool = new CardPool();
|
||||
|
||||
Reference in New Issue
Block a user