updated verify check to ignore evergreen keywords

This commit is contained in:
Evan Kranzler 2020-10-06 19:33:39 -04:00
parent b5d52fe14c
commit e43da063ef

View file

@ -21,6 +21,7 @@ import mage.game.draft.RateCard;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.TokenImpl;
import mage.sets.TherosBeyondDeath;
import mage.util.CardUtil;
import mage.verify.mtgjson.MtgJsonCard;
import mage.verify.mtgjson.MtgJsonService;
import mage.verify.mtgjson.MtgJsonSet;
@ -69,6 +70,10 @@ public class VerifyCardDataTest {
private static final String SKIP_LIST_SCRYFALL_DOWNLOAD_SETS = "SCRYFALL_DOWNLOAD_SETS";
private static final String SKIP_LIST_WRONG_CARD_NUMBERS = "WRONG_CARD_NUMBERS";
private static final String SKIP_LIST_SAMPLE_DECKS = "SAMPLE_DECKS";
private static final List<String> evergreenKeywords = Arrays.asList(
"flying", "lifelink", "menace", "trample", "haste", "first strike", "hexproof",
"deathtouch", "double strike", "indestructible", "reach", "flash", "defender"
);
static {
// skip lists for checks (example: unstable cards with same name may have different stats)
@ -1432,6 +1437,20 @@ public class VerifyCardDataTest {
refText = refText.replace("[", "").replace("]", "");
}
// evergreen keyword fix
for (String s : refText.split("[\\$\\\n]")) {
if (Arrays
.stream(s.split(", "))
.map(String::toLowerCase)
.allMatch(evergreenKeywords::contains)) {
String replacement = Arrays
.stream(s.split(", "))
.map(CardUtil::getTextWithFirstCharUpperCase)
.reduce("", (a, b) -> a + "\n" + b);
refText = refText.replace(s, replacement);
}
}
String[] refRules = refText.split("[\\$\\\n]"); // ref card's abilities can be splited by \n or $ chars
for (int i = 0; i < refRules.length; i++) {
refRules[i] = prepareRule(card.getName(), refRules[i]);