mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
Merge branch 'CollectorBoosters' into 'master'
Collector boosters See merge request core-developers/forge!4913
This commit is contained in:
@@ -87,7 +87,7 @@ public class BoosterDraft implements IBoosterDraft {
|
||||
protected boolean generateProduct() {
|
||||
switch (this.draftFormat) {
|
||||
case Full: // Draft from all cards in Forge
|
||||
final Supplier<List<PaperCard>> s = new UnOpenedProduct(SealedProduct.Template.genericBooster);
|
||||
final Supplier<List<PaperCard>> s = new UnOpenedProduct(SealedProduct.Template.genericDraftBooster);
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
this.product.add(s);
|
||||
|
||||
@@ -107,7 +107,7 @@ public class CustomLimited extends DeckBase {
|
||||
slots.add(ImmutablePair.of(kv[1], Integer.parseInt(kv[0])));
|
||||
}
|
||||
} else
|
||||
slots = SealedProduct.Template.genericBooster.getSlots();
|
||||
slots = SealedProduct.Template.genericDraftBooster.getSlots();
|
||||
|
||||
final CustomLimited cd = new CustomLimited(data.get("Name"), slots);
|
||||
cd.landSetCode = data.get("LandSetCode");
|
||||
|
||||
@@ -166,7 +166,7 @@ public class SealedCardPoolGenerator {
|
||||
switch(poolType) {
|
||||
case Full:
|
||||
// Choose number of boosters
|
||||
if (!chooseNumberOfBoosters(new UnOpenedProduct(SealedProduct.Template.genericBooster))) {
|
||||
if (!chooseNumberOfBoosters(new UnOpenedProduct(SealedProduct.Template.genericDraftBooster))) {
|
||||
return;
|
||||
}
|
||||
landSetCode = CardEdition.Predicates.getRandomSetWithAllBasicLands(FModel.getMagicDb().getEditions()).getCode();
|
||||
@@ -211,7 +211,7 @@ public class SealedCardPoolGenerator {
|
||||
code = pieces[1];
|
||||
}
|
||||
|
||||
// Generate boosters
|
||||
// Generate draft boosters
|
||||
for(int i = 0; i < num; i++) {
|
||||
this.product.add(new UnOpenedProduct(FModel.getMagicDb().getBoosters().get(code)));
|
||||
}
|
||||
|
||||
@@ -69,20 +69,23 @@ public final class BoosterUtils {
|
||||
};
|
||||
|
||||
private static final GameFormat.Collection formats = FModel.getFormats();
|
||||
private static final Predicate<CardEdition> filterExt = formats.getExtended().editionLegalPredicate;
|
||||
private static final Predicate<CardEdition> filterPioneer = formats.getPioneer().editionLegalPredicate;
|
||||
private static final Predicate<CardEdition> filterModern= formats.getModern().editionLegalPredicate;
|
||||
|
||||
/** The filter t2booster. */
|
||||
private static final Predicate<CardEdition> filterT2booster = Predicates.and(CardEdition.Predicates.CAN_MAKE_BOOSTER,
|
||||
private static final Predicate<CardEdition> filterStandard = Predicates.and(CardEdition.Predicates.CAN_MAKE_BOOSTER,
|
||||
formats.getStandard().editionLegalPredicate);
|
||||
|
||||
/** The filter ext but t2. */
|
||||
private static final Predicate<CardEdition> filterExtButT2 = Predicates.and(
|
||||
private static final Predicate<CardEdition> filterPioneerNotStandard = Predicates.and(
|
||||
CardEdition.Predicates.CAN_MAKE_BOOSTER,
|
||||
Predicates.and(filterExt, formats.getStandard().editionLegalPredicate));
|
||||
Predicates.and(filterPioneer, Predicates.not(formats.getStandard().editionLegalPredicate)));
|
||||
|
||||
private static final Predicate<CardEdition> filterModernNotPioneer = Predicates.and(
|
||||
CardEdition.Predicates.CAN_MAKE_BOOSTER,
|
||||
Predicates.and(filterModern, Predicates.not(filterPioneer)));
|
||||
|
||||
/** The filter not ext. */
|
||||
private static final Predicate<CardEdition> filterNotExt = Predicates.and(CardEdition.Predicates.CAN_MAKE_BOOSTER,
|
||||
Predicates.not(filterExt));
|
||||
private static final Predicate<CardEdition> filterNotModern = Predicates.and(CardEdition.Predicates.CAN_MAKE_BOOSTER,
|
||||
Predicates.not(filterModern));
|
||||
|
||||
/**
|
||||
* Gets the quest starter deck.
|
||||
@@ -169,7 +172,19 @@ public final class BoosterUtils {
|
||||
return generateRandomBoosterPacks(quantity, isLegalInQuestFormat(questController.getFormat()));
|
||||
} else {
|
||||
final int rollD100 = MyRandom.getRandom().nextInt(100);
|
||||
return generateRandomBoosterPacks(quantity, rollD100 < 40 ? filterT2booster : (rollD100 < 75 ? filterExtButT2 : filterNotExt));
|
||||
// 30% Standard, 20% Pioneer, pre-standard -> 20% Modern, pre-pioneer -> 30% Pre-modern
|
||||
Predicate<CardEdition> rolledFilter;
|
||||
if (rollD100 < 30) {
|
||||
rolledFilter = filterStandard;
|
||||
} else if (rollD100 < 50) {
|
||||
rolledFilter = filterPioneerNotStandard;
|
||||
} else if (rollD100 < 70) {
|
||||
rolledFilter = filterModernNotPioneer;
|
||||
} else {
|
||||
rolledFilter = filterNotModern;
|
||||
}
|
||||
|
||||
return generateRandomBoosterPacks(quantity, rolledFilter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
@@ -589,7 +590,15 @@ public class QuestWinLoseController {
|
||||
final IUnOpenedProduct product = new UnOpenedProduct(getBoosterTemplate(), cards);
|
||||
cardsWon = product.get();
|
||||
} else {
|
||||
final IUnOpenedProduct product = new UnOpenedProduct(FModel.getMagicDb().getBoosters().get(chooseEd.getCode()));
|
||||
final IUnOpenedProduct product;
|
||||
List<String> boosterTypes = Lists.newArrayList(chooseEd.getAvailableBoosterTypes());
|
||||
String setAffix = "";
|
||||
String type = SGuiChoose.one("Which booster type do you choose?", boosterTypes);
|
||||
if (!type.equals("Draft")) {
|
||||
setAffix = type;
|
||||
}
|
||||
product = new UnOpenedProduct(FModel.getMagicDb().getBoosters().get(chooseEd.getCode() + setAffix));
|
||||
|
||||
cardsWon = product.get();
|
||||
}
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ public class MetaSet {
|
||||
|
||||
switch(type) {
|
||||
case Full:
|
||||
return new UnOpenedProduct(SealedProduct.Template.genericBooster);
|
||||
return new UnOpenedProduct(SealedProduct.Template.genericDraftBooster);
|
||||
|
||||
case Booster:
|
||||
return new UnOpenedProduct(FModel.getMagicDb().getBoosters().get(data));
|
||||
@@ -179,7 +179,7 @@ public class MetaSet {
|
||||
|
||||
case JoinedSet:
|
||||
Predicate<PaperCard> predicate = IPaperCard.Predicates.printedInSets(data.split(" "));
|
||||
return new UnOpenedProduct(SealedProduct.Template.genericBooster, predicate);
|
||||
return new UnOpenedProduct(SealedProduct.Template.genericDraftBooster, predicate);
|
||||
|
||||
case Choose: return UnOpenedMeta.choose(data);
|
||||
case Random: return UnOpenedMeta.random(data);
|
||||
|
||||
Reference in New Issue
Block a user