From cac088abee6fe548f7c8f72a2a012f7fc00567bb Mon Sep 17 00:00:00 2001 From: spjspj Date: Sat, 15 Oct 2016 16:04:37 +1100 Subject: [PATCH] spjspj - SWS Capture - wrong mana cost - If card in .dck file is borked due to wrong set/number, try loading based on name --- Mage.Sets/src/mage/cards/c/Capture.java | 2 +- .../mage/cards/decks/importer/DckDeckImporter.java | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Mage.Sets/src/mage/cards/c/Capture.java b/Mage.Sets/src/mage/cards/c/Capture.java index ccb26c94ca..83256458e3 100644 --- a/Mage.Sets/src/mage/cards/c/Capture.java +++ b/Mage.Sets/src/mage/cards/c/Capture.java @@ -45,7 +45,7 @@ import mage.target.common.TargetCreaturePermanent; public class Capture extends CardImpl { public Capture(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{R}"); + super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{R}"); // Gain control of target creature until end of turn. this.getSpellAbility().addTarget(new TargetCreaturePermanent()); diff --git a/Mage/src/main/java/mage/cards/decks/importer/DckDeckImporter.java b/Mage/src/main/java/mage/cards/decks/importer/DckDeckImporter.java index e2b454155e..39252c25b6 100644 --- a/Mage/src/main/java/mage/cards/decks/importer/DckDeckImporter.java +++ b/Mage/src/main/java/mage/cards/decks/importer/DckDeckImporter.java @@ -43,7 +43,7 @@ import mage.cards.repository.CardRepository; */ public class DckDeckImporter extends DeckImporter { - private static final Pattern pattern = Pattern.compile("(SB:)?\\s*(\\d*)\\s*\\[([^]:]+):([^]:]+)\\].*"); + private static final Pattern pattern = Pattern.compile("(SB:)?\\s*(\\d*)\\s*\\[([^]:]+):([^]:]+)\\]\\s*(.*)\\s*$"); private static final Pattern layoutPattern = Pattern.compile("LAYOUT (\\w+):\\((\\d+),(\\d+)\\)([^|]+)\\|(.*)$"); @@ -70,6 +70,17 @@ public class DckDeckImporter extends DeckImporter { DeckCardInfo deckCardInfo = null; CardInfo cardInfo = CardRepository.instance.findCard(setCode, cardNum); + if (cardInfo == null) { + // Try alternate based on name + String cardName = m.group(5); + if (cardName != null && cardName.length() > 0) { + cardInfo = CardRepository.instance.findPreferedCoreExpansionCard(cardName, false); + sbMessage.append("Could not find card '" + cardName + "' in set " + setCode + " of number " + cardNum + ".\n"); + if (cardInfo != null) { + sbMessage.append("Made substitution of " + cardInfo.getCardNumber() + ", " + cardInfo.getCard().getExpansionSetCode() + " instead.\n"); + } + } + } if (cardInfo != null) { deckCardInfo = new DeckCardInfo(cardInfo.getName(), cardInfo.getCardNumber(), cardInfo.getSetCode()); }