Fixed verify color check.

This commit is contained in:
LevelX2 2018-11-26 19:01:18 +01:00
parent 2323654a22
commit b7ebff4fa1

View file

@ -1,7 +1,18 @@
package mage.verify; package mage.verify;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Paths;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.keyword.DevoidAbility;
import mage.abilities.keyword.MultikickerAbility; import mage.abilities.keyword.MultikickerAbility;
import mage.cards.*; import mage.cards.*;
import mage.cards.basiclands.BasicLand; import mage.cards.basiclands.BasicLand;
@ -18,19 +29,6 @@ import org.mage.plugins.card.images.CardDownloadData;
import org.mage.plugins.card.images.DownloadPictures; import org.mage.plugins.card.images.DownloadPictures;
import org.reflections.Reflections; import org.reflections.Reflections;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Paths;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/** /**
* @author JayDi85 * @author JayDi85
*/ */
@ -108,7 +106,7 @@ public class VerifyCardDataTest {
} }
private int failed = 0; private int failed = 0;
private ArrayList<String> outputMessages = new ArrayList<>(); private final ArrayList<String> outputMessages = new ArrayList<>();
@Test @Test
public void verifyCards() throws IOException { public void verifyCards() throws IOException {
@ -353,7 +351,6 @@ public class VerifyCardDataTest {
} }
// TODO: add test to check num cards for rarity (rarityStats > 0 and numRarity > 0) // TODO: add test to check num cards for rarity (rarityStats > 0 and numRarity > 0)
printMessages(warningsList); printMessages(warningsList);
printMessages(errorsList); printMessages(errorsList);
if (errorsList.size() > 0) { if (errorsList.size() > 0) {
@ -368,7 +365,6 @@ public class VerifyCardDataTest {
Collection<ExpansionSet> sets = Sets.getInstance().values(); Collection<ExpansionSet> sets = Sets.getInstance().values();
// 1. wrong UsesVariousArt settings (set have duplicated card name without that setting -- e.g. cards will have same image) // 1. wrong UsesVariousArt settings (set have duplicated card name without that setting -- e.g. cards will have same image)
for (ExpansionSet set : sets) { for (ExpansionSet set : sets) {
@ -572,18 +568,18 @@ public class VerifyCardDataTest {
if (ref.colors != null) { if (ref.colors != null) {
expected.addAll(ref.colors); expected.addAll(ref.colors);
} }
if(card.isFlipCard()){ if (card.isFlipCard()) {
expected.addAll(ref.colorIdentity); expected.addAll(ref.colorIdentity);
} }
ObjectColor color = card.getColor(null); ObjectColor color = card.getColor(null);
if (expected.size() != color.getColorCount() if (expected.size() != color.getColorCount()
|| (color.isBlack() && !expected.contains("B")) || (color.isBlack() && !expected.contains("Black"))
|| (color.isBlue() && !expected.contains("U")) || (color.isBlue() && !expected.contains("Blue"))
|| (color.isGreen() && !expected.contains("G")) || (color.isGreen() && !expected.contains("Green"))
|| (color.isRed() && !expected.contains("R")) || (color.isRed() && !expected.contains("Red"))
|| (color.isWhite() && !expected.contains("W"))) { || (color.isWhite() && !expected.contains("White"))) {
fail(card, "colors", color + " != " + expected); fail(card, "colors", color + " != " + expected);
} }
} }
@ -598,7 +594,7 @@ public class VerifyCardDataTest {
// fix names (e.g. Urzas to Urza's) // fix names (e.g. Urzas to Urza's)
if (expected != null && expected.contains("Urzas")) { if (expected != null && expected.contains("Urzas")) {
expected = new ArrayList<>(expected); expected = new ArrayList<>(expected);
for (ListIterator<String> it = ((List<String>) expected).listIterator(); it.hasNext(); ) { for (ListIterator<String> it = ((List<String>) expected).listIterator(); it.hasNext();) {
if (it.next().equals("Urzas")) { if (it.next().equals("Urzas")) {
it.set("Urza's"); it.set("Urza's");
} }