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:
parent
f25e4785ae
commit
44d1ab348b
2 changed files with 16 additions and 4 deletions
|
@ -587,9 +587,9 @@ void CardDatabase::refreshCachedReverseRelatedCards()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto *newCardRelation = new CardRelation(card->getName(), cardRelation->getDoesAttach(),
|
auto *newCardRelation = new CardRelation(
|
||||||
cardRelation->getIsCreateAllExclusion(),
|
card->getName(), cardRelation->getDoesAttach(), cardRelation->getIsCreateAllExclusion(),
|
||||||
cardRelation->getIsVariable(), cardRelation->getDefaultCount());
|
cardRelation->getIsVariable(), cardRelation->getDefaultCount(), cardRelation->getIsPersistent());
|
||||||
cards.value(targetCard)->addReverseRelatedCards2Me(newCardRelation);
|
cards.value(targetCard)->addReverseRelatedCards2Me(newCardRelation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -334,7 +334,7 @@ int OracleImporter::importCardsFromSet(const CardSetPtr ¤tSet,
|
||||||
|
|
||||||
power = getStringPropertyFromMap(card, "power");
|
power = getStringPropertyFromMap(card, "power");
|
||||||
toughness = getStringPropertyFromMap(card, "toughness");
|
toughness = getStringPropertyFromMap(card, "toughness");
|
||||||
if (power.isEmpty() || toughness.isEmpty()){
|
if (power.isEmpty() || toughness.isEmpty()) {
|
||||||
ptSeparator = "";
|
ptSeparator = "";
|
||||||
}
|
}
|
||||||
if (!(power.isEmpty() && toughness.isEmpty())) {
|
if (!(power.isEmpty() && toughness.isEmpty())) {
|
||||||
|
@ -381,6 +381,18 @@ int OracleImporter::importCardsFromSet(const CardSetPtr ¤tSet,
|
||||||
name = faceName;
|
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);
|
CardInfoPtr newCard = addCard(name + numComponent, text, isToken, properties, relatedCards, setInfo);
|
||||||
numCards++;
|
numCards++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue