Use getCards()

Took 4 minutes
This commit is contained in:
Lukas Brübach 2025-12-31 13:50:47 +01:00
parent 2c4920560c
commit 07a67e5854

View file

@ -19,27 +19,20 @@ void DeckListStatisticsAnalyzer::analyze()
{ {
clearData(); clearData();
auto nodes = model->getDeckList()->getCardNodes(); QList<ExactCard> cards = model->getCards();
for (auto *node : nodes) { for (auto card : cards) {
CardInfoPtr info = CardDatabaseManager::query()->getCardInfo(node->getName()); auto info = card.getInfo();
if (!info) { const int cmc = info.getCmc().toInt();
continue;
}
const int count = node->getNumber();
const int cmc = info->getCmc().toInt();
// Convert once // Convert once
QStringList types = info->getMainCardType().split(' '); QStringList types = info.getMainCardType().split(' ');
QStringList subtypes = info->getCardType().split('-').last().split(" "); QStringList subtypes = info.getCardType().split('-').last().split(" ");
QString colors = info->getColors(); QString colors = info.getColors();
int power = info->getPowTough().split("/").first().toInt(); int power = info.getPowTough().split("/").first().toInt();
int toughness = info->getPowTough().split("/").last().toInt(); int toughness = info.getPowTough().split("/").last().toInt();
// For each copy of card // For each copy of card
for (int i = 0; i < count; ++i) {
// ---------------- Mana Curve ---------------- // ---------------- Mana Curve ----------------
if (config.computeManaCurve) { if (config.computeManaCurve) {
manaCurveMap[cmc]++; manaCurveMap[cmc]++;
@ -105,7 +98,6 @@ void DeckListStatisticsAnalyzer::analyze()
} }
} }
} }
}
emit statsUpdated(); emit statsUpdated();
} }