Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update draftable edition sections #6631

Open
wants to merge 39 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
4762795
Fix edition txt files
Ayora29 Oct 3, 2024
f048e26
Fix edition txt files
Ayora29 Oct 3, 2024
f83d5de
Fix edition txt files
Ayora29 Oct 3, 2024
d124499
Fix edition txt files
Ayora29 Oct 4, 2024
bcea66a
Fix art index when parsing edition files sections
Ayora29 Oct 4, 2024
e4c41a4
Fix edition txt files
Ayora29 Oct 4, 2024
3cf26bf
Fix edition txt files
Ayora29 Oct 5, 2024
0d8a2a4
Fix edition txt files
Ayora29 Oct 5, 2024
c55c02f
Fix edition txt files
Ayora29 Oct 6, 2024
ad077ab
Fix edition txt files
Ayora29 Oct 7, 2024
248324a
Fix edition txt files
Ayora29 Oct 7, 2024
5180c14
Fix edition txt files
Ayora29 Oct 7, 2024
40210a1
Fix edition txt files
Ayora29 Oct 8, 2024
06f919b
Fix edition txt files
Ayora29 Oct 8, 2024
5556c7e
Fix edition txt files
Ayora29 Oct 8, 2024
7df48b9
Fix edition txt files
Ayora29 Oct 10, 2024
03e2acd
Merge pull request #1 from Ayora29/master
Ayora29 Oct 10, 2024
e5de473
Fix edition txt files
Ayora29 Oct 10, 2024
507ed03
Fix edition txt files
Ayora29 Oct 10, 2024
45bbc70
Fix edition txt files
Ayora29 Oct 11, 2024
c81236f
Fix edition txt files
Ayora29 Oct 11, 2024
97794f7
Fix edition txt files
Ayora29 Oct 11, 2024
4d3ac54
Fix edition txt files
Ayora29 Oct 11, 2024
6953bdf
Fix edition txt files
Ayora29 Oct 11, 2024
83f79c6
Fix edition txt files
Ayora29 Oct 11, 2024
ea0134f
Convert MKM to BoosterSlots
Ayora29 Oct 13, 2024
742d094
Rename "RareMythic" section
Ayora29 Oct 13, 2024
bba32fe
Remove conjured cards that do not have unique artwork.
Ayora29 Oct 14, 2024
02634e2
Restore basic land order
Ayora29 Oct 14, 2024
cf124a5
Merge branch 'master' into edition_sections
Ayora29 Oct 18, 2024
22652e2
Merge branch 'master' into edition_sections
Ayora29 Oct 18, 2024
fb5ea7f
Merge branch 'master' into edition_sections
Ayora29 Oct 21, 2024
143dc91
Merge branch 'master' into edition_sections
Ayora29 Nov 7, 2024
73986db
Merge from upstream/master + fix MH3 conflict
Ayora29 Nov 25, 2024
1ec1559
Merge remote-tracking branch 'origin/edition_sections' into edition_s…
Ayora29 Nov 25, 2024
5bf6034
Merge branch 'Card-Forge:master' into edition_sections
Ayora29 Nov 25, 2024
cecd1f2
Fixes
Ayora29 Nov 25, 2024
52e12ce
parseSections : Fix Index out of bounds error for empty file
Ayora29 Nov 26, 2024
7809100
FileSection.java : use for loop instead of do/while
Ayora29 Nov 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 10 additions & 17 deletions forge-core/src/main/java/forge/card/CardEdition.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,19 @@ public final class CardEdition implements Comparable<CardEdition> {
// immutable
public enum Type {
UNKNOWN,

CORE,
EXPANSION,
STARTER,
REPRINT,
BOXED_SET,

COLLECTOR_EDITION,
DUEL_DECK,
PROMO,
ONLINE,

DRAFT,

COMMANDER,
MULTIPLAYER,
FUNNY,

OTHER, // FALLBACK CATEGORY
CUSTOM_SET; // custom sets

Expand Down Expand Up @@ -131,22 +126,23 @@ public enum EditionSectionWithCollectorNumbers {
SPECIAL_SLOT("special slot"), //to help with convoluted boosters
PRECON_PRODUCT("precon product"),
BORDERLESS("borderless"),
BORDERLESS_PROFILE("borderless profile"),
BORDERLESS_FRAME("borderless frame"),
ETCHED("etched"),
SHOWCASE("showcase"),
FULL_ART("full art"),
EXTENDED_ART("extended art"),
ALTERNATE_ART("alternate art"),
ALTERNATE_FRAME("alternate frame"),
RETRO_FRAME("retro frame"),
BUY_A_BOX("buy a box"),
PROMO("promo"),
PRERELEASE_PROMO("prerelease promo"),
BUNDLE("bundle"),
BOX_TOPPER("box topper"),
DUNGEONS("dungeons"),
JUMPSTART("jumpstart"),
REBALANCED("rebalanced"),
ETERNAL("eternal");
ETERNAL("eternal"),
CONJURED("conjured"),
SCHEME("scheme");

private final String name;

Expand Down Expand Up @@ -215,7 +211,7 @@ public String toString() {
*/
public static String getSortableCollectorNumber(final String collectorNumber){
String inputCollNumber = collectorNumber;
if (collectorNumber == null || collectorNumber.length() == 0)
if (collectorNumber == null || collectorNumber.isEmpty())
inputCollNumber = "50000"; // very big number of 5 digits to have them in last positions

String matchedCollNr = sortableCollNumberLookup.getOrDefault(inputCollNumber, null);
Expand Down Expand Up @@ -379,7 +375,6 @@ private static Date parseDate(String date) {
public String getSlotReplaceCommonWith() { return slotReplaceCommonWith; }
public String getAdditionalSheetForFoils() { return additionalSheetForFoils; }
public String getAdditionalUnlockSet() { return additionalUnlockSet; }
public boolean getSmallSetOverride() { return smallSetOverride; }
public String getDoublePickDuringDraft() { return doublePickDuringDraft; }
public String getBoosterMustContain() { return boosterMustContain; }
public String getBoosterReplaceSlotFromPrintSheet() { return boosterReplaceSlotFromPrintSheet; }
Expand Down Expand Up @@ -514,7 +509,7 @@ public List<PrintSheet> getPrintSheetsBySection() {
for (CardInSet card : cards) {
int index = 1;
if (cardToIndex.containsKey(card.name)) {
index = cardToIndex.get(card.name);
index = cardToIndex.get(card.name) + 1;
}

cardToIndex.put(card.name, index);
Expand Down Expand Up @@ -709,9 +704,6 @@ protected CardEdition read(File file) {
res.fatPackExtraSlots = metadata.get("FatPackExtraSlots", "");

switch (metadata.get("foil", "newstyle").toLowerCase()) {
case "notsupported":
res.foilType = FoilType.NOT_SUPPORTED;
break;
case "oldstyle":
case "classic":
res.foilType = FoilType.OLD_STYLE;
Expand All @@ -720,6 +712,7 @@ protected CardEdition read(File file) {
case "modern":
res.foilType = FoilType.MODERN;
break;
case "notsupported":
default:
res.foilType = FoilType.NOT_SUPPORTED;
break;
Expand Down Expand Up @@ -774,7 +767,7 @@ private void initAliases(CardEdition E){ //Add the alias to the edition here, to
public void add(CardEdition item) { //Even though we want it to be read only, make an exception for custom content.
if(lock) throw new UnsupportedOperationException("This is a read-only storage");
else map.put(item.getName(), item);
};
}
public void append(CardEdition.Collection C){ //Append custom editions
if (lock) throw new UnsupportedOperationException("This is a read-only storage");
for(CardEdition E : C){ //Update the alias list as above or else it'll fail to look up.
Expand Down Expand Up @@ -908,7 +901,7 @@ public static CardEdition getPreferredArtEditionWithAllBasicLands() {
StaticData.instance().getEditions().getOrderedEditions(),
com.google.common.base.Predicates.and(hasBasicLands, artPreference::accept));
Iterator<CardEdition> editionsIterator = editionsWithBasicLands.iterator();
List<CardEdition> selectedEditions = new ArrayList<CardEdition>();
List<CardEdition> selectedEditions = new ArrayList<>();
while (editionsIterator.hasNext())
selectedEditions.add(editionsIterator.next());
if (selectedEditions.isEmpty())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ public static List<PaperCard> getBoosterPack(SealedTemplate template) {
}

List<PaperCard> result = new ArrayList<>();
List<PrintSheet> sheetsUsed = new ArrayList<>();

CardEdition edition = StaticData.instance().getEditions().get(template.getEdition());

Expand Down Expand Up @@ -233,7 +232,6 @@ public static List<PaperCard> getBoosterPack(SealedTemplate template) {
if (sheetKey.startsWith("wholeSheet")) {
PrintSheet ps = getPrintSheet(sheetKey);
result.addAll(ps.all());
sheetsUsed.add(ps);
continue;
}

Expand All @@ -252,7 +250,7 @@ public static List<PaperCard> getBoosterPack(SealedTemplate template) {
if ((edition.getName().equals("Planeshift")) &&
(slotType.startsWith(BoosterSlots.RARE))
&& (foilSlot.startsWith(BoosterSlots.SPECIAL))
) {
) {
numCards--;
}
}
Expand All @@ -264,7 +262,6 @@ public static List<PaperCard> getBoosterPack(SealedTemplate template) {
: edition.getSlotReplaceCommonWith().trim();
PrintSheet replaceSheet = getPrintSheet(replaceKey);
result.addAll(replaceSheet.random(1, true));
sheetsUsed.add(replaceSheet);
System.out.println("Common was replaced with something from the replace sheet...");
replaceCommon = false;
}
Expand All @@ -283,7 +280,6 @@ public static List<PaperCard> getBoosterPack(SealedTemplate template) {
}

result.addAll(paperCards);
sheetsUsed.add(ps);

if (foilInThisSlot) {
if (!foilAtEndOfPack) {
Expand Down Expand Up @@ -395,8 +391,6 @@ public static List<PaperCard> getBoosterPack(SealedTemplate template) {
public static List<PaperCard> getBoosterPack(SealedTemplateWithSlots template) {
// SealedTemplateWithSlots ignores all Edition level params
// Instead each slot defines their percentages on their own

CardEdition edition = StaticData.instance().getEditions().get(template.getEdition());
List<PaperCard> result = new ArrayList<>();
Map<String, BoosterSlot> boosterSlots = template.getNamedSlots();

Expand Down Expand Up @@ -501,7 +495,7 @@ private static void ensureGuaranteedCardInBooster(List<PaperCard> result, Sealed
* Replaces an already present card in the booster with a card from the supplied print sheet.
* Nothing is replaced if there is no matching rarity found.
* @param booster in which a card gets replaced
* @param printSheetKey
* @param printSheetKey print sheet key from which take the replacement card
*/
public static void replaceCardFromExtraSheet(List<PaperCard> booster, String printSheetKey) {
PrintSheet replacementSheet = StaticData.instance().getPrintSheets().get(printSheetKey);
Expand All @@ -516,7 +510,7 @@ public static void replaceCardFromExtraSheet(List<PaperCard> booster, String pri
* @param toAdd new card which replaces a card in the booster
*/
public static void replaceCard(List<PaperCard> booster, PaperCard toAdd) {
Predicate<PaperCard> rarityPredicate = null;
Predicate<PaperCard> rarityPredicate;
switch (toAdd.getRarity()) {
case BasicLand:
rarityPredicate = Presets.IS_BASIC_LAND;
Expand Down Expand Up @@ -573,11 +567,10 @@ public static void addCardsFromExtraSheet(List<PaperCard> dest, String printShee
}
}

@SuppressWarnings("unchecked")
public static PrintSheet makeSheet(String sheetKey, Iterable<PaperCard> src) {
PrintSheet ps = new PrintSheet(sheetKey);
String[] sKey = TextUtil.splitWithParenthesis(sheetKey, ' ', 2);
Predicate<PaperCard> setPred = (Predicate<PaperCard>) (sKey.length > 1 ? IPaperCard.Predicates.printedInSets(sKey[1].split(" ")) : Predicates.alwaysTrue());
Predicate<PaperCard> setPred = (sKey.length > 1 ? IPaperCard.Predicates.printedInSets(sKey[1].split(" ")) : Predicates.alwaysTrue());

List<String> operators = new LinkedList<>(Arrays.asList(TextUtil.splitWithParenthesis(sKey[0], ':')));
Predicate<PaperCard> extraPred = buildExtraPredicate(operators);
Expand Down Expand Up @@ -679,11 +672,11 @@ private static Predicate<PaperCard> buildExtraPredicate(List<String> operators)
Predicate<PaperCard> toAdd = null;
if (operator.equalsIgnoreCase(BoosterSlots.DUAL_FACED_CARD)) {
toAdd = Predicates.compose(
Predicates.or(
Predicates.or(
CardRulesPredicates.splitType(CardSplitType.Transform),
CardRulesPredicates.splitType(CardSplitType.Meld),
CardRulesPredicates.splitType(CardSplitType.Modal)
),
),
PaperCard::getRules);
} else if (operator.equalsIgnoreCase(BoosterSlots.LAND)) { toAdd = Predicates.compose(CardRulesPredicates.Presets.IS_LAND, PaperCard::getRules);
} else if (operator.equalsIgnoreCase(BoosterSlots.BASIC_LAND)) { toAdd = IPaperCard.Predicates.Presets.IS_BASIC_LAND;
Expand Down
Loading