Split card handling added to cmc filter (#3090)
This commit is contained in:
parent
ab3989aeba
commit
501e82f712
1 changed files with 16 additions and 1 deletions
|
@ -231,7 +231,22 @@ bool FilterItem::acceptManaCost(const CardInfoPtr info) const
|
||||||
|
|
||||||
bool FilterItem::acceptCmc(const CardInfoPtr info) const
|
bool FilterItem::acceptCmc(const CardInfoPtr info) const
|
||||||
{
|
{
|
||||||
return relationCheck(info->getCmc().toInt());
|
bool convertSuccess;
|
||||||
|
int cmcInt = info->getCmc().toInt(&convertSuccess);
|
||||||
|
// if conversion failed, check for the "//" separator used in split cards
|
||||||
|
if (!convertSuccess) {
|
||||||
|
int cmcSum = 0;
|
||||||
|
for (const QString &cmc : info->getCmc().split("//")) {
|
||||||
|
cmcInt = cmc.toInt();
|
||||||
|
cmcSum += cmcInt;
|
||||||
|
if (relationCheck(cmcInt)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return relationCheck(cmcSum);
|
||||||
|
} else {
|
||||||
|
return relationCheck(cmcInt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FilterItem::acceptLoyalty(const CardInfoPtr info) const
|
bool FilterItem::acceptLoyalty(const CardInfoPtr info) const
|
||||||
|
|
Loading…
Reference in a new issue