prioritize creature on maincardtype (#3611)

This commit is contained in:
ebbit1q 2019-03-04 07:32:19 +01:00 committed by Zach H
parent 477faafb84
commit fafdb65453

View file

@ -242,9 +242,17 @@ int OracleImporter::importCardsFromSet(CardSetPtr currentSet, const QList<QVaria
if (!colorIdentity.isEmpty())
properties.insert("coloridentity", colorIdentity);
maintype = card.value("types").toStringList().first();
if (!maintype.isEmpty())
properties.insert("maintype", maintype);
{
const auto &typeList = card.value("types").toStringList();
if (typeList.contains("Creature")) {
properties.insert("maintype", "Creature");
} else {
const auto &maintype = typeList.first();
if (!maintype.isEmpty()) {
properties.insert("maintype", maintype);
}
}
}
power = getStringPropertyFromMap(card, "power");
toughness = getStringPropertyFromMap(card, "toughness");
@ -383,4 +391,4 @@ bool OracleImporter::saveToFile(const QString &fileName)
{
CockatriceXml4Parser parser;
return parser.saveToFile(sets, cards, fileName);
}
}