Adjust for DBConverter.

Took 6 minutes
This commit is contained in:
Lukas Brübach 2025-12-13 15:03:19 +01:00
parent 2d162cfa5a
commit 10965d6336

View file

@ -5,6 +5,10 @@
#include <libcockatrice/card/database/parser/cockatrice_xml_4.h>
#include <libcockatrice/interfaces/noop_card_preference_provider.h>
static const QList<AllowedCount> kConstructedCounts = {{4, "legal"}, {0, "banned"}};
static const QList<AllowedCount> kSingletonCounts = {{1, "legal"}, {0, "banned"}};
class CardDatabaseConverter : public CardDatabase
{
public:
@ -41,7 +45,7 @@ public:
CardCondition anyNumberAllowed;
anyNumberAllowed.field = "text";
anyNumberAllowed.matchType = "contains";
anyNumberAllowed.value = "may contain any number of";
anyNumberAllowed.value = "A deck can have any number of";
ExceptionRule mayContainAnyNumber;
mayContainAnyNumber.conditions.append(anyNumberAllowed);
@ -50,11 +54,11 @@ public:
FormatRulesNameMap defaultFormatRulesNameMap;
// ----------------- Helper lambda to create format -----------------
auto makeFormat = [&](const QString &name, int maxCopies = 4, int minDeck = 60, int maxDeck = -1,
int maxSideboardSize = 15) -> FormatRulesPtr {
auto makeFormat = [&](const QString &name, int minDeck = 60, int maxDeck = -1, int maxSideboardSize = 15,
const QList<AllowedCount> &allowedCounts = kConstructedCounts) -> FormatRulesPtr {
FormatRulesPtr f(new FormatRules);
f->formatName = name;
f->maxCopies = maxCopies;
f->allowedCounts = allowedCounts;
f->minDeckSize = minDeck;
f->maxDeckSize = maxDeck;
f->maxSideboardSize = maxSideboardSize;
@ -65,27 +69,29 @@ public:
};
// ----------------- Standard formats -----------------
makeFormat("Alchemy", 4, 60);
makeFormat("Brawl", 1, 60, 60);
makeFormat("Commander", 1, 100, 100);
makeFormat("Duel", 1, 100, 100);
makeFormat("Future");
makeFormat("Gladiator", 4, 60, 60, 0);
makeFormat("Historic");
makeFormat("Legacy");
makeFormat("Modern");
makeFormat("Oathbreaker", 1, 60, 60);
makeFormat("OldSchool");
makeFormat("Pauper");
makeFormat("PauperCommander", 1, 100, 100);
makeFormat("Penny");
makeFormat("Pioneer");
makeFormat("Predh", 1, 100, 100);
makeFormat("Premodern");
makeFormat("Standard");
makeFormat("StandardBrawl", 1, 60, 60);
makeFormat("Modern");
makeFormat("Legacy");
makeFormat("Pioneer");
makeFormat("Historic");
makeFormat("Timeless");
makeFormat("Vintage");
makeFormat("Future");
makeFormat("OldSchool");
makeFormat("Premodern");
makeFormat("Pauper");
makeFormat("Penny");
// ----------------- Singleton formats -----------------
makeFormat("Commander", 100, 100, 15, kSingletonCounts);
makeFormat("Duel", 100, 100, 15, kSingletonCounts);
makeFormat("Brawl", 60, 60, 15, kSingletonCounts);
makeFormat("StandardBrawl", 60, 60, 15, kSingletonCounts);
makeFormat("Oathbreaker", 60, 60, 15, kSingletonCounts);
makeFormat("PauperCommander", 100, 100, 15, kSingletonCounts);
makeFormat("Predh", 100, 100, 15, kSingletonCounts);
// ----------------- Restricted formats -----------------
makeFormat("Vintage", 60, -1, 15, {{4, "legal"}, {1, "restricted"}, {0, "banned"}});
return defaultFormatRulesNameMap;
}