mirror of
https://github.com/correl/mage.git
synced 2024-12-01 19:19:55 +00:00
* Deck editor: fixed error message "layout mismatch" for decks with special cards number (PUMA set and other);
This commit is contained in:
parent
ef64865db0
commit
cf072f0b1a
1 changed files with 11 additions and 12 deletions
|
@ -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()) {
|
||||||
|
|
Loading…
Reference in a new issue