mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
Merge 23bf1ae03c into acc180d1d4
This commit is contained in:
commit
1d6bede017
1 changed files with 11 additions and 1 deletions
|
|
@ -2573,7 +2573,7 @@ public class VerifyCardDataTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String[] wrongSymbols = {"’", "“", "”"};
|
private static final String[] wrongSymbols = {"’", "“", "”", "\n"};
|
||||||
|
|
||||||
private void checkWrongSymbolsInRules(Card card) {
|
private void checkWrongSymbolsInRules(Card card) {
|
||||||
for (String s : wrongSymbols) {
|
for (String s : wrongSymbols) {
|
||||||
|
|
@ -2582,6 +2582,10 @@ public class VerifyCardDataTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Pattern ruleNameCheck = Pattern.compile("\\b(?<!named |name is )"+Pattern.quote(card.getName())+"(?! \\{)");
|
||||||
|
Set<String> overlapNames = Arrays.stream(SubType.class.getEnumConstants()).map(SubType::toString).collect(Collectors.toSet()); // Assembly-Worker, Coward, etc.
|
||||||
|
// TODO: Tibalt, Cosmic Impostor's emblem should refer to the source permanent, even if it has a different name
|
||||||
|
overlapNames.addAll(Arrays.asList("Exile", "Kher Keep", "Kookus", "Regenerate", "Shield of Kaldra", "Stangg", "Tibalt, Cosmic Impostor"));
|
||||||
for (String rule : card.getRules()) {
|
for (String rule : card.getRules()) {
|
||||||
for (String s : wrongSymbols) {
|
for (String s : wrongSymbols) {
|
||||||
if (rule.contains(s)) {
|
if (rule.contains(s)) {
|
||||||
|
|
@ -2591,6 +2595,12 @@ public class VerifyCardDataTest {
|
||||||
if (rule.contains("&mdash ")) {
|
if (rule.contains("&mdash ")) {
|
||||||
fail(card, "rules", "card's rules contains restricted test [&mdash ] instead [—]");
|
fail(card, "rules", "card's rules contains restricted test [&mdash ] instead [—]");
|
||||||
}
|
}
|
||||||
|
if (ruleNameCheck.matcher(rule).find() && !overlapNames.contains(card.getName())) {
|
||||||
|
fail(card, "rules", "card's pre-formatted rules incorrectly contains its name directly, probably use {this} instead or add to overlapNames exceptions list");
|
||||||
|
}
|
||||||
|
if (rule.contains("named {this}") || rule.contains("name is {this}")) {
|
||||||
|
fail(card, "rules", "card's rules contains \"named {this}\" or \"name is {this}\", should use card's name directly");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue