Oracle remove old code handling split cards; fix #382

This commit is contained in:
Fabio Bas 2015-06-23 19:23:07 +02:00
parent 0c24f48aa2
commit a1d28736d7

View file

@ -71,11 +71,7 @@ CardInfo *OracleImporter::addCard(const QString &setName,
) )
{ {
QStringList cardTextRows = cardText.split("\n"); QStringList cardTextRows = cardText.split("\n");
bool splitCard = false;
if (cardName.contains('(')) {
cardName.remove(QRegExp(" \\(.*\\)"));
splitCard = true;
}
// Workaround for card name weirdness // Workaround for card name weirdness
if (cardName.contains("XX")) if (cardName.contains("XX"))
cardName.remove("XX"); cardName.remove("XX");
@ -87,32 +83,26 @@ CardInfo *OracleImporter::addCard(const QString &setName,
cardCost.remove(QChar('}')); cardCost.remove(QChar('}'));
CardInfo *card; CardInfo *card;
if (cards.contains(cardName)) { bool mArtifact = false;
card = cards.value(cardName); if (cardType.endsWith("Artifact"))
if (splitCard && !card->getText().contains(cardText)) for (int i = 0; i < cardTextRows.size(); ++i)
card->setText(card->getText() + "\n---\n" + cardText); if (cardTextRows[i].contains("{T}") && cardTextRows[i].contains("to your mana pool"))
} else { mArtifact = true;
bool mArtifact = false;
if (cardType.endsWith("Artifact")) bool cipt = cardText.contains("Hideaway") || (cardText.contains(cardName + " enters the battlefield tapped") && !cardText.contains(cardName + " enters the battlefield tapped unless"));
for (int i = 0; i < cardTextRows.size(); ++i)
if (cardTextRows[i].contains("{T}") && cardTextRows[i].contains("to your mana pool")) card = new CardInfo(this, cardName, isToken, cardCost, cmc, cardType, cardPT, cardText, colors, relatedCards, upsideDown, cardLoyalty, cipt);
mArtifact = true; int tableRow = 1;
QString mainCardType = card->getMainCardType();
bool cipt = cardText.contains("Hideaway") || (cardText.contains(cardName + " enters the battlefield tapped") && !cardText.contains(cardName + " enters the battlefield tapped unless")); if ((mainCardType == "Land") || mArtifact)
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;