mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-20 09:22:15 -07:00
Fix UST cards
This commit is contained in:
parent
bdffd518cb
commit
e3cf540689
1 changed files with 18 additions and 10 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
#include "game/cards/card_database_parser/cockatrice_xml_4.h"
|
#include "game/cards/card_database_parser/cockatrice_xml_4.h"
|
||||||
#include "qt-json/json.h"
|
#include "qt-json/json.h"
|
||||||
|
|
||||||
#include <QtWidgets>
|
#include <QRegularExpression>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
|
|
||||||
|
|
@ -42,7 +42,7 @@ bool OracleImporter::readSetsFromByteArray(const QByteArray &data)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QListIterator<QVariant> it(setsMap.values());
|
QListIterator it(setsMap.values());
|
||||||
QVariantMap map;
|
QVariantMap map;
|
||||||
|
|
||||||
QString shortName;
|
QString shortName;
|
||||||
|
|
@ -211,13 +211,12 @@ int OracleImporter::importCardsFromSet(const CardSetPtr ¤tSet, const QList
|
||||||
QMap<QString, QList<SplitCardPart>> splitCards;
|
QMap<QString, QList<SplitCardPart>> splitCards;
|
||||||
QString ptSeparator("/");
|
QString ptSeparator("/");
|
||||||
QVariantMap card;
|
QVariantMap card;
|
||||||
QString layout, name, text, colors, colorIdentity, maintype, faceName;
|
QString layout, name, text, colors, colorIdentity, faceName;
|
||||||
static const bool isToken = false;
|
static constexpr bool isToken = false;
|
||||||
|
static const QList<QString> setsWithCardsWithSameNameButDifferentText = {"UST"};
|
||||||
QVariantHash properties;
|
QVariantHash properties;
|
||||||
CardInfoPerSet setInfo;
|
CardInfoPerSet setInfo;
|
||||||
QList<CardRelation *> relatedCards;
|
QList<CardRelation *> relatedCards;
|
||||||
static const QList<QString> specialNumChars = {"★", "s", "†"};
|
|
||||||
QMap<QString, QVariant> specialPromoCards;
|
|
||||||
QList<QString> allNameProps;
|
QList<QString> allNameProps;
|
||||||
|
|
||||||
for (const QVariant &cardVar : cardsList) {
|
for (const QVariant &cardVar : cardsList) {
|
||||||
|
|
@ -244,7 +243,7 @@ int OracleImporter::importCardsFromSet(const CardSetPtr ¤tSet, const QList
|
||||||
|
|
||||||
// card properties
|
// card properties
|
||||||
properties.clear();
|
properties.clear();
|
||||||
QMapIterator<QString, QString> it(cardProperties);
|
QMapIterator it(cardProperties);
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
it.next();
|
it.next();
|
||||||
QString mtgjsonProperty = it.key();
|
QString mtgjsonProperty = it.key();
|
||||||
|
|
@ -256,7 +255,7 @@ int OracleImporter::importCardsFromSet(const CardSetPtr ¤tSet, const QList
|
||||||
|
|
||||||
// per-set properties
|
// per-set properties
|
||||||
setInfo = CardInfoPerSet(currentSet);
|
setInfo = CardInfoPerSet(currentSet);
|
||||||
QMapIterator<QString, QString> it2(setInfoProperties);
|
QMapIterator it2(setInfoProperties);
|
||||||
while (it2.hasNext()) {
|
while (it2.hasNext()) {
|
||||||
it2.next();
|
it2.next();
|
||||||
QString mtgjsonProperty = it2.key();
|
QString mtgjsonProperty = it2.key();
|
||||||
|
|
@ -267,7 +266,7 @@ int OracleImporter::importCardsFromSet(const CardSetPtr ¤tSet, const QList
|
||||||
}
|
}
|
||||||
|
|
||||||
// Identifiers
|
// Identifiers
|
||||||
QMapIterator<QString, QString> it3(identifierProperties);
|
QMapIterator it3(identifierProperties);
|
||||||
while (it3.hasNext()) {
|
while (it3.hasNext()) {
|
||||||
it3.next();
|
it3.next();
|
||||||
auto mtgjsonProperty = it3.key();
|
auto mtgjsonProperty = it3.key();
|
||||||
|
|
@ -278,7 +277,16 @@ int OracleImporter::importCardsFromSet(const CardSetPtr ¤tSet, const QList
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString numComponent{};
|
QString numComponent;
|
||||||
|
const QString numProperty = setInfo.getProperty("num");
|
||||||
|
const QChar lastChar = numProperty.at(numProperty.size() - 1);
|
||||||
|
|
||||||
|
// Un-Sets do some wonky stuff. Split up these cards as individual entries.
|
||||||
|
if (setsWithCardsWithSameNameButDifferentText.contains(currentSet->getShortName()) &&
|
||||||
|
allNameProps.contains(faceName) && layout == "normal" && lastChar.isLetter()) {
|
||||||
|
numComponent = " (" + QString(lastChar).toLower() + ")";
|
||||||
|
}
|
||||||
|
allNameProps.append(faceName);
|
||||||
|
|
||||||
// special handling properties
|
// special handling properties
|
||||||
colors = card.value("colors").toStringList().join("");
|
colors = card.value("colors").toStringList().join("");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue