Little fixes and code refactor

This commit is contained in:
Oleg Agafonov 2020-08-29 18:09:44 +04:00
parent c67e937dfb
commit ab8a4eb26a
8 changed files with 71 additions and 98 deletions

View file

@ -191,12 +191,8 @@ public final class GuiDisplayUtil {
// counters
if (card.getMageObjectType().canHaveCounters()) {
java.util.List<CounterView> counters = new ArrayList<>();
if (card instanceof PermanentView) {
if (card.getCounters() != null) {
counters = new ArrayList<>(card.getCounters());
}
} else if (card.getCounters() != null) {
counters = new ArrayList<>(card.getCounters());
if (card.getCounters() != null) {
counters.addAll(card.getCounters());
}
if (!counters.isEmpty()) {
StringBuilder sb = new StringBuilder();
@ -406,9 +402,7 @@ public final class GuiDisplayUtil {
}
private static String replaceNamesInRule(String rule, String cardName) {
String res = rule.replaceAll("\\{this\\}", cardName.isEmpty() ? "this" : cardName);
res = res.replaceAll("\\{source\\}", cardName.isEmpty() ? "this" : cardName);
return res;
return rule.replaceAll("\\{this\\}", cardName.isEmpty() ? "this" : cardName);
}
private static String getResourcePath(String image) {