Fixed a problem with bosster generation for boosters with partners and basic lands.

This commit is contained in:
LevelX2 2019-12-15 16:18:04 +01:00
parent af9f2c93dd
commit 2413f956ee
2 changed files with 20 additions and 8 deletions

View file

@ -15,7 +15,6 @@ public final class Battlebond extends ExpansionSet {
return instance;
}
private Battlebond() {
super("Battlebond", "BBD", ExpansionSet.buildDate(2018, 6, 8), SetType.SUPPLEMENTAL);
this.blockName = "Battlebond";
@ -28,6 +27,8 @@ public final class Battlebond extends ExpansionSet {
this.numBoosterRare = 1;
this.ratioBoosterMythic = 8;
this.maxCardNumberInBooster = 254; // Don't use the 2 foil mystics copies because it would influence a random ratio
cards.add(new SetCardInfo("Aim High", 189, Rarity.UNCOMMON, mage.cards.a.AimHigh.class));
cards.add(new SetCardInfo("Angel of Retribution", 86, Rarity.UNCOMMON, mage.cards.a.AngelOfRetribution.class));
cards.add(new SetCardInfo("Angelic Chorus", 87, Rarity.RARE, mage.cards.a.AngelicChorus.class));

View file

@ -1,5 +1,8 @@
package mage.cards;
import java.io.Serializable;
import java.util.*;
import java.util.stream.Collectors;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.keyword.PartnerWithAbility;
@ -12,10 +15,6 @@ import mage.util.CardUtil;
import mage.util.RandomUtil;
import org.apache.log4j.Logger;
import java.io.Serializable;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author BetaSteward_at_googlemail.com
*/
@ -270,8 +269,8 @@ public abstract class ExpansionSet implements Serializable {
}
protected boolean validateColors(List<Card> booster) {
List<ObjectColor> magicColors =
Arrays.asList(ObjectColor.WHITE, ObjectColor.BLUE, ObjectColor.BLACK, ObjectColor.RED, ObjectColor.GREEN);
List<ObjectColor> magicColors
= Arrays.asList(ObjectColor.WHITE, ObjectColor.BLUE, ObjectColor.BLACK, ObjectColor.RED, ObjectColor.GREEN);
// all cards colors
Map<ObjectColor, Integer> colorWeight = new HashMap<>();
@ -354,7 +353,6 @@ public abstract class ExpansionSet implements Serializable {
addToBooster(booster, commons);
}
List<CardInfo> rares = getCardsByRarity(Rarity.RARE);
List<CardInfo> mythics = getCardsByRarity(Rarity.MYTHIC);
for (int i = 0; i < numBoosterRare; i++) {
@ -384,6 +382,19 @@ public abstract class ExpansionSet implements Serializable {
}
}
}
if (numBoosterLands > 0) {
List<CardInfo> specialLands = getSpecialLand();
List<CardInfo> basicLands = getCardsByRarity(Rarity.LAND);
for (int i = 0; i < numBoosterLands; i++) {
if (ratioBoosterSpecialLand > 0 && RandomUtil.nextInt(ratioBoosterSpecialLand) < ratioBoosterSpecialLandNumerator && specialLands != null) {
addToBooster(booster, specialLands);
} else {
addToBooster(booster, basicLands);
}
}
}
return booster;
}