[ORI] Fixed booster generation to include double faced creature/planeswalker cards.

This commit is contained in:
LevelX2 2015-07-17 08:08:50 +02:00
parent 6804ba1f2f
commit 5ed37420b5
2 changed files with 38 additions and 35 deletions

View file

@ -51,6 +51,7 @@ public class MagicOrigins extends ExpansionSet {
this.numBoosterUncommon = 3;
this.numBoosterRare = 1;
this.ratioBoosterMythic = 8;
this.numBoosterDoubleFaced = -1; // use by rarity
/* There are additional cards, numbered 273288, that don't appear in Magic
Origin booster packs. These are reprints from earlier sets that are present in
some supplemental products, including sample decks and the Deck Builder's Toolkit.

View file

@ -1,31 +1,30 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.cards;
import java.io.Serializable;
@ -61,7 +60,7 @@ public abstract class ExpansionSet implements Serializable {
protected int numBoosterCommon;
protected int numBoosterUncommon;
protected int numBoosterRare;
protected int numBoosterDoubleFaced;
protected int numBoosterDoubleFaced; // -1 = include normally 0 = exclude 1-n = include explicit
protected int ratioBoosterMythic;
protected String packageName;
@ -113,7 +112,7 @@ public abstract class ExpansionSet implements Serializable {
}
public List<Card> create15CardBooster() {
// Forces 15 card booster packs.
// Forces 15 card booster packs.
// if the packs are too small, it adds commons to fill it out.
// if the packs are too big, it removes the first cards.
// since it adds lands then commons before uncommons
@ -137,13 +136,13 @@ public abstract class ExpansionSet implements Serializable {
if (!hasBoosters) {
return booster;
}
if (numBoosterLands > 0) {
List<CardInfo> basicLands = getCardsByRarity(Rarity.LAND);
for (int i = 0; i < numBoosterLands; i++) {
addToBooster(booster, basicLands);
}
}
}
List<CardInfo> commons = getCardsByRarity(Rarity.COMMON);
for (int i = 0; i < numBoosterCommon; i++) {
addToBooster(booster, commons);
@ -237,7 +236,7 @@ public abstract class ExpansionSet implements Serializable {
return booster;
}
/* add double faced card for Innistrad booster
/* add double faced card for Innistrad booster
* rarity near as the normal distribution
*/
private void addDoubleFace(List<Card> booster) {
@ -269,11 +268,11 @@ public abstract class ExpansionSet implements Serializable {
}
}
}
public boolean hasBoosters() {
return hasBoosters;
}
public boolean hasBasicLands() {
return hasBasicLands;
}
@ -287,7 +286,10 @@ public abstract class ExpansionSet implements Serializable {
} else {
criteria.setCodes(this.code);
}
criteria.rarities(rarity).doubleFaced(false);
criteria.rarities(rarity);
if (numBoosterDoubleFaced > -1) {
criteria.doubleFaced(false);
}
if (maxCardNumberInBooster != Integer.MAX_VALUE) {
criteria.maxCardNumber(maxCardNumberInBooster);
}