add support for adventures to oracle (#3836)

* add support for adventures to oracle

this causes cockatrice to correctly fetch the front of the card for the adventure portion rather than sending lots of bad requests to scryfall

* treat adventures more like split cards

* dont hardcode `maintype: creature`
This commit is contained in:
skwerlman 2019-10-09 01:05:30 -04:00 committed by Zach H
parent a3fc9b6ee5
commit e8fd2ce2aa

View file

@ -316,7 +316,7 @@ int OracleImporter::importCardsFromSet(CardSetPtr currentSet, const QList<QVaria
}
// split cards are considered a single card, enqueue for later merging
if (layout == "split" || layout == "aftermath") {
if (layout == "split" || layout == "aftermath" || layout == "adventure") {
// get the position of this card part
int index = additionalNames.indexOf(name);
// construct full card name
@ -370,12 +370,15 @@ int OracleImporter::importCardsFromSet(CardSetPtr currentSet, const QList<QVaria
setInfo = tmp.getSetInfo();
} else {
const QVariantHash &props = tmp.getProperties();
layout = properties.value("layout").toString();
for (const QString &prop : props.keys()) {
QString originalPropertyValue = properties.value(prop).toString();
QString thisCardPropertyValue = props.value(prop).toString();
if (originalPropertyValue != thisCardPropertyValue) {
if (prop == "colors") {
properties.insert(prop, originalPropertyValue + thisCardPropertyValue);
} else if (prop == "maintype" && layout == "adventure") {
properties.insert(prop, originalPropertyValue);
} else {
properties.insert(prop,
originalPropertyValue + splitCardPropSeparator + thisCardPropertyValue);