Fix various hints and warnings on many set & block classes (via IntelliJ IDEA linting):

- replacing hard coded strings of set codes with reference to 'mage.sets.<set>.getInstance().getCode()' allows for set class names to no longer show as unreferenced & adds for more consistence between other block units
- various protected variables were able to be changed to private to clean up additional warnings
- some JavaDoc comments were generating warnings due to missing documentation
- removed some unused imports and unused variables
- there were multiple conditional logic checks for 'rarity != Rarity.LAND' within an if block where the outer condition was 'if rarity == Rarity.COMMON' rendering the inner condition always true and thus redundant
- a few ExpansionSet.buildDate parameters wer using octal values (eg. '03' instead of '3') which triggered some warnings
- added a booster generation test for WarOfTheSparks to make sure every booster contains a planeswalker
- added a booster generation test for ModernHorizons to make sure every booster contains a snow land
- booster generation test for Battlbond set referenced the Coldsnap set class instead of Battlebond
This commit is contained in:
Mike Simons 2019-07-18 23:28:48 -04:00
parent bbd1390397
commit 8d08f005af
37 changed files with 94 additions and 95 deletions

View file

@ -12,7 +12,7 @@ public class AmonkhetBlock extends Constructed {
public AmonkhetBlock() { public AmonkhetBlock() {
super("Constructed - Amonkhet Block"); super("Constructed - Amonkhet Block");
setCodes.add("AKH"); setCodes.add(mage.sets.Amonkhet.getInstance().getCode());
setCodes.add("HOU"); setCodes.add(mage.sets.HourOfDevastation.getInstance().getCode());
} }
} }

View file

@ -12,7 +12,7 @@ public class BattleForZendikarBlock extends Constructed {
public BattleForZendikarBlock() { public BattleForZendikarBlock() {
super("Constructed - Battle for Zendikar Block"); super("Constructed - Battle for Zendikar Block");
setCodes.add("BFZ"); setCodes.add(mage.sets.BattleForZendikar.getInstance().getCode());
setCodes.add("OGW"); setCodes.add(mage.sets.OathOfTheGatewatch.getInstance().getCode());
} }
} }

View file

@ -12,9 +12,9 @@ public class InnistradBlock extends Constructed {
public InnistradBlock() { public InnistradBlock() {
super("Constructed - Innistrad Block"); super("Constructed - Innistrad Block");
setCodes.add("ISD"); setCodes.add(mage.sets.Innistrad.getInstance().getCode());
setCodes.add("DKA"); setCodes.add(mage.sets.DarkAscension.getInstance().getCode());
setCodes.add("AVR"); setCodes.add(mage.sets.AvacynRestored.getInstance().getCode());
} }
} }

View file

@ -11,7 +11,7 @@ public class IxalanBlock extends Constructed {
public IxalanBlock() { public IxalanBlock() {
super("Constructed - Ixalan Block"); super("Constructed - Ixalan Block");
setCodes.add("XLN"); setCodes.add(mage.sets.Ixalan.getInstance().getCode());
setCodes.add("RIX"); setCodes.add(mage.sets.RivalsOfIxalan.getInstance().getCode());
} }
} }

View file

@ -12,7 +12,7 @@ public class KaladeshBlock extends Constructed {
public KaladeshBlock() { public KaladeshBlock() {
super("Constructed - Kaladesh Block"); super("Constructed - Kaladesh Block");
setCodes.add("KLD"); setCodes.add(mage.sets.Kaladesh.getInstance().getCode());
setCodes.add("AER"); setCodes.add(mage.sets.AetherRevolt.getInstance().getCode());
} }
} }

View file

@ -12,9 +12,9 @@ public class KamigawaBlock extends Constructed {
public KamigawaBlock() { public KamigawaBlock() {
super("Constructed - Kamigawa Block"); super("Constructed - Kamigawa Block");
setCodes.add("CHK"); setCodes.add(mage.sets.ChampionsOfKamigawa.getInstance().getCode());
setCodes.add("BOK"); setCodes.add(mage.sets.BetrayersOfKamigawa.getInstance().getCode());
setCodes.add("SOK"); setCodes.add(mage.sets.SaviorsOfKamigawa.getInstance().getCode());
} }
} }

View file

@ -12,9 +12,9 @@ public class KhansOfTarkirBlock extends Constructed {
public KhansOfTarkirBlock() { public KhansOfTarkirBlock() {
super("Constructed - Khans of Tarkir Block"); super("Constructed - Khans of Tarkir Block");
setCodes.add("KTK"); setCodes.add(mage.sets.KhansOfTarkir.getInstance().getCode());
setCodes.add("FRF"); setCodes.add(mage.sets.FateReforged.getInstance().getCode());
setCodes.add("DTK"); setCodes.add(mage.sets.DragonsOfTarkir.getInstance().getCode());
} }
} }

View file

@ -11,7 +11,7 @@ public class LorwynBlock extends Constructed {
public LorwynBlock() { public LorwynBlock() {
super("Constructed - Lorwyn Block"); super("Constructed - Lorwyn Block");
setCodes.add("LRW"); setCodes.add(mage.sets.Lorwyn.getInstance().getCode());
setCodes.add("MOR"); setCodes.add(mage.sets.Morningtide.getInstance().getCode());
} }
} }

View file

@ -12,9 +12,9 @@ public class ReturnToRavnicaBlock extends Constructed {
public ReturnToRavnicaBlock() { public ReturnToRavnicaBlock() {
super("Constructed - Return to Ravnica Block"); super("Constructed - Return to Ravnica Block");
setCodes.add("RTR"); setCodes.add(mage.sets.ReturnToRavnica.getInstance().getCode());
setCodes.add("GTC"); setCodes.add(mage.sets.Gatecrash.getInstance().getCode());
setCodes.add("DGM"); setCodes.add(mage.sets.DragonsMaze.getInstance().getCode());
} }
} }

View file

@ -12,9 +12,9 @@ public class ScarsOfMirrodinBlock extends Constructed {
public ScarsOfMirrodinBlock() { public ScarsOfMirrodinBlock() {
super("Constructed - Scars of Mirrodin Block"); super("Constructed - Scars of Mirrodin Block");
setCodes.add("SOM"); setCodes.add(mage.sets.ScarsOfMirrodin.getInstance().getCode());
setCodes.add("MBS"); setCodes.add(mage.sets.MirrodinBesieged.getInstance().getCode());
setCodes.add("NPH"); setCodes.add(mage.sets.NewPhyrexia.getInstance().getCode());
} }
} }

View file

@ -12,8 +12,8 @@ public class ShadowmoorBlock extends Constructed {
public ShadowmoorBlock() { public ShadowmoorBlock() {
super("Constructed - Shadowmoor Block"); super("Constructed - Shadowmoor Block");
setCodes.add("SHM"); setCodes.add(mage.sets.Shadowmoor.getInstance().getCode());
setCodes.add("EVE"); setCodes.add(mage.sets.Eventide.getInstance().getCode());
} }
} }

View file

@ -12,7 +12,7 @@ public class ShadowsOverInnistradBlock extends Constructed {
public ShadowsOverInnistradBlock() { public ShadowsOverInnistradBlock() {
super("Constructed - Shadows over Innistrad Block"); super("Constructed - Shadows over Innistrad Block");
setCodes.add("SOI"); setCodes.add(mage.sets.ShadowsOverInnistrad.getInstance().getCode());
setCodes.add("EDM"); setCodes.add(mage.sets.EldritchMoon.getInstance().getCode());
} }
} }

View file

@ -12,9 +12,9 @@ public class ShardsOfAlaraBlock extends Constructed {
public ShardsOfAlaraBlock() { public ShardsOfAlaraBlock() {
super("Constructed - Shards of Alara Block"); super("Constructed - Shards of Alara Block");
setCodes.add("ALA"); setCodes.add(mage.sets.ShardsOfAlara.getInstance().getCode());
setCodes.add("CON"); setCodes.add(mage.sets.Conflux.getInstance().getCode());
setCodes.add("ARB"); setCodes.add(mage.sets.AlaraReborn.getInstance().getCode());
} }
} }

View file

@ -15,7 +15,7 @@ public class StarWarsBlock extends Constructed {
public StarWarsBlock() { public StarWarsBlock() {
super("Constructed Custom - Star Wars Block"); super("Constructed Custom - Star Wars Block");
setCodes.add("SWS"); setCodes.add(mage.sets.StarWars.getInstance().getCode());
} }
} }

View file

@ -26,7 +26,7 @@ public class SuperType2 extends Constructed {
* Kamigawa/Ravnica standard, where rotation stabilized. * Kamigawa/Ravnica standard, where rotation stabilized.
* Data taken from http://thattournament.website/historic-tournament.php * Data taken from http://thattournament.website/historic-tournament.php
*/ */
protected static final String[][] standards = { private static final String[][] standards = {
// 11th Standard // 11th Standard
{"7ED", "INV", "APC", "PLS", "ODY", "TOR", "JUD"}, {"7ED", "INV", "APC", "PLS", "ODY", "TOR", "JUD"},
// 12th Standard // 12th Standard
@ -72,7 +72,7 @@ public class SuperType2 extends Constructed {
* regular validation function to test validity. * regular validation function to test validity.
* *
* @param deck - the deck to validate. * @param deck - the deck to validate.
* @return * @return boolean if valid deck
*/ */
@Override @Override
public boolean validate(Deck deck) { public boolean validate(Deck deck) {

View file

@ -12,9 +12,9 @@ public class TherosBlock extends Constructed {
public TherosBlock() { public TherosBlock() {
super("Constructed - Theros Block"); super("Constructed - Theros Block");
setCodes.add("THS"); setCodes.add(mage.sets.Theros.getInstance().getCode());
setCodes.add("BNG"); setCodes.add(mage.sets.BornOfTheGods.getInstance().getCode());
setCodes.add("JOU"); setCodes.add(mage.sets.JourneyIntoNyx.getInstance().getCode());
} }
} }

View file

@ -15,9 +15,9 @@ public class ZendikarBlock extends Constructed {
public ZendikarBlock() { public ZendikarBlock() {
super("Constructed - Zendikar Block"); super("Constructed - Zendikar Block");
setCodes.add("ZEN"); setCodes.add(mage.sets.Zendikar.getInstance().getCode());
setCodes.add("WWK"); setCodes.add(mage.sets.Worldwake.getInstance().getCode());
setCodes.add("ROE"); setCodes.add(mage.sets.RiseOfTheEldrazi.getInstance().getCode());
} }
} }

View file

@ -22,7 +22,7 @@ public final class AetherRevolt extends ExpansionSet {
return instance; return instance;
} }
protected final List<CardInfo> savedSpecialLand = new ArrayList<>(); private final List<CardInfo> savedSpecialLand = new ArrayList<>();
private AetherRevolt() { private AetherRevolt() {
super("Aether Revolt", "AER", ExpansionSet.buildDate(2017, 1, 20), SetType.EXPANSION); super("Aether Revolt", "AER", ExpansionSet.buildDate(2017, 1, 20), SetType.EXPANSION);

View file

@ -23,7 +23,7 @@ public final class Amonkhet extends ExpansionSet {
return instance; return instance;
} }
protected final List<CardInfo> savedSpecialLand = new ArrayList<>(); private final List<CardInfo> savedSpecialLand = new ArrayList<>();
private Amonkhet() { private Amonkhet() {
super("Amonkhet", "AKH", ExpansionSet.buildDate(2017, 4, 28), SetType.EXPANSION); super("Amonkhet", "AKH", ExpansionSet.buildDate(2017, 4, 28), SetType.EXPANSION);

View file

@ -21,7 +21,7 @@ public final class BattleForZendikar extends ExpansionSet {
return instance; return instance;
} }
protected final List<CardInfo> savedSpecialLand = new ArrayList<>(); private final List<CardInfo> savedSpecialLand = new ArrayList<>();
private BattleForZendikar() { private BattleForZendikar() {
super("Battle for Zendikar", "BFZ", ExpansionSet.buildDate(2015, 10, 2), SetType.EXPANSION); super("Battle for Zendikar", "BFZ", ExpansionSet.buildDate(2015, 10, 2), SetType.EXPANSION);

View file

@ -1,9 +1,7 @@
package mage.sets; package mage.sets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import mage.cards.Card;
import mage.cards.ExpansionSet; import mage.cards.ExpansionSet;
import mage.cards.repository.CardCriteria; import mage.cards.repository.CardCriteria;
import mage.cards.repository.CardInfo; import mage.cards.repository.CardInfo;
@ -23,8 +21,8 @@ public final class CoreSet2019 extends ExpansionSet {
public static CoreSet2019 getInstance() { public static CoreSet2019 getInstance() {
return instance; return instance;
} }
List<CardInfo> savedSpecialCommon = new ArrayList<>();
protected final List<CardInfo> savedSpecialLand = new ArrayList<>(); private final List<CardInfo> savedSpecialLand = new ArrayList<>();
private CoreSet2019() { private CoreSet2019() {
super("Core Set 2019", "M19", ExpansionSet.buildDate(2018, 7, 13), SetType.CORE); super("Core Set 2019", "M19", ExpansionSet.buildDate(2018, 7, 13), SetType.CORE);
@ -372,7 +370,7 @@ public final class CoreSet2019 extends ExpansionSet {
criteria.setCodes(this.code).notTypes(CardType.LAND); criteria.setCodes(this.code).notTypes(CardType.LAND);
savedCardsInfos = CardRepository.instance.findCards(criteria); savedCardsInfos = CardRepository.instance.findCards(criteria);
if (maxCardNumberInBooster != Integer.MAX_VALUE) { if (maxCardNumberInBooster != Integer.MAX_VALUE) {
savedCardsInfos.removeIf(next -> next.getCardNumberAsInt() > maxCardNumberInBooster && rarity != Rarity.LAND); savedCardsInfos.removeIf(next -> next.getCardNumberAsInt() > maxCardNumberInBooster);
} }
savedCards.put(rarity, savedCardsInfos); savedCards.put(rarity, savedCardsInfos);
} }

View file

@ -22,7 +22,6 @@ public final class CoreSet2020 extends ExpansionSet {
return instance; return instance;
} }
private final List<CardInfo> savedSpecialCommon = new ArrayList<>();
private final List<CardInfo> savedSpecialLand = new ArrayList<>(); private final List<CardInfo> savedSpecialLand = new ArrayList<>();
private CoreSet2020() { private CoreSet2020() {
@ -106,7 +105,7 @@ public final class CoreSet2020 extends ExpansionSet {
cards.add(new SetCardInfo("Chandra, Novice Pyromancer", 128, Rarity.UNCOMMON, mage.cards.c.ChandraNovicePyromancer.class)); cards.add(new SetCardInfo("Chandra, Novice Pyromancer", 128, Rarity.UNCOMMON, mage.cards.c.ChandraNovicePyromancer.class));
cards.add(new SetCardInfo("Cloudkin Seer", 54, Rarity.COMMON, mage.cards.c.CloudkinSeer.class)); cards.add(new SetCardInfo("Cloudkin Seer", 54, Rarity.COMMON, mage.cards.c.CloudkinSeer.class));
cards.add(new SetCardInfo("Colossus Hammer", 223, Rarity.UNCOMMON, mage.cards.c.ColossusHammer.class)); cards.add(new SetCardInfo("Colossus Hammer", 223, Rarity.UNCOMMON, mage.cards.c.ColossusHammer.class));
cards.add(new SetCardInfo("Concordia Pegasus", 304, Rarity.UNCOMMON, mage.cards.c.ConcordiaPegasus.class)); cards.add(new SetCardInfo("Concordia Pegasus", 304, Rarity.COMMON, mage.cards.c.ConcordiaPegasus.class));
cards.add(new SetCardInfo("Convolute", 55, Rarity.COMMON, mage.cards.c.Convolute.class)); cards.add(new SetCardInfo("Convolute", 55, Rarity.COMMON, mage.cards.c.Convolute.class));
cards.add(new SetCardInfo("Coral Merfolk", 315, Rarity.COMMON, mage.cards.c.CoralMerfolk.class)); cards.add(new SetCardInfo("Coral Merfolk", 315, Rarity.COMMON, mage.cards.c.CoralMerfolk.class));
cards.add(new SetCardInfo("Corpse Knight", 206, Rarity.UNCOMMON, mage.cards.c.CorpseKnight.class)); cards.add(new SetCardInfo("Corpse Knight", 206, Rarity.UNCOMMON, mage.cards.c.CorpseKnight.class));
@ -399,7 +398,7 @@ public final class CoreSet2020 extends ExpansionSet {
criteria.setCodes(this.code).notTypes(CardType.LAND); criteria.setCodes(this.code).notTypes(CardType.LAND);
savedCardsInfos = CardRepository.instance.findCards(criteria); savedCardsInfos = CardRepository.instance.findCards(criteria);
if (maxCardNumberInBooster != Integer.MAX_VALUE) { if (maxCardNumberInBooster != Integer.MAX_VALUE) {
savedCardsInfos.removeIf(next -> next.getCardNumberAsInt() > maxCardNumberInBooster && rarity != Rarity.LAND); savedCardsInfos.removeIf(next -> next.getCardNumberAsInt() > maxCardNumberInBooster);
} }
savedCards.put(rarity, savedCardsInfos); savedCards.put(rarity, savedCardsInfos);
} }

View file

@ -23,10 +23,10 @@ public final class DragonsMaze extends ExpansionSet {
return instance; return instance;
} }
List<CardInfo> savedSpecialRares = new ArrayList<>(); private List<CardInfo> savedSpecialRares = new ArrayList<>();
private DragonsMaze() { private DragonsMaze() {
super("Dragon's Maze", "DGM", ExpansionSet.buildDate(2013, 5, 03), SetType.EXPANSION); super("Dragon's Maze", "DGM", ExpansionSet.buildDate(2013, 5, 3), SetType.EXPANSION);
this.blockName = "Return to Ravnica"; this.blockName = "Return to Ravnica";
this.hasBoosters = true; this.hasBoosters = true;
this.numBoosterSpecial = 1; this.numBoosterSpecial = 1;
@ -204,7 +204,7 @@ public final class DragonsMaze extends ExpansionSet {
criteria.rarities(rarity).doubleFaced(false); criteria.rarities(rarity).doubleFaced(false);
savedCardsInfos = CardRepository.instance.findCards(criteria); savedCardsInfos = CardRepository.instance.findCards(criteria);
if (maxCardNumberInBooster != Integer.MAX_VALUE) { if (maxCardNumberInBooster != Integer.MAX_VALUE) {
savedCardsInfos.removeIf(next -> next.getCardNumberAsInt() > maxCardNumberInBooster && rarity != Rarity.LAND); savedCardsInfos.removeIf(next -> next.getCardNumberAsInt() > maxCardNumberInBooster);
} }
savedCards.put(rarity, savedCardsInfos); savedCards.put(rarity, savedCardsInfos);
} }
@ -224,7 +224,6 @@ public final class DragonsMaze extends ExpansionSet {
@Override @Override
public List<CardInfo> getSpecialRare() { public List<CardInfo> getSpecialRare() {
List<CardInfo> specialRares = new ArrayList<>();
if (savedSpecialRares == null) { if (savedSpecialRares == null) {
CardCriteria criteria = new CardCriteria(); CardCriteria criteria = new CardCriteria();
criteria.setCodes("GTC").name("Breeding Pool"); criteria.setCodes("GTC").name("Breeding Pool");
@ -258,8 +257,7 @@ public final class DragonsMaze extends ExpansionSet {
criteria.setCodes("RTR").name("Temple Garden"); criteria.setCodes("RTR").name("Temple Garden");
savedSpecialRares.addAll(CardRepository.instance.findCards(criteria)); savedSpecialRares.addAll(CardRepository.instance.findCards(criteria));
} }
specialRares.addAll(savedSpecialRares); return new ArrayList<>(savedSpecialRares);
return specialRares;
} }
@Override @Override

View file

@ -16,7 +16,7 @@ public final class DuelDecksDivineVsDemonic extends ExpansionSet {
} }
private DuelDecksDivineVsDemonic() { private DuelDecksDivineVsDemonic() {
super("Duel Decks: Divine vs. Demonic", "DDC", ExpansionSet.buildDate(2009, 04, 10), SetType.SUPPLEMENTAL); super("Duel Decks: Divine vs. Demonic", "DDC", ExpansionSet.buildDate(2009, 4, 10), SetType.SUPPLEMENTAL);
this.blockName = "Duel Decks"; this.blockName = "Duel Decks";
this.hasBasicLands = true; this.hasBasicLands = true;

View file

@ -21,7 +21,7 @@ public final class DuelDecksJaceVsChandra extends ExpansionSet {
} }
private DuelDecksJaceVsChandra() { private DuelDecksJaceVsChandra() {
super("Duel Decks: Jace vs. Chandra", "DD2", ExpansionSet.buildDate(2008, 11, 07), SetType.SUPPLEMENTAL); super("Duel Decks: Jace vs. Chandra", "DD2", ExpansionSet.buildDate(2008, 11, 7), SetType.SUPPLEMENTAL);
this.blockName = "Duel Decks"; this.blockName = "Duel Decks";
this.hasBasicLands = true; this.hasBasicLands = true;

View file

@ -19,8 +19,8 @@ public final class FateReforged extends ExpansionSet {
private static final FateReforged instance = new FateReforged(); private static final FateReforged instance = new FateReforged();
List<CardInfo> savedSpecialRares = new ArrayList<>(); private List<CardInfo> savedSpecialRares = new ArrayList<>();
List<CardInfo> savedSpecialCommon = new ArrayList<>(); private List<CardInfo> savedSpecialCommon = new ArrayList<>();
public static FateReforged getInstance() { public static FateReforged getInstance() {
return instance; return instance;
@ -238,7 +238,7 @@ public final class FateReforged extends ExpansionSet {
criteria.setCodes(this.code).notTypes(CardType.LAND); criteria.setCodes(this.code).notTypes(CardType.LAND);
savedCardsInfos = CardRepository.instance.findCards(criteria); savedCardsInfos = CardRepository.instance.findCards(criteria);
if (maxCardNumberInBooster != Integer.MAX_VALUE) { if (maxCardNumberInBooster != Integer.MAX_VALUE) {
savedCardsInfos.removeIf(next -> next.getCardNumberAsInt() > maxCardNumberInBooster && rarity != Rarity.LAND); savedCardsInfos.removeIf(next -> next.getCardNumberAsInt() > maxCardNumberInBooster);
} }
savedCards.put(rarity, savedCardsInfos); savedCards.put(rarity, savedCardsInfos);
} }
@ -251,7 +251,6 @@ public final class FateReforged extends ExpansionSet {
@Override @Override
public List<CardInfo> getSpecialCommon() { public List<CardInfo> getSpecialCommon() {
List<CardInfo> specialCommons = new ArrayList<>();
if (savedSpecialCommon.isEmpty()) { if (savedSpecialCommon.isEmpty()) {
// the 10 common lands from Fate Reforged can show up in the basic lands slot // the 10 common lands from Fate Reforged can show up in the basic lands slot
// http://magic.wizards.com/en/articles/archive/feature/fetching-look-fate-reforged-2014-12-24 // http://magic.wizards.com/en/articles/archive/feature/fetching-look-fate-reforged-2014-12-24
@ -261,13 +260,11 @@ public final class FateReforged extends ExpansionSet {
criteria.rarities(Rarity.LAND).setCodes(this.code); criteria.rarities(Rarity.LAND).setCodes(this.code);
savedSpecialCommon.addAll(CardRepository.instance.findCards(criteria)); savedSpecialCommon.addAll(CardRepository.instance.findCards(criteria));
} }
specialCommons.addAll(savedSpecialCommon); return new ArrayList<>(savedSpecialCommon);
return specialCommons;
} }
@Override @Override
public List<CardInfo> getSpecialRare() { public List<CardInfo> getSpecialRare() {
List<CardInfo> specialRares = new ArrayList<>();
if (savedSpecialRares.isEmpty()) { if (savedSpecialRares.isEmpty()) {
CardCriteria criteria = new CardCriteria(); CardCriteria criteria = new CardCriteria();
criteria.setCodes("KTK").name("Bloodstained Mire"); criteria.setCodes("KTK").name("Bloodstained Mire");
@ -285,7 +282,6 @@ public final class FateReforged extends ExpansionSet {
criteria.setCodes("KTK").name("Wooded Foothills"); criteria.setCodes("KTK").name("Wooded Foothills");
savedSpecialRares.addAll(CardRepository.instance.findCards(criteria)); savedSpecialRares.addAll(CardRepository.instance.findCards(criteria));
} }
specialRares.addAll(savedSpecialRares); return new ArrayList<>(savedSpecialRares);
return specialRares;
} }
} }

View file

@ -22,7 +22,7 @@ public final class HourOfDevastation extends ExpansionSet {
return instance; return instance;
} }
protected final List<CardInfo> savedSpecialLand = new ArrayList<>(); private final List<CardInfo> savedSpecialLand = new ArrayList<>();
private HourOfDevastation() { private HourOfDevastation() {
super("Hour of Devastation", "HOU", ExpansionSet.buildDate(2017, 7, 14), SetType.EXPANSION); super("Hour of Devastation", "HOU", ExpansionSet.buildDate(2017, 7, 14), SetType.EXPANSION);

View file

@ -23,7 +23,7 @@ public final class Kaladesh extends ExpansionSet {
return instance; return instance;
} }
protected final List<CardInfo> savedSpecialLand = new ArrayList<>(); private final List<CardInfo> savedSpecialLand = new ArrayList<>();
private Kaladesh() { private Kaladesh() {
super("Kaladesh", "KLD", ExpansionSet.buildDate(2016, 9, 30), SetType.EXPANSION); super("Kaladesh", "KLD", ExpansionSet.buildDate(2016, 9, 30), SetType.EXPANSION);

View file

@ -1,14 +1,13 @@
package mage.sets; package mage.sets;
/**
*
* @author JayDi85
*/
import mage.cards.ExpansionSet; import mage.cards.ExpansionSet;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.SetType; import mage.constants.SetType;
/**
* @author JayDi85
*/
public final class Masters25 extends ExpansionSet { public final class Masters25 extends ExpansionSet {
private static final Masters25 instance = new Masters25(); private static final Masters25 instance = new Masters25();

View file

@ -22,7 +22,7 @@ public final class MastersEditionIV extends ExpansionSet {
return instance; return instance;
} }
protected final List<CardInfo> savedSpecialLand = new ArrayList<>(); private final List<CardInfo> savedSpecialLand = new ArrayList<>();
private MastersEditionIV() { private MastersEditionIV() {
super("Masters Edition IV", "ME4", ExpansionSet.buildDate(2011, 1, 10), SetType.MAGIC_ONLINE); super("Masters Edition IV", "ME4", ExpansionSet.buildDate(2011, 1, 10), SetType.MAGIC_ONLINE);

View file

@ -26,7 +26,7 @@ public final class OathOfTheGatewatch extends ExpansionSet {
return instance; return instance;
} }
protected final List<CardInfo> savedSpecialLand = new ArrayList<>(); private final List<CardInfo> savedSpecialLand = new ArrayList<>();
private OathOfTheGatewatch() { private OathOfTheGatewatch() {
super("Oath of the Gatewatch", "OGW", ExpansionSet.buildDate(2016, 1, 22), SetType.EXPANSION); super("Oath of the Gatewatch", "OGW", ExpansionSet.buildDate(2016, 1, 22), SetType.EXPANSION);

View file

@ -12,9 +12,6 @@ public final class Portal extends ExpansionSet {
private static final Portal instance = new Portal(); private static final Portal instance = new Portal();
/**
* @return
*/
public static Portal getInstance() { public static Portal getInstance() {
return instance; return instance;
} }

View file

@ -13,10 +13,6 @@ public final class PortalSecondAge extends ExpansionSet {
private static final PortalSecondAge instance = new PortalSecondAge(); private static final PortalSecondAge instance = new PortalSecondAge();
/**
*
* @return
*/
public static PortalSecondAge getInstance() { public static PortalSecondAge getInstance() {
return instance; return instance;
} }

View file

@ -25,7 +25,7 @@ public final class ShadowsOverInnistrad extends ExpansionSet {
return instance; return instance;
} }
protected final EnumMap<Rarity, List<CardInfo>> savedDoubleFacedCards; private final EnumMap<Rarity, List<CardInfo>> savedDoubleFacedCards;
private ShadowsOverInnistrad() { private ShadowsOverInnistrad() {
super("Shadows over Innistrad", "SOI", ExpansionSet.buildDate(2016, 4, 8), SetType.EXPANSION); super("Shadows over Innistrad", "SOI", ExpansionSet.buildDate(2016, 4, 8), SetType.EXPANSION);
@ -387,7 +387,7 @@ public final class ShadowsOverInnistrad extends ExpansionSet {
} }
} }
public List<CardInfo> getDoubleFacedCardsByRarity(Rarity rarity) { private List<CardInfo> getDoubleFacedCardsByRarity(Rarity rarity) {
List<CardInfo> savedCardsInfos = savedDoubleFacedCards.get(rarity); List<CardInfo> savedCardsInfos = savedDoubleFacedCards.get(rarity);
if (savedCardsInfos == null) { if (savedCardsInfos == null) {
CardCriteria criteria = new CardCriteria(); CardCriteria criteria = new CardCriteria();

View file

@ -13,10 +13,6 @@ public final class Starter2000 extends ExpansionSet {
private static final Starter2000 instance = new Starter2000(); private static final Starter2000 instance = new Starter2000();
/**
*
* @return
*/
public static Starter2000 getInstance() { public static Starter2000 getInstance() {
return instance; return instance;
} }

View file

@ -28,14 +28,14 @@ public class DeckValidatorTest extends MageTestBase {
int number; int number;
public CardNameAmount(String setCode, int cardNumber, int number) { CardNameAmount(String setCode, int cardNumber, int number) {
this.name = ""; this.name = "";
this.setCode = setCode; this.setCode = setCode;
this.cardNumber = String.valueOf(cardNumber); this.cardNumber = String.valueOf(cardNumber);
this.number = number; this.number = number;
} }
public CardNameAmount(String name, int number) { CardNameAmount(String name, int number) {
this.name = name; this.name = name;
this.number = number; this.number = number;
} }
@ -48,11 +48,11 @@ public class DeckValidatorTest extends MageTestBase {
return number; return number;
} }
public String getSetCode() { String getSetCode() {
return setCode; return setCode;
} }
public String getCardNumber() { String getCardNumber() {
return cardNumber; return cardNumber;
} }
@ -359,6 +359,7 @@ public class DeckValidatorTest extends MageTestBase {
cardinfo = CardRepository.instance.findCard(cardNameAmount.getName()); cardinfo = CardRepository.instance.findCard(cardNameAmount.getName());
} }
for (int i = 0; i < cardNameAmount.getNumber(); i++) { for (int i = 0; i < cardNameAmount.getNumber(); i++) {
assert cardinfo != null;
deckToTest.getCards().add(cardinfo.getCard()); deckToTest.getCards().add(cardinfo.getCard());
} }
} }
@ -372,6 +373,7 @@ public class DeckValidatorTest extends MageTestBase {
cardinfo = CardRepository.instance.findCard(cardNameAmount.getName()); cardinfo = CardRepository.instance.findCard(cardNameAmount.getName());
} }
for (int i = 0; i < cardNameAmount.getNumber(); i++) { for (int i = 0; i < cardNameAmount.getNumber(); i++) {
assert cardinfo != null;
deckToTest.getSideboard().add(cardinfo.getCard()); deckToTest.getSideboard().add(cardinfo.getCard());
} }
} }

View file

@ -5,6 +5,7 @@ import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.keyword.PartnerWithAbility; import mage.abilities.keyword.PartnerWithAbility;
import mage.cards.Card; import mage.cards.Card;
@ -143,6 +144,15 @@ public class BoosterGenerationTest extends MageTestBase {
assertTrue(allCards.stream().anyMatch(card -> card.getCardType().contains(CardType.LAND) && card.getRarity().equals(Rarity.COMMON))); assertTrue(allCards.stream().anyMatch(card -> card.getCardType().contains(CardType.LAND) && card.getRarity().equals(Rarity.COMMON)));
} }
@Test
public void testWarOfTheSpark_EveryBoosterContainsPlaneswalker() {
for (int i = 0; i < 10; i++) {
List<Card> booster = WarOfTheSpark.getInstance().createBooster();
// check that booster contains a planeswalker
assertTrue(booster.stream().anyMatch(MageObject::isPlaneswalker));
}
}
@Test @Test
public void testDominaria_EveryBoosterContainsLegendaryCreature() { public void testDominaria_EveryBoosterContainsLegendaryCreature() {
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
@ -160,6 +170,14 @@ public class BoosterGenerationTest extends MageTestBase {
} }
} }
@Test
public void testModernHorizons_BoosterMustHaveOneSnowLand() {
for (int i = 0; i < 10; i++) {
List<Card> booster = ModernHorizons.getInstance().createBooster();
assertTrue("Modern Horizon's booster must contain 1 snow covered land", booster.stream().anyMatch(card -> card.isBasic() && card.getName().startsWith("Snow-Covered ")));
}
}
@Test @Test
public void testMastersEditionII_BoosterMustHaveOneSnowLand() { public void testMastersEditionII_BoosterMustHaveOneSnowLand() {
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
@ -171,7 +189,7 @@ public class BoosterGenerationTest extends MageTestBase {
@Test @Test
public void testBattlebond_BoosterMustHaveOneLand() { public void testBattlebond_BoosterMustHaveOneLand() {
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
List<Card> booster = Coldsnap.getInstance().createBooster(); List<Card> booster = Battlebond.getInstance().createBooster();
assertTrue("battlebond's booster must contain 1 land", booster.stream().anyMatch(card -> card.isBasic() && card.isLand())); assertTrue("battlebond's booster must contain 1 land", booster.stream().anyMatch(card -> card.isBasic() && card.isLand()));
} }
} }