small optimization to DoIfCostPaid text generation

This commit is contained in:
Evan Kranzler 2021-02-04 10:18:39 -05:00
parent f38639e1db
commit 3727e2ea42
4 changed files with 12 additions and 30 deletions

View file

@ -60,6 +60,10 @@ public final class CardUtil {
public static final SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss.SSS");
private static final List<String> costWords = Arrays.asList(
"put", "return", "exile", "discard", "sacrifice", "remove", "tap", "reveal", "pay"
);
/**
* Increase spell or ability cost to be paid.
*
@ -1169,4 +1173,8 @@ public final class CardUtil {
}
return zcc;
}
public static boolean checkCostWords(String text) {
return text != null && costWords.stream().anyMatch(text.toLowerCase(Locale.ENGLISH)::startsWith);
}
}