mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
Merge branch 'master' into fix_hints_on_ward
# Conflicts: # Mage.Sets/src/mage/cards/g/GavonyDawnguard.java
This commit is contained in:
commit
f0b28ff21b
5305 changed files with 66292 additions and 32486 deletions
|
|
@ -2,9 +2,12 @@ package mage.verify;
|
|||
|
||||
import com.google.common.base.CharMatcher;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.common.SagaAbility;
|
||||
import mage.abilities.common.WerewolfBackTriggeredAbility;
|
||||
import mage.abilities.common.WerewolfFrontTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.FightTargetsEffect;
|
||||
import mage.abilities.effects.keyword.ScryEffect;
|
||||
import mage.abilities.keyword.*;
|
||||
|
|
@ -56,7 +59,7 @@ public class VerifyCardDataTest {
|
|||
|
||||
private static final Logger logger = Logger.getLogger(VerifyCardDataTest.class);
|
||||
|
||||
private static final String FULL_ABILITIES_CHECK_SET_CODE = "VOC"; // check all abilities and output cards with wrong abilities texts;
|
||||
private static final String FULL_ABILITIES_CHECK_SET_CODE = "NCC"; // 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 ONLY_TEXT = false; // use when checking text locally, suppresses unnecessary checks and output messages
|
||||
|
||||
|
|
@ -77,8 +80,9 @@ public class VerifyCardDataTest {
|
|||
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", "vigilance"
|
||||
"flying", "lifelink", "menace", "trample", "haste", "first strike", "hexproof", "fear",
|
||||
"deathtouch", "double strike", "indestructible", "reach", "flash", "defender", "vigilance",
|
||||
"plainswalk", "islandwalk", "swampwalk", "mountainwalk", "forestwalk"
|
||||
);
|
||||
|
||||
static {
|
||||
|
|
@ -102,7 +106,6 @@ public class VerifyCardDataTest {
|
|||
skipListAddName(SKIP_LIST_TYPE, "UNH", "Old Fogey"); // uses summon word as a joke card
|
||||
skipListAddName(SKIP_LIST_TYPE, "UND", "Old Fogey");
|
||||
skipListAddName(SKIP_LIST_TYPE, "UST", "capital offense"); // uses "instant" instead "Instant" as a joke card
|
||||
skipListAddName(SKIP_LIST_TYPE, "NEO", "Oni-Cult Anvil"); // temporary
|
||||
|
||||
// subtype
|
||||
skipListCreate(SKIP_LIST_SUBTYPE);
|
||||
|
|
@ -234,7 +237,7 @@ public class VerifyCardDataTest {
|
|||
}
|
||||
|
||||
private static boolean evergreenCheck(String s) {
|
||||
return evergreenKeywords.contains(s) || s.startsWith("protection from") || s.startsWith("hexproof from");
|
||||
return evergreenKeywords.contains(s) || s.startsWith("protection from") || s.startsWith("hexproof from") || s.startsWith("ward ");
|
||||
}
|
||||
|
||||
private static <T> boolean eqSet(Collection<T> a, Collection<T> b) {
|
||||
|
|
@ -1134,7 +1137,7 @@ public class VerifyCardDataTest {
|
|||
Token token = (Token) createNewObject(tokenClass);
|
||||
if (token == null) {
|
||||
errorsList.add("Error: token must have default constructor with zero params: " + tokenClass.getName());
|
||||
} else if (tokDataNamesIndex.getOrDefault(token.getName(), "").isEmpty()) {
|
||||
} else if (tokDataNamesIndex.getOrDefault(token.getName().replace(" Token", ""), "").isEmpty()) {
|
||||
errorsList.add("Error: can't find data in card-pictures-tok.txt for token: " + tokenClass.getName() + " -> " + token.getName());
|
||||
}
|
||||
}
|
||||
|
|
@ -1482,6 +1485,13 @@ public class VerifyCardDataTest {
|
|||
newRule = newRule.replaceAll("(?i) <i>\\(.+\\)</i>", "");
|
||||
newRule = newRule.replaceAll("(?i) \\(.+\\)", "");
|
||||
|
||||
// fix specifically for mana abilities
|
||||
if (newRule.startsWith("({T}: Add")) {
|
||||
newRule = newRule
|
||||
.replace("(", "")
|
||||
.replace(")", "");
|
||||
}
|
||||
|
||||
// replace special text and symbols
|
||||
newRule = newRule
|
||||
.replace("{this}", cardName)
|
||||
|
|
@ -1544,7 +1554,7 @@ public class VerifyCardDataTest {
|
|||
.replace("{this}", card.getName())
|
||||
//.replace("<i>", "")
|
||||
//.replace("</i>", "")
|
||||
.replace("—", "—");;
|
||||
.replace("—", "—");
|
||||
|
||||
boolean found = false;
|
||||
for (String refRule : refRules) {
|
||||
|
|
@ -1582,13 +1592,20 @@ public class VerifyCardDataTest {
|
|||
}
|
||||
}*/
|
||||
private static final boolean compareText(String cardText, String refText, String name) {
|
||||
if (cardText.equals(refText)) {
|
||||
return true;
|
||||
}
|
||||
if (cardText.replace(name, name.split(", ")[0]).equals(refText)) {
|
||||
return true;
|
||||
}
|
||||
return cardText.replace(name, name.split(" ")[0]).equals(refText);
|
||||
return cardText.equals(refText)
|
||||
|| cardText.replace(name, name.split(", ")[0]).equals(refText)
|
||||
|| cardText.replace(name, name.split(" ")[0]).equals(refText);
|
||||
}
|
||||
|
||||
private static final boolean checkForEffect(Card card, Class<? extends Effect> effectClazz) {
|
||||
return card.getAbilities()
|
||||
.stream()
|
||||
.map(Ability::getModes)
|
||||
.map(LinkedHashMap::values)
|
||||
.flatMap(Collection::stream)
|
||||
.map(Mode::getEffects)
|
||||
.flatMap(Collection::stream)
|
||||
.anyMatch(effectClazz::isInstance);
|
||||
}
|
||||
|
||||
private void checkWrongAbilitiesText(Card card, MtgJsonCard ref, int cardIndex) {
|
||||
|
|
@ -1602,24 +1619,20 @@ public class VerifyCardDataTest {
|
|||
}
|
||||
|
||||
String refText = ref.text;
|
||||
// lands fix
|
||||
if (refText.startsWith("(") && refText.endsWith(")")) {
|
||||
refText = refText.substring(1, refText.length() - 1);
|
||||
}
|
||||
// planeswalker fix [-7]: xxx
|
||||
refText = refText.replaceAll("\\[([\\−\\+]?\\d*)\\]\\: ", "$1: ");
|
||||
refText = refText.replaceAll("\\[([\\−\\+]?\\d*)\\]\\: ", "$1: ").replaceAll("\\[\\−X\\]\\: ", "-X: ");
|
||||
|
||||
// evergreen keyword fix
|
||||
for (String s : refText.split("[\\$\\\n]")) {
|
||||
for (String s : refText.replaceAll(" \\(.+?\\)", "").split("[\\$\\\n]")) {
|
||||
if (Arrays
|
||||
.stream(s.split(", "))
|
||||
.stream(s.split("[,;] "))
|
||||
.map(String::toLowerCase)
|
||||
.allMatch(VerifyCardDataTest::evergreenCheck)) {
|
||||
String replacement = Arrays
|
||||
.stream(s.split(", "))
|
||||
.stream(s.split("[,;] "))
|
||||
.map(CardUtil::getTextWithFirstCharUpperCase)
|
||||
.reduce("", (a, b) -> a + '\n' + b);
|
||||
refText = refText.replace(s, replacement.substring(1));
|
||||
.collect(Collectors.joining("\n"));
|
||||
refText = refText.replace(s, replacement);
|
||||
}
|
||||
}
|
||||
// modal spell fix
|
||||
|
|
@ -1634,7 +1647,8 @@ public class VerifyCardDataTest {
|
|||
}
|
||||
// mana ability fix
|
||||
for (String s : refText.split("[\\$\\\n]")) {
|
||||
if (!(s.startsWith("{T}: Add {") || s.startsWith("({T}: Add {")) || !s.contains("} or {")) {
|
||||
if (!(s.startsWith("{T}: Add {") || s.startsWith("({T}: Add {"))
|
||||
|| !(s.contains("} or {") || s.contains("}, or {"))) {
|
||||
continue;
|
||||
}
|
||||
String newStr = "";
|
||||
|
|
@ -1643,6 +1657,9 @@ public class VerifyCardDataTest {
|
|||
newStr += "{T}: Add {" + c + "}.\n";
|
||||
}
|
||||
}
|
||||
if (!newStr.isEmpty()) {
|
||||
newStr = newStr.substring(0, newStr.length() - 1);
|
||||
}
|
||||
refText = refText.replace(s, newStr);
|
||||
}
|
||||
|
||||
|
|
@ -1655,9 +1672,11 @@ public class VerifyCardDataTest {
|
|||
String[] cardRules = card
|
||||
.getRules()
|
||||
.stream()
|
||||
.reduce("", (a, b) -> a + '\n' + b)
|
||||
.collect(Collectors.joining("\n"))
|
||||
.replace("<br>", "\n")
|
||||
.replace("<br/>", "\n")
|
||||
.replace("<b>", "")
|
||||
.replace("</b>", "")
|
||||
.split("[\\$\\\n]");
|
||||
for (int i = 0; i < cardRules.length; i++) {
|
||||
cardRules[i] = prepareRule(card.getName(), cardRules[i]);
|
||||
|
|
@ -1689,6 +1708,7 @@ public class VerifyCardDataTest {
|
|||
for (int j = 0; j <= refRules.length - 1; j++) {
|
||||
String refRule = refRules[j];
|
||||
if (!refRule.startsWith("+ ")) {
|
||||
isFine = false;
|
||||
refRules[j] = "- " + refRules[j];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue