mirror of
https://github.com/magefree/mage.git
synced 2025-12-28 22:42:03 -08:00
* deck text importer, Ignore sum lines eg. "22 craetures".
This commit is contained in:
parent
350bae2d95
commit
b629053507
1 changed files with 10 additions and 1 deletions
|
|
@ -28,10 +28,12 @@
|
|||
|
||||
package mage.cards.decks.importer;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import mage.cards.Sets;
|
||||
import java.util.Set;
|
||||
import mage.cards.decks.DeckCardInfo;
|
||||
import mage.cards.decks.DeckCardLists;
|
||||
import mage.cards.repository.CardInfo;
|
||||
|
|
@ -45,8 +47,12 @@ import mage.cards.repository.ExpansionRepository;
|
|||
*/
|
||||
public class TxtDeckImporter extends DeckImporter {
|
||||
|
||||
public static final String[] SET_VALUES = new String[] { "lands", "creatures", "planeswalkers","other spells" };
|
||||
public static final Set<String> IGNORE_NAMES = new HashSet<String>(Arrays.asList(SET_VALUES));
|
||||
|
||||
private boolean sideboard = false;
|
||||
|
||||
|
||||
@Override
|
||||
protected void readLine(String line, DeckCardLists deckList) {
|
||||
if (line.length() == 0 || line.startsWith("//")) {
|
||||
|
|
@ -61,6 +67,9 @@ public class TxtDeckImporter extends DeckImporter {
|
|||
int delim = line.indexOf(' ');
|
||||
String lineNum = line.substring(0, delim).trim();
|
||||
String lineName = line.substring(delim).replace("’","\'").trim();
|
||||
if (IGNORE_NAMES.contains(lineName)) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
int num = Integer.parseInt(lineNum);
|
||||
List<CardInfo> cards = CardRepository.instance.findCards(lineName);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue