Cockatrice/cockatrice/src/game_graphics/tally/tally.cpp
2026-09-06 01:46:37 -07:00

28 lines
765 B
C++

#include "tally.h"
#include "stats_tally.h"
#include "subtype_tally.h"
TallyType Tally::intToType(int value)
{
if (value < static_cast<int>(TallyType::None) || value > static_cast<int>(TallyType::MaxValue)) {
return TallyType::None;
}
return static_cast<TallyType>(value);
}
QList<TallyRow> Tally::compute(const QList<CardItem *> &cards, const TallyType type)
{
switch (type) {
case TallyType::None:
return {};
case TallyType::Subtypes:
return SubtypeTally::countSubtypes(cards);
case TallyType::TotalPower:
return StatsTally::computeTotalPower(cards);
case TallyType::TotalToughness:
return StatsTally::computeTotalToughness(cards);
}
return {};
}