Skip to content

Commit 0872f09

Browse files
authored
Implement [BLB] Collation
magefree#13160
1 parent 6b9532f commit 0872f09

File tree

1 file changed

+215
-0
lines changed

1 file changed

+215
-0
lines changed

Mage.Sets/src/mage/sets/Bloomburrow.java

+215
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
import mage.cards.ExpansionSet;
44
import mage.constants.Rarity;
55
import mage.constants.SetType;
6+
import mage.cards.repository.CardCriteria;
7+
import mage.cards.repository.CardInfo;
8+
import mage.cards.repository.CardRepository;
9+
import mage.collation.BoosterCollator;
10+
import mage.collation.BoosterStructure;
11+
import mage.collation.CardRun;
12+
import mage.collation.RarityConfiguration;
13+
import mage.util.RandomUtil;
14+
15+
import java.util.ArrayList;
16+
import java.util.List;
617

718
/**
819
* @author TheElk801
@@ -310,4 +321,208 @@ private Bloomburrow() {
310321
cards.add(new SetCardInfo("Ygra, Eater of All", 294, Rarity.MYTHIC, mage.cards.y.YgraEaterOfAll.class, NON_FULL_USE_VARIOUS));
311322
cards.add(new SetCardInfo("Zoraline, Cosmos Caller", 242, Rarity.RARE, mage.cards.z.ZoralineCosmosCaller.class));
312323
}
324+
325+
@Override
326+
protected void generateBoosterMap() {
327+
super.generateBoosterMap();
328+
329+
CardInfo cardInfo;
330+
for( int cn = 54 ; cn < 64 ; cn++ ){
331+
cardInfo = CardRepository.instance.findCard("SPG", "" + cn);
332+
if( cardInfo != null ){
333+
inBoosterMap.put("SPG_" + cn, cardInfo);
334+
}else{
335+
throw new IllegalArgumentException("Card not found: " + "SPG_" + cn);
336+
}
337+
}
338+
}
339+
340+
@Override
341+
public BoosterCollator createCollator() {
342+
return new BloomburrowCollator();
343+
}
344+
}
345+
346+
// Booster collation info from https://vm1.substation33.com/tiera/t/lethe/blb.html
347+
// Using Japanese collation plus other info inferred from various sources
348+
class BloomburrowCollator implements BoosterCollator {
349+
350+
private final CardRun commonA = new CardRun(false, "42", "3", "245", "176", "26", "106", "160");
351+
private final CardRun commonB = new CardRun(true, "201", "156", "229", "198", "144", "210", "193", "130", "243", "163", "136", "225", "189", "153", "237", "182", "229", "151", "235", "167", "161", "226", "193", "150", "220", "189", "136", "216", "200", "144", "235", "167", "130", "226", "195", "122", "251", "175", "148", "208", "170", "156", "225", "200", "123", "210", "201", "122", "243", "190", "148", "251", "175", "232", "151", "237", "163", "142", "208", "198", "150", "210", "189", "153", "244", "182", "161", "220", "163", "142", "229", "193", "150", "237", "198", "144", "244", "182", "243", "161", "232", "195", "153", "216", "201", "142", "235", "170", "136", "226", "200", "151", "232", "190", "130", "216", "195", "123", "251", "167", "156", "220", "175", "122", "244", "170", "148", "225", "190", "123", "208");
352+
private final CardRun commonC = new CardRun(true, "84", "62", "32", "64", "117", "20", "71", "93", "23", "45", "102", "77", "32", "96", "62", "117", "1", "105", "80", "91", "17", "45", "254", "109", "35", "71", "110", "8", "59", "89", "1", "56", "261", "82", "7", "62", "96", "37", "50", "93", "20", "56", "110", "32", "261", "67", "84", "7", "69", "117", "25", "46", "91", "37", "50", "115", "35", "59", "102", "23", "77", "105", "25", "64", "89", "8", "80", "109", "39", "69", "254", "115", "17", "56", "93", "23", "71", "91", "37", "67", "96", "261", "7", "69", "82", "35", "50", "109", "39", "46", "84", "8", "45", "102", "20", "64", "89", "25", "254", "59", "105", "17", "77", "115", "80", "1", "110", "67", "82", "39", "46");
353+
private final CardRun uncommonA = new CardRun(true, "250", "194", "248", "159", "51", "83", "30", "186", "5", "203", "246", "188", "108", "178", "250", "51", "83", "194", "248", "159", "30", "188", "246", "203", "249", "186", "5", "108", "250", "178", "10", "248", "83", "194", "30", "159", "249", "203", "5", "186", "51", "108", "246", "10", "188", "250", "194", "249", "159", "30", "203", "83", "5", "246", "188", "10", "108", "186", "248", "178", "51", "203", "30", "194", "250", "5", "159", "186", "108", "249", "51", "188", "248", "178", "246", "10", "83", "186", "159", "203", "108", "188", "249", "194", "30", "248", "178", "10", "250", "83", "249", "159", "30", "203", "83", "5", "246", "188", "10", "178", "51", "250", "194", "249", "5", "246", "10", "108", "186", "248", "178", "51");
354+
private final CardRun uncommonB = new CardRun(true, "213", "31", "256", "228", "22", "236", "33", "238", "11", "259", "233", "21", "240", "13", "228", "256", "14", "213", "22", "258", "33", "236", "255", "16", "234", "27", "257", "24", "259", "11", "206", "15", "222", "31", "238", "21", "233", "16", "234", "4", "258", "19", "236", "27", "222", "31", "256", "11", "231", "13", "233", "24", "255", "4", "206", "16", "240", "21", "228", "22", "213", "257", "14", "238", "33", "231", "259", "15", "255", "31", "234", "24", "206", "16", "222", "4", "259", "228", "22", "238", "27", "213", "21", "258", "13", "233", "33", "231", "19", "236", "15", "257", "11", "256", "14", "258", "13", "240", "19", "231", "27", "222", "4", "234", "14", "206", "15", "255", "24", "257", "240", "19");
355+
private final CardRun uncommonC = new CardRun(true, "113", "55", "141", "87", "74", "165", "104", "135", "247", "177", "149", "97", "127", "164", "162", "63", "145", "116", "60", "138", "174", "118", "52", "146", "114", "73", "128", "94", "199", "137", "57", "147", "173", "58", "116", "162", "65", "145", "70", "114", "137", "247", "165", "52", "87", "58", "146", "76", "97", "43", "104", "179", "141", "63", "168", "70", "128", "73", "135", "113", "55", "199", "138", "72", "121", "127", "177", "98", "44", "126", "101", "169", "131", "185", "92", "74", "85", "174", "95", "125", "173", "57", "118", "157", "164", "60", "147", "166", "94", "149", "179", "98", "43", "126", "95", "185", "48", "125", "44", "168", "85", "72", "101", "166", "65", "157", "92", "48", "169", "121", "76", "131");
356+
private final CardRun rare = new CardRun(false, "204", "204", "124", "124", "41", "41", "205", "205", "129", "129", "207", "207", "6", "6", "209", "209", "86", "86", "88", "88", "90", "90", "9", "9", "47", "47", "211", "211", "133", "133", "12", "12", "252", "252", "171", "171", "134", "134", "212", "212", "172", "172", "253", "253", "214", "214", "139", "139", "140", "140", "180", "180", "99", "99", "18", "18", "221", "221", "181", "181", "53", "53", "223", "223", "224", "224", "143", "143", "184", "184", "61", "61", "227", "227", "103", "103", "187", "187", "66", "66", "28", "28", "111", "111", "191", "191", "34", "34", "75", "75", "155", "155", "196", "196", "197", "197", "260", "260", "78", "78", "158", "158", "79", "79", "202", "202", "36", "36", "119", "119", "239", "239", "40", "40", "120", "120", "81", "81", "242", "242", "2", "132", "49", "215", "217", "218", "54", "183", "100", "230", "107", "192", "112", "152", "29", "68", "154", "219", "38", "241");
357+
private final CardRun listGuest = new CardRun(false, "SPG_54", "SPG_55", "SPG_56", "SPG_57", "SPG_58", "SPG_59", "SPG_60", "SPG_61", "SPG_62", "SPG_63");
358+
// boosterfun showcase variants not included
359+
private final CardRun land = new CardRun(false, "262", "262", "262", "262", "263", "263", "263", "264", "264", "265", "266", "266", "266", "266", "267", "267", "267", "268", "268", "269", "270", "270", "270", "270", "271", "271", "271", "272", "272", "273", "274", "274", "274", "274", "275", "275", "275", "276", "276", "277", "278", "278", "278", "278", "279", "279", "279", "280", "280", "281");
360+
361+
// because a foil card is independant from sorted runs, repeated as unsorted runs
362+
private final CardRun foilCommonB = new CardRun(true, "201", "156", "229", "198", "144", "210", "193", "130", "243", "163", "136", "225", "189", "153", "237", "182", "229", "151", "235", "167", "161", "226", "193", "150", "220", "189", "136", "216", "200", "144", "235", "167", "130", "226", "195", "122", "251", "175", "148", "208", "170", "156", "225", "200", "123", "210", "201", "122", "243", "190", "148", "251", "175", "232", "151", "237", "163", "142", "208", "198", "150", "210", "189", "153", "244", "182", "161", "220", "163", "142", "229", "193", "150", "237", "198", "144", "244", "182", "243", "161", "232", "195", "153", "216", "201", "142", "235", "170", "136", "226", "200", "151", "232", "190", "130", "216", "195", "123", "251", "167", "156", "220", "175", "122", "244", "170", "148", "225", "190", "123", "208");
363+
private final CardRun foilCommonC = new CardRun(true, "84", "62", "32", "64", "117", "20", "71", "93", "23", "45", "102", "77", "32", "96", "62", "117", "1", "105", "80", "91", "17", "45", "254", "109", "35", "71", "110", "8", "59", "89", "1", "56", "261", "82", "7", "62", "96", "37", "50", "93", "20", "56", "110", "32", "261", "67", "84", "7", "69", "117", "25", "46", "91", "37", "50", "115", "35", "59", "102", "23", "77", "105", "25", "64", "89", "8", "80", "109", "39", "69", "254", "115", "17", "56", "93", "23", "71", "91", "37", "67", "96", "261", "7", "69", "82", "35", "50", "109", "39", "46", "84", "8", "45", "102", "20", "64", "89", "25", "254", "59", "105", "17", "77", "115", "80", "1", "110", "67", "82", "39", "46");
364+
private final CardRun foilUncommonA = new CardRun(true, "250", "194", "248", "159", "51", "83", "30", "186", "5", "203", "246", "188", "108", "178", "250", "51", "83", "194", "248", "159", "30", "188", "246", "203", "249", "186", "5", "108", "250", "178", "10", "248", "83", "194", "30", "159", "249", "203", "5", "186", "51", "108", "246", "10", "188", "250", "194", "249", "159", "30", "203", "83", "5", "246", "188", "10", "108", "186", "248", "178", "51", "203", "30", "194", "250", "5", "159", "186", "108", "249", "51", "188", "248", "178", "246", "10", "83", "186", "159", "203", "108", "188", "249", "194", "30", "248", "178", "10", "250", "83", "249", "159", "30", "203", "83", "5", "246", "188", "10", "178", "51", "250", "194", "249", "5", "246", "10", "108", "186", "248", "178", "51");
365+
private final CardRun foilUncommonB = new CardRun(true, "213", "31", "256", "228", "22", "236", "33", "238", "11", "259", "233", "21", "240", "13", "228", "256", "14", "213", "22", "258", "33", "236", "255", "16", "234", "27", "257", "24", "259", "11", "206", "15", "222", "31", "238", "21", "233", "16", "234", "4", "258", "19", "236", "27", "222", "31", "256", "11", "231", "13", "233", "24", "255", "4", "206", "16", "240", "21", "228", "22", "213", "257", "14", "238", "33", "231", "259", "15", "255", "31", "234", "24", "206", "16", "222", "4", "259", "228", "22", "238", "27", "213", "21", "258", "13", "233", "33", "231", "19", "236", "15", "257", "11", "256", "14", "258", "13", "240", "19", "231", "27", "222", "4", "234", "14", "206", "15", "255", "24", "257", "240", "19");
366+
private final CardRun foilUncommonC = new CardRun(true, "113", "55", "141", "87", "74", "165", "104", "135", "247", "177", "149", "97", "127", "164", "162", "63", "145", "116", "60", "138", "174", "118", "52", "146", "114", "73", "128", "94", "199", "137", "57", "147", "173", "58", "116", "162", "65", "145", "70", "114", "137", "247", "165", "52", "87", "58", "146", "76", "97", "43", "104", "179", "141", "63", "168", "70", "128", "73", "135", "113", "55", "199", "138", "72", "121", "127", "177", "98", "44", "126", "101", "169", "131", "185", "92", "74", "85", "174", "95", "125", "173", "57", "118", "157", "164", "60", "147", "166", "94", "149", "179", "98", "43", "126", "95", "185", "48", "125", "44", "168", "85", "72", "101", "166", "65", "157", "92", "48", "169", "121", "76", "131");
367+
368+
private final BoosterStructure BBBCCC = new BoosterStructure(
369+
commonB, commonB, commonB,
370+
commonC, commonC, commonC
371+
);
372+
private final BoosterStructure ABBBCCC = new BoosterStructure(
373+
commonA,
374+
commonB, commonB, commonB,
375+
commonC, commonC, commonC
376+
);
377+
private final BoosterStructure BBBBCCC = new BoosterStructure(
378+
commonB, commonB, commonB, commonB,
379+
commonC, commonC, commonC
380+
);
381+
private final BoosterStructure BBBCCCC = new BoosterStructure(
382+
commonB, commonB, commonB,
383+
commonC, commonC, commonC, commonC
384+
);
385+
private final BoosterStructure ABBBBCCC = new BoosterStructure(
386+
commonA,
387+
commonB, commonB, commonB, commonB,
388+
commonC, commonC, commonC
389+
);
390+
private final BoosterStructure ABBBCCCC = new BoosterStructure(
391+
commonA,
392+
commonB, commonB, commonB,
393+
commonC, commonC, commonC, commonC
394+
);
395+
private final BoosterStructure BBBBCCCC = new BoosterStructure(
396+
commonB, commonB, commonB, commonB,
397+
commonC, commonC, commonC, commonC
398+
);
399+
400+
private final BoosterStructure BCC = new BoosterStructure(
401+
uncommonB,
402+
uncommonC, uncommonC
403+
);
404+
private final BoosterStructure ABCC = new BoosterStructure(
405+
uncommonA,
406+
uncommonB,
407+
uncommonC, uncommonC
408+
);
409+
private final BoosterStructure BBCC = new BoosterStructure(
410+
uncommonB, uncommonB,
411+
uncommonC, uncommonC
412+
);
413+
private final BoosterStructure BCCC = new BoosterStructure(
414+
uncommonB,
415+
uncommonC, uncommonC, uncommonC
416+
);
417+
418+
private final BoosterStructure R1 = new BoosterStructure(rare);
419+
private final BoosterStructure R2 = new BoosterStructure(rare,rare);
420+
private final BoosterStructure L1 = new BoosterStructure(land);
421+
private final BoosterStructure Sg = new BoosterStructure(listGuest);
422+
private final BoosterStructure fcA = new BoosterStructure(commonA);
423+
private final BoosterStructure fcB = new BoosterStructure(foilCommonB);
424+
private final BoosterStructure fcC = new BoosterStructure(foilCommonC);
425+
private final BoosterStructure fuA = new BoosterStructure(foilUncommonA);
426+
private final BoosterStructure fuB = new BoosterStructure(foilUncommonB);
427+
private final BoosterStructure fuC = new BoosterStructure(foilUncommonC);
428+
429+
// In order for equal numbers of each common to exist, the average booster must contain:
430+
// 0.6 A commons ( 60074 / 97200) 6 Commons ( 1 / 80) or ( 1215 / 97200)
431+
// 3.3 B commons (317534 / 97200) 7 Commons (247 / 300) or (80028 / 97200)
432+
// 3.3 C commons (317534 / 97200) 8 Commons (197 / 200) or (15957 / 97200)
433+
private final RarityConfiguration commonRuns6 = new RarityConfiguration(BBBCCC);
434+
private final RarityConfiguration commonRuns7A = new RarityConfiguration(ABBBCCC);
435+
private final RarityConfiguration commonRuns7BC = new RarityConfiguration(BBBBCCC,BBBCCCC);
436+
private final RarityConfiguration commonRuns8A = new RarityConfiguration(ABBBBCCC, ABBBCCCC);
437+
private final RarityConfiguration commonRuns8BC = new RarityConfiguration(BBBBCCCC);
438+
private static final RarityConfiguration commonRuns(int runLength){
439+
return ( 6< runLength ? 7< runLength ?
440+
( RandomUtil.nextInt(15957) <4789 ? commonRuns8BC : commonRuns8A )
441+
: ( RandomUtil.nextInt(8892) <5434 ? commonRuns7A : commonRuns7BC )
442+
: commonRuns6 );
443+
}
444+
445+
// In order for equal numbers of each uncommon to exist, the average booster must contain:
446+
// 0.59 A uncommons ( 44 / 75) 3 Uncommons (1 / 3) or (25 / 75)
447+
// 1.03 B uncommons ( 77 / 75) 4 Uncommons (2 / 3) or (50 / 75)
448+
// 2.05 C uncommons (154 / 75)
449+
private final RarityConfiguration uncommonRuns3 = new RarityConfiguration(BCC);
450+
private final RarityConfiguration uncommonRuns4A = new RarityConfiguration(ABCC);
451+
private final RarityConfiguration uncommonRuns4BC = new RarityConfiguration(BBCC, BCCC, BCCC);
452+
private static final RarityConfiguration uncommonRuns(int runLength){
453+
return ( 3< runLength ? RandomUtil.nextInt(25) <22 ?
454+
uncommonRuns4A : uncommonRuns4BC : uncommonRuns3 );
455+
}
456+
457+
private final RarityConfiguration rareRuns1 = new RarityConfiguration(R1);
458+
private final RarityConfiguration rareRuns2 = new RarityConfiguration(R2);
459+
private static final RarityConfiguration rareRuns(int runLength){
460+
return ( 1< runLength ? rareRuns2 : rareRuns1 );
461+
}
462+
// 1.5% of packs contain a special guest card
463+
private final RarityConfiguration listRuns = new RarityConfiguration(Sg);
464+
465+
private final RarityConfiguration landRuns = new RarityConfiguration(L1);
466+
467+
// Foil - 2/3 C , 1/4 U , 1/12 R/M
468+
private final RarityConfiguration foilRunsC = new RarityConfiguration(
469+
fcA, fcA, fcA, fcA, fcA, fcA, fcA,
470+
471+
fcB, fcB, fcB, fcB, fcB, fcB, fcB, fcB, fcB, fcB,
472+
fcB, fcB, fcB, fcB, fcB, fcB, fcB, fcB, fcB, fcB,
473+
fcB, fcB, fcB, fcB, fcB, fcB, fcB, fcB, fcB, fcB,
474+
fcB, fcB, fcB, fcB, fcB, fcB, fcB,
475+
476+
fcC, fcC, fcC, fcC, fcC, fcC, fcC, fcC, fcC, fcC,
477+
fcC, fcC, fcC, fcC, fcC, fcC, fcC, fcC, fcC, fcC,
478+
fcC, fcC, fcC, fcC, fcC, fcC, fcC, fcC, fcC, fcC,
479+
fcC, fcC, fcC, fcC, fcC, fcC, fcC
480+
);
481+
private final RarityConfiguration foilRunsU = new RarityConfiguration(
482+
fuA, fuA, fuA, fuA,
483+
fuB, fuB, fuB, fuB, fuB, fuB, fuB,
484+
fuC, fuC, fuC, fuC, fuC, fuC, fuC, fuC, fuC, fuC,
485+
fuC, fuC, fuC, fuC
486+
);
487+
private final RarityConfiguration foilRunsRM = new RarityConfiguration(R1);
488+
private static final RarityConfiguration foilRuns(){
489+
int runRoll = RandomUtil.nextInt(12);
490+
return ( 11> runRoll ? 8> runRoll ?
491+
foilRunsC : foilRunsU : foilRunsRM );
492+
}
493+
494+
@Override
495+
public List<String> makeBooster() {
496+
List<String> booster = new ArrayList<>();
497+
498+
// 1-2 rares, 3-4 uncommons, and 6-8 commons
499+
// wildcard 1/6 common, 2/3 uncommon, 1/6 rare (incl mythic)
500+
int wildNum = RandomUtil.nextInt(6);
501+
502+
int numCommon = 7;
503+
boolean wildRare = false;
504+
boolean wildUncommon = false;
505+
if( wildNum < 1 ){
506+
numCommon++;
507+
}else if( wildNum < 5 ){
508+
wildUncommon = true;
509+
}else{
510+
wildRare = true;
511+
};
512+
513+
booster.addAll(foilRuns().getNext().makeRun());
514+
booster.addAll(landRuns.getNext().makeRun());
515+
booster.addAll(rareRuns( wildRare ? 2 : 1 ).getNext().makeRun());
516+
517+
// 1.5% of Play Boosters features a Special Guests card displacing a common card.
518+
if (RandomUtil.nextInt(200) <3) {
519+
booster.addAll(listRuns.getNext().makeRun());
520+
--numCommon;
521+
}
522+
523+
booster.addAll(uncommonRuns( wildUncommon ? 4 : 3 ).getNext().makeRun());
524+
booster.addAll(commonRuns( numCommon ).getNext().makeRun());
525+
526+
return booster;
527+
}
313528
}

0 commit comments

Comments
 (0)