diff --git a/Mage.Client/src/main/java/org/mage/card/arcane/ManaSymbols.java b/Mage.Client/src/main/java/org/mage/card/arcane/ManaSymbols.java index 071c252e6f..998b9763d6 100644 --- a/Mage.Client/src/main/java/org/mage/card/arcane/ManaSymbols.java +++ b/Mage.Client/src/main/java/org/mage/card/arcane/ManaSymbols.java @@ -67,7 +67,7 @@ public final class ManaSymbols { } private static final Map setImagesExist = new HashMap<>(); - private static final Pattern REPLACE_SYMBOLS_PATTERN = Pattern.compile("\\{([^}/]*)/?([^}]*)\\}"); + private static final Pattern REPLACE_SYMBOLS_PATTERN = Pattern.compile("\\{([^}/]*)/?([^}/]*)/?([^}/]*)\\}"); private static final String[] symbols = new String[]{ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", @@ -78,7 +78,8 @@ public final class ManaSymbols { "S", "T", "Q", "U", "UB", "UR", "UP", "2U", "W", "WB", "WU", "WP", "2W", - "X", "C", "E"}; + "X", "C", "E", + "BGP", "BRP", "GUP", "GWP", "RGP", "RWP", "UBP", "URP", "WBP", "WUP"}; private static final JLabel labelRender = new JLabel(); // render mana text @@ -651,7 +652,7 @@ public final class ManaSymbols { replaced = replaced.replace(CardInfo.SPLIT_MANA_SEPARATOR_FULL, CardInfo.SPLIT_MANA_SEPARATOR_RENDER); replaced = REPLACE_SYMBOLS_PATTERN.matcher(replaced).replaceAll( - "$1$2 { while (true) { String sym; if (symIndex < symbols.length) { + // take next char symbol sym = symbols[symIndex++]; } else if (numeric <= maxNumeric) { + // take next numeric symbol sym = String.valueOf(numeric++); } else { + // switch to next size sizeIndex++; if (sizeIndex == sizes.length) { return endOfData(); @@ -70,26 +76,34 @@ public class GathererSymbols implements Iterable { String symbol = sym.replaceAll("/", ""); File dst = new File(dir, symbol + ".gif"); - /** - * Handle a bug on Gatherer where a few symbols are missing - * at the large size. Fall back to using the medium symbol - * for those cases. - */ + // workaround for miss icons on Gatherer (no cards with it, so no icons) + // TODO: comment and try download without workaround, keep fix for symbols with "Resource not found" error + switch (symbol) { + case "WUP": + case "BRP": + case "BGP": + case "WBP": + case "UBP": + case "URP": + // skip icon download + continue; + } + + // workaround for miss large size icons on Gatherer (replace it by medium size) + // TODO: comment and try download without workaround, keep fix for symbols with "Resource not found" error int modSizeIndex = sizeIndex; if (sizeIndex == 2) { - switch (sym) { - case "WP": - case "UP": - case "BP": - case "RP": - case "GP": - case "E": - case "C": + switch (symbol) { + case "GUP": + case "GWP": + case "RGP": + case "RWP": + // need replace to medium size modSizeIndex = 1; break; - default: - // Nothing to do, symbol is available in the large size + // normal size + break; } }