* Masters Edition IV - Fixed urza's special lands in boosters

This commit is contained in:
Oleg Agafonov 2018-01-12 14:20:20 +04:00
parent 9e94ee0810
commit 4c3425d29c
2 changed files with 60 additions and 5 deletions

View file

@ -30,9 +30,15 @@ package mage.sets;
import mage.cards.ExpansionSet;
import mage.cards.a.AesthirGlider;
import mage.cards.e.EliteCatWarrior;
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 LevelX2
@ -45,6 +51,8 @@ public class MastersEditionIV extends ExpansionSet {
return instance;
}
protected final List<CardInfo> savedSpecialLand = new ArrayList<>();
private MastersEditionIV() {
super("Masters Edition IV", "ME4", ExpansionSet.buildDate(2011, 1, 10), SetType.MAGIC_ONLINE);
this.hasBasicLands = false;
@ -54,6 +62,7 @@ public class MastersEditionIV extends ExpansionSet {
this.numBoosterUncommon = 3;
this.numBoosterRare = 1;
this.ratioBoosterMythic = 0;
this.ratioBoosterSpecialLand = 1; // replace all basic lands
cards.add(new SetCardInfo("Acid Rain", 36, Rarity.RARE, mage.cards.a.AcidRain.class));
cards.add(new SetCardInfo("Aesthir Glider", 176, Rarity.COMMON, AesthirGlider.class));
cards.add(new SetCardInfo("Air Elemental", 37, Rarity.UNCOMMON, mage.cards.a.AirElemental.class));
@ -312,4 +321,18 @@ public class MastersEditionIV extends ExpansionSet {
cards.add(new SetCardInfo("Zombie Master", 105, Rarity.UNCOMMON, mage.cards.z.ZombieMaster.class));
}
@Override
public List<CardInfo> getSpecialLand() {
// ME4 replace all basic lands with special (1 per booster)
// https://mtg.gamepedia.com/Masters_Edition_IV
if (savedSpecialLand.isEmpty()) {
savedSpecialLand.addAll(CardRepository.instance.findCards(new CardCriteria().setCodes(this.code).name("Urza's Mine")));
savedSpecialLand.addAll(CardRepository.instance.findCards(new CardCriteria().setCodes(this.code).name("Urza's Power Plant")));
savedSpecialLand.addAll(CardRepository.instance.findCards(new CardCriteria().setCodes(this.code).name("Urza's Tower")));
}
return new ArrayList<>(savedSpecialLand);
}
}

View file

@ -1,22 +1,26 @@
package org.mage.test.sets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import mage.cards.Card;
import mage.cards.repository.CardInfo;
import mage.cards.repository.CardScanner;
import mage.sets.FateReforged;
import mage.sets.MastersEditionII;
import mage.sets.MastersEditionIV;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mage.test.serverside.base.MageTestBase;
/**
*
* @author nigelzor
* @author nigelzor, JayDi85
*/
public class BoosterGenerationTest extends MageTestBase {
@ -56,15 +60,43 @@ public class BoosterGenerationTest extends MageTestBase {
}
@Test
public void testMastersEditionIV() {
public void testMastersEditionIV_UrzaSpecialLandsList() {
List<String> needUrzaList = Arrays.asList(
"Urza's Mine",
"Urza's Power Plant",
"Urza's Tower"
);
List<CardInfo> setOrzaList = MastersEditionIV.getInstance().getSpecialLand();
Assert.assertEquals("Urza special lands must have 4 variation for each of 3 card", 3 * 4, setOrzaList.size());
List<String> foundedUrzaList = new ArrayList<>();
for (CardInfo cardInfo: setOrzaList) {
Assert.assertTrue("card " + cardInfo.getName() + " must be in urza's list", needUrzaList.contains(cardInfo.getName()));
foundedUrzaList.add(cardInfo.getName());
}
for (String needName: needUrzaList) {
Assert.assertTrue("can't find need card " + needName + " in special land list", foundedUrzaList.contains(needName));
}
}
@Test
public void testMastersEditionIV_UrzaSpecialLandInBoosters() {
// ME4 replace all basic lands with special (1 per booster)
// https://mtg.gamepedia.com/Masters_Edition_IV
List<String> urzaLand = Arrays.asList(
"Urza's Mine",
"Urza's Power Plant",
"Urza's Tower"
);
List<Card> booster = MastersEditionIV.getInstance().createBooster();
assertTrue(str(booster), contains(booster, urzaLand, "ME4"));
assertFalse(str(booster), contains(booster, basics, null));
for(int i = 1; i <= 5; i++) {
List<Card> booster = MastersEditionIV.getInstance().createBooster();
assertTrue(str(booster), contains(booster, urzaLand, "ME4"));
assertFalse(str(booster), contains(booster, basics, null));
}
}
private static String str(List<Card> cards) {