mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
Dominaria packs will now be guaranteed to have at least one legendary creature
This commit is contained in:
parent
ad3bf578bb
commit
6a0aadbea3
2 changed files with 20 additions and 2 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue