Commit 5f28dff3 authored by Fabio Bas's avatar Fabio Bas
Browse files

Fix #1188

parent 8407d7cc
...@@ -76,33 +76,38 @@ CardInfo *OracleImporter::addCard(const QString &setName, ...@@ -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 {
// detect mana generator artifacts // Remove {} around mana costs
bool mArtifact = false; cardCost.remove(QChar('{'));
if (cardType.endsWith("Artifact")) cardCost.remove(QChar('}'));
for (int i = 0; i < cardTextRows.size(); ++i)
if (cardTextRows[i].contains("{T}") && cardTextRows[i].contains("to your mana pool")) // detect mana generator artifacts
mArtifact = true; bool mArtifact = false;
if (cardType.endsWith("Artifact"))
// detect cards that enter the field tapped for (int i = 0; i < cardTextRows.size(); ++i)
bool cipt = cardText.contains("Hideaway") || (cardText.contains(cardName + " enters the battlefield tapped") && !cardText.contains(cardName + " enters the battlefield tapped unless")); if (cardTextRows[i].contains("{T}") && cardTextRows[i].contains("to your mana pool"))
mArtifact = true;
// insert the card and its properties
CardInfo *card = new CardInfo(this, cardName, isToken, cardCost, cmc, cardType, cardPT, cardText, colors, relatedCards, upsideDown, cardLoyalty, cipt); // detect cards that enter the field tapped
int tableRow = 1; bool cipt = cardText.contains("Hideaway") || (cardText.contains(cardName + " enters the battlefield tapped") && !cardText.contains(cardName + " enters the battlefield tapped unless"));
QString mainCardType = card->getMainCardType();
if ((mainCardType == "Land") || mArtifact) // insert the card and its properties
tableRow = 0; card = new CardInfo(this, cardName, isToken, cardCost, cmc, cardType, cardPT, cardText, colors, relatedCards, upsideDown, cardLoyalty, cipt);
else if ((mainCardType == "Sorcery") || (mainCardType == "Instant")) int tableRow = 1;
tableRow = 3; QString mainCardType = card->getMainCardType();
else if (mainCardType == "Creature") if ((mainCardType == "Land") || mArtifact)
tableRow = 2; tableRow = 0;
card->setTableRow(tableRow); else if ((mainCardType == "Sorcery") || (mainCardType == "Instant"))
tableRow = 3;
cards.insert(cardName, card); else if (mainCardType == "Creature")
tableRow = 2;
card->setTableRow(tableRow);
cards.insert(cardName, card);
}
card->setMuId(setName, cardId); card->setMuId(setName, cardId);
return card; return card;
...@@ -190,6 +195,12 @@ int OracleImporter::importTextSpoiler(CardSet *set, const QVariant &data) ...@@ -190,6 +195,12 @@ int OracleImporter::importTextSpoiler(CardSet *set, const QVariant &data)
CardInfo *card = addCard(set->getShortName(), cardName, false, cardId, cardCost, cmc, cardType, cardPT, cardLoyalty, cardText, colors, relatedCards, upsideDown); CardInfo *card = addCard(set->getShortName(), cardName, false, cardId, cardCost, cmc, cardType, cardPT, cardLoyalty, cardText, colors, relatedCards, upsideDown);
if (!set->contains(card)) { if (!set->contains(card)) {
if(cardName=="Mountain")
{
qDebug() << cardName << " " << set->getShortName();
}
card->addToSet(set); card->addToSet(set);
cards++; cards++;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment