use of mage.constants.Rarity in project mage by magefree.
the class DarkAscensionCollator method addDoubleFace.
@Override
protected void addDoubleFace(List<Card> booster) {
Rarity rarity;
for (int i = 0; i < numBoosterDoubleFaced; i++) {
int rarityKey = RandomUtil.nextInt(121);
if (rarityKey < 72) {
rarity = Rarity.COMMON;
} else if (rarityKey < 108) {
rarity = Rarity.UNCOMMON;
} else if (rarityKey < 117) {
rarity = Rarity.RARE;
} else {
rarity = Rarity.MYTHIC;
}
List<CardInfo> doubleFacedCards = getSpecialCardsByRarity(rarity);
addToBooster(booster, doubleFacedCards);
}
}
use of mage.constants.Rarity in project mage by magefree.
the class ModernHorizons2Collator method addSpecialCards.
@Override
protected void addSpecialCards(List<Card> booster, int number) {
// number is here always 1
Rarity rarity;
int rarityKey = RandomUtil.nextInt(120);
if (rarityKey < 4) {
rarity = Rarity.MYTHIC;
} else if (rarityKey < 40) {
rarity = Rarity.RARE;
} else {
rarity = Rarity.UNCOMMON;
}
List<CardInfo> reprintCards = getSpecialCardsByRarity(rarity);
addToBooster(booster, reprintCards);
}
use of mage.constants.Rarity in project mage by magefree.
the class DragonsMazeCollator method addSpecialCards.
@Override
protected void addSpecialCards(List<Card> booster, int number) {
// number is here always 1
// the land print sheets are believed to contain 23 copies of each Guildgate,
// one copy of each RTR and GTC shockland, and two copies of Maze's End
Rarity rarity;
int rarityKey = RandomUtil.nextInt(242);
if (rarityKey < 230) {
rarity = Rarity.COMMON;
} else if (rarityKey < 240) {
rarity = Rarity.RARE;
} else {
rarity = Rarity.MYTHIC;
}
addToBooster(booster, getSpecialCardsByRarity(rarity));
}
use of mage.constants.Rarity in project mage by magefree.
the class ShadowsOverInnistradCollator method addSpecialCards.
// Then about an eighth of the packs will have a second double-faced card, which will be a rare or mythic rare
// 12/15 of such packs contain one of 6 rare DFCs and 3/15 packs contain one of 3 mythic DFCs
@Override
protected void addSpecialCards(List<Card> booster, int number) {
// number is here always 1
Rarity rarity;
if (RandomUtil.nextInt(15) < 12) {
rarity = Rarity.RARE;
} else {
rarity = Rarity.MYTHIC;
}
addToBooster(booster, getSpecialCardsByRarity(rarity));
}
use of mage.constants.Rarity in project mage by magefree.
the class BoosterGenerationTest method testKaldheim_SnowLandAndMDFC.
@Test
public void testKaldheim_SnowLandAndMDFC() {
boolean foundVale = false;
boolean foundMDFC = false;
boolean foundNoMDFC = false;
for (int i = 1; i <= 100; i++) {
List<Card> booster = Kaldheim.getInstance().createBooster();
assertEquals("Booster does not have 15 cards", 15, booster.size());
assertTrue("Booster contains cards from another set", booster.stream().map(Card::getExpansionSetCode).allMatch("KHM"::equals));
assertFalse("Booster cannot contain non-snow basic lands", booster.stream().anyMatch(card -> card.isBasic() && !card.isSnow()));
assertEquals("Booster must contain exactly 1 rare or mythic", 1, booster.stream().map(Card::getRarity).filter(rarity -> rarity == Rarity.RARE || rarity == Rarity.MYTHIC).count());
assertEquals("Booster must contain exactly 3 uncommons", 3, booster.stream().map(Card::getRarity).filter(Rarity.UNCOMMON::equals).count());
List<Card> snowLands = booster.stream().filter(card -> card.isSnow() && card.isLand(currentGame)).collect(Collectors.toList());
switch(snowLands.size()) {
case 0:
fail("Booster must have snow lands");
case 1:
Card snowLand = snowLands.get(0);
assertTrue("Only one snow land, must be basic or common", snowLand.isBasic() || snowLand.getRarity() == Rarity.COMMON);
assertNotEquals("Only one snow land, can't be Shimmerdrift Vale", "Shimmerdrift Vale", snowLand.getName());
assertNotEquals("Only one snow land, can't be Faceless Haven", "Faceless Haven", snowLand.getName());
break;
case 2:
assertEquals("Booster can't have two snow lands unless one is Shimmerdrift Vale or Faceless Haven", 1, snowLands.stream().filter(card -> card.getName().equals("Shimmerdrift Vale") || card.getName().equals("Faceless Haven")).count());
assertEquals("Booster can't have two snow lands unless one is not Shimmerdrift Vale or Faceless Haven", 1, snowLands.stream().filter(card -> !card.getName().equals("Shimmerdrift Vale") && !card.getName().equals("Faceless Haven")).count());
break;
case 3:
assertEquals("Booster can't have three snow lands unless one is Shimmerdrift Vale", 1, snowLands.stream().filter(card -> card.getName().equals("Shimmerdrift Vale")).count());
assertEquals("Booster can't have three snow lands unless one is Faceless Haven", 1, snowLands.stream().filter(card -> card.getName().equals("Faceless Haven")).count());
assertEquals("Booster can't have three snow lands unless one is not Shimmerdrift Vale or Faceless Haven", 1, snowLands.stream().filter(card -> !card.getName().equals("Shimmerdrift Vale") && !card.getName().equals("Faceless Haven")).count());
break;
default:
fail("Booster can't have more than three snow lands");
}
long mdfcCount = booster.stream().filter(card -> card instanceof ModalDoubleFacesCard).count();
assertTrue("Booster can't have more than one MDFC", mdfcCount < 2);
foundMDFC |= mdfcCount > 0;
foundNoMDFC |= mdfcCount == 0;
foundVale |= booster.stream().map(MageObject::getName).anyMatch("Shimmerdrift Vale"::equals);
if (foundVale && foundMDFC && foundNoMDFC && i > 20) {
break;
}
}
assertTrue("No booster contained Shimmerdrift Vale", foundVale);
assertTrue("No booster contained an MDFC", foundMDFC);
assertTrue("Every booster contained an MDFC", foundNoMDFC);
}
Aggregations