From e94163a4c3a9cf229857b45eed3e210587bced49 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 20 Sep 2015 21:10:02 +0200 Subject: [PATCH] Fixed that no Zendikar Expeditions lands were added to Battle for Zendikar boosters. I replaced every 20th basic land now by one random land of Zendikar Expeditions. --- .../src/mage/sets/BattleForZendikar.java | 24 +++++++++++++++++-- Mage/src/mage/cards/ExpansionSet.java | 14 ++++++++++- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/Mage.Sets/src/mage/sets/BattleForZendikar.java b/Mage.Sets/src/mage/sets/BattleForZendikar.java index b6dc6ad2d7..f21179f974 100644 --- a/Mage.Sets/src/mage/sets/BattleForZendikar.java +++ b/Mage.Sets/src/mage/sets/BattleForZendikar.java @@ -25,18 +25,21 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.sets; +import java.util.ArrayList; import java.util.GregorianCalendar; +import java.util.List; import mage.cards.ExpansionSet; +import mage.cards.repository.CardCriteria; +import mage.cards.repository.CardInfo; +import mage.cards.repository.CardRepository; import mage.constants.SetType; /** * * @author fireshoes */ - public class BattleForZendikar extends ExpansionSet { private static final BattleForZendikar fINSTANCE = new BattleForZendikar(); @@ -45,16 +48,33 @@ public class BattleForZendikar extends ExpansionSet { return fINSTANCE; } + List savedSpecialLand = new ArrayList<>(); + private BattleForZendikar() { super("Battle for Zendikar", "BFZ", "mage.sets.battleforzendikar", new GregorianCalendar(2015, 10, 2).getTime(), SetType.EXPANSION); this.blockName = "Battle for Zendikar"; this.hasBoosters = true; this.hasBasicLands = true; this.numBoosterLands = 1; + this.ratioBoosterSpecialLand = 20; // Approximately as rare as opening a foil mythic = 8 * 6 = ~every 48th booster includes one + // I set it to 20 to get it more often this.numBoosterCommon = 10; this.numBoosterUncommon = 3; this.numBoosterRare = 1; this.ratioBoosterMythic = 8; + this.numBoosterSpecial = 0; } + @Override + public List getSpecialLand() { + List specialLand = new ArrayList<>(); + if (savedSpecialLand.isEmpty()) { + CardCriteria criteria = new CardCriteria(); + criteria.setCodes("EXP"); + specialLand.addAll(CardRepository.instance.findCards(criteria)); + } + + specialLand.addAll(savedSpecialLand); + return specialLand; + } } diff --git a/Mage/src/mage/cards/ExpansionSet.java b/Mage/src/mage/cards/ExpansionSet.java index 23c5649fbe..7758bb84a3 100644 --- a/Mage/src/mage/cards/ExpansionSet.java +++ b/Mage/src/mage/cards/ExpansionSet.java @@ -56,7 +56,10 @@ public abstract class ExpansionSet implements Serializable { protected String blockName; protected boolean hasBoosters = false; protected int numBoosterSpecial; + protected int numBoosterLands; + protected int ratioBoosterSpecialLand = 0; // if > 0 basic lands are replaced with speical land in the ratio every X land is replaced by special land + protected int numBoosterCommon; protected int numBoosterUncommon; protected int numBoosterRare; @@ -150,9 +153,14 @@ public abstract class ExpansionSet implements Serializable { } if (numBoosterLands > 0) { + List specialLands = getSpecialLand(); List basicLands = getCardsByRarity(Rarity.LAND); for (int i = 0; i < numBoosterLands; i++) { - addToBooster(booster, basicLands); + if (ratioBoosterSpecialLand > 0 && rnd.nextInt(ratioBoosterSpecialLand) == 1 && specialLands != null) { + addToBooster(booster, specialLands); + } else { + addToBooster(booster, basicLands); + } } } List commons = getCardsByRarity(Rarity.COMMON); @@ -320,6 +328,10 @@ public abstract class ExpansionSet implements Serializable { return null; } + public List getSpecialLand() { + return null; + } + public void removeSavedCards() { savedCards.clear(); }