Merge pull request #1190 from ctrlaltca/fix_1188
oracle: fix broken import of sets; fix #1188
This commit is contained in:
commit
14e8fcdd44
1 changed files with 30 additions and 25 deletions
|
@ -76,33 +76,38 @@ CardInfo *OracleImporter::addCard(const QString &setName,
|
||||||
cardName = cardName.replace("Æ", "AE");
|
cardName = cardName.replace("Æ", "AE");
|
||||||
cardName = cardName.replace("’", "'");
|
cardName = cardName.replace("’", "'");
|
||||||
|
|
||||||
// Remove {} around mana costs
|
CardInfo * card;
|
||||||
cardCost.remove(QChar('{'));
|
if (cards.contains(cardName)) {
|
||||||
cardCost.remove(QChar('}'));
|
card = cards.value(cardName);
|
||||||
|
} else {
|
||||||
|
// Remove {} around mana costs
|
||||||
|
cardCost.remove(QChar('{'));
|
||||||
|
cardCost.remove(QChar('}'));
|
||||||
|
|
||||||
// detect mana generator artifacts
|
// detect mana generator artifacts
|
||||||
bool mArtifact = false;
|
bool mArtifact = false;
|
||||||
if (cardType.endsWith("Artifact"))
|
if (cardType.endsWith("Artifact"))
|
||||||
for (int i = 0; i < cardTextRows.size(); ++i)
|
for (int i = 0; i < cardTextRows.size(); ++i)
|
||||||
if (cardTextRows[i].contains("{T}") && cardTextRows[i].contains("to your mana pool"))
|
if (cardTextRows[i].contains("{T}") && cardTextRows[i].contains("to your mana pool"))
|
||||||
mArtifact = true;
|
mArtifact = true;
|
||||||
|
|
||||||
// detect cards that enter the field tapped
|
// detect cards that enter the field tapped
|
||||||
bool cipt = cardText.contains("Hideaway") || (cardText.contains(cardName + " enters the battlefield tapped") && !cardText.contains(cardName + " enters the battlefield tapped unless"));
|
bool cipt = cardText.contains("Hideaway") || (cardText.contains(cardName + " enters the battlefield tapped") && !cardText.contains(cardName + " enters the battlefield tapped unless"));
|
||||||
|
|
||||||
// insert the card and its properties
|
// insert the card and its properties
|
||||||
CardInfo *card = new CardInfo(this, cardName, isToken, cardCost, cmc, cardType, cardPT, cardText, colors, relatedCards, upsideDown, cardLoyalty, cipt);
|
card = new CardInfo(this, cardName, isToken, cardCost, cmc, cardType, cardPT, cardText, colors, relatedCards, upsideDown, cardLoyalty, cipt);
|
||||||
int tableRow = 1;
|
int tableRow = 1;
|
||||||
QString mainCardType = card->getMainCardType();
|
QString mainCardType = card->getMainCardType();
|
||||||
if ((mainCardType == "Land") || mArtifact)
|
if ((mainCardType == "Land") || mArtifact)
|
||||||
tableRow = 0;
|
tableRow = 0;
|
||||||
else if ((mainCardType == "Sorcery") || (mainCardType == "Instant"))
|
else if ((mainCardType == "Sorcery") || (mainCardType == "Instant"))
|
||||||
tableRow = 3;
|
tableRow = 3;
|
||||||
else if (mainCardType == "Creature")
|
else if (mainCardType == "Creature")
|
||||||
tableRow = 2;
|
tableRow = 2;
|
||||||
card->setTableRow(tableRow);
|
card->setTableRow(tableRow);
|
||||||
|
|
||||||
cards.insert(cardName, card);
|
cards.insert(cardName, card);
|
||||||
|
}
|
||||||
card->setMuId(setName, cardId);
|
card->setMuId(setName, cardId);
|
||||||
|
|
||||||
return card;
|
return card;
|
||||||
|
|
Loading…
Reference in a new issue