From 5ed37420b58c382ae70b62cfaa7b42cfd87ab10e Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Fri, 17 Jul 2015 08:08:50 +0200 Subject: [PATCH] [ORI] Fixed booster generation to include double faced creature/planeswalker cards. --- Mage.Sets/src/mage/sets/MagicOrigins.java | 1 + Mage/src/mage/cards/ExpansionSet.java | 72 ++++++++++++----------- 2 files changed, 38 insertions(+), 35 deletions(-) diff --git a/Mage.Sets/src/mage/sets/MagicOrigins.java b/Mage.Sets/src/mage/sets/MagicOrigins.java index d9d75e78dd0..63cfc6f55d5 100644 --- a/Mage.Sets/src/mage/sets/MagicOrigins.java +++ b/Mage.Sets/src/mage/sets/MagicOrigins.java @@ -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 273–288, 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. diff --git a/Mage/src/mage/cards/ExpansionSet.java b/Mage/src/mage/cards/ExpansionSet.java index 17aee8cbb9b..4c5b9249fcc 100644 --- a/Mage/src/mage/cards/ExpansionSet.java +++ b/Mage/src/mage/cards/ExpansionSet.java @@ -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 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 basicLands = getCardsByRarity(Rarity.LAND); for (int i = 0; i < numBoosterLands; i++) { addToBooster(booster, basicLands); } - } + } List 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 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); }