1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-10 01:01:05 -09:00

added some options to mage verify for text verification

This commit is contained in:
Evan Kranzler 2021-05-04 08:00:03 -04:00
parent 970427e23f
commit 95bfcb5ef8

View file

@ -58,7 +58,9 @@ public class VerifyCardDataTest {
private static final String FULL_ABILITIES_CHECK_SET_CODE = "C21"; // check all abilities and output cards with wrong abilities texts; private static final String FULL_ABILITIES_CHECK_SET_CODE = "C21"; // check all abilities and output cards with wrong abilities texts;
private static final boolean AUTO_FIX_SAMPLE_DECKS = false; // debug only: auto-fix sample decks by test_checkSampleDecks test run private static final boolean AUTO_FIX_SAMPLE_DECKS = false; // debug only: auto-fix sample decks by test_checkSampleDecks test run
private static final boolean ONLY_TEXT = false; // use when checking text locally, suppresses unnecessary checks and output messages
private static final Set<String> checkedNames = new HashSet<>();
private static final HashMap<String, Set<String>> skipCheckLists = new HashMap<>(); private static final HashMap<String, Set<String>> skipCheckLists = new HashMap<>();
private static final Set<String> subtypesToIgnore = new HashSet<>(); private static final Set<String> subtypesToIgnore = new HashSet<>();
private static final String SKIP_LIST_PT = "PT"; private static final String SKIP_LIST_PT = "PT";
@ -1175,7 +1177,7 @@ public class VerifyCardDataTest {
MtgJsonCard ref = MtgJsonService.cardFromSet(card.getExpansionSetCode(), card.getName(), card.getCardNumber()); MtgJsonCard ref = MtgJsonService.cardFromSet(card.getExpansionSetCode(), card.getName(), card.getCardNumber());
if (ref != null) { if (ref != null) {
checkAll(card, ref, cardIndex); checkAll(card, ref, cardIndex);
} else if (!skipWarning) { } else if (!skipWarning && !ONLY_TEXT) {
warn(card, "Missing card reference"); warn(card, "Missing card reference");
} }
} }
@ -1184,7 +1186,19 @@ public class VerifyCardDataTest {
return options != null && options.contains(value); return options != null && options.contains(value);
} }
private static boolean checkName(MtgJsonCard ref) {
if (!ONLY_TEXT || checkedNames.contains(ref.name)) {
return false;
}
checkedNames.add(ref.name);
return true;
}
private void checkAll(Card card, MtgJsonCard ref, int cardIndex) { private void checkAll(Card card, MtgJsonCard ref, int cardIndex) {
if (checkName(ref)) {
return;
}
if (!ONLY_TEXT) {
checkCost(card, ref); checkCost(card, ref);
checkPT(card, ref); checkPT(card, ref);
checkSubtypes(card, ref); checkSubtypes(card, ref);
@ -1194,6 +1208,7 @@ public class VerifyCardDataTest {
checkBasicLands(card, ref); checkBasicLands(card, ref);
checkMissingAbilities(card, ref); checkMissingAbilities(card, ref);
checkWrongSymbolsInRules(card); checkWrongSymbolsInRules(card);
}
checkWrongAbilitiesText(card, ref, cardIndex); checkWrongAbilitiesText(card, ref, cardIndex);
} }
@ -1561,7 +1576,9 @@ public class VerifyCardDataTest {
if (!isAbilityFounded && cardRules[i].length() > 0) { if (!isAbilityFounded && cardRules[i].length() > 0) {
isFine = false; isFine = false;
if (!ONLY_TEXT) {
warn(card, "card ability can't be found in ref [" + card.getName() + ": " + cardRules[i] + "]"); warn(card, "card ability can't be found in ref [" + card.getName() + ": " + cardRules[i] + "]");
}
cardRules[i] = "- " + cardRules[i]; cardRules[i] = "- " + cardRules[i];
} }
} }