From 37df2436a891afef58c067159d63a4c5899359a0 Mon Sep 17 00:00:00 2001 From: "Alex W. Jackson" Date: Mon, 30 Aug 2021 20:33:30 -0400 Subject: [PATCH] Coldsnap boosters don't have a land slot; snow basic lands are regular commons --- Mage.Sets/src/mage/sets/Coldsnap.java | 29 ++++++++++++++++++- .../mage/test/sets/BoosterGenerationTest.java | 8 ----- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/Mage.Sets/src/mage/sets/Coldsnap.java b/Mage.Sets/src/mage/sets/Coldsnap.java index 67274220f8..297fb01dbf 100644 --- a/Mage.Sets/src/mage/sets/Coldsnap.java +++ b/Mage.Sets/src/mage/sets/Coldsnap.java @@ -2,9 +2,15 @@ package mage.sets; import mage.cards.ExpansionSet; +import mage.cards.repository.CardCriteria; +import mage.cards.repository.CardInfo; +import mage.cards.repository.CardRepository; import mage.constants.Rarity; import mage.constants.SetType; +import java.util.ArrayList; +import java.util.List; + /** * @author North */ @@ -20,7 +26,7 @@ public final class Coldsnap extends ExpansionSet { super("Coldsnap", "CSP", ExpansionSet.buildDate(2006, 6, 21), SetType.EXPANSION); this.blockName = "Ice Age"; this.hasBoosters = true; - this.numBoosterLands = 1; + this.numBoosterLands = 0; this.numBoosterCommon = 11; this.numBoosterUncommon = 3; this.numBoosterRare = 1; @@ -184,4 +190,25 @@ public final class Coldsnap extends ExpansionSet { cards.add(new SetCardInfo("Zombie Musher", 75, Rarity.COMMON, mage.cards.z.ZombieMusher.class)); cards.add(new SetCardInfo("Zur the Enchanter", 135, Rarity.RARE, mage.cards.z.ZurTheEnchanter.class)); } + + @Override + public List getCardsByRarity(Rarity rarity) { + if (rarity != Rarity.COMMON) { + return super.getCardsByRarity(rarity); + } + List savedCardsInfos = savedCards.get(rarity); + if (savedCardsInfos != null) { + return new ArrayList(savedCardsInfos); + } + CardCriteria criteria = new CardCriteria(); + criteria.setCodes(this.code).rarities(rarity); + savedCardsInfos = CardRepository.instance.findCards(criteria); + // Snow basic lands are included in boosters as regular commons, not in a land slot + criteria = new CardCriteria(); + criteria.setCodes(this.code).rarities(Rarity.LAND); + savedCardsInfos.addAll(CardRepository.instance.findCards(criteria)); + savedCards.put(rarity, savedCardsInfos); + // Return a copy of the saved cards information, as not to modify the original. + return new ArrayList(savedCardsInfos); + } } diff --git a/Mage.Tests/src/test/java/org/mage/test/sets/BoosterGenerationTest.java b/Mage.Tests/src/test/java/org/mage/test/sets/BoosterGenerationTest.java index 56ec4d3cba..42802f2e02 100644 --- a/Mage.Tests/src/test/java/org/mage/test/sets/BoosterGenerationTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/sets/BoosterGenerationTest.java @@ -248,14 +248,6 @@ public class BoosterGenerationTest extends MageTestBase { } } - @Test - public void testColdSnap_BoosterMustHaveOneSnowLand() { - for (int i = 0; i < 10; i++) { - List booster = Coldsnap.getInstance().createBooster(); - assertTrue("coldsnap's booster must contain 1 snow covered land", booster.stream().anyMatch(card -> card.isBasic() && card.getName().startsWith("Snow-Covered "))); - } - } - @Test public void testModernHorizons_BoosterMustHaveOneSnowLand() { for (int i = 0; i < 10; i++) {