mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-09 01:23:57 -07:00
Use getCards()
Took 4 minutes
This commit is contained in:
parent
2c4920560c
commit
07a67e5854
1 changed files with 61 additions and 69 deletions
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue