mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-11 12:54:10 -07:00
Adjust for DBConverter.
Took 6 minutes
This commit is contained in:
parent
2d162cfa5a
commit
10965d6336
1 changed files with 29 additions and 23 deletions
|
|
@ -5,6 +5,10 @@
|
||||||
#include <libcockatrice/card/database/parser/cockatrice_xml_4.h>
|
#include <libcockatrice/card/database/parser/cockatrice_xml_4.h>
|
||||||
#include <libcockatrice/interfaces/noop_card_preference_provider.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
|
class CardDatabaseConverter : public CardDatabase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -41,7 +45,7 @@ public:
|
||||||
CardCondition anyNumberAllowed;
|
CardCondition anyNumberAllowed;
|
||||||
anyNumberAllowed.field = "text";
|
anyNumberAllowed.field = "text";
|
||||||
anyNumberAllowed.matchType = "contains";
|
anyNumberAllowed.matchType = "contains";
|
||||||
anyNumberAllowed.value = "may contain any number of";
|
anyNumberAllowed.value = "A deck can have any number of";
|
||||||
|
|
||||||
ExceptionRule mayContainAnyNumber;
|
ExceptionRule mayContainAnyNumber;
|
||||||
mayContainAnyNumber.conditions.append(anyNumberAllowed);
|
mayContainAnyNumber.conditions.append(anyNumberAllowed);
|
||||||
|
|
@ -50,11 +54,11 @@ public:
|
||||||
FormatRulesNameMap defaultFormatRulesNameMap;
|
FormatRulesNameMap defaultFormatRulesNameMap;
|
||||||
|
|
||||||
// ----------------- Helper lambda to create format -----------------
|
// ----------------- Helper lambda to create format -----------------
|
||||||
auto makeFormat = [&](const QString &name, int maxCopies = 4, int minDeck = 60, int maxDeck = -1,
|
auto makeFormat = [&](const QString &name, int minDeck = 60, int maxDeck = -1, int maxSideboardSize = 15,
|
||||||
int maxSideboardSize = 15) -> FormatRulesPtr {
|
const QList<AllowedCount> &allowedCounts = kConstructedCounts) -> FormatRulesPtr {
|
||||||
FormatRulesPtr f(new FormatRules);
|
FormatRulesPtr f(new FormatRules);
|
||||||
f->formatName = name;
|
f->formatName = name;
|
||||||
f->maxCopies = maxCopies;
|
f->allowedCounts = allowedCounts;
|
||||||
f->minDeckSize = minDeck;
|
f->minDeckSize = minDeck;
|
||||||
f->maxDeckSize = maxDeck;
|
f->maxDeckSize = maxDeck;
|
||||||
f->maxSideboardSize = maxSideboardSize;
|
f->maxSideboardSize = maxSideboardSize;
|
||||||
|
|
@ -65,27 +69,29 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
// ----------------- Standard formats -----------------
|
// ----------------- 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("Standard");
|
||||||
makeFormat("StandardBrawl", 1, 60, 60);
|
makeFormat("Modern");
|
||||||
|
makeFormat("Legacy");
|
||||||
|
makeFormat("Pioneer");
|
||||||
|
makeFormat("Historic");
|
||||||
makeFormat("Timeless");
|
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;
|
return defaultFormatRulesNameMap;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue