Merge origin/master

This commit is contained in:
LevelX2 2018-04-17 21:30:50 +02:00
commit 89ac8cf62f
2 changed files with 20 additions and 2 deletions

View file

@ -83,7 +83,7 @@ public abstract class ExpansionSet implements Serializable {
return this.cardNumber;
}
public int getCardNumberAsInt(){
public int getCardNumberAsInt() {
return CardUtil.parseCardNumberAsInt(this.cardNumber);
}
@ -121,6 +121,7 @@ public abstract class ExpansionSet implements Serializable {
protected int numBoosterRare;
protected int numBoosterDoubleFaced; // -1 = include normally 0 = exclude 1-n = include explicit
protected int ratioBoosterMythic;
protected boolean needsLegends = false;
protected int maxCardNumberInBooster; // used to omit cards with collector numbers beyond the regular cards in a set for boosters
@ -210,6 +211,20 @@ public abstract class ExpansionSet implements Serializable {
}
public List<Card> createBooster() {
if (needsLegends) {
for (int i = 0; i < 100000; i++) {//don't want to somehow loop forever
List<Card> booster = tryBooster();
for (Card card : booster) {
if (card.isLegendary() && card.isCreature()) {// Dominaria packs must contain at least one legendary creature.
return booster;
}
}
}
}
return tryBooster();
}
public List<Card> tryBooster() {
List<Card> booster = new ArrayList<>();
if (!hasBoosters) {
return booster;
@ -436,6 +451,8 @@ public abstract class ExpansionSet implements Serializable {
savedCards.clear();
}
public int getMaxCardNumberInBooster() { return maxCardNumberInBooster; }
public int getMaxCardNumberInBooster() {
return maxCardNumberInBooster;
}
}