mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-23 18:06:26 -07:00
Merge branch 'master' into tooomm-qt5
This commit is contained in:
commit
bbf2412157
219 changed files with 7310 additions and 1824 deletions
|
|
@ -18,7 +18,7 @@ static const QList<AllowedCount> kSingletonCounts = {{1, "legal"}, {0, "banned"}
|
|||
|
||||
SplitCardPart::SplitCardPart(const QString &_name,
|
||||
const QString &_text,
|
||||
const QVariantHash &_properties,
|
||||
const QHash<QString, QString> &_properties,
|
||||
const PrintingInfo &_printingInfo)
|
||||
: name(_name), text(_text), properties(_properties), printingInfo(_printingInfo)
|
||||
{
|
||||
|
|
@ -135,7 +135,7 @@ static void sortAndReduceColors(QString &colors)
|
|||
CardInfoPtr OracleImporter::addCard(QString name,
|
||||
const QString &text,
|
||||
bool isToken,
|
||||
QVariantHash properties,
|
||||
QHash<QString, QString> properties,
|
||||
const QList<CardRelation *> &relatedCards,
|
||||
const PrintingInfo &printingInfo)
|
||||
{
|
||||
|
|
@ -152,7 +152,7 @@ CardInfoPtr OracleImporter::addCard(QString name,
|
|||
}
|
||||
|
||||
// Remove {} around mana costs, except if it's split cost
|
||||
QString manacost = properties.value("manacost").toString();
|
||||
QString manacost = properties.value("manacost");
|
||||
if (!manacost.isEmpty()) {
|
||||
QStringList symbols = manacost.split("}");
|
||||
QString formattedCardCost;
|
||||
|
|
@ -169,12 +169,12 @@ CardInfoPtr OracleImporter::addCard(QString name,
|
|||
}
|
||||
|
||||
// fix colors
|
||||
QString allColors = properties.value("colors").toString();
|
||||
QString allColors = properties.value("colors");
|
||||
if (allColors.size() > 1) {
|
||||
sortAndReduceColors(allColors);
|
||||
properties.insert("colors", allColors);
|
||||
}
|
||||
QString allColorIdent = properties.value("coloridentity").toString();
|
||||
QString allColorIdent = properties.value("coloridentity");
|
||||
if (allColorIdent.size() > 1) {
|
||||
sortAndReduceColors(allColorIdent);
|
||||
properties.insert("coloridentity", allColorIdent);
|
||||
|
|
@ -182,16 +182,15 @@ CardInfoPtr OracleImporter::addCard(QString name,
|
|||
|
||||
// DETECT CARD POSITIONING INFO
|
||||
|
||||
bool landscapeOrientation = properties.value("maintype").toString() == "Battle" ||
|
||||
properties.value("layout").toString() == "split" ||
|
||||
properties.value("layout").toString() == "planar";
|
||||
bool landscapeOrientation = properties.value("maintype") == "Battle" || properties.value("layout") == "split" ||
|
||||
properties.value("layout") == "planar";
|
||||
|
||||
// cards that enter the field tapped
|
||||
bool cipt = parseCipt(name, text) || landscapeOrientation;
|
||||
|
||||
// table row
|
||||
int tableRow = 1;
|
||||
QString mainCardType = properties.value("maintype").toString();
|
||||
QString mainCardType = properties.value("maintype");
|
||||
if (mainCardType == "Land") {
|
||||
tableRow = 0;
|
||||
} else if (mainCardType == "Sorcery" || mainCardType == "Instant") {
|
||||
|
|
@ -201,11 +200,11 @@ CardInfoPtr OracleImporter::addCard(QString name,
|
|||
}
|
||||
|
||||
// card side
|
||||
QString side = properties.value("side").toString() == "b" ? "back" : "front";
|
||||
QString side = properties.value("side") == "b" ? "back" : "front";
|
||||
properties.insert("side", side);
|
||||
|
||||
// upsideDown (flip cards)
|
||||
QString layout = properties.value("layout").toString();
|
||||
QString layout = properties.value("layout");
|
||||
bool upsideDown = layout == "flip" && side == "back";
|
||||
|
||||
// insert the card and its properties
|
||||
|
|
@ -279,7 +278,7 @@ int OracleImporter::importCardsFromSet(const CardSetPtr ¤tSet, const QList
|
|||
}
|
||||
|
||||
// card properties
|
||||
QVariantHash properties;
|
||||
QHash<QString, QString> properties;
|
||||
for (auto i = cardProperties.cbegin(), end = cardProperties.cend(); i != end; ++i) {
|
||||
QString mtgjsonProperty = i.key();
|
||||
QString xmlPropertyName = i.value();
|
||||
|
|
@ -290,8 +289,7 @@ int OracleImporter::importCardsFromSet(const CardSetPtr ¤tSet, const QList
|
|||
}
|
||||
|
||||
// per-set properties
|
||||
PrintingInfo printingInfo = PrintingInfo(currentSet);
|
||||
QVariantHash printingProps;
|
||||
QHash<QString, QString> printingProps;
|
||||
for (auto i = setInfoProperties.cbegin(), end = setInfoProperties.cend(); i != end; ++i) {
|
||||
QString mtgjsonProperty = i.key();
|
||||
QString xmlPropertyName = i.value();
|
||||
|
|
@ -318,7 +316,7 @@ int OracleImporter::importCardsFromSet(const CardSetPtr ¤tSet, const QList
|
|||
}
|
||||
}
|
||||
|
||||
printingInfo.setProperties(printingProps);
|
||||
PrintingInfo printingInfo(currentSet, printingProps);
|
||||
|
||||
QString numComponent;
|
||||
const QString numProperty = printingInfo.getProperty("num");
|
||||
|
|
@ -431,7 +429,7 @@ int OracleImporter::importCardsFromSet(const CardSetPtr ¤tSet, const QList
|
|||
QList<QPair<QList<SplitCardPart>, QString>> partsAndNames = splitCards.values();
|
||||
for (auto [splitCardParts, name] : partsAndNames) {
|
||||
QString text;
|
||||
QVariantHash properties;
|
||||
QHash<QString, QString> properties;
|
||||
PrintingInfo printingInfo;
|
||||
|
||||
for (const SplitCardPart &tmp : splitCardParts) {
|
||||
|
|
@ -444,11 +442,11 @@ int OracleImporter::importCardsFromSet(const CardSetPtr ¤tSet, const QList
|
|||
properties = tmp.getProperties();
|
||||
printingInfo = tmp.getPrintingInfo();
|
||||
} else {
|
||||
const QVariantHash &tmpProps = tmp.getProperties();
|
||||
const QHash<QString, QString> &tmpProps = tmp.getProperties();
|
||||
for (auto i = tmpProps.cbegin(), end = tmpProps.cend(); i != end; ++i) {
|
||||
QString prop = i.key();
|
||||
QString originalPropertyValue = properties.value(prop).toString();
|
||||
QString thisCardPropertyValue = i.value().toString();
|
||||
QString originalPropertyValue = properties.value(prop);
|
||||
QString thisCardPropertyValue = i.value();
|
||||
if (!thisCardPropertyValue.isEmpty() && originalPropertyValue != thisCardPropertyValue) {
|
||||
if (originalPropertyValue.isEmpty()) { // don't create //es if one field is empty
|
||||
properties.insert(prop, thisCardPropertyValue);
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ class SplitCardPart
|
|||
public:
|
||||
SplitCardPart(const QString &_name,
|
||||
const QString &_text,
|
||||
const QVariantHash &_properties,
|
||||
const QHash<QString, QString> &_properties,
|
||||
const PrintingInfo &_printingInfo);
|
||||
inline const QString &getName() const
|
||||
{
|
||||
|
|
@ -105,7 +105,7 @@ public:
|
|||
{
|
||||
return text;
|
||||
}
|
||||
inline const QVariantHash &getProperties() const
|
||||
inline const QHash<QString, QString> &getProperties() const
|
||||
{
|
||||
return properties;
|
||||
}
|
||||
|
|
@ -117,7 +117,7 @@ public:
|
|||
private:
|
||||
QString name;
|
||||
QString text;
|
||||
QVariantHash properties;
|
||||
QHash<QString, QString> properties;
|
||||
PrintingInfo printingInfo;
|
||||
};
|
||||
|
||||
|
|
@ -142,7 +142,7 @@ private:
|
|||
CardInfoPtr addCard(QString name,
|
||||
const QString &text,
|
||||
bool isToken,
|
||||
QVariantHash properties,
|
||||
QHash<QString, QString> properties,
|
||||
const QList<CardRelation *> &relatedCards,
|
||||
const PrintingInfo &printingInfo);
|
||||
signals:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue