support effect '<permanent> has base power and toughness p/t until end of tunr'

master
melvinzhang 2017-08-05 20:19:18 +08:00
parent 8f15e0e280
commit af7ec09115
1 changed files with 4 additions and 2 deletions

View File

@ -21,7 +21,7 @@ public class PermanentSpecParser {
public final boolean duration;
public final boolean additionTo;
public static final String BECOMES = " become(s)?( a| an)?(?<legendary> legendary)?( )?(?<pt>[0-9]+/[0-9]+)? (?<all>.*?)( with base power and toughness (?<pt2>[0-9]+/[0-9]+))?( (with|and gains) (?<ability>.*?))?";
public static final String BECOMES = " (become(s)?( a| an)?(?<legendary> legendary)?( )?(?<pt>[0-9]+/[0-9]+)? (?<all>.*?)|has)(( with)? base power and toughness (?<pt2>[0-9]+/[0-9]+))?( (with|and gains) (?<ability>.*?))?";
public PermanentSpecParser(final Matcher matcher) {
final String ptStr = matcher.group("pt") != null ? matcher.group("pt") :
@ -30,7 +30,9 @@ public class PermanentSpecParser {
final String[] ptTok = ptStr == null ? null : ptStr.split("/");
pt = ptTok == null ? null : new int[]{Integer.parseInt(ptTok[0]), Integer.parseInt(ptTok[1])};
final List<String> tokens = new LinkedList<>(Arrays.asList(matcher.group("all").split(", | and | ")));
final List<String> tokens = matcher.group("all") == null ?
new LinkedList<>() :
new LinkedList<>(Arrays.asList(matcher.group("all").split(", | and | ")));
colors = MagicColor.prefixColors(tokens);
subTypes = MagicSubType.prefixSubTypes(tokens);
types = MagicType.prefixTypes(tokens);