From 07e1dff10c364f971ae01eb97c6b3770e2bfccd8 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 8 Jul 2021 18:46:42 -0400 Subject: [PATCH] added an additional subtype verification test --- .../test/java/mage/verify/VerifyCardDataTest.java | 14 ++++++++++++++ Mage/src/main/java/mage/constants/SubType.java | 6 ++++++ 2 files changed, 20 insertions(+) diff --git a/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java b/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java index 6cba7d5ed9..ebc9e54894 100644 --- a/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java +++ b/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java @@ -1254,6 +1254,20 @@ public class VerifyCardDataTest { expected.removeIf(subtypesToIgnore::contains); } + for (SubType subType : card.getSubtype()) { + if (!subType.isCustomSet() && !subType.canGain(card)) { + String cardTypeString = card + .getCardType() + .stream() + .map(CardType::toString) + .reduce((a, b) -> a + " " + b) + .orElse(""); + fail(card, "subtypes", "card has subtype " + + subType.getDescription() + " (" + subType.getSubTypeSet() + ')' + + " that doesn't match its card type(s) (" + cardTypeString + ')'); + } + } + if (!eqSet(actual, expected)) { fail(card, "subtypes", actual + " != " + expected); } diff --git a/Mage/src/main/java/mage/constants/SubType.java b/Mage/src/main/java/mage/constants/SubType.java index ea04d9c37e..8e90af1188 100644 --- a/Mage/src/main/java/mage/constants/SubType.java +++ b/Mage/src/main/java/mage/constants/SubType.java @@ -544,6 +544,10 @@ public enum SubType { return "AEIOUaeiou".indexOf(c) != -1; } + public boolean isCustomSet() { + return customSet; + } + public static SubType fromString(String value) { for (SubType st : SubType.values()) { if (st.toString().equals(value)) { @@ -581,6 +585,8 @@ public enum SubType { return mageObject.isArtifact(); case PlaneswalkerType: return mageObject.isPlaneswalker(); + case SpellType: + return mageObject.isInstantOrSorcery(); } return false; }