use of mage.constants.Rarity in project mage by magefree.
the class CardPanelTypeComparator method compare.
@Override
public int compare(MageCard o1, MageCard o2) {
Rarity r1 = o1.getOriginal().getRarity();
Rarity r2 = o2.getOriginal().getRarity();
int val = Integer.compare(r1 == null ? 0 : r1.getSorting(), r2 == null ? 0 : r2.getSorting());
if (val == 0) {
return o1.getOriginal().getName().compareTo(o2.getOriginal().getName());
} else {
return val;
}
}
use of mage.constants.Rarity in project mage by magefree.
the class VintageMasters method addSpecialCards.
@Override
protected void addSpecialCards(List<Card> booster, int number) {
// number is here always 1
Rarity rarity;
// You will open a Power Nine card about once in 53 packs
if (RandomUtil.nextInt(53) == 0) {
rarity = Rarity.BONUS;
} else {
// assuming same distribution as foils in paper Masters sets, 10:3:1 C:U:R
int rarityKey = RandomUtil.nextInt(112);
if (rarityKey < 80) {
rarity = Rarity.COMMON;
} else if (rarityKey < 104) {
rarity = Rarity.UNCOMMON;
} else if (rarityKey < 111) {
rarity = Rarity.RARE;
} else {
rarity = Rarity.MYTHIC;
}
}
addToBooster(booster, getCardsByRarity(rarity));
}
use of mage.constants.Rarity in project mage by magefree.
the class ExpansionSet method addDoubleFace.
/* add double faced card for Innistrad booster
* rarity near as the normal distribution
*/
protected void addDoubleFace(List<Card> booster) {
Rarity rarity;
for (int i = 0; i < numBoosterDoubleFaced; i++) {
int rarityKey = RandomUtil.nextInt(121);
if (rarityKey < 66) {
rarity = Rarity.COMMON;
} else if (rarityKey < 108) {
rarity = Rarity.UNCOMMON;
} else if (rarityKey < 120) {
rarity = Rarity.RARE;
} else {
rarity = Rarity.MYTHIC;
}
addToBooster(booster, getSpecialCardsByRarity(rarity));
}
}
use of mage.constants.Rarity in project mage by magefree.
the class ExpansionSet method tryBooster.
public List<Card> tryBooster() {
List<Card> booster = new ArrayList<>();
if (!hasBoosters) {
return booster;
}
if (numBoosterLands > 0) {
List<CardInfo> specialLands = getSpecialCardsByRarity(Rarity.LAND);
List<CardInfo> basicLands = getCardsByRarity(Rarity.LAND);
for (int i = 0; i < numBoosterLands; i++) {
if (ratioBoosterSpecialLand > 0 && RandomUtil.nextInt(ratioBoosterSpecialLand) < ratioBoosterSpecialLandNumerator) {
addToBooster(booster, specialLands);
} else {
addToBooster(booster, basicLands);
}
}
}
int numCommonsToGenerate = numBoosterCommon;
int numSpecialToGenerate = numBoosterSpecial;
if (ratioBoosterSpecialCommon > 0 && RandomUtil.nextInt(ratioBoosterSpecialCommon) < 1) {
--numCommonsToGenerate;
++numSpecialToGenerate;
}
List<CardInfo> commons = getCardsByRarity(Rarity.COMMON);
for (int i = 0; i < numCommonsToGenerate; i++) {
addToBooster(booster, commons);
}
int numUncommonsToGenerate = numBoosterUncommon;
int numRaresToGenerate = numBoosterRare;
if (ratioBoosterSpecialRare > 0) {
Rarity specialRarity = Rarity.UNCOMMON;
if (ratioBoosterSpecialRare * RandomUtil.nextDouble() <= 1) {
specialRarity = (checkSpecialMythic() ? Rarity.MYTHIC : Rarity.RARE);
--numRaresToGenerate;
} else {
--numUncommonsToGenerate;
}
addToBooster(booster, getSpecialCardsByRarity(specialRarity));
}
List<CardInfo> uncommons = getCardsByRarity(Rarity.UNCOMMON);
for (int i = 0; i < numUncommonsToGenerate; i++) {
addToBooster(booster, uncommons);
}
if (numRaresToGenerate > 0) {
List<CardInfo> rares = getCardsByRarity(Rarity.RARE);
List<CardInfo> mythics = getCardsByRarity(Rarity.MYTHIC);
for (int i = 0; i < numRaresToGenerate; i++) {
addToBooster(booster, checkMythic() ? mythics : rares);
}
}
if (numBoosterDoubleFaced > 0) {
addDoubleFace(booster);
}
if (numSpecialToGenerate > 0) {
addSpecialCards(booster, numSpecialToGenerate);
}
return booster;
}
use of mage.constants.Rarity in project mage by magefree.
the class EldritchMoonCollator method addSpecialCards.
// Then about an eighth of the packs will have a second double-faced card, which will be a rare or mythic rare
// 10/12 of such packs contain one of 5 rare DFCs and 2/12 packs contain one of 2 mythic DFCs
@Override
protected void addSpecialCards(List<Card> booster, int number) {
// number is here always 1
Rarity rarity;
if (RandomUtil.nextInt(12) < 10) {
rarity = Rarity.RARE;
} else {
rarity = Rarity.MYTHIC;
}
addToBooster(booster, getSpecialCardsByRarity(rarity));
}
Aggregations