mirror of
https://github.com/correl/mage.git
synced 2024-11-28 19:19:55 +00:00
updated verify check to ignore evergreen keywords
This commit is contained in:
parent
b5d52fe14c
commit
e43da063ef
1 changed files with 19 additions and 0 deletions
|
@ -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]);
|
||||
|
|
Loading…
Reference in a new issue