Add Oracle support for persistent & Fix persistent on reverse-related (#4742)

* fix persistent reverse-related

* create relations from spellbook property

* run format.sh
This commit is contained in:
cajun 2023-02-06 06:00:54 -06:00 committed by GitHub
parent f25e4785ae
commit 44d1ab348b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 4 deletions

View file

@ -587,9 +587,9 @@ void CardDatabase::refreshCachedReverseRelatedCards()
continue;
}
auto *newCardRelation = new CardRelation(card->getName(), cardRelation->getDoesAttach(),
cardRelation->getIsCreateAllExclusion(),
cardRelation->getIsVariable(), cardRelation->getDefaultCount());
auto *newCardRelation = new CardRelation(
card->getName(), cardRelation->getDoesAttach(), cardRelation->getIsCreateAllExclusion(),
cardRelation->getIsVariable(), cardRelation->getDefaultCount(), cardRelation->getIsPersistent());
cards.value(targetCard)->addReverseRelatedCards2Me(newCardRelation);
}
}

View file

@ -381,6 +381,18 @@ int OracleImporter::importCardsFromSet(const CardSetPtr &currentSet,
name = faceName;
}
// mtgjon related cards
if (card.contains("relatedCards")) {
QVariantMap givenRelated = card.value("relatedCards").toMap();
// conjured cards from a spellbook
if (givenRelated.contains("spellbook")) {
auto spbk = givenRelated.value("spellbook").toStringList();
for (const QString &spbkName : spbk) {
relatedCards.append(new CardRelation(spbkName, false, false, false, 1, true));
}
}
}
CardInfoPtr newCard = addCard(name + numComponent, text, isToken, properties, relatedCards, setInfo);
numCards++;
}