Merge pull request #4877 from spjspj/master

Fix mana dialog box.
This commit is contained in:
spjspj 2018-04-27 23:55:40 +10:00 committed by GitHub
commit 96f8fb0cb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1332,7 +1332,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
repaint();
}
private static final Pattern pattern = Pattern.compile(".*Add(.*)(\\{[WUBRGXC]\\})(.*)to your mana pool");
private static final Pattern pattern = Pattern.compile(".*Add(.*)(\\{[WUBRGXC]\\})");
public void analyseDeck() {
HashMap<String, Integer> qtys = new HashMap<>();
@ -1408,10 +1408,9 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
// Adding mana
for (String str : card.getRules()) {
Matcher m = pattern.matcher(str);
// ".*Add(.*)(\\{[WUBRGXC]\\})(.*)to your mana pool"
// ".*Add(.*)(\\{[WUBRGXC]\\})(.*)"
while (m.find()) {
System.out.println("0=" + m.group(0) + ",,,1=" + m.group(1) + ",,,2=" + m.group(2) + ",,,3=" + m.group(3));
str = "Add" + m.group(1) + m.group(3) + "to your mana pool";
str = "Add" + m.group(1);
int num = 1;
if (manaCounts.get(m.group(2)) != null) {
num = manaCounts.get(m.group(2));