text fixes [ALA] [CON] [ARB] (#11036)

* Tweak verify for double cycling
* small fixes
* do not verify some GUI-related rules.
This commit is contained in:
Susucre 2023-08-27 02:46:49 +02:00 committed by GitHub
parent 2ec4401cee
commit 52eaa600ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 57 additions and 9 deletions

View file

@ -29,7 +29,6 @@ import mage.filter.Filter;
import mage.game.command.Dungeon;
import mage.game.command.Plane;
import mage.game.draft.DraftCube;
import mage.cards.RateCard;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.custom.CreatureToken;
@ -53,6 +52,8 @@ import java.lang.reflect.*;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
@ -2224,7 +2225,11 @@ public class VerifyCardDataTest {
refText += "<br>";
refText = refText.replace("<br>", "\n");
}
// mana ability fix
// Current implementation makes one Activated Ability per kind of color.
// We split such abilities in the reference text.
// TODO: extend to more complex ones. See https://github.com/magefree/mage/issues/10832
for (String s : refText.split("[\\$\\\n]")) {
if (!(s.startsWith("{T}: Add {") || s.startsWith("({T}: Add {"))
|| !(s.contains("} or {") || s.contains("}, or {"))) {
@ -2242,6 +2247,30 @@ public class VerifyCardDataTest {
refText = refText.replace(s, newStr);
}
// cycling fix
// Current implementation makes one CyclingAbility per quality,
// We split such abilities in the reference text.
//
// For instance "Swampcycling {2}, mountaincycling {2}"
// becomes "Swampcycling {2}\nMountaincycling {2}"
for (String s : refText.split("[\\$\\\n]")) {
if (!Pattern.matches("^[a-zA-Z]*cycling .*, [a-zA-Z]*cycling.*", s)) {
continue;
}
String newStr = "";
Pattern p = Pattern.compile(", [a-zA-Z]*cycling");
Matcher m = p.matcher(s);
int start = 0;
while (m.find()) {
String group = m.group();
int newStart = m.start();
newStr += s.substring(start, newStart) + "\n" + group.substring(2, 3).toUpperCase() + group.substring(3);
start = newStart + group.length();
}
newStr += s.substring(start);
refText = refText.replace(s, newStr);
}
String[] refRules = refText.split("[\\$\\\n]"); // ref card's abilities can be splited by \n or $ chars
for (int i = 0; i < refRules.length; i++) {
@ -2279,6 +2308,12 @@ public class VerifyCardDataTest {
boolean isFine = true;
for (int i = 0; i < cardRules.length; i++) {
if (cardRules[i].startsWith("Use the Special button")) {
// This is a rules text for GUI implication like Quenchable Fire
cardRules[i] = "+ " + cardRules[i];
continue;
}
boolean isAbilityFounded = false;
for (int j = 0; j < refRules.length; j++) {
String refRule = refRules[j];