mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
Fixes a problem of parsing large colorless costs (All the big Eldrazi creatures).
This commit is contained in:
parent
6fcce4ab8b
commit
7fbd807991
1 changed files with 11 additions and 1 deletions
|
@ -189,7 +189,7 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M
|
|||
String[] symbols = mana.split("^\\{|\\}\\{|\\}$");
|
||||
for (String symbol: symbols) {
|
||||
if (symbol.length() > 0) {
|
||||
if (symbol.length() == 1) {
|
||||
if (symbol.length() == 1 || isNumeric(symbol)) {
|
||||
if (Character.isDigit(symbol.charAt(0))) {
|
||||
this.add((T)new GenericManaCost(Integer.valueOf(symbol)));
|
||||
}
|
||||
|
@ -213,6 +213,16 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M
|
|||
}
|
||||
}
|
||||
|
||||
private boolean isNumeric ( String symbol ) {
|
||||
try {
|
||||
Integer.parseInt(symbol);
|
||||
return true;
|
||||
}
|
||||
catch ( NumberFormatException e ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getSymbols() {
|
||||
List<String> symbols = new ArrayList<String>();
|
||||
|
|
Loading…
Reference in a new issue