mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
DOM set codes get exported as DAR for MTGA.
This commit is contained in:
parent
e980240553
commit
0a2c81ad7b
2 changed files with 11 additions and 4 deletions
|
@ -1,5 +1,6 @@
|
|||
package mage.cards.decks.exporter;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import mage.cards.decks.DeckCardInfo;
|
||||
import mage.cards.decks.DeckCardLists;
|
||||
import mage.cards.decks.DeckFileFilter;
|
||||
|
@ -13,9 +14,11 @@ import java.util.*;
|
|||
*/
|
||||
public class MtgArenaDeckExporter extends DeckExporter {
|
||||
|
||||
private final String ext = "mtga";
|
||||
private final String description = "MTG Arena's deck format (*.mtga)";
|
||||
private final FileFilter fileFilter = new DeckFileFilter(ext, description);
|
||||
private static final String ext = "mtga";
|
||||
private static final String description = "MTG Arena's deck format (*.mtga)";
|
||||
private static final FileFilter fileFilter = new DeckFileFilter(ext, description);
|
||||
|
||||
private static final Map<String, String> SET_CODE_REPLACEMENTS = ImmutableMap.of("DOM", "DAR");
|
||||
|
||||
@Override
|
||||
public void writeDeck(PrintWriter out, DeckCardLists deck) {
|
||||
|
@ -33,7 +36,9 @@ public class MtgArenaDeckExporter extends DeckExporter {
|
|||
private List<String> prepareCardsList(List<DeckCardInfo> sourceCards, Map<String, Integer> amount, String prefix) {
|
||||
List<String> res = new ArrayList<>();
|
||||
for (DeckCardInfo card : sourceCards) {
|
||||
String name = card.getCardName() + " (" + card.getSetCode().toUpperCase(Locale.ENGLISH) + ") " + card.getCardNum();
|
||||
String setCode = card.getSetCode().toUpperCase(Locale.ENGLISH);
|
||||
setCode = SET_CODE_REPLACEMENTS.getOrDefault(setCode, setCode);
|
||||
String name = card.getCardName() + " (" + setCode + ") " + card.getCardNum();
|
||||
String code = prefix + name;
|
||||
int curAmount = amount.getOrDefault(code, 0);
|
||||
if (curAmount == 0) {
|
||||
|
|
|
@ -22,6 +22,7 @@ public class MtgArenaDeckExporterTest {
|
|||
deck.getCards().add(new DeckCardInfo("Plains", "2", "RNA", 3));
|
||||
deck.getCards().add(new DeckCardInfo("Plains", "2", "RNA", 5)); // must combine
|
||||
deck.getCards().add(new DeckCardInfo("Mountain", "3", "RNA", 1));
|
||||
deck.getCards().add(new DeckCardInfo("Goblin Chainwhirler", "129", "DOM", 4));
|
||||
deck.getSideboard().add(new DeckCardInfo("Island", "1", "RNA", 2));
|
||||
deck.getSideboard().add(new DeckCardInfo("Island", "1", "RNA", 5)); // must combine
|
||||
deck.getSideboard().add(new DeckCardInfo("Mountain", "2", "RNA", 3));
|
||||
|
@ -30,6 +31,7 @@ public class MtgArenaDeckExporterTest {
|
|||
assertEquals("2 Forest (RNA) 1" + System.lineSeparator() +
|
||||
"8 Plains (RNA) 2" + System.lineSeparator() +
|
||||
"1 Mountain (RNA) 3" + System.lineSeparator() +
|
||||
"4 Goblin Chainwhirler (DAR) 129" + System.lineSeparator() +
|
||||
System.lineSeparator() +
|
||||
"7 Island (RNA) 1" + System.lineSeparator() +
|
||||
"3 Mountain (RNA) 2" + System.lineSeparator(),
|
||||
|
|
Loading…
Reference in a new issue