diff --git a/Mage.Sets/src/mage/sets/DragonsMaze.java b/Mage.Sets/src/mage/sets/DragonsMaze.java index 45c316b308e..1fe91979797 100644 --- a/Mage.Sets/src/mage/sets/DragonsMaze.java +++ b/Mage.Sets/src/mage/sets/DragonsMaze.java @@ -84,7 +84,8 @@ public class DragonsMaze extends ExpansionSet { savedCardsInfos = CardRepository.instance.findCards(criteria); savedCards.put(rarity, savedCardsInfos); } - return savedCardsInfos; + // Return a copy of the saved cards information, as not to modify the original. + return new ArrayList<>(savedCardsInfos); } else { return super.getCardsByRarity(rarity); } diff --git a/Mage.Sets/src/mage/sets/FateReforged.java b/Mage.Sets/src/mage/sets/FateReforged.java index f1126deeb10..76d31b292a2 100644 --- a/Mage.Sets/src/mage/sets/FateReforged.java +++ b/Mage.Sets/src/mage/sets/FateReforged.java @@ -81,9 +81,8 @@ public class FateReforged extends ExpansionSet { savedCardsInfos = CardRepository.instance.findCards(criteria); savedCards.put(rarity, savedCardsInfos); } - List cards = new ArrayList<>(); - cards.addAll(savedCardsInfos); - return cards; + // Return a copy of the saved cards information, as not to modify the original. + return new ArrayList<>(savedCardsInfos); } else { return super.getCardsByRarity(rarity); } diff --git a/Mage/src/mage/cards/ExpansionSet.java b/Mage/src/mage/cards/ExpansionSet.java index 5c307480558..23c5649fbe3 100644 --- a/Mage/src/mage/cards/ExpansionSet.java +++ b/Mage/src/mage/cards/ExpansionSet.java @@ -117,16 +117,11 @@ public abstract class ExpansionSet implements Serializable { // if the packs are too big, it removes the first cards. // since it adds lands then commons before uncommons // and rares this should be the least disruptive. - List theBooster = this.createBooster(); List commons = getCardsByRarity(Rarity.COMMON); - int iterations = 0; - while (15 > theBooster.size() && !commons.isEmpty()) { + + while (15 > theBooster.size()) { addToBooster(theBooster, commons); - iterations++; - if (iterations > 14) { - break; - } } while (theBooster.size() > 15) { @@ -301,9 +296,8 @@ public abstract class ExpansionSet implements Serializable { savedCardsInfos = CardRepository.instance.findCards(criteria); savedCards.put(rarity, savedCardsInfos); } - List cards = new ArrayList<>(); - cards.addAll(savedCardsInfos); - return cards; + // Return a copy of the saved cards information, as not to modify the original. + return new ArrayList<>(savedCardsInfos); } public List getSpecialCommon() {