* Deck editor: fixed error message "layout mismatch" for decks with special cards number (PUMA set and other);

This commit is contained in:
Oleg Agafonov 2020-01-14 03:05:11 +04:00
parent ef64865db0
commit cf072f0b1a

View file

@ -1,18 +1,17 @@
package mage.cards.decks.importer; package mage.cards.decks.importer;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import mage.cards.decks.DeckCardInfo; import mage.cards.decks.DeckCardInfo;
import mage.cards.decks.DeckCardLayout; import mage.cards.decks.DeckCardLayout;
import mage.cards.decks.DeckCardLists; import mage.cards.decks.DeckCardLists;
import mage.cards.repository.CardInfo; import mage.cards.repository.CardInfo;
import mage.cards.repository.CardRepository; import mage.cards.repository.CardRepository;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** /**
*
* @author North * @author North
*/ */
public class DckDeckImporter extends PlainTextDeckImporter { public class DckDeckImporter extends PlainTextDeckImporter {
@ -23,7 +22,7 @@ public class DckDeckImporter extends PlainTextDeckImporter {
private static final Pattern layoutStackPattern = Pattern.compile("\\(([^)]*)\\)"); private static final Pattern layoutStackPattern = Pattern.compile("\\(([^)]*)\\)");
private static final Pattern layoutStackEntryPattern = Pattern.compile("\\[(\\w+[^:]*\\w*):(\\d+\\w*)]"); // [JR:64ab],[JR:64],[MPSAK1321:43],[MPSAKH:9],[MPS123-AKH:32],[MPS-13AKH:30],[MPS-AKH:49],[MPS-AKH:11] private static final Pattern layoutStackEntryPattern = Pattern.compile("\\[(\\w+[^:]*\\w*):(\\w+\\w*)]"); // test cases: [JR:64ab],[JR:64],[MPSAK1321:43],[MPSAKH:9],[MPS123-AKH:32],[MPS-13AKH:30],[MPS-AKH:49],[MPS-AKH:11], [PUMA:U16]
@Override @Override
protected void readLine(String line, DeckCardLists deckList) { protected void readLine(String line, DeckCardLists deckList) {
@ -93,9 +92,9 @@ public class DckDeckImporter extends PlainTextDeckImporter {
} }
} }
} else if (line.startsWith("NAME:")) { } else if (line.startsWith("NAME:")) {
deckList.setName(line.substring(5, line.length())); deckList.setName(line.substring(5));
} else if (line.startsWith("AUTHOR:")) { } else if (line.startsWith("AUTHOR:")) {
deckList.setAuthor(line.substring(7, line.length())); deckList.setAuthor(line.substring(7));
} else if (line.startsWith("LAYOUT")) { } else if (line.startsWith("LAYOUT")) {
Matcher m2 = layoutPattern.matcher(line); Matcher m2 = layoutPattern.matcher(line);
if (m2.find()) { if (m2.find()) {