From dc17e3fb905f11d87b569dbba30e01843d5946b8 Mon Sep 17 00:00:00 2001 From: "Alex W. Jackson" Date: Fri, 11 Mar 2022 03:37:46 -0500 Subject: [PATCH] Implement collation for MM3 and IMA --- Mage.Sets/src/mage/sets/IconicMasters.java | 103 ++++++++++++++++++ .../src/mage/sets/ModernMasters2017.java | 102 +++++++++++++++++ 2 files changed, 205 insertions(+) diff --git a/Mage.Sets/src/mage/sets/IconicMasters.java b/Mage.Sets/src/mage/sets/IconicMasters.java index a211bac386..0774344baa 100644 --- a/Mage.Sets/src/mage/sets/IconicMasters.java +++ b/Mage.Sets/src/mage/sets/IconicMasters.java @@ -1,9 +1,16 @@ package mage.sets; import mage.cards.ExpansionSet; +import mage.collation.BoosterCollator; +import mage.collation.BoosterStructure; +import mage.collation.CardRun; +import mage.collation.RarityConfiguration; import mage.constants.Rarity; import mage.constants.SetType; +import java.util.ArrayList; +import java.util.List; + /** * @author MajorLazar */ @@ -276,4 +283,100 @@ public final class IconicMasters extends ExpansionSet { cards.add(new SetCardInfo("Wrench Mind", 115, Rarity.COMMON, mage.cards.w.WrenchMind.class)); cards.add(new SetCardInfo("Yosei, the Morning Star", 39, Rarity.RARE, mage.cards.y.YoseiTheMorningStar.class)); } + + @Override + public BoosterCollator createCollator() { + return new IconicMastersCollator(); + } +} + +// Booster collation info from https://www.lethe.xyz/mtg/collation/ima.html +// Using USA collation for common/uncommon, rare collation inferred from other sets +class IconicMastersCollator implements BoosterCollator { + private final CardRun commonA = new CardRun(true, "151", "16", "51", "126", "23", "50", "124", "19", "68", "150", "35", "76", "153", "12", "54", "119", "24", "41", "139", "34", "70", "137", "33", "66", "132", "16", "67", "135", "22", "51", "127", "32", "60", "124", "19", "41", "151", "35", "68", "150", "27", "72", "119", "23", "50", "126", "12", "66", "153", "24", "76", "139", "34", "70", "135", "33", "54", "137", "32", "60", "132", "22", "67", "127", "27", "72"); + private final CardRun commonB = new CardRun(true, "105", "165", "113", "167", "79", "176", "80", "170", "86", "187", "91", "185", "84", "173", "85", "182", "115", "178", "103", "161", "90", "191", "79", "167", "113", "170", "80", "165", "105", "176", "84", "185", "115", "187", "91", "173", "103", "182", "86", "161", "85", "178", "90", "167", "79", "191", "113", "165", "91", "176", "80", "187", "84", "185", "105", "161", "86", "170", "85", "173", "90", "182", "115", "178", "103", "191"); + private final CardRun commonC1 = new CardRun(true, "15", "146", "1", "71", "171", "102", "53", "123", "248", "219", "244", "160", "88", "57", "6", "141", "226", "92", "130", "29", "181", "216", "133", "15", "45", "1", "102", "177", "146", "229", "4", "114", "219", "53", "123", "171", "71", "226", "29", "88", "141", "248", "4", "229", "57", "177", "92", "6", "133", "216", "160", "130", "45", "114", "181"); + private final CardRun commonC2 = new CardRun(true, "190", "89", "61", "129", "222", "111", "25", "43", "158", "17", "214", "235", "13", "104", "154", "69", "117", "218", "25", "89", "61", "190", "214", "235", "104", "129", "43", "13", "158", "222", "111", "244", "117", "154", "25", "69", "17", "61", "214", "89", "111", "218", "190", "104", "43", "129", "235", "13", "222", "158", "154", "69", "218", "117", "17"); + private final CardRun uncommonA = new CardRun(true, "148", "247", "5", "202", "168", "107", "220", "192", "73", "217", "188", "121", "38", "93", "232", "77", "169", "2", "236", "206", "227", "125", "81", "44", "134", "243", "14", "204", "155", "112", "221", "202", "56", "220", "188", "131", "5", "97", "241", "52", "175", "38", "247", "211", "213", "121", "93", "77", "148", "232", "21", "206", "155", "81", "217", "192", "73", "221", "168", "125", "14", "107", "236", "44", "169", "2", "243", "204", "227", "134", "112", "52", "131", "241", "5", "202", "175", "97", "213", "211", "56", "220", "188", "148", "21", "93", "236", "73", "168", "14", "232", "206", "217", "121", "107", "77", "125", "247", "38", "192", "155", "81", "227", "204", "44", "213", "169", "131", "21", "112", "243", "56", "175", "2", "241", "211", "221", "134", "97", "52"); + private final CardRun uncommonB = new CardRun(true, "196", "156", "94", "225", "198", "46", "230", "166", "147", "7", "100", "245", "64", "186", "36", "234", "194", "224", "128", "109", "58", "143", "233", "3", "193", "162", "87", "231", "196", "40", "215", "156", "147", "37", "83", "249", "59", "180", "197", "239", "30", "225", "128", "100", "64", "142", "245", "36", "198", "230", "94", "166", "193", "58", "224", "186", "234", "3", "109", "147", "46", "156", "7", "239", "194", "231", "140", "87", "40", "143", "249", "30", "197", "162", "83", "225", "196", "64", "215", "166", "142", "36", "100", "233", "59", "180", "37", "245", "198", "230", "140", "94", "46", "128", "234", "7", "193", "186", "109", "231", "194", "58", "224", "162", "143", "3", "83", "233", "59", "180", "37", "249", "197", "215", "142", "87", "40", "140", "239", "30"); + private final CardRun rare = new CardRun(false, "9", "10", "20", "26", "28", "31", "39", "42", "48", "49", "55", "63", "74", "75", "78", "82", "95", "96", "99", "106", "110", "116", "118", "120", "122", "138", "144", "145", "159", "163", "164", "172", "174", "179", "184", "195", "199", "200", "201", "203", "205", "207", "208", "209", "210", "212", "223", "228", "237", "238", "240", "242", "246", "9", "10", "20", "26", "28", "31", "39", "42", "48", "49", "55", "63", "74", "75", "78", "82", "95", "96", "99", "106", "110", "116", "118", "120", "122", "138", "144", "145", "159", "163", "164", "172", "174", "179", "184", "195", "199", "200", "201", "203", "205", "207", "208", "209", "210", "212", "223", "228", "237", "238", "240", "242", "246", "8", "11", "18", "47", "62", "65", "98", "101", "108", "136", "149", "152", "157", "183", "189"); + private final CardRun foilCommon = new CardRun(true, "214", "66", "170", "85", "124", "34", "43", "92", "123", "160", "15", "219", "67", "171", "90", "126", "35", "53", "104", "129", "190", "12", "235", "68", "173", "103", "127", "6", "50", "102", "141", "158", "16", "229", "70", "176", "105", "132", "19", "51", "111", "117", "181", "17", "222", "57", "178", "113", "139", "32", "54", "79", "133", "191", "22", "244", "61", "182", "114", "150", "4", "60", "86", "146", "185", "23", "1", "71", "187", "115", "151", "25", "72", "91", "119", "161", "24", "216", "45", "154", "88", "153", "13", "76", "80", "135", "165", "27", "218", "69", "177", "89", "130", "29", "41", "84", "137", "167", "33", "248", "226"); + + private final BoosterStructure AABBC1C1C1C1C1C1 = new BoosterStructure( + commonA, commonA, + commonB, commonB, + commonC1, commonC1, commonC1, commonC1, commonC1, commonC1 + ); + private final BoosterStructure AAABBC1C1C1C1C1 = new BoosterStructure( + commonA, commonA, commonA, + commonB, commonB, + commonC1, commonC1, commonC1, commonC1, commonC1 + ); + private final BoosterStructure AAAABBC2C2C2C2 = new BoosterStructure( + commonA, commonA, commonA, commonA, + commonB, commonB, + commonC2, commonC2, commonC2, commonC2 + ); + private final BoosterStructure AAAABBBC2C2C2 = new BoosterStructure( + commonA, commonA, commonA, commonA, + commonB, commonB, commonB, + commonC2, commonC2, commonC2 + ); + private final BoosterStructure AAB = new BoosterStructure(uncommonA, uncommonA, uncommonB); + private final BoosterStructure ABB = new BoosterStructure(uncommonA, uncommonB, uncommonB); + private final BoosterStructure R1 = new BoosterStructure(rare); + private final BoosterStructure FC = new BoosterStructure(foilCommon); + private final BoosterStructure FUA = new BoosterStructure(uncommonA); + private final BoosterStructure FUB = new BoosterStructure(uncommonB); + + // In order for equal numbers of each common to exist, the average booster must contain: + // 3.27 A commons (36 / 11) + // 2.18 B commons (24 / 11) + // 2.73 C1 commons (30 / 11, or 60 / 11 in each C1 booster) + // 1.82 C2 commons (20 / 11, or 40 / 11 in each C2 booster) + // These numbers are the same for all sets with 101 commons in A/B/C1/C2 print runs + // and with 10 common slots per booster + private final RarityConfiguration commonRuns = new RarityConfiguration( + AABBC1C1C1C1C1C1, + AABBC1C1C1C1C1C1, + AABBC1C1C1C1C1C1, + AABBC1C1C1C1C1C1, + AABBC1C1C1C1C1C1, + AAABBC1C1C1C1C1, + AAABBC1C1C1C1C1, + AAABBC1C1C1C1C1, + AAABBC1C1C1C1C1, + AAABBC1C1C1C1C1, + AAABBC1C1C1C1C1, + + AAAABBC2C2C2C2, + AAAABBC2C2C2C2, + AAAABBC2C2C2C2, + AAAABBC2C2C2C2, + AAAABBC2C2C2C2, + AAAABBC2C2C2C2, + AAAABBC2C2C2C2, + AAAABBBC2C2C2, + AAAABBBC2C2C2, + AAAABBBC2C2C2, + AAAABBBC2C2C2 + ); + private final RarityConfiguration uncommonRuns = new RarityConfiguration(AAB, ABB); + private final RarityConfiguration rareRuns = new RarityConfiguration(R1); + private final RarityConfiguration foilRuns = new RarityConfiguration( + FC, FC, FC, FC, FC, FC, FC, FC, FC, FC, + FC, FC, FC, FC, FC, FC, FC, FC, FC, FC, + FUA, FUB, FUA, FUB, FUA, FUB, + R1, R1 + ); + + @Override + public List makeBooster() { + List booster = new ArrayList<>(); + booster.addAll(commonRuns.getNext().makeRun()); + booster.addAll(uncommonRuns.getNext().makeRun()); + booster.addAll(rareRuns.getNext().makeRun()); + booster.addAll(foilRuns.getNext().makeRun()); + return booster; + } } diff --git a/Mage.Sets/src/mage/sets/ModernMasters2017.java b/Mage.Sets/src/mage/sets/ModernMasters2017.java index 8137d6771d..7a364a114c 100644 --- a/Mage.Sets/src/mage/sets/ModernMasters2017.java +++ b/Mage.Sets/src/mage/sets/ModernMasters2017.java @@ -1,9 +1,16 @@ package mage.sets; import mage.cards.ExpansionSet; +import mage.collation.BoosterCollator; +import mage.collation.BoosterStructure; +import mage.collation.CardRun; +import mage.collation.RarityConfiguration; import mage.constants.Rarity; import mage.constants.SetType; +import java.util.ArrayList; +import java.util.List; + /** * @author fireshoes */ @@ -276,4 +283,99 @@ public final class ModernMasters2017 extends ExpansionSet { cards.add(new SetCardInfo("Zur the Enchanter", 204, Rarity.RARE, mage.cards.z.ZurTheEnchanter.class)); } + @Override + public BoosterCollator createCollator() { + return new ModernMasters2017Collator(); + } +} + +// Booster collation info from https://www.lethe.xyz/mtg/collation/mm3.html +// Using USA collation for common/uncommon, rare collation inferred from other sets +class ModernMasters2017Collator implements BoosterCollator { + private final CardRun commonA = new CardRun(true, "154", "234", "160", "184", "73", "248", "131", "192", "11", "236", "43", "151", "159", "119", "241", "156", "188", "86", "246", "205", "207", "100", "154", "172", "70", "230", "169", "166", "118", "248", "150", "38", "92", "7", "178", "156", "236", "73", "192", "131", "184", "160", "234", "151", "11", "159", "43", "241", "205", "188", "118", "172", "86", "246", "100", "150", "166", "70", "207", "7", "230", "119", "38", "169", "178", "92"); + private final CardRun commonB = new CardRun(true, "140", "74", "138", "67", "124", "71", "137", "82", "135", "78", "123", "62", "136", "65", "125", "60", "126", "80", "129", "79", "133", "71", "138", "82", "123", "78", "124", "81", "126", "62", "137", "65", "140", "74", "135", "60", "129", "67", "125", "80", "136", "79", "133", "71", "138", "65", "123", "78", "124", "60", "137", "81", "140", "74", "126", "62", "136", "82", "135", "67", "129", "80", "125", "79", "133", "81"); + private final CardRun commonC1 = new CardRun(true, "14", "48", "168", "247", "97", "16", "34", "157", "53", "93", "29", "41", "242", "208", "104", "10", "47", "237", "211", "111", "18", "30", "231", "209", "89", "1", "48", "235", "168", "97", "14", "34", "94", "242", "111", "29", "41", "157", "231", "93", "16", "53", "209", "247", "94", "1", "47", "211", "235", "104", "18", "30", "208", "237", "89"); + private final CardRun commonC2 = new CardRun(true, "109", "8", "51", "113", "24", "44", "102", "28", "58", "110", "23", "39", "114", "21", "52", "99", "5", "42", "109", "24", "51", "102", "8", "44", "113", "23", "58", "99", "21", "39", "110", "28", "52", "114", "5", "51", "109", "23", "42", "102", "10", "44", "110", "24", "39", "113", "8", "52", "114", "21", "58", "99", "5", "42", "28"); + private final CardRun uncommonA = new CardRun(true, "75", "174", "225", "49", "155", "224", "149", "238", "212", "215", "9", "228", "37", "222", "167", "245", "165", "223", "183", "226", "195", "88", "201", "217", "2", "198", "227", "103", "181", "219", "149", "220", "193", "130", "152", "224", "49", "210", "225", "27", "202", "233", "199", "215", "174", "75", "171", "9", "222", "212", "226", "37", "165", "223", "167", "219", "201", "2", "181", "217", "103", "195", "227", "183", "228", "155", "88", "198", "215", "199", "238", "171", "27", "210", "220", "130", "202", "245", "149", "223", "152", "49", "174", "233", "212", "225", "193", "37", "155", "9", "224", "165", "217", "75", "181", "228", "167", "222", "198", "88", "171", "238", "183", "227", "210", "2", "195", "226", "103", "201", "219", "27", "202", "245", "199", "220", "152", "130", "233", "193"); + private final CardRun uncommonB = new CardRun(true, "142", "173", "15", "95", "145", "170", "61", "180", "31", "12", "213", "127", "6", "186", "59", "17", "56", "197", "112", "128", "85", "179", "120", "107", "33", "203", "106", "189", "57", "117", "185", "95", "243", "173", "115", "45", "15", "170", "61", "191", "145", "12", "196", "17", "68", "194", "56", "87", "120", "197", "6", "83", "31", "179", "142", "186", "106", "127", "213", "45", "112", "203", "59", "180", "33", "128", "185", "107", "85", "189", "68", "170", "145", "87", "196", "117", "31", "173", "243", "95", "61", "186", "115", "179", "57", "83", "142", "191", "56", "12", "213", "127", "33", "194", "59", "180", "6", "107", "185", "128", "85", "197", "120", "17", "112", "203", "68", "117", "196", "45", "15", "189", "115", "191", "243", "87", "57", "194", "106", "83"); + private final CardRun rare = new CardRun(false, "3", "19", "20", "22", "25", "26", "32", "35", "36", "40", "46", "55", "63", "64", "66", "69", "77", "84", "90", "96", "98", "101", "108", "116", "121", "132", "134", "139", "143", "144", "146", "147", "148", "153", "158", "162", "163", "164", "175", "176", "182", "190", "204", "206", "214", "216", "218", "221", "229", "239", "240", "244", "249", "3", "19", "20", "22", "25", "26", "32", "35", "36", "40", "46", "55", "63", "64", "66", "69", "77", "84", "90", "96", "98", "101", "108", "116", "121", "132", "134", "139", "143", "144", "146", "147", "148", "153", "158", "162", "163", "164", "175", "176", "182", "190", "204", "206", "214", "216", "218", "221", "229", "239", "240", "244", "249", "4", "13", "50", "54", "72", "76", "91", "105", "122", "141", "161", "177", "187", "200", "232"); + private final CardRun foilCommon = new CardRun(true, "123", "11", "126", "39", "151", "58", "178", "81", "231", "125", "140", "124", "14", "129", "41", "154", "60", "184", "82", "234", "104", "150", "99", "16", "131", "42", "156", "62", "188", "86", "235", "109", "78", "100", "18", "133", "43", "157", "65", "192", "89", "236", "110", "79", "102", "21", "135", "44", "159", "67", "205", "92", "237", "111", "80", "1", "23", "136", "47", "160", "70", "207", "93", "241", "113", "52", "5", "24", "137", "48", "166", "71", "208", "94", "242", "114", "53", "7", "28", "138", "51", "168", "73", "209", "97", "246", "118", "34", "8", "29", "230", "248", "169", "74", "211", "172", "247", "119", "38", "10", "30"); + + private final BoosterStructure AABBC1C1C1C1C1C1 = new BoosterStructure( + commonA, commonA, + commonB, commonB, + commonC1, commonC1, commonC1, commonC1, commonC1, commonC1 + ); + private final BoosterStructure AAABBC1C1C1C1C1 = new BoosterStructure( + commonA, commonA, commonA, + commonB, commonB, + commonC1, commonC1, commonC1, commonC1, commonC1 + ); + private final BoosterStructure AAAABBC2C2C2C2 = new BoosterStructure( + commonA, commonA, commonA, commonA, + commonB, commonB, + commonC2, commonC2, commonC2, commonC2 + ); + private final BoosterStructure AAAABBBC2C2C2 = new BoosterStructure( + commonA, commonA, commonA, commonA, + commonB, commonB, commonB, + commonC2, commonC2, commonC2 + ); + private final BoosterStructure AAB = new BoosterStructure(uncommonA, uncommonA, uncommonB); + private final BoosterStructure ABB = new BoosterStructure(uncommonA, uncommonB, uncommonB); + private final BoosterStructure R1 = new BoosterStructure(rare); + private final BoosterStructure FC = new BoosterStructure(foilCommon); + private final BoosterStructure FUA = new BoosterStructure(uncommonA); + private final BoosterStructure FUB = new BoosterStructure(uncommonB); + + // In order for equal numbers of each common to exist, the average booster must contain: + // 3.27 A commons (36 / 11) + // 2.18 B commons (24 / 11) + // 2.73 C1 commons (30 / 11, or 60 / 11 in each C1 booster) + // 1.82 C2 commons (20 / 11, or 40 / 11 in each C2 booster) + // These numbers are the same for all sets with 101 commons in A/B/C1/C2 print runs + // and with 10 common slots per booster + private final RarityConfiguration commonRuns = new RarityConfiguration( + AABBC1C1C1C1C1C1, + AABBC1C1C1C1C1C1, + AABBC1C1C1C1C1C1, + AABBC1C1C1C1C1C1, + AABBC1C1C1C1C1C1, + AAABBC1C1C1C1C1, + AAABBC1C1C1C1C1, + AAABBC1C1C1C1C1, + AAABBC1C1C1C1C1, + AAABBC1C1C1C1C1, + AAABBC1C1C1C1C1, + + AAAABBC2C2C2C2, + AAAABBC2C2C2C2, + AAAABBC2C2C2C2, + AAAABBC2C2C2C2, + AAAABBC2C2C2C2, + AAAABBC2C2C2C2, + AAAABBC2C2C2C2, + AAAABBBC2C2C2, + AAAABBBC2C2C2, + AAAABBBC2C2C2, + AAAABBBC2C2C2 + ); + private final RarityConfiguration uncommonRuns = new RarityConfiguration(AAB, ABB); + private final RarityConfiguration rareRuns = new RarityConfiguration(R1); + private final RarityConfiguration foilRuns = new RarityConfiguration( + FC, FC, FC, FC, FC, FC, FC, FC, FC, FC, + FC, FC, FC, FC, FC, FC, FC, FC, FC, FC, + FUA, FUB, FUA, FUB, FUA, FUB, + R1, R1 + ); + + @Override + public List makeBooster() { + List booster = new ArrayList<>(); + booster.addAll(commonRuns.getNext().makeRun()); + booster.addAll(uncommonRuns.getNext().makeRun()); + booster.addAll(rareRuns.getNext().makeRun()); + booster.addAll(foilRuns.getNext().makeRun()); + return booster; + } }